diff -Nru org-mode-7.7/contrib/babel/langs/ob-fortran.el org-mode-7.8.02/contrib/babel/langs/ob-fortran.el --- org-mode-7.7/contrib/babel/langs/ob-fortran.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/contrib/babel/langs/ob-fortran.el 1970-01-01 00:00:00.000000000 +0000 @@ -1,162 +0,0 @@ -;;; ob-fortran.el --- org-babel functions for fortran - -;; Copyright (C) 2011 Sergey Litvinov, Eric Schulte - -;; Authors: Sergey Litvinov (based on ob-C.el by Eric Schulte), Eric Schulte -;; Keywords: literate programming, reproducible research, fortran -;; Homepage: http://orgmode.org -;; Version: 7.6 - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. -;; -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs; see the file COPYING. If not, write to the -;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -;; Boston, MA 02110-1301, USA. - -;;; Commentary: - -;; Org-Babel support for evaluating fortran code. - -;;; Code: -(require 'ob) -(require 'ob-eval) -(require 'cc-mode) - -(declare-function org-entry-get "org" - (pom property &optional inherit literal-nil)) - -(defvar org-babel-tangle-lang-exts) -(add-to-list 'org-babel-tangle-lang-exts '("fortran" . "F90")) - -(defvar org-babel-default-header-args:fortran '()) - -(defvar org-babel-fortran-compiler "gfortran" - "fortran command used to compile a fortran source code file into an - executable.") - -(defun org-babel-execute:fortran (body params) - "This function should only be called by `org-babel-execute:fortran'" - (let* ((tmp-src-file (org-babel-temp-file "fortran-src-" ".F90")) - (tmp-bin-file (org-babel-temp-file "fortran-bin-")) - (cmdline (cdr (assoc :cmdline params))) - (flags (cdr (assoc :flags params))) - (full-body (org-babel-expand-body:fortran body params)) - (compile - (progn - (with-temp-file tmp-src-file (insert full-body)) - (org-babel-eval - (format "%s -o %s %s %s" - org-babel-fortran-compiler - (org-babel-process-file-name tmp-bin-file) - (mapconcat 'identity - (if (listp flags) flags (list flags)) " ") - (org-babel-process-file-name tmp-src-file)) "")))) - ((lambda (results) - (org-babel-reassemble-table - (if (member "vector" (cdr (assoc :result-params params))) - (let ((tmp-file (org-babel-temp-file "f-"))) - (with-temp-file tmp-file (insert results)) - (org-babel-import-elisp-from-file tmp-file)) - (org-babel-read results)) - (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))))) - (org-babel-trim - (org-babel-eval - (concat tmp-bin-file (if cmdline (concat " " cmdline) "")) ""))))) - -(defun org-babel-expand-body:fortran (body params) - "Expand a block of fortran or fortran code with org-babel according to -it's header arguments." - (let ((vars (mapcar #'cdr (org-babel-get-header params :var))) - (main-p (not (string= (cdr (assoc :main params)) "no"))) - (includes (or (cdr (assoc :includes params)) - (org-babel-read (org-entry-get nil "includes" t)))) - (defines (org-babel-read - (or (cdr (assoc :defines params)) - (org-babel-read (org-entry-get nil "defines" t)))))) - (mapconcat 'identity - (list - ;; includes - (mapconcat - (lambda (inc) (format "#include %s" inc)) - (if (listp includes) includes (list includes)) "\n") - ;; defines - (mapconcat - (lambda (inc) (format "#define %s" inc)) - (if (listp defines) defines (list defines)) "\n") - ;; body - (if main-p - (org-babel-fortran-ensure-main-wrap - (concat - ;; variables - (mapconcat 'org-babel-fortran-var-to-fortran vars "\n") - body) params) - body) "\n") "\n"))) - -(defun org-babel-fortran-ensure-main-wrap (body params) - "Wrap body in a \"program ... end program\" block if none exists." - (if (string-match "^[ \t]*program[ \t]*.*" (capitalize body)) - (let ((vars (mapcar #'cdr (org-babel-get-header params :var)))) - (if vars (error "cannot use :vars if 'program' statment is present")) - body) - (format "program main\n%s\nend program main\n" body))) - -(defun org-babel-prep-session:fortran (session params) - "This function does nothing as fortran is a compiled language with no -support for sessions" - (error "fortran is a compiled languages -- no support for sessions")) - -(defun org-babel-load-session:fortran (session body params) - "This function does nothing as fortran is a compiled language with no -support for sessions" - (error "fortran is a compiled languages -- no support for sessions")) - -;; helper functions - -(defun org-babel-fortran-var-to-fortran (pair) - "fortranonvert an elisp val into a string of fortran code specifying a var -of the same value." - ;; TODO list support - (let ((var (car pair)) - (val (cdr pair))) - (when (symbolp val) - (setq val (symbol-name val)) - (when (= (length val) 1) - (setq val (string-to-char val)))) - (cond - ((integerp val) - (format "integer, parameter :: %S = %S\n" var val)) - ((floatp val) - (format "real, parameter :: %S = %S\n" var val)) - ((or (characterp val)) - (format "character, parameter :: %S = '%S'\n" var val)) - ((stringp val) - (format "character(len=%d), parameter :: %S = '%s'\n" - (length val) var val)) - ((listp val) - (format "real, parameter :: %S(%d) = %s\n" - var (length val) (ob-fortran-transform-list val))) - (t - (error (format "the type of parameter %s is not supported by ob-fortran" - var)))))) - -(defun ob-fortran-transform-list (val) - "Return a fortran representation of enclose syntactic lists." - (if (listp val) - (concat "(/" (mapconcat #'ob-fortran-transform-list val ", ") "/)") - (format "%S" val))) - -(provide 'ob-fortran) - -;;; ob-fortran.el ends here diff -Nru org-mode-7.7/contrib/babel/library-of-babel.org org-mode-7.8.02/contrib/babel/library-of-babel.org --- org-mode-7.7/contrib/babel/library-of-babel.org 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/contrib/babel/library-of-babel.org 2011-12-13 00:34:24.000000000 +0000 @@ -22,7 +22,7 @@ A collection of simple utility functions: -#+srcname: echo +#+name: echo #+begin_src emacs-lisp :var input="echo'd" input #+end_src @@ -35,7 +35,7 @@ =:results scalar= header arguments can be used to read the contents of file as either a table or a string. -#+srcname: read +#+name: read #+begin_src emacs-lisp :var file="" :var format="" (if (string= format "csv") (with-temp-buffer @@ -49,7 +49,7 @@ Write =data= to a file at =file=. If =data= is a list, then write it as a table in traditional Org-mode table syntax. -#+srcname: write +#+name: write #+begin_src emacs-lisp :var data="" :var file="" :var ext='() (flet ((echo (r) (if (stringp r) r (format "%S" r)))) (with-temp-file file @@ -67,7 +67,7 @@ Read local or remote file in [[http://www.json.org/][json]] format into emacs-lisp objects. -#+srcname: json +#+name: json #+begin_src emacs-lisp :var file='() :var url='() (require 'json) (cond @@ -96,7 +96,7 @@ when trying to download textual documents, but this is working fine for spreadsheets. -#+source: gdoc-read +#+name: gdoc-read #+begin_src emacs-lisp :var title="example" :var format="csv" (let* ((file (concat title "." format)) (cmd (format "google docs get --format %S --title %S" format title))) @@ -126,7 +126,7 @@ it will be saved to a spreadsheet, otherwise it will be saved as a normal document. -#+source: gdoc-write +#+name: gdoc-write #+begin_src emacs-lisp :var title="babel-upload" :var data=fibs(n=10) :results silent (let* ((format (if (listp data) "csv" "txt")) (tmp-file (make-temp-file "org-babel-google-doc" nil (concat "." format))) @@ -157,7 +157,7 @@ Plot column 2 (y axis) against column 1 (x axis). Columns 3 and beyond, if present, are ignored. -#+srcname: R-plot(data=R-plot-example-data) +#+name: R-plot(data=R-plot-example-data) #+begin_src R plot(data) #+end_src @@ -169,7 +169,7 @@ | 4 | 16 | | 5 | 25 | -#+lob: R-plot(data=R-plot-example-data) +#+call: R-plot(data=R-plot-example-data) #+resname: R-plot(data=R-plot-example-data) : nil @@ -180,7 +180,7 @@ ** Headline references -#+source: headline +#+name: headline #+begin_src emacs-lisp :var headline=top :var file='() (save-excursion (when file (get-file-buffer file)) @@ -194,22 +194,30 @@ * Tables -** LaTeX Table export +** LaTeX Table Export *** booktabs -This block can be used to wrap a table in the latex =booktabs= -environment, it takes the following arguments -- all but the first two -are optional. +This source block can be used to wrap a table in the latex =booktabs= +environment. The source block adds a =toprule= and =bottomrule= (so +don't use =hline= at the top or bottom of the table). The =hline= +after the header is replaced with a =midrule=. + +Note that this function bypasses the Org-mode LaTeX exporter and calls +=orgtbl-to-generic= to create the output table. This means that the +entries in the table are not translated from Org-mode to LaTeX. + +It takes the following arguments -- all but the first two are +optional. | arg | description | |-------+--------------------------------------------| | table | a reference to the table | -| align | optional alignment string | +| align | alignment string | | env | optional environment, default to "tabular" | | width | optional width specification string | -#+srcname: booktabs +#+name: booktabs #+begin_src emacs-lisp :var table='((:head) hline (:body)) :var align='() :var env="tabular" :var width='() :noweb yes :results latex (flet ((to-tab (tab) (orgtbl-to-generic @@ -241,7 +249,7 @@ (to-tab table)))))) #+end_src -*** Longtable +*** longtable This block can be used to wrap a table in the latex =longtable= environment, it takes the following arguments -- all but the first two @@ -258,7 +266,7 @@ | foot | optional "foot" string | | lastfoot | optional "lastfoot" string | -#+srcname: longtable +#+name: longtable #+begin_src emacs-lisp :var table='((:table)) :var align='() :var width='() :var hline="\\hline" :var firsthead='() :var head='() :var foot='() :var lastfoot='() :noweb yes :results latex (org-fill-template " @@ -288,13 +296,67 @@ (list :lend " \\\\" :sep " & " :hline hline))))) #+end_src + +*** booktabs-notes + +This source block builds on [[booktabs]]. It accepts two additional +arguments, both of which are optional. + +#+tblname: arguments +| arg | description | +|--------+------------------------------------------------------| +| notes | an org-mode table with footnotes | +| lspace | if non-nil, insert =addlinespace= after =bottomrule= | + +An example footnote to the =arguments= table specifies the column +span. Note the use of LaTeX, rather than Org-mode, markup. + +#+tblname: arguments-notes +| \multicolumn{2}{l}{This is a footnote to the \emph{arguments} table.} | + +#+name: booktabs-notes +#+begin_src emacs-lisp :var table='((:head) hline (:body)) :var notes='() :var align='() :var env="tabular" :var width='() :var lspace='() :noweb yes :results latex + (flet ((to-tab (tab) + (orgtbl-to-generic + (mapcar (lambda (lis) + (if (listp lis) + (mapcar (lambda (el) + (if (stringp el) + el + (format "%S" el))) lis) + lis)) tab) + (list :lend " \\\\" :sep " & " :hline "\\hline")))) + (org-fill-template + " + \\begin{%env}%width%align + \\toprule + %table + \\bottomrule%spacer + %notes + \\end{%env}\n" + (list + (cons "env" (or env "table")) + (cons "width" (if width (format "{%s}" width) "")) + (cons "align" (if align (format "{%s}" align) "")) + (cons "spacer" (if lspace "\\addlinespace" "")) + (cons "table" + ;; only use \midrule if it looks like there are column headers + (if (equal 'hline (second table)) + (concat (to-tab (list (first table))) + "\n\\midrule\n" + (to-tab (cddr table))) + (to-tab table))) + (cons "notes" (if notes (to-tab notes) "")) + ))) +#+end_src + ** Elegant lisp for transposing a matrix. #+tblname: transpose-example | 1 | 2 | 3 | | 4 | 5 | 6 | -#+srcname: transpose +#+name: transpose #+begin_src emacs-lisp :var table=transpose-example (apply #'mapcar* #'list table) #+end_src @@ -304,6 +366,39 @@ | 2 | 5 | | 3 | 6 | +** Convert every element of a table to a string + +#+tblname: hetero-table +| 1 | 2 | 3 | +| a | b | c | + +#+name: all-to-string +#+begin_src emacs-lisp :var tbl='() + (defun all-to-string (tbl) + (if (listp tbl) + (mapcar #'all-to-string tbl) + (if (stringp tbl) + tbl + (format "%s" tbl)))) + (all-to-string tbl) +#+end_src + +#+begin_src emacs-lisp :var tbl=hetero-table + (mapcar (lambda (row) (mapcar (lambda (cell) (stringp cell)) row)) tbl) +#+end_src + +#+name: +| nil | nil | nil | +| t | t | t | + +#+begin_src emacs-lisp :var tbl=all-to-string(hetero-table) + (mapcar (lambda (row) (mapcar (lambda (cell) (stringp cell)) row)) tbl) +#+end_src + +#+name: +| t | t | t | +| t | t | t | + * Misc ** File-specific Version Control logging @@ -317,7 +412,7 @@ local version control system, but has only been tested to work with Git. 'limit' is currently unsupported. -#+source: vc-log +#+name: vc-log #+headers: :var limit=-1 #+headers: :var buf=(buffer-name (current-buffer)) #+begin_src emacs-lisp @@ -345,34 +440,34 @@ ** Trivial python code blocks -#+srcname: python-identity(a=1) +#+name: python-identity(a=1) #+begin_src python a #+end_src -#+srcname: python-add(a=1, b=2) +#+name: python-add(a=1, b=2) #+begin_src python a + b #+end_src ** Arithmetic -#+source: lob-add +#+name: lob-add #+begin_src emacs-lisp :var a=0 :var b=0 (+ a b) #+end_src -#+source: lob-minus +#+name: lob-minus #+begin_src emacs-lisp :var a=0 :var b=0 (- a b) #+end_src -#+source: lob-times +#+name: lob-times #+begin_src emacs-lisp :var a=0 :var b=0 (* a b) #+end_src -#+source: lob-div +#+name: lob-div #+begin_src emacs-lisp :var a=0 :var b=0 (/ a b) #+end_src @@ -382,7 +477,7 @@ The =elispgantt= source block was sent to the mailing list by Eric Fraga. It was modified slightly by Tom Dye. -#+source: elispgantt +#+name: elispgantt #+begin_src emacs-lisp :var table=gantttest (let ((dates "") (entries (nthcdr 2 table)) diff -Nru org-mode-7.7/contrib/doc/fr-orgcard.tex org-mode-7.8.02/contrib/doc/fr-orgcard.tex --- org-mode-7.7/contrib/doc/fr-orgcard.tex 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/contrib/doc/fr-orgcard.tex 2011-12-13 00:34:24.000000000 +0000 @@ -680,6 +680,5 @@ % compile-command: "tex refcard" % End: -% arch-tag: 139f6750-5cfc-49ca-92b5-237fe5795290 diff -Nru org-mode-7.7/contrib/lisp/htmlize.el org-mode-7.8.02/contrib/lisp/htmlize.el --- org-mode-7.7/contrib/lisp/htmlize.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/contrib/lisp/htmlize.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,6 +1,6 @@ ;; htmlize.el -- Convert buffer text and decorations to HTML. -;; Copyright (C) 1997,1998,1999,2000,2001,2002,2003,2005,2006,2009 Hrvoje Niksic +;; Copyright (C) 1997-2011 Hrvoje Niksic ;; Author: Hrvoje Niksic ;; Keywords: hypermedia, extensions diff -Nru org-mode-7.7/contrib/lisp/org2rem.el org-mode-7.8.02/contrib/lisp/org2rem.el --- org-mode-7.7/contrib/lisp/org2rem.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/contrib/lisp/org2rem.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,6 +1,6 @@ ;;; org2rem.el --- Convert org appointments into reminders -;; Copyright (C) 2006, 2007, 2008 Free Software Foundation, Inc. +;; Copyright (C) 2006-2011 Free Software Foundation, Inc. ;; Author: Bastien Guerry and Shatad Pratap ;; Keywords: outlines, hypermedia, calendar, wp @@ -648,6 +648,4 @@ (provide 'org2rem) -;; arch-tag: 65985fe9-095c-49c7-a7b6-cb4ee15c0a95 - ;;; org-exp.el ends here diff -Nru org-mode-7.7/contrib/lisp/org-annotate-file.el org-mode-7.8.02/contrib/lisp/org-annotate-file.el --- org-mode-7.7/contrib/lisp/org-annotate-file.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/contrib/lisp/org-annotate-file.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,6 +1,6 @@ ;;; org-annotate-file.el --- Annotate a file with org syntax -;; Copyright (C) 2008 Philip Jackson +;; Copyright (C) 2008-2011 Philip Jackson ;; Author: Philip Jackson ;; Version: 0.2 @@ -99,7 +99,7 @@ (concat "file:" filename "::" line) (org-annotate-file-elipsify-desc line)))) (with-current-buffer (find-file org-annotate-file-storage-file) - (unless (org-mode-p) + (unless (eq major-mode 'org-mode) (org-mode)) (goto-char (point-min)) (widen) @@ -127,4 +127,5 @@ (insert link)) (provide 'org-annotate-file) + ;;; org-annotate-file.el ends here diff -Nru org-mode-7.7/contrib/lisp/org-bookmark.el org-mode-7.8.02/contrib/lisp/org-bookmark.el --- org-mode-7.7/contrib/lisp/org-bookmark.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/contrib/lisp/org-bookmark.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,5 +1,5 @@ ;;; org-bookmark.el - Support for links to bookmark -;; Copyright (C) 2008 Free Software Foundation, Inc. +;; Copyright (C) 2008-2011 Free Software Foundation, Inc. ;; ;; Author: Tokuya Kameshima ;; Version: 1.0 diff -Nru org-mode-7.7/contrib/lisp/org-checklist.el org-mode-7.8.02/contrib/lisp/org-checklist.el --- org-mode-7.7/contrib/lisp/org-checklist.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/contrib/lisp/org-checklist.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,6 +1,6 @@ ;;; org-checklist.el --- org functions for checklist handling -;; Copyright (C) 2008 James TD Smith +;; Copyright (C) 2008-2011 James TD Smith ;; Author: James TD Smith (@ ahktenzero (. mohorovi cc)) ;; Version: 1.0 diff -Nru org-mode-7.7/contrib/lisp/org-choose.el org-mode-7.8.02/contrib/lisp/org-choose.el --- org-mode-7.7/contrib/lisp/org-choose.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/contrib/lisp/org-choose.el 2011-12-13 00:34:24.000000000 +0000 @@ -2,7 +2,9 @@ ;;;_. Headers ;;;_ , License -;; Copyright (C) 2009 Tom Breton (Tehom) +;; Copyright (C) 2009-2011 Tom Breton (Tehom) + +;; This file is not part of GNU Emacs. ;; Author: Tom Breton (Tehom) ;; Keywords: outlines, convenience @@ -536,4 +538,5 @@ ;;;_ + End: ;;;_ , End + ;;; org-choose.el ends here diff -Nru org-mode-7.7/contrib/lisp/org-collector.el org-mode-7.8.02/contrib/lisp/org-collector.el --- org-mode-7.7/contrib/lisp/org-collector.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/contrib/lisp/org-collector.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,6 +1,6 @@ ;;; org-collector --- collect properties into tables -;; Copyright (C) 2008 Free Software Foundation, Inc. +;; Copyright (C) 2008-2011 Free Software Foundation, Inc. ;; Author: Eric Schulte ;; Keywords: outlines, hypermedia, calendar, wp, experimentation, @@ -119,6 +119,8 @@ (conds (plist-get params :conds)) (match (plist-get params :match)) (scope (plist-get params :scope)) + (noquote (plist-get params :noquote)) + (colnames (plist-get params :colnames)) (content-lines (org-split-string (plist-get params :content) "\n")) id table line pos) (save-excursion @@ -130,8 +132,10 @@ (goto-char idpos)) (t (error "Cannot find entry with :ID: %s" id)))) (org-narrow-to-subtree) + (setq stringformat (if noquote "%s" "%S")) (setq table (org-propview-to-table - (org-propview-collect cols conds match scope inherit))) + (org-propview-collect cols stringformat conds match scope inherit + (if colnames colnames cols)) stringformat)) (widen)) (setq pos (point)) (when content-lines @@ -167,7 +171,7 @@ (when p (cons n p)))) inherit)))) -(defun org-propview-collect (cols &optional conds match scope inherit) +(defun org-propview-collect (cols stringformat &optional conds match scope inherit colnames) (interactive) ;; collect the properties from every header (let* ((header-props @@ -191,8 +195,8 @@ header-props)))))) (append (list - (mapcar (lambda (el) (format "%S" el)) cols) ;; output headers - 'hline) ;; ------------------------------------------------ + (if colnames colnames (mapcar (lambda (el) (format stringformat el)) cols)) + 'hline) ;; ------------------------------------------------ (mapcar ;; calculate the value of the column for each header (lambda (props) (mapcar (lambda (col) (let ((result (org-propview-eval-w-props props col))) @@ -211,14 +215,14 @@ header-props)) header-props))))) -(defun org-propview-to-table (results) +(defun org-propview-to-table (results stringformat) ;; (message (format "cols:%S" cols)) (orgtbl-to-orgtbl (mapcar (lambda (row) (if (equal row 'hline) 'hline - (mapcar (lambda (el) (format "%S" el)) row))) + (mapcar (lambda (el) (format stringformat el)) row))) (delq nil results)) '())) (provide 'org-collector) diff -Nru org-mode-7.7/contrib/lisp/org-contacts.el org-mode-7.8.02/contrib/lisp/org-contacts.el --- org-mode-7.7/contrib/lisp/org-contacts.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/contrib/lisp/org-contacts.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,6 +1,6 @@ ;;; org-contacts.el --- Contacts management -;; Copyright (C) 2010, 2011 Julien Danjou +;; Copyright (C) 2010-2011 Julien Danjou ;; Author: Julien Danjou ;; Keywords: outlines, hypermedia, calendar @@ -157,7 +157,7 @@ (dolist (file (org-contacts-files)) (org-check-agenda-file file) (with-current-buffer (org-get-agenda-file-buffer file) - (unless (org-mode-p) + (unless (eq major-mode 'org-mode) (error "File %s is no in `org-mode'" file)) (org-scan-tags '(add-to-list 'markers (set-marker (make-marker) (point))) @@ -169,9 +169,10 @@ (when (not (fboundp 'completion-table-case-fold)) ;; That function is new in Emacs 24... - (defun completion-table-case-fold (table string pred action) - (let ((completion-ignore-case t)) - (complete-with-action action table string pred)))) + (defun completion-table-case-fold (table &optional dont-fold) + (lambda (string pred action) + (let ((completion-ignore-case (not dont-fold))) + (complete-with-action action table string pred))))) (defun org-contacts-complete-name (&optional start) "Complete text at START with a user name and email." @@ -226,9 +227,7 @@ ;; If the user has an email address, append USER . if email collect (org-contacts-format-email contact-name email)) ", "))))) - (list start end (if org-contacts-completion-ignore-case - (apply-partially #'completion-table-case-fold completion-list) - completion-list)))) + (list start end (completion-table-case-fold completion-list (not org-contacts-completion-ignore-case))))) (defun org-contacts-message-complete-function () "Function used in `completion-at-point-functions' in `message-mode'." @@ -239,9 +238,10 @@ (defun org-contacts-gnus-get-name-email () "Get name and email address from Gnus message." - (gnus-with-article-headers - (mail-extract-address-components - (or (mail-fetch-field "From") "")))) + (if (gnus-alive-p) + (gnus-with-article-headers + (mail-extract-address-components + (or (mail-fetch-field "From") ""))))) (defun org-contacts-gnus-article-from-get-marker () "Return a marker for a contact based on From." @@ -262,7 +262,7 @@ (when marker (switch-to-buffer-other-window (marker-buffer marker)) (goto-char marker) - (when (org-mode-p) + (when (eq major-mode 'org-mode) (org-show-context 'agenda) (save-excursion (and (outline-next-heading) @@ -533,10 +533,11 @@ (defun erc-nicknames-list () "Return all nicknames of all ERC buffers." - (loop for buffer in (erc-buffer-list) - nconc (with-current-buffer buffer - (loop for user-entry in (mapcar 'car (erc-get-channel-user-list)) - collect (elt user-entry 1))))) + (if (fboundp 'erc-buffer-list) + (loop for buffer in (erc-buffer-list) + nconc (with-current-buffer buffer + (loop for user-entry in (mapcar 'car (erc-get-channel-user-list)) + collect (elt user-entry 1)))))) (add-to-list 'org-property-set-functions-alist `(,org-contacts-nickname-property . org-contacts-completing-read-nickname)) diff -Nru org-mode-7.7/contrib/lisp/org-contribdir.el org-mode-7.8.02/contrib/lisp/org-contribdir.el --- org-mode-7.7/contrib/lisp/org-contribdir.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/contrib/lisp/org-contribdir.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,5 +1,5 @@ ;;; org-contribdir.el --- Mark the location of the contrib directory -;; Copyright (C) 2009 Free Software Foundation, Inc. +;; Copyright (C) 2009-2011 Free Software Foundation, Inc. ;; ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp diff -Nru org-mode-7.7/contrib/lisp/org-depend.el org-mode-7.8.02/contrib/lisp/org-depend.el --- org-mode-7.7/contrib/lisp/org-depend.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/contrib/lisp/org-depend.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,5 +1,5 @@ ;;; org-depend.el --- TODO dependencies for Org-mode -;; Copyright (C) 2008 Free Software Foundation, Inc. +;; Copyright (C) 2008-2011 Free Software Foundation, Inc. ;; ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp diff -Nru org-mode-7.7/contrib/lisp/org-element.el org-mode-7.8.02/contrib/lisp/org-element.el --- org-mode-7.7/contrib/lisp/org-element.el 1970-01-01 00:00:00.000000000 +0000 +++ org-mode-7.8.02/contrib/lisp/org-element.el 2011-12-13 00:34:24.000000000 +0000 @@ -0,0 +1,3635 @@ +;;; org-element.el --- Parser And Applications for Org syntax + +;; Copyright (C) 2011 Free Software Foundation, Inc. + +;; Author: Nicolas Goaziou +;; Keywords: outlines, hypermedia, calendar, wp + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see . + +;;; Commentary: + +;; Org syntax can be divided into three categories: "Greater +;; elements", "Elements" and "Objects". + +;; An object can be defined anywhere on a line. It may span over more +;; than a line but never contains a blank one. Objects belong to the +;; following types: `emphasis', `entity', `export-snippet', +;; `footnote-reference', `inline-babel-call', `inline-src-block', +;; `latex-fragment', `line-break', `link', `macro', `radio-target', +;; `statistics-cookie', `subscript', `superscript', `target', +;; `time-stamp' and `verbatim'. + +;; An element always starts and ends at the beginning of a line. The +;; only element's type containing objects is called a `paragraph'. +;; Other types are: `comment', `comment-block', `example-block', +;; `export-block', `fixed-width', `horizontal-rule', `keyword', +;; `latex-environment', `babel-call', `property-drawer', +;; `quote-section', `src-block', `table' and `verse-block'. + +;; Elements containing paragraphs are called greater elements. +;; Concerned types are: `center-block', `drawer', `dynamic-block', +;; `footnote-definition', `headline', `inlinetask', `item', +;; `plain-list', `quote-block' and `special-block'. + +;; Greater elements (excepted `headline' and `item' types) and +;; elements (excepted `keyword', `babel-call', and `property-drawer' +;; types) can have a fixed set of keywords as attributes. Those are +;; called "affiliated keywords", to distinguish them from others +;; keywords, which are full-fledged elements. In particular, the +;; "name" affiliated keyword allows to label almost any element in an +;; Org buffer. + +;; Notwithstanding affiliated keywords, each greater element, element +;; and object has a fixed set of properties attached to it. Among +;; them, three are shared by all types: `:begin' and `:end', which +;; refer to the beginning and ending buffer positions of the +;; considered element or object, and `:post-blank', which holds the +;; number of blank lines, or white spaces, at its end. + +;; Some elements also have special properties whose value can hold +;; objects themselves (i.e. an item tag, an headline name, a table +;; cell). Such values are called "secondary strings". + +;; Lisp-wise, an element or an object can be represented as a list. +;; It follows the pattern (TYPE PROPERTIES CONTENTS), where: +;; TYPE is a symbol describing the Org element or object. +;; PROPERTIES is the property list attached to it. See docstring of +;; appropriate parsing function to get an exhaustive +;; list. +;; CONTENTS is a list of elements, objects or raw strings contained +;; in the current element or object, when applicable. + +;; An Org buffer is a nested list of such elements and objects, whose +;; type is `org-data' and properties is nil. + +;; The first part of this file implements a parser and an interpreter +;; for each type of Org syntax. + +;; The next two parts introduce two accessors and a function +;; retrieving the smallest element containing point (respectively +;; `org-element-get-property', `org-element-get-contents' and +;; `org-element-at-point'). + +;; The following part creates a fully recursive buffer parser. It +;; also provides a tool to map a function to elements or objects +;; matching some criteria in the parse tree. Functions of interest +;; are `org-element-parse-buffer', `org-element-map' and, to a lesser +;; extent, `org-element-parse-secondary-string'. + +;; The penultimate part is the cradle of an interpreter for the +;; obtained parse tree: `org-element-interpret-data' (and its +;; relative, `org-element-interpret-secondary'). + +;; The library ends by furnishing a set of interactive tools for +;; element's navigation and manipulation. + + +;;; Code: + +(eval-when-compile (require 'cl)) +(require 'org) +(declare-function org-inlinetask-goto-end "org-inlinetask" ()) + + +;;; Greater elements + +;; For each greater element type, we define a parser and an +;; interpreter. + +;; A parser (`item''s excepted) accepts no argument and represents the +;; element or object as the list described above. An interpreter +;; accepts two arguments: the list representation of the element or +;; object, and its contents. The latter may be nil, depending on the +;; element or object considered. It returns the appropriate Org +;; syntax, as a string. + +;; Parsing functions must follow the naming convention: +;; org-element-TYPE-parser, where TYPE is greater element's type, as +;; defined in `org-element-greater-elements'. +;; +;; Similarly, interpreting functions must follow the naming +;; convention: org-element-TYPE-interpreter. + +;; With the exception of `headline' and `item' types, greater elements +;; cannot contain other greater elements of their own type. + +;; Beside implementing a parser and an interpreter, adding a new +;; greater element requires to tweak `org-element-guess-type'. +;; Moreover, the newly defined type must be added to both +;; `org-element-all-elements' and `org-element-greater-elements'. + + +;;;; Center Block +(defun org-element-center-block-parser () + "Parse a center block. + +Return a list whose car is `center-block' and cdr is a plist +containing `:begin', `:end', `:hiddenp', `:contents-begin', +`:contents-end' and `:post-blank' keywords. + +Assume point is at beginning or end of the block." + (save-excursion + (let* ((case-fold-search t) + (keywords (progn + (end-of-line) + (re-search-backward + (concat "^[ \t]*#\\+begin_center") nil t) + (org-element-collect-affiliated-keywords))) + (begin (car keywords)) + (contents-begin (progn (forward-line) (point))) + (hidden (org-truely-invisible-p)) + (contents-end (progn (re-search-forward + (concat "^[ \t]*#\\+end_center") nil t) + (point-at-bol))) + (pos-before-blank (progn (forward-line) (point))) + (end (progn (org-skip-whitespace) + (if (eobp) (point) (point-at-bol))))) + (list 'center-block + `(:begin ,begin + :end ,end + :hiddenp ,hidden + :contents-begin ,contents-begin + :contents-end ,contents-end + :post-blank ,(count-lines pos-before-blank end) + ,@(cadr keywords)))))) + +(defun org-element-center-block-interpreter (center-block contents) + "Interpret CENTER-BLOCK element as Org syntax. +CONTENTS is the contents of the element." + (format "#+begin_center\n%s#+end_center" contents)) + +;;;; Drawer +(defun org-element-drawer-parser () + "Parse a drawer. + +Return a list whose car is `drawer' and cdr is a plist containing +`:drawer-name', `:begin', `:end', `:hiddenp', `:contents-begin', +`:contents-end' and `:post-blank' keywords. + +Assume point is at beginning of drawer." + (save-excursion + (let* ((case-fold-search t) + (name (progn (looking-at org-drawer-regexp) + (org-match-string-no-properties 1))) + (keywords (org-element-collect-affiliated-keywords)) + (begin (car keywords)) + (contents-begin (progn (forward-line) (point))) + (hidden (org-truely-invisible-p)) + (contents-end (progn (re-search-forward "^[ \t]*:END:" nil t) + (point-at-bol))) + (pos-before-blank (progn (forward-line) (point))) + (end (progn (org-skip-whitespace) + (if (eobp) (point) (point-at-bol))))) + (list 'drawer + `(:begin ,begin + :end ,end + :drawer-name ,name + :hiddenp ,hidden + :contents-begin ,contents-begin + :contents-end ,contents-end + :post-blank ,(count-lines pos-before-blank end) + ,@(cadr keywords)))))) + +(defun org-element-drawer-interpreter (drawer contents) + "Interpret DRAWER element as Org syntax. +CONTENTS is the contents of the element." + (format ":%s:\n%s:END:" + (org-element-get-property :drawer-name drawer) + contents)) + +;;;; Dynamic Block +(defun org-element-dynamic-block-parser () + "Parse a dynamic block. + +Return a list whose car is `dynamic-block' and cdr is a plist +containing `:block-name', `:begin', `:end', `:hiddenp', +`:contents-begin', `:contents-end', `:arguments' and +`:post-blank' keywords. + +Assume point is at beginning of dynamic block." + (save-excursion + (let* ((case-fold-search t) + (name (progn (looking-at org-dblock-start-re) + (org-match-string-no-properties 1))) + (arguments (org-match-string-no-properties 3)) + (keywords (org-element-collect-affiliated-keywords)) + (begin (car keywords)) + (contents-begin (progn (forward-line) (point))) + (hidden (org-truely-invisible-p)) + (contents-end (progn (re-search-forward org-dblock-end-re nil t) + (point-at-bol))) + (pos-before-blank (progn (forward-line) (point))) + (end (progn (org-skip-whitespace) + (if (eobp) (point) (point-at-bol))))) + (list 'dynamic-block + `(:begin ,begin + :end ,end + :block-name ,name + :arguments ,arguments + :hiddenp ,hidden + :contents-begin ,contents-begin + :contents-end ,contents-end + :post-blank ,(count-lines pos-before-blank end) + ,@(cadr keywords)))))) + +(defun org-element-dynamic-block-interpreter (dynamic-block contents) + "Interpret DYNAMIC-BLOCK element as Org syntax. +CONTENTS is the contents of the element." + (format "#+BEGIN: %s%s\n%s#+END:" + (org-element-get-property :block-name dynamic-block) + (let ((args (org-element-get-property :arguments dynamic-block))) + (and arg (concat " " args))) + contents)) + +;;;; Footnote Definition + +(defun org-element-footnote-definition-parser () + "Parse a footnote definition. + +Return a list whose car is `footnote-definition' and cdr is +a plist containing `:label', `:begin' `:end', `:contents-begin', +`contents-end' and `:post-blank' keywords." + (save-excursion + (let* ((f-def (org-footnote-at-definition-p)) + (label (car f-def)) + (keywords (progn (goto-char (nth 1 f-def)) + (org-element-collect-affiliated-keywords))) + (begin (car keywords)) + (contents-begin (progn (looking-at (concat "\\[" label "\\]")) + (goto-char (match-end 0)) + (org-skip-whitespace) + (point))) + (end (goto-char (nth 2 f-def))) + (contents-end (progn (skip-chars-backward " \r\t\n") + (forward-line) + (point)))) + (list 'footnote-definition + `(:label ,label + :begin ,begin + :end ,end + :contents-begin ,contents-begin + :contents-end ,contents-end + :post-blank ,(count-lines contents-end end) + ,@(cadr keywords)))))) + +(defun org-element-footnote-definition-interpreter (footnote-definition contents) + "Interpret FOOTNOTE-DEFINITION element as Org syntax. +CONTENTS is the contents of the footnote-definition." + (concat (format "[%s]" (org-element-get-property :label footnote-definition)) + " " + contents)) + + +;;;; Headline +(defun org-element-headline-parser () + "Parse an headline. + +Return a list whose car is `headline' and cdr is a plist +containing `:raw-value', `:title', `:begin', `:end', +`:pre-blank', `:hiddenp', `:contents-begin' and `:contents-end', +`:level', `:priority', `:tags', `:todo-keyword',`:todo-type', +`:scheduled', `:deadline', `:timestamp', `:clock', `:category', +`:custom-id', `:id', `:quotedp', `:archivedp', `:commentedp', +`:last-sibling-p' and `:footnote-section-p' keywords. + +The plist also contains any property set in the property drawer, +with its name in lowercase, the underscores replaced with hyphens +and colons at the beginning (i.e. `:custom-id'). + +Assume point is at beginning of the headline." + (save-excursion + (let* ((components (org-heading-components)) + (level (nth 1 components)) + (todo (nth 2 components)) + (todo-type (and todo + (if (member todo org-done-keywords) 'done 'todo))) + (tags (nth 5 components)) + (raw-value (nth 4 components)) + (quotedp (string-match (format "^%s +" org-quote-string) raw-value)) + (commentedp (string-match + (format "^%s +" org-comment-string) raw-value)) + (archivedp (and tags + (string-match (format ":%s:" org-archive-tag) tags))) + (footnote-section-p (and org-footnote-section + (string= org-footnote-section raw-value))) + (standard-props (let (plist) + (mapc + (lambda (p) + (let ((p-name (downcase (car p)))) + (while (string-match "_" p-name) + (setq p-name + (replace-match "-" nil nil p-name))) + (setq p-name (intern (concat ":" p-name))) + (setq plist + (plist-put plist p-name (cdr p))))) + (org-entry-properties nil 'standard)) + plist)) + (time-props (org-entry-properties nil 'special "CLOCK")) + (scheduled (cdr (assoc "SCHEDULED" time-props))) + (deadline (cdr (assoc "DEADLINE" time-props))) + (clock (cdr (assoc "CLOCK" time-props))) + (timestamp (cdr (assoc "TIMESTAMP" time-props))) + (begin (point)) + (pos-after-head (save-excursion (forward-line) (point))) + (contents-begin (save-excursion (forward-line) + (org-skip-whitespace) + (if (eobp) (point) (point-at-bol)))) + (hidden (save-excursion (forward-line) (org-truely-invisible-p))) + (end (progn (goto-char (org-end-of-subtree t t)))) + (contents-end (progn (skip-chars-backward " \r\t\n") + (forward-line) + (point))) + title) + ;; Clean RAW-VALUE from any quote or comment string. + (when (or quotedp commentedp) + (setq raw-value + (replace-regexp-in-string + (concat "\\(" org-quote-string "\\|" org-comment-string "\\) +") + "" + raw-value))) + ;; Clean TAGS from archive tag, if any. + (when archivedp + (setq tags + (and (not (string= tags (format ":%s:" org-archive-tag))) + (replace-regexp-in-string + (concat org-archive-tag ":") "" tags))) + (when (string= tags ":") (setq tags nil))) + ;; Then get TITLE. + (setq title (org-element-parse-secondary-string + raw-value + (cdr (assq 'headline org-element-string-restrictions)))) + (list 'headline + `(:raw-value ,raw-value + :title ,title + :begin ,begin + :end ,end + :pre-blank ,(count-lines pos-after-head contents-begin) + :hiddenp ,hidden + :contents-begin ,contents-begin + :contents-end ,contents-end + :level ,level + :priority ,(nth 3 components) + :tags ,tags + :todo-keyword ,todo + :todo-type ,todo-type + :scheduled ,scheduled + :deadline ,deadline + :timestamp ,timestamp + :clock ,clock + :post-blank ,(count-lines contents-end end) + :footnote-section-p ,footnote-section-p + :archivedp ,archivedp + :commentedp ,commentedp + :quotedp ,quotedp + ,@standard-props))))) + +(defun org-element-headline-interpreter (headline contents) + "Interpret HEADLINE element as Org syntax. +CONTENTS is the contents of the element." + (let* ((level (org-element-get-property :level headline)) + (todo (org-element-get-property :todo-keyword headline)) + (priority (org-element-get-property :priority headline)) + (title (org-element-get-property :raw-value headline)) + (tags (let ((tag-string (org-element-get-property :tags headline)) + (archivedp (org-element-get-property :archivedp headline))) + (cond + ((and (not tag-string) archivedp) + (format ":%s:" org-archive-tag)) + (archivedp (concat ":" org-archive-tag tag-string)) + (t tag-string)))) + (commentedp (org-element-get-property :commentedp headline)) + (quotedp (org-element-get-property :quotedp headline)) + (pre-blank (org-element-get-property :pre-blank headline)) + (heading (concat (make-string level ?*) + (and todo (concat " " todo)) + (and quotedp (concat " " org-quote-string)) + (and commentedp (concat " " org-comment-string)) + (and priority (concat " " priority)) + (cond ((and org-footnote-section + (org-element-get-property + :footnote-section-p headline)) + (concat " " org-footnote-section)) + (title (concat " " title))))) + ;; Align tags. + (tags-fmt (when tags + (let ((tags-len (length tags))) + (format "%% %ds" + (cond + ((zerop org-tags-column) (1+ tags-len)) + ((< org-tags-column 0) + (max (- (+ org-tags-column (length heading))) + (1+ tags-len))) + (t (max (+ (- org-tags-column (length heading)) + tags-len) + (1+ tags-len))))))))) + (concat heading (and tags (format tags-fmt tags)) + (make-string (1+ pre-blank) 10) + contents))) + +;;;; Inlinetask +(defun org-element-inlinetask-parser () + "Parse an inline task. + +Return a list whose car is `inlinetask' and cdr is a plist +containing `:raw-value', `:title', `:begin', `:end', `:hiddenp', +`:contents-begin' and `:contents-end', `:level', `:with-priority', +`tags:', `todo-keyword', `todo-type', and `:post-blank' keywords. + +Assume point is at beginning of the inline task." + (save-excursion + (let* ((keywords (org-element-collect-affiliated-keywords)) + (begin (car keywords)) + (components (org-heading-components)) + (todo (nth 2 components)) + (todo-type (and todo + (if (member todo org-done-keywords) 'done 'todo))) + (raw-value (nth 4 components)) + (title (org-element-parse-secondary-string + raw-value + (cdr (assq 'inlinetask org-element-string-restrictions)))) + (contents-begin (save-excursion (forward-line) (point))) + (hidden (org-truely-invisible-p)) + (pos-before-blank (org-inlinetask-goto-end)) + ;; In the case of a single line task, CONTENTS-BEGIN and + ;; CONTENTS-END might overlap. + (contents-end (max contents-begin + (save-excursion (forward-line -1) (point)))) + (end (progn (org-skip-whitespace) + (if (eobp) (point) (point-at-bol))))) + (list 'inlinetask + `(:raw-value ,raw-value + :title ,title + :begin ,begin + :end ,end + :hiddenp ,(and (> contents-end contents-begin) hidden) + :contents-begin ,contents-begin + :contents-end ,contents-end + :level ,(nth 1 components) + :with-priority ,(nth 3 components) + :with-tags ,(nth 5 components) + :todo-keyword ,todo + :todo-type ,todo-type + :post-blank ,(count-lines pos-before-blank end) + ,@(cadr keywords)))))) + +(defun org-element-inlinetask-interpreter (inlinetask contents) + "Interpret INLINETASK element as Org syntax. +CONTENTS is the contents of inlinetask." + (let* ((level (org-element-get-property :level inlinetask)) + (todo (org-element-get-property :todo-keyword inlinetask)) + (priority (org-element-get-property :priority inlinetask)) + (title (org-element-get-property :raw-value inlinetask)) + (tags (org-element-get-property :tags inlinetask)) + (task (concat (make-string level ?*) + (and todo (concat " " todo)) + (and priority (concat " " priority)) + (and title (concat " " title)))) + ;; Align tags. + (tags-fmt (when tags + (format "%% %ds" + (cond + ((zerop org-tags-column) 1) + ((< 0 org-tags-column) + (max (+ org-tags-column + (length inlinetask) + (length tags)) + 1)) + (t (max (- org-tags-column (length inlinetask)) + 1))))))) + (concat inlinetask (and tags (format tags-fmt tags) "\n" contents)))) + +;;;; Item +(defun org-element-item-parser (struct) + "Parse an item. + +STRUCT is the structure of the plain list. + +Return a list whose car is `item' and cdr is a plist containing +`:begin', `:end', `:contents-begin', `:contents-end', +`:checkbox', `:counter', `:tag' and `:hiddenp'. + +Assume point is at the beginning of the item." + (save-excursion + (beginning-of-line) + (let* ((begin (point)) + (bullet (org-list-get-bullet (point) struct)) + (checkbox (let ((box (org-list-get-checkbox begin struct))) + (cond ((equal "[ ]" box) 'off) + ((equal "[X]" box) 'on) + ((equal "[-]" box) 'trans)))) + (counter (let ((c (org-list-get-counter begin struct))) + (cond + ((not c) nil) + ((string-match "[A-Za-z]" c) + (- (string-to-char (upcase (match-string 0 c))) + 64)) + ((string-match "[0-9]+" c) + (string-to-number (match-string 0 c)))))) + (raw-tag (org-list-get-tag begin struct)) + (tag (and raw-tag + (org-element-parse-secondary-string + raw-tag + (cdr (assq 'item org-element-string-restrictions))))) + (end (org-list-get-item-end begin struct)) + (contents-begin (progn (looking-at org-list-full-item-re) + (goto-char (match-end 0)) + (org-skip-whitespace) + (if (>= (point) end) + (point-at-bol) + (point)))) + (hidden (progn (forward-line) + (and (not (= (point) end)) + (org-truely-invisible-p)))) + (contents-end (progn (goto-char end) + (skip-chars-backward " \r\t\n") + (forward-line) + (point)))) + ;; Note: CONTENTS-BEGIN and CONTENTS-END can be mixed up in the + ;; case of an empty item separated from the next by a blank + ;; line. + (list 'item + `(:bullet ,bullet + :begin ,begin + :end ,end + :contents-begin ,(min contents-begin contents-end) + :contents-end ,(max contents-begin contents-end) + :checkbox ,checkbox + :counter ,counter + :raw-tag ,raw-tag + :tag ,tag + :hiddenp ,hidden + :structure ,struct + :post-blank ,(count-lines contents-end end)))))) + +(defun org-element-item-interpreter (item contents) + "Interpret ITEM element as Org syntax. +CONTENTS is the contents of the element." + (let* ((bullet (org-element-get-property :bullet item)) + (checkbox (org-element-get-property :checkbox item)) + (counter (org-element-get-property :counter item)) + (tag (org-element-get-property :raw-tag item)) + ;; Compute indentation. + (ind (make-string (length bullet) 32))) + ;; Indent contents. + (concat + bullet + (when (and org-list-two-spaces-after-bullet-regexp + (string-match org-list-two-spaces-after-bullet-regexp bullet)) + " ") + (and counter (format "[@%d] " counter)) + (cond + ((eq checkbox 'on) "[X] ") + ((eq checkbox 'off) "[ ] ") + ((eq checkbox 'trans) "[-] ")) + (and tag (format "%s :: " tag)) + (org-trim + (replace-regexp-in-string + "\\(^\\)[ \t]*\\S-" ind contents nil nil 1))))) + +;;;; Plain List +(defun org-element-plain-list-parser (&optional structure) + "Parse a plain list. + +Return a list whose car is `plain-list' and cdr is a plist +containing `:type', `:begin', `:end', `:contents-begin' and +`:contents-end', `:level', `:structure' and `:post-blank' +keywords. + +Assume point is at one of the list items." + (save-excursion + (let* ((struct (or structure (org-list-struct))) + (prevs (org-list-prevs-alist struct)) + (parents (org-list-parents-alist struct)) + (type (org-list-get-list-type (point) struct prevs)) + (contents-begin (goto-char + (org-list-get-list-begin (point) struct prevs))) + (keywords (org-element-collect-affiliated-keywords)) + (begin (car keywords)) + (contents-end (goto-char + (org-list-get-list-end (point) struct prevs))) + (end (save-excursion (org-skip-whitespace) + (if (eobp) (point) (point-at-bol)))) + (level 0)) + ;; Get list level. + (let ((item contents-begin)) + (while (setq item + (org-list-get-parent + (org-list-get-list-begin item struct prevs) + struct parents)) + (incf level))) + ;; Blank lines below list belong to the top-level list only. + (when (> level 0) + (setq end (min (org-list-get-bottom-point struct) + (progn (org-skip-whitespace) + (if (eobp) (point) (point-at-bol)))))) + ;; Return value. + (list 'plain-list + `(:type ,type + :begin ,begin + :end ,end + :contents-begin ,contents-begin + :contents-end ,contents-end + :level ,level + :structure ,struct + :post-blank ,(count-lines contents-end end) + ,@(cadr keywords)))))) + +(defun org-element-plain-list-interpreter (plain-list contents) + "Interpret PLAIN-LIST element as Org syntax. +CONTENTS is the contents of the element." + contents) + +;;;; Quote Block +(defun org-element-quote-block-parser () + "Parse a quote block. + +Return a list whose car is `quote-block' and cdr is a plist +containing `:begin', `:end', `:hiddenp', `:contents-begin', +`:contents-end' and `:post-blank' keywords. + +Assume point is at beginning or end of the block." + (save-excursion + (let* ((case-fold-search t) + (keywords (progn + (end-of-line) + (re-search-backward + (concat "^[ \t]*#\\+begin_quote") nil t) + (org-element-collect-affiliated-keywords))) + (begin (car keywords)) + (contents-begin (progn (forward-line) (point))) + (hidden (org-truely-invisible-p)) + (contents-end (progn (re-search-forward + (concat "^[ \t]*#\\+end_quote") nil t) + (point-at-bol))) + (pos-before-blank (progn (forward-line) (point))) + (end (progn (org-skip-whitespace) + (if (eobp) (point) (point-at-bol))))) + (list 'quote-block + `(:begin ,begin + :end ,end + :hiddenp ,hidden + :contents-begin ,contents-begin + :contents-end ,contents-end + :post-blank ,(count-lines pos-before-blank end) + ,@(cadr keywords)))))) + + +(defun org-element-quote-block-interpreter (quote-block contents) + "Interpret QUOTE-BLOCK element as Org syntax. +CONTENTS is the contents of the element." + (format "#+begin_quote\n%s#+end_quote" contents)) + +;;;; Special Block +(defun org-element-special-block-parser () + "Parse a special block. + +Return a list whose car is `special-block' and cdr is a plist +containing `:type', `:begin', `:end', `:hiddenp', +`:contents-begin', `:contents-end' and `:post-blank' keywords. + +Assume point is at beginning or end of the block." + (save-excursion + (let* ((case-fold-search t) + (type (progn (looking-at + "[ \t]*#\\+\\(?:begin\\|end\\)_\\([-A-Za-z0-9]+\\)") + (org-match-string-no-properties 1))) + (keywords (progn + (end-of-line) + (re-search-backward + (concat "^[ \t]*#\\+begin_" type) nil t) + (org-element-collect-affiliated-keywords))) + (begin (car keywords)) + (contents-begin (progn (forward-line) (point))) + (hidden (org-truely-invisible-p)) + (contents-end (progn (re-search-forward + (concat "^[ \t]*#\\+end_" type) nil t) + (point-at-bol))) + (pos-before-blank (progn (forward-line) (point))) + (end (progn (org-skip-whitespace) + (if (eobp) (point) (point-at-bol))))) + (list 'special-block + `(:type ,type + :begin ,begin + :end ,end + :hiddenp ,hidden + :contents-begin ,contents-begin + :contents-end ,contents-end + :post-blank ,(count-lines pos-before-blank end) + ,@(cadr keywords)))))) + +(defun org-element-special-block-interpreter (special-block contents) + "Interpret SPECIAL-BLOCK element as Org syntax. +CONTENTS is the contents of the element." + (let ((block-type (org-element-get-property :type special-block))) + (format "#+begin_%s\n%s#+end_%s" block-type contents block-type))) + + + +;;; Elements + +;; For each element, a parser and an interpreter are also defined. +;; Both follow the same naming convention used for greater elements. + +;; Also, as for greater elements, adding a new element type is done +;; through the following steps: implement a parser and an interpreter, +;; tweak `org-element-guess-type' so that it recognizes the new type +;; and add that new type to `org-element-all-elements'. + +;; As a special case, when the newly defined type is a block type, +;; `org-element-non-recursive-block-alist' has to be modified +;; accordingly. + + +;;;; Babel Call +(defun org-element-babel-call-parser () + "Parse a babel call. + +Return a list whose car is `babel-call' and cdr is a plist +containing `:begin', `:end', `:info' and `:post-blank' as +keywords." + (save-excursion + (let ((info (progn (looking-at org-babel-block-lob-one-liner-regexp) + (org-babel-lob-get-info))) + (beg (point-at-bol)) + (pos-before-blank (progn (forward-line) (point))) + (end (progn (org-skip-whitespace) + (if (eobp) (point) (point-at-bol))))) + (list 'babel-call + `(:beg ,beg + :end ,end + :info ,info + :post-blank ,(count-lines pos-before-blank end)))))) + +(defun org-element-babel-call-interpreter (inline-babel-call contents) + "Interpret INLINE-BABEL-CALL object as Org syntax. +CONTENTS is nil." + (let* ((babel-info (org-element-get-property :info inline-babel-call)) + (main-source (car babel-info)) + (post-options (nth 1 babel-info))) + (concat "#+call: " + (if (string-match "\\[\\(\\[.*?\\]\\)\\]" main-source) + ;; Remove redundant square brackets. + (replace-match + (match-string 1 main-source) nil nil main-source) + main-source) + (and post-options (format "[%s]" post-options))))) + +;;;; Comment +(defun org-element-comment-parser () + "Parse a comment. + +Return a list whose car is `comment' and cdr is a plist +containing `:begin', `:end', `:value' and `:post-blank' +keywords." + (let ((comment-re "\\(#\\|[ \t]*#\\+\\( \\|$\\)\\)") + beg-coms begin end value pos-before-blank keywords) + (save-excursion + ;; Move to the beginning of comments. + (unless (bobp) + (while (and (not (bobp)) (looking-at comment-re)) + (forward-line -1)) + (unless (looking-at comment-re) (forward-line 1))) + (setq beg-coms (point)) + ;; Get affiliated keywords, if any. + (setq keywords (org-element-collect-affiliated-keywords)) + ;; Store true beginning of element. + (setq begin (car keywords)) + ;; Get ending of comments. If point is in a list, ensure to not + ;; get outside of it. + (let* ((itemp (org-in-item-p)) + (max-pos (if itemp + (org-list-get-bottom-point + (save-excursion (goto-char itemp) (org-list-struct))) + (point-max)))) + (while (and (looking-at comment-re) (< (point) max-pos)) + (forward-line))) + (setq pos-before-blank (point)) + ;; Find position after blank. + (org-skip-whitespace) + (setq end (if (eobp) (point) (point-at-bol))) + ;; Extract value. + (setq value (buffer-substring-no-properties beg-coms pos-before-blank))) + (list 'comment + `(:begin ,begin + :end ,end + :value ,value + :post-blank ,(count-lines pos-before-blank end) + ,@(cadr keywords))))) + +(defun org-element-comment-interpreter (comment contents) + "Interpret COMMENT element as Org syntax. +CONTENTS is nil." + (org-element-get-property :value comment)) + +;;;; Comment Block +(defun org-element-comment-block-parser () + "Parse an export block. + +Return a list whose car is `comment-block' and cdr is a plist +containing `:begin', `:end', `:hiddenp', `:value' and +`:post-blank' keywords." + (save-excursion + (end-of-line) + (let* ((case-fold-search t) + (keywords (progn + (re-search-backward "^[ \t]*#\\+begin_comment" nil t) + (org-element-collect-affiliated-keywords))) + (begin (car keywords)) + (contents-begin (progn (forward-line) (point))) + (hidden (org-truely-invisible-p)) + (contents-end (progn (re-search-forward + "^[ \t]*#\\+end_comment" nil t) + (point-at-bol))) + (pos-before-blank (progn (forward-line) (point))) + (end (progn (org-skip-whitespace) + (if (eobp) (point) (point-at-bol)))) + (value (buffer-substring-no-properties contents-begin contents-end))) + (list 'comment-block + `(:begin ,begin + :end ,end + :value ,value + :hiddenp ,hidden + :post-blank ,(count-lines pos-before-blank end) + ,@(cadr keywords)))))) + +(defun org-element-comment-block-interpreter (comment-block contents) + "Interpret COMMENT-BLOCK element as Org syntax. +CONTENTS is nil." + (concat "#+begin_comment\n" + (org-remove-indentation + (org-element-get-property :value comment-block)) + "#+begin_comment")) + +;;;; Example Block +(defun org-element-example-block-parser () + "Parse an example block. + +Return a list whose car is `example' and cdr is a plist +containing `:begin', `:end', `:options', `:hiddenp', `:value' and +`:post-blank' keywords." + (save-excursion + (end-of-line) + (let* ((case-fold-search t) + (options (progn + (re-search-backward + "^[ \t]*#\\+begin_example\\(?: +\\(.*\\)\\)?" nil t) + (org-match-string-no-properties 1))) + (keywords (org-element-collect-affiliated-keywords)) + (begin (car keywords)) + (contents-begin (progn (forward-line) (point))) + (hidden (org-truely-invisible-p)) + (contents-end (progn + (re-search-forward "^[ \t]*#\\+end_example" nil t) + (point-at-bol))) + (value (buffer-substring-no-properties contents-begin contents-end)) + (pos-before-blank (progn (forward-line) (point))) + (end (progn (org-skip-whitespace) + (if (eobp) (point) (point-at-bol))))) + (list 'example-block + `(:begin ,begin + :end ,end + :value ,value + :options ,options + :hiddenp ,hidden + :post-blank ,(count-lines pos-before-blank end) + ,@(cadr keywords)))))) + +(defun org-element-example-block-interpreter (example-block contents) + "Interpret EXAMPLE-BLOCK element as Org syntax. +CONTENTS is nil." + (let ((options (org-element-get-property :options example-block))) + (concat "#+begin_example" (and options (concat " " options)) "\n" + (org-remove-indentation + (org-element-get-property :value example-block)) + "#+end_example"))) + +;;;; Export Block +(defun org-element-export-block-parser () + "Parse an export block. + +Return a list whose car is `export-block' and cdr is a plist +containing `:begin', `:end', `:type', `:hiddenp', `:value' and +`:post-blank' keywords." + (save-excursion + (end-of-line) + (let* ((case-fold-search t) + (contents) + (type (progn (re-search-backward + (concat "[ \t]*#\\+begin_" + (org-re "\\([[:alnum:]]+\\)"))) + (downcase (org-match-string-no-properties 1)))) + (keywords (org-element-collect-affiliated-keywords)) + (begin (car keywords)) + (contents-begin (progn (forward-line) (point))) + (hidden (org-truely-invisible-p)) + (contents-end (progn (re-search-forward + (concat "^[ \t]*#\\+end_" type) nil t) + (point-at-bol))) + (pos-before-blank (progn (forward-line) (point))) + (end (progn (org-skip-whitespace) + (if (eobp) (point) (point-at-bol)))) + (value (buffer-substring-no-properties contents-begin contents-end))) + (list 'export-block + `(:begin ,begin + :end ,end + :type ,type + :value ,value + :hiddenp ,hidden + :post-blank ,(count-lines pos-before-blank end) + ,@(cadr keywords)))))) + +(defun org-element-export-block-interpreter (export-block contents) + "Interpret EXPORT-BLOCK element as Org syntax. +CONTENTS is nil." + (let ((type (org-element-get-property :type export-block))) + (concat (format "#+begin_%s\n" type) + (org-element-get-property :value export-block) + (format "#+end_%s" type)))) + +;;;; Fixed-width +(defun org-element-fixed-width-parser () + "Parse a fixed-width section. + +Return a list whose car is `fixed-width' and cdr is a plist +containing `:begin', `:end', `:value' and `:post-blank' +keywords." + (let ((fixed-re "[ \t]*:\\( \\|$\\)") + beg-area begin end value pos-before-blank keywords) + (save-excursion + ;; Move to the beginning of the fixed-width area. + (unless (bobp) + (while (and (not (bobp)) (looking-at fixed-re)) + (forward-line -1)) + (unless (looking-at fixed-re) (forward-line 1))) + (setq beg-area (point)) + ;; Get affiliated keywords, if any. + (setq keywords (org-element-collect-affiliated-keywords)) + ;; Store true beginning of element. + (setq begin (car keywords)) + ;; Get ending of fixed-width area. If point is in a list, + ;; ensure to not get outside of it. + (let* ((itemp (org-in-item-p)) + (max-pos (if itemp + (org-list-get-bottom-point + (save-excursion (goto-char itemp) (org-list-struct))) + (point-max)))) + (while (and (looking-at fixed-re) (< (point) max-pos)) + (forward-line))) + (setq pos-before-blank (point)) + ;; Find position after blank + (org-skip-whitespace) + (setq end (if (eobp) (point) (point-at-bol))) + ;; Extract value. + (setq value (buffer-substring-no-properties beg-area pos-before-blank))) + (list 'fixed-width + `(:begin ,begin + :end ,end + :value ,value + :post-blank ,(count-lines pos-before-blank end) + ,@(cadr keywords))))) + +(defun org-element-fixed-width-interpreter (fixed-width contents) + "Interpret FIXED-WIDTH element as Org syntax. +CONTENTS is nil." + (org-remove-indentation (org-element-get-property :value fixed-width))) + +;;;; Horizontal Rule +(defun org-element-horizontal-rule-parser () + "Parse an horizontal rule. + + Return a list whose car is `horizontal-rule' and cdr is + a plist containing `:begin', `:end' and `:post-blank' + keywords." + (save-excursion + (let* ((keywords (org-element-collect-affiliated-keywords)) + (begin (car keywords)) + (post-hr (progn (forward-line) (point))) + (end (progn (org-skip-whitespace) + (if (eobp) (point) (point-at-bol))))) + (list 'horizontal-rule + `(:begin ,begin + :end ,end + :post-blank ,(count-lines post-hr end) + ,@(cadr keywords)))))) + +(defun org-element-horizontal-rule-interpreter (horizontal-rule contents) + "Interpret HORIZONTAL-RULE element as Org syntax. +CONTENTS is nil." + "-----") + +;;;; Keyword +(defun org-element-keyword-parser () + "Parse a keyword at point. + +Return a list whose car is `keyword' and cdr is a plist +containing `:key', `:value', `:begin', `:end' and `:post-blank' +keywords." + (save-excursion + (let* ((begin (point)) + (key (progn (looking-at + "[ \t]*#\\+\\(\\(?:[a-z]+\\)\\(?:_[a-z]+\\)*\\):") + (org-match-string-no-properties 1))) + (value (org-trim (buffer-substring-no-properties + (match-end 0) (point-at-eol)))) + (pos-before-blank (progn (forward-line) (point))) + (end (progn (org-skip-whitespace) + (if (eobp) (point) (point-at-bol))))) + (list 'keyword + `(:key ,key + :value ,value + :begin ,begin + :end ,end + :post-blank ,(count-lines pos-before-blank end)))))) + +(defun org-element-keyword-interpreter (keyword contents) + "Interpret KEYWORD element as Org syntax. +CONTENTS is nil." + (format "#+%s: %s" + (org-element-get-property :key keyword) + (org-element-get-property :value keyword))) + +;;;; Latex Environment +(defun org-element-latex-environment-parser () + "Parse a LaTeX environment. + +Return a list whose car is `latex-environment' and cdr is a plist +containing `:begin', `:end', `:value' and `:post-blank' keywords." + (save-excursion + (end-of-line) + (let* ((case-fold-search t) + (contents-begin (re-search-backward "^[ \t]*\\\\begin" nil t)) + (keywords (org-element-collect-affiliated-keywords)) + (begin (car keywords)) + (contents-end (progn (re-search-forward "^[ \t]*\\\\end") + (forward-line) + (point))) + (value (buffer-substring-no-properties contents-begin contents-end)) + (end (progn (org-skip-whitespace) + (if (eobp) (point) (point-at-bol))))) + (list 'latex-environment + `(:begin ,begin + :end ,end + :value ,value + :post-blank ,(count-lines contents-end end) + ,@(cadr keywords)))))) + +(defun org-element-latex-environment-interpreter (latex-environment contents) + "Interpret LATEX-ENVIRONMENT element as Org syntax. +CONTENTS is nil." + (org-element-get-property :value latex-environment)) + +;;;; Paragraph +(defun org-element-paragraph-parser () + "Parse a paragraph. + +Return a list whose car is `paragraph' and cdr is a plist +containing `:begin', `:end', `:contents-begin' and +`:contents-end' and `:post-blank' keywords. + +Assume point is at the beginning of the paragraph." + (save-excursion + (let* ((contents-begin (point)) + (keywords (org-element-collect-affiliated-keywords)) + (begin (car keywords)) + (contents-end (progn + (end-of-line) + (if (re-search-forward + org-element-paragraph-separate nil 'm) + (progn (forward-line -1) (end-of-line) (point)) + (point)))) + (pos-before-blank (progn (forward-line) (point))) + (end (progn (org-skip-whitespace) + (if (eobp) (point) (point-at-bol))))) + (list 'paragraph + `(:begin ,begin + :end ,end + :contents-begin ,contents-begin + :contents-end ,contents-end + :post-blank ,(count-lines pos-before-blank end) + ,@(cadr keywords)))))) + +(defun org-element-paragraph-interpreter (paragraph contents) + "Interpret PARAGRAPH element as Org syntax. +CONTENTS is the contents of the element." + contents) + +;;;; Property Drawer +(defun org-element-property-drawer-parser () + "Parse a property drawer. + +Return a list whose car is `property-drawer' and cdr is a plist +containing `:begin', `:end', `:hiddenp', `:contents-begin', +`:contents-end', `:properties' and `:post-blank' keywords." + (save-excursion + (let ((case-fold-search t) + (begin (progn (end-of-line) + (re-search-backward org-property-start-re) + (match-beginning 0))) + (contents-begin (progn (forward-line) (point))) + (hidden (org-truely-invisible-p)) + (properties (let (val) + (while (not (looking-at "^[ \t]*:END:")) + (when (looking-at + (org-re + "[ \t]*:\\([[:alpha:]][[:alnum:]_-]*\\):")) + (push (cons (match-string 1) + (org-trim + (buffer-substring + (match-end 0) (point-at-eol)))) + val)) + (forward-line)) + val)) + (contents-end (progn (re-search-forward "^[ \t]*:END:" nil t) + (point-at-bol))) + (pos-before-blank (progn (forward-line) (point))) + (end (progn (org-skip-whitespace) + (if (eobp) (point) (point-at-bol))))) + (list 'property-drawer + `(:begin ,begin + :end ,end + :hiddenp ,hidden + :properties ,properties + :post-blank ,(count-lines pos-before-blank end)))))) + +(defun org-element-property-drawer-interpreter (property-drawer contents) + "Interpret PROPERTY-DRAWER element as Org syntax. +CONTENTS is nil." + (let ((props (org-element-get-property :properties property-drawer))) + (concat + ":PROPERTIES:\n" + (mapconcat (lambda (p) + (format org-property-format (format ":%s:" (car p)) (cdr p))) + (nreverse props) "\n") + "\n:END:"))) + +;;;; Quote Section +(defun org-element-quote-section-parser () + "Parse a quote section. + +Return a list whose car is `quote-section' and cdr is a plist +containing `:begin', `:end', `:value' and `:post-blank' +keywords." + (save-excursion + (let* ((begin (progn (org-back-to-heading t) + (forward-line) + (org-skip-whitespace) + (point-at-bol))) + (end (progn (org-with-limited-levels (outline-next-heading)) + (point))) + (pos-before-blank (progn (skip-chars-backward " \r\t\n") + (forward-line) + (point))) + (value (unless (= begin end) + (buffer-substring-no-properties begin pos-before-blank)))) + (list 'quote-section + `(:begin ,begin + :end ,end + :value ,value + :post-blank ,(if value + (count-lines pos-before-blank end) + 0)))))) + +(defun org-element-quote-section-interpreter (quote-section contents) + "Interpret QUOTE-SECTION element as Org syntax. +CONTENTS is nil." + (org-element-get-property :value quote-section)) + +;;;; Src Block +(defun org-element-src-block-parser () + "Parse a src block. + +Return a list whose car is `src-block' and cdr is a plist +containing `:language', `:switches', `:parameters', `:begin', +`:end', `:hiddenp', `:contents-begin', `:contents-end', `:value' +and `:post-blank' keywords." + (save-excursion + (end-of-line) + (let* ((case-fold-search t) + ;; Get position at beginning of block. + (contents-begin + (re-search-backward + (concat "^[ \t]*#\\+begin_src" + "\\(?: +\\(\\S-+\\)\\)?" ; language + "\\(\\(?: +[-+][A-Za-z]\\)*\\)" ; switches + "\\(.*\\)[ \t]*$") ; arguments + nil t)) + ;; Get language as a string. + (language (org-match-string-no-properties 1)) + ;; Get switches. + (switches (org-match-string-no-properties 2)) + ;; Get parameters. + (parameters (org-trim (org-match-string-no-properties 3))) + ;; Get affiliated keywords. + (keywords (org-element-collect-affiliated-keywords)) + ;; Get beginning position. + (begin (car keywords)) + ;; Get position at end of block. + (contents-end (progn (re-search-forward "^[ \t]*#\\+end_src" nil t) + (forward-line) + (point))) + ;; Retrieve code. + (value (buffer-substring-no-properties + (save-excursion (goto-char contents-begin) + (forward-line) + (point)) + (match-beginning 0))) + ;; Get position after ending blank lines. + (end (progn (org-skip-whitespace) + (if (eobp) (point) (point-at-bol)))) + ;; Get visibility status. + (hidden (progn (goto-char contents-begin) + (forward-line) + (org-truely-invisible-p)))) + (list 'src-block + `(:language ,language + :switches ,switches + :parameters ,parameters + :begin ,begin + :end ,end + :hiddenp ,hidden + :value ,value + :post-blank ,(count-lines contents-end end) + ,@(cadr keywords)))))) + +(defun org-element-src-block-interpreter (src-block contents) + "Interpret SRC-BLOCK element as Org syntax. +CONTENTS is nil." + (let ((lang (org-element-get-property :language src-block)) + (switches (org-element-get-property :switches src-block)) + (params (org-element-get-property :parameters src-block)) + (value (let ((val (org-element-get-property :value src-block))) + (cond + (org-src-preserve-indentation val) + ((zerop org-edit-src-content-indentation) + (org-remove-indentation val)) + (t + (let ((ind (make-string + org-edit-src-content-indentation 32))) + (replace-regexp-in-string + "\\(^\\)[ \t]*\\S-" ind + (org-remove-indentation val) nil nil 1))))))) + (concat (format "#+begin_src%s\n" + (concat (and lang (concat " " lang)) + (and switches (concat " " switches)) + (and params (concat " " params)))) + value + "#+end_src"))) + +;;;; Table +(defun org-element-table-parser () + "Parse a table at point. + +Return a list whose car is `table' and cdr is a plist containing +`:begin', `:end', `:contents-begin', `:contents-end', `:tblfm', +`:type', `:raw-table' and `:post-blank' keywords." + (save-excursion + (let* ((table-begin (goto-char (org-table-begin t))) + (type (if (org-at-table.el-p) 'table.el 'org)) + (keywords (org-element-collect-affiliated-keywords)) + (begin (car keywords)) + (table-end (goto-char (marker-position (org-table-end t)))) + (tblfm (when (looking-at "[ \t]*#\\+tblfm: +\\(.*\\)[ \t]*") + (prog1 (org-match-string-no-properties 1) + (forward-line)))) + (pos-before-blank (point)) + (end (progn (org-skip-whitespace) + (if (eobp) (point) (point-at-bol)))) + (raw-table (org-remove-indentation + (buffer-substring-no-properties table-begin table-end)))) + (list 'table + `(:begin ,begin + :end ,end + :type ,type + :raw-table ,raw-table + :tblfm ,tblfm + :post-blank ,(count-lines pos-before-blank end) + ,@(cadr keywords)))))) + +(defun org-element-table-interpreter (table contents) + "Interpret TABLE element as Org syntax. +CONTENTS is nil." + (org-element-get-property :raw-table table)) + +;;;; Verse Block +(defun org-element-verse-block-parser () + "Parse a verse block. + +Return a list whose car is `verse-block' and cdr is a plist +containing `:begin', `:end', `:hiddenp', `:raw-value', `:value' +and `:post-blank' keywords. + +Assume point is at beginning or end of the block." + (save-excursion + (let* ((case-fold-search t) + (keywords (progn + (end-of-line) + (re-search-backward + (concat "^[ \t]*#\\+begin_verse") nil t) + (org-element-collect-affiliated-keywords))) + (begin (car keywords)) + (hidden (progn (forward-line) (org-truely-invisible-p))) + (raw-val (buffer-substring-no-properties + (point) + (progn + (re-search-forward (concat "^[ \t]*#\\+end_verse") nil t) + (point-at-bol)))) + (pos-before-blank (progn (forward-line) (point))) + (end (progn (org-skip-whitespace) + (if (eobp) (point) (point-at-bol)))) + (value (org-element-parse-secondary-string + (org-remove-indentation raw-val) + (cdr (assq 'verse org-element-string-restrictions))))) + (list 'verse-block + `(:begin ,begin + :end ,end + :hiddenp ,hidden + :raw-value ,raw-val + :value ,value + :post-blank ,(count-lines pos-before-blank end) + ,@(cadr keywords)))))) + + +(defun org-element-verse-block-interpreter (verse-block contents) + "Interpret VERSE-BLOCK element as Org syntax. +CONTENTS is nil." + (format "#+begin_verse\n%s#+end_verse" + (org-remove-indentation + (org-element-get-property :raw-value verse-block)))) + + + +;;; Objects + +;; Unlike to elements, interstices can be found between objects. +;; That's why, along with the parser, successor functions are provided +;; for each object. Some objects share the same successor +;; (i.e. `emphasis' and `verbatim' objects). + +;; A successor must accept a single argument bounding the search. It +;; will return either a cons cell whose car is the object's type, as +;; a symbol, and cdr the position of its next occurrence, or nil. + +;; Successors follow the naming convention: +;; org-element-NAME-successor, where NAME is the name of the +;; successor, as defined in `org-element-all-successors'. + +;; Some object types (i.e `emphasis') are recursive. Restrictions on +;; object types they can contain will be specified in +;; `org-element-object-restrictions'. + +;; Adding a new type of object is simple. Implement a successor, +;; a parser, and an interpreter for it, all following the naming +;; convention. Register successor in `org-element-all-successors', +;; maybe tweak restrictions about it, and that's it. + +;;;; Emphasis +(defun org-element-emphasis-parser () + "Parse text markup object at point. + +Return a list whose car is `emphasis' and cdr is a plist with +`:marker', `:begin', `:end', `:contents-begin' and +`:contents-end' and `:post-blank' keywords. + +Assume point is at the first emphasis marker." + (save-excursion + (unless (bolp) (backward-char 1)) + (looking-at org-emph-re) + (let ((begin (match-beginning 2)) + (marker (org-match-string-no-properties 3)) + (contents-begin (match-beginning 4)) + (contents-end (match-end 4)) + (post-blank (progn (goto-char (match-end 2)) + (skip-chars-forward " \t"))) + (end (point))) + (list 'emphasis + `(:marker ,marker + :begin ,begin + :end ,end + :contents-begin ,contents-begin + :contents-end ,contents-end + :post-blank ,post-blank))))) + +(defun org-element-emphasis-interpreter (emphasis contents) + "Interpret EMPHASIS object as Org syntax. +CONTENTS is the contents of the object." + (let ((marker (org-element-get-property :marker emphasis))) + (concat marker contents marker))) + +(defun org-element-text-markup-successor (limit) + "Search for the next emphasis or verbatim and return position. + +LIMIT bounds the search. + +Return value is a cons cell whose car is `emphasis' or +`verbatim' and cdr is beginning position." + (save-excursion + (unless (bolp) (backward-char)) + (when (re-search-forward org-emph-re limit t) + (cons (if (nth 4 (assoc (match-string 3) org-emphasis-alist)) + 'verbatim + 'emphasis) + (match-beginning 2))))) + +;;;; Entity +(defun org-element-entity-parser () + "Parse entity at point. + +Return a list whose car is `entity' and cdr a plist with +`:begin', `:end', `:latex', `:latex-math-p', `:html', `:latin1', +`:utf-8', `:ascii', `:use-brackets-p' and `:post-blank' as +keywords. + +Assume point is at the beginning of the entity." + (save-excursion + (looking-at "\\\\\\(frac[13][24]\\|[a-zA-Z]+\\)\\($\\|{}\\|[^[:alpha:]]\\)") + (let* ((value (org-entity-get (match-string 1))) + (begin (match-beginning 0)) + (bracketsp (string= (match-string 2) "{}")) + (post-blank (progn (goto-char (match-end 1)) + (when bracketsp (forward-char 2)) + (skip-chars-forward " \t"))) + (end (point))) + (list 'entity + `(:name ,(car value) + :latex ,(nth 1 value) + :latex-math-p ,(nth 2 value) + :html ,(nth 3 value) + :ascii ,(nth 4 value) + :latin1 ,(nth 5 value) + :utf-8 ,(nth 6 value) + :begin ,begin + :end ,end + :use-brackets-p ,bracketsp + :post-blank ,post-blank))))) + +(defun org-element-entity-interpreter (entity contents) + "Interpret ENTITY object as Org syntax. +CONTENTS is nil." + (concat "\\" + (org-element-get-property :name entity) + (when (org-element-get-property :use-brackets-p entity) "{}"))) + +(defun org-element-latex-or-entity-successor (limit) + "Search for the next latex-fragment or entity object. + +LIMIT bounds the search. + +Return value is a cons cell whose car is `entity' or +`latex-fragment' and cdr is beginning position." + (save-excursion + (let ((matchers (plist-get org-format-latex-options :matchers)) + ;; ENTITY-RE matches both LaTeX commands and Org entities. + (entity-re + "\\\\\\(frac[13][24]\\|[a-zA-Z]+\\)\\($\\|[^[:alpha:]\n]\\)")) + (when (re-search-forward + (concat (mapconcat (lambda (e) (nth 1 (assoc e org-latex-regexps))) + matchers "\\|") + "\\|" entity-re) + limit t) + (goto-char (match-beginning 0)) + (if (looking-at entity-re) + ;; Determine if it's a real entity or a LaTeX command. + (cons (if (org-entity-get (match-string 1)) 'entity 'latex-fragment) + (match-beginning 0)) + ;; No entity nor command: point is at a LaTeX fragment. + ;; Determine its type to get the correct beginning position. + (cons 'latex-fragment + (catch 'return + (mapc (lambda (e) + (when (looking-at (nth 1 (assoc e org-latex-regexps))) + (throw 'return + (match-beginning + (nth 2 (assoc e org-latex-regexps)))))) + matchers) + (point)))))))) + +;;;; Export Snippet +(defun org-element-export-snippet-parser () + "Parse export snippet at point. + +Return a list whose car is `export-snippet' and cdr a plist with +`:begin', `:end', `:back-end', `:value' and `:post-blank' as +keywords. + +Assume point is at the beginning of the snippet." + (save-excursion + (looking-at "@\\([-A-Za-z0-9]+\\){") + (let* ((begin (point)) + (back-end (org-match-string-no-properties 1)) + (before-blank (progn (goto-char (scan-sexps (1- (match-end 0)) 1)))) + (value (buffer-substring-no-properties + (match-end 0) (1- before-blank))) + (post-blank (skip-chars-forward " \t")) + (end (point))) + (list 'export-snippet + `(:back-end ,back-end + :value ,value + :begin ,begin + :end ,end + :post-blank ,post-blank))))) + +(defun org-element-export-snippet-interpreter (export-snippet contents) + "Interpret EXPORT-SNIPPET object as Org syntax. +CONTENTS is nil." + (format "@%s{%s}" + (org-element-get-property :back-end export-snippet) + (org-element-get-property :value export-snippet))) + +(defun org-element-export-snippet-successor (limit) + "Search for the next export-snippet object. + +LIMIT bounds the search. + +Return value is a cons cell whose car is `export-snippet' cdr is +its beginning position." + (save-excursion + (catch 'exit + (while (re-search-forward "@[-A-Za-z0-9]+{" limit t) + (when (let ((end (ignore-errors (scan-sexps (1- (point)) 1)))) + (and end (eq (char-before end) ?}))) + (throw 'exit (cons 'export-snippet (match-beginning 0)))))))) + +;;;; Footnote Reference + +(defun org-element-footnote-reference-parser () + "Parse footnote reference at point. + +Return a list whose car is `footnote-reference' and cdr a plist +with `:label', `:type', `:definition', `:begin', `:end' and +`:post-blank' as keywords." + (save-excursion + (let* ((ref (org-footnote-at-reference-p)) + (label (car ref)) + (raw-def (nth 3 ref)) + (inline-def (and raw-def + (org-element-parse-secondary-string raw-def nil))) + (type (if (nth 3 ref) 'inline 'standard)) + (begin (nth 1 ref)) + (post-blank (progn (goto-char (nth 2 ref)) + (skip-chars-forward " \t"))) + (end (point))) + (list 'footnote-reference + `(:label ,label + :type ,type + :inline-definition ,inline-def + :begin ,begin + :end ,end + :post-blank ,post-blank + :raw-definition ,raw-def))))) + +(defun org-element-footnote-reference-interpreter (footnote-reference contents) + "Interpret FOOTNOTE-REFERENCE object as Org syntax. +CONTENTS is nil." + (let ((label (or (org-element-get-property :label footnote-reference) + "fn:")) + (def (let ((raw (org-element-get-property + :raw-definition footnote-reference))) + (if raw (concat ":" raw) "")))) + (format "[%s]" (concat label def)))) + +(defun org-element-footnote-reference-successor (limit) + "Search for the next footnote-reference and return beginning + position. + +LIMIT bounds the search. + +Return value is a cons cell whose car is `footnote-reference' and +cdr is beginning position." + (let (fn-ref) + (when (setq fn-ref (org-footnote-get-next-reference nil nil limit)) + (cons 'footnote-reference (nth 1 fn-ref))))) + + +;;;; Inline Babel Call +(defun org-element-inline-babel-call-parser () + "Parse inline babel call at point. + +Return a list whose car is `inline-babel-call' and cdr a plist with +`:begin', `:end', `:info' and `:post-blank' as keywords. + +Assume point is at the beginning of the babel call." + (save-excursion + (unless (bolp) (backward-char)) + (looking-at org-babel-inline-lob-one-liner-regexp) + (let ((info (save-match-data (org-babel-lob-get-info))) + (begin (match-end 1)) + (post-blank (progn (goto-char (match-end 0)) + (skip-chars-forward " \t"))) + (end (point))) + (list 'inline-babel-call + `(:begin ,begin + :end ,end + :info ,info + :post-blank ,post-blank))))) + +(defun org-element-inline-babel-call-interpreter (inline-babel-call contents) + "Interpret INLINE-BABEL-CALL object as Org syntax. +CONTENTS is nil." + (let* ((babel-info (org-element-get-property :info inline-babel-call)) + (main-source (car babel-info)) + (post-options (nth 1 babel-info))) + (concat "call_" + (if (string-match "\\[\\(\\[.*?\\]\\)\\]" main-source) + ;; Remove redundant square brackets. + (replace-match + (match-string 1 main-source) nil nil main-source) + main-source) + (and post-options (format "[%s]" post-options))))) + +(defun org-element-inline-babel-call-successor (limit) + "Search for the next inline-babel-call and return beginning + position. + +LIMIT bounds the search. + +Return value is a cons cell whose car is `inline-babel-call' and +cdr is beginning position." + (save-excursion + ;; Use a simplified version of + ;; org-babel-inline-lob-one-liner-regexp as regexp for more speed. + (when (re-search-forward + "\\(?:babel\\|call\\)_\\([^()\n]+?\\)\\(\\[\\(.*\\)\\]\\|\\(\\)\\)(\\([^\n]*\\))\\(\\[\\(.*?\\)\\]\\)?" + limit t) + (cons 'inline-babel-call (match-beginning 0))))) + +;;;; Inline Src Block +(defun org-element-inline-src-block-parser () + "Parse inline source block at point. + +Return a list whose car is `inline-src-block' and cdr a plist +with `:begin', `:end', `:language', `:value', `:parameters' and +`:post-blank' as keywords. + +Assume point is at the beginning of the inline src block." + (save-excursion + (unless (bolp) (backward-char)) + (looking-at org-babel-inline-src-block-regexp) + (let ((begin (match-beginning 1)) + (language (org-match-string-no-properties 2)) + (parameters (org-match-string-no-properties 4)) + (value (org-match-string-no-properties 5)) + (post-blank (progn (goto-char (match-end 0)) + (skip-chars-forward " \t"))) + (end (point))) + (list 'inline-src-block + `(:language ,language + :value ,value + :parameters ,parameters + :begin ,begin + :end ,end + :post-blank ,post-blank))))) + + + +(defun org-element-inline-src-block-successor (limit) + "Search for the next inline-babel-call and return beginning position. + +LIMIT bounds the search. + +Return value is a cons cell whose car is `inline-babel-call' and +cdr is beginning position." + (save-excursion + (when (re-search-forward org-babel-inline-src-block-regexp limit t) + (cons 'inline-src-block (match-beginning 1))))) + +;;;; Latex Fragment +(defun org-element-latex-fragment-parser () + "Parse latex fragment at point. + +Return a list whose car is `latex-fragment' and cdr a plist with +`:value', `:begin', `:end', and `:post-blank' as keywords. + +Assume point is at the beginning of the latex fragment." + (save-excursion + (let* ((begin (point)) + (substring-match + (catch 'exit + (mapc (lambda (e) + (let ((latex-regexp (nth 1 (assoc e org-latex-regexps)))) + (when (or (looking-at latex-regexp) + (and (not (bobp)) + (save-excursion + (backward-char) + (looking-at latex-regexp)))) + (throw 'exit (nth 2 (assoc e org-latex-regexps)))))) + (plist-get org-format-latex-options :matchers)) + ;; None found: it's a macro. + (looking-at "\\\\[a-zA-Z]+\\*?\\(\\(\\[[^][\n{}]*\\]\\)\\|\\({[^{}\n]*}\\)\\)*") + 0)) + (value (match-string-no-properties substring-match)) + (post-blank (progn (goto-char (match-end substring-match)) + (skip-chars-forward " \t"))) + (end (point))) + (list 'latex-fragment + `(:value ,value + :begin ,begin + :end ,end + :post-blank ,post-blank))))) + +(defun org-element-latex-fragment-interpreter (latex-fragment contents) + "Interpret LATEX-FRAGMENT object as Org syntax. +CONTENTS is nil." + (org-element-get-property :value latex-fragment)) + +;;;; Line Break +(defun org-element-line-break-parser () + "Parse line break at point. + +Return a list whose car is `line-break', and cdr a plist with +`:begin', `:end' and `:post-blank' keywords. + +Assume point is at the beginning of the line break." + (save-excursion + (let* ((begin (point)) + (end (progn (end-of-line) (point))) + (post-blank (- (skip-chars-backward " \t"))) + (end (point))) + (list 'line-break + `(:begin ,begin + :end ,end + :post-blank ,post-blank))))) + +(defun org-element-line-break-interpreter (line-break contents) + "Interpret LINE-BREAK object as Org syntax. +CONTENTS is nil." + (org-element-get-property :value line-break)) + +(defun org-element-line-break-successor (limit) + "Search for the next statistics cookie and return position. + +LIMIT bounds the search. + +Return value is a cons cell whose car is `line-break' and cdr is +beginning position." + (save-excursion + (let ((beg (and (re-search-forward "[^\\\\]\\(\\\\\\\\\\)[ \t]*$" limit t) + (goto-char (match-beginning 1))))) + ;; A line break can only happen on a non-empty line. + (when (and beg (re-search-backward "\\S-" (point-at-bol) t)) + (cons 'line-break beg))))) + +;;;; Link +(defun org-element-link-parser () + "Parse link at point. + +Return a list whose car is `link' and cdr a plist with `:type', +`:path', `:raw-link', `:begin', `:end', `:contents-begin', +`:contents-end' and `:post-blank' as keywords. + +Assume point is at the beginning of the link." + (save-excursion + (let ((begin (point)) + end contents-begin contents-end link-end post-blank path type + raw-link link) + (cond + ;; Type 1: text targeted from a radio target. + ((and org-target-link-regexp (looking-at org-target-link-regexp)) + (setq type "radio" + path (org-match-string-no-properties 0) + contents-begin (match-beginning 0) + contents-end (match-end 0) + link-end (match-end 0))) + ;; Type 2: Standard link, i.e. [[http://orgmode.org][homepage]] + ((looking-at org-bracket-link-regexp) + (setq contents-begin (match-beginning 3) + contents-end (match-end 3) + link-end (match-end 0) + ;; RAW-LINK is the original link. + raw-link (org-match-string-no-properties 1) + link (org-link-expand-abbrev + (replace-regexp-in-string + " *\n *" " " (org-link-unescape raw-link) t t))) + ;; 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)) + ;; 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))) + ;; Id type: PATH is the id. + ((string-match "^id:\\([-a-f0-9]+\\)" link) + (setq type "id" path (match-string 1 link))) + ;; Code-ref type: PATH is the name of the reference. + ((string-match "^(\\(.*\\))$" link) + (setq type "coderef" path (match-string 1 link))) + ;; Custom-id type: PATH is the name of the custom id. + ((= (aref link 0) ?#) + (setq type "custom-id" path (substring 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)))) + ;; 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))) + ;; Type 4: Angular link, i.e. + ((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)))) + ;; 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")) + end (point)) + (list 'link + `(:type ,type + :path ,path + :raw-link ,(or raw-link path) + :begin ,begin + :end ,end + :contents-begin ,contents-begin + :contents-end ,contents-end + :post-blank ,post-blank))))) + +(defun org-element-link-interpreter (link contents) + "Interpret LINK object as Org syntax. +CONTENTS is the contents of the object." + (let ((type (org-element-get-property :type link)) + (raw-link (org-element-get-property :raw-link link))) + (cond + ((string= type "radio") raw-link) + (t (format "[[%s]%s]" + raw-link + (if (string= contents "") "" (format "[%s]" contents))))))) + +(defun org-element-link-successor (limit) + "Search for the next link and return position. + +LIMIT bounds the search. + +Return value is a cons cell whose car is `link' and cdr is +beginning position." + (save-excursion + (let ((link-regexp + (if org-target-link-regexp + (concat org-any-link-re "\\|" org-target-link-regexp) + org-any-link-re))) + (when (re-search-forward link-regexp limit t) + (cons 'link (match-beginning 0)))))) + +;;;; Macro +(defun org-element-macro-parser () + "Parse macro at point. + +Return a list whose car is `macro' and cdr a plist with `:key', +`:args', `:begin', `:end', `:value' and `:post-blank' as +keywords. + +Assume point is at the macro." + (save-excursion + (looking-at "{{{\\([a-zA-Z][-a-zA-Z0-9_]*\\)\\(([ \t\n]*\\([^\000]*?\\))\\)?}}}") + (let ((begin (point)) + (key (downcase (org-match-string-no-properties 1))) + (value (org-match-string-no-properties 0)) + (post-blank (progn (goto-char (match-end 0)) + (skip-chars-forward " \t"))) + (end (point)) + (args (let ((args (org-match-string-no-properties 3)) args2) + (when args + (setq args (org-split-string args ",")) + (while args + (while (string-match "\\\\\\'" (car args)) + ;; Repair bad splits. + (setcar (cdr args) (concat (substring (car args) 0 -1) + "," (nth 1 args))) + (pop args)) + (push (pop args) args2)) + (mapcar 'org-trim (nreverse args2)))))) + (list 'macro + `(:key ,key + :value ,value + :args ,args + :begin ,begin + :end ,end + :post-blank ,post-blank))))) + +(defun org-element-macro-interpreter (macro contents) + "Interpret MACRO object as Org syntax. +CONTENTS is nil." + (org-element-get-property :value macro)) + +(defun org-element-macro-successor (limit) + "Search for the next macro and return position. + +LIMIT bounds the search. + +Return value is cons cell whose car is `macro' and cdr is +beginning position." + (save-excursion + (when (re-search-forward + "{{{\\([a-zA-Z][-a-zA-Z0-9_]*\\)\\(([ \t\n]*\\([^\000]*?\\))\\)?}}}" + limit t) + (cons 'macro (match-beginning 0))))) + +;;;; Radio-target +(defun org-element-radio-target-parser () + "Parse radio target at point. + +Return a list whose car is `radio-target' and cdr a plist with +`:begin', `:end', `:contents-begin', `:contents-end', `raw-value' +and `:post-blank' as keywords. + +Assume point is at the radio target." + (save-excursion + (looking-at org-radio-target-regexp) + (let ((begin (point)) + (contents-begin (match-beginning 1)) + (contents-end (match-end 1)) + (raw-value (org-match-string-no-properties 1)) + (post-blank (progn (goto-char (match-end 0)) + (skip-chars-forward " \t"))) + (end (point))) + (list 'radio-target + `(:begin ,begin + :end ,end + :contents-begin ,contents-begin + :contents-end ,contents-end + :raw-value ,raw-value + :post-blank ,post-blank))))) + +(defun org-element-radio-target-interpreter (target contents) + "Interpret TARGET object as Org syntax. +CONTENTS is the contents of the object." + (concat ">")) + +(defun org-element-radio-target-successor (limit) + "Search for the next radio-target and return position. + +LIMIT bounds the search. + +Return value is a cons cell whose car is `radio-target' and cdr +is beginning position." + (save-excursion + (when (re-search-forward org-radio-target-regexp limit t) + (cons 'radio-target (match-beginning 0))))) + +;;;; Statistics Cookie +(defun org-element-statistics-cookie-parser () + "Parse statistics cookie at point. + +Return a list whose car is `statistics-cookie', and cdr a plist +with `:begin', `:end', `:value' and `:post-blank' keywords. + +Assume point is at the beginning of the statistics-cookie." + (save-excursion + (looking-at "\\[[0-9]*\\(%\\|/[0-9]*\\)\\]") + (let* ((begin (point)) + (value (buffer-substring-no-properties + (match-beginning 0) (match-end 0))) + (post-blank (progn (goto-char (match-end 0)) + (skip-chars-forward " \t"))) + (end (point))) + (list 'statistics-cookie + `(:begin ,begin + :end ,end + :value ,value + :post-blank ,post-blank))))) + +(defun org-element-statistics-cookie-interpreter (statistics-cookie contents) + "Interpret STATISTICS-COOKIE object as Org syntax. +CONTENTS is nil." + (org-element-get-property :value statistics-cookie)) + +(defun org-element-statistics-cookie-successor (limit) + "Search for the next statistics cookie and return position. + +LIMIT bounds the search. + +Return value is a cons cell whose car is `statistics-cookie' and +cdr is beginning position." + (save-excursion + (when (re-search-forward "\\[[0-9]*\\(%\\|/[0-9]*\\)\\]" limit t) + (cons 'statistics-cookie (match-beginning 0))))) + +;;;; Subscript +(defun org-element-subscript-parser () + "Parse subscript at point. + +Return a list whose car is `subscript' and cdr a plist with +`:begin', `:end', `:contents-begin', `:contents-end', +`:use-brackets-p' and `:post-blank' as keywords. + +Assume point is at the underscore." + (save-excursion + (unless (bolp) (backward-char)) + (let ((bracketsp (if (looking-at org-match-substring-with-braces-regexp) + t + (not (looking-at org-match-substring-regexp)))) + (begin (match-beginning 2)) + (contents-begin (or (match-beginning 5) + (match-beginning 3))) + (contents-end (or (match-end 5) (match-end 3))) + (post-blank (progn (goto-char (match-end 0)) + (skip-chars-forward " \t"))) + (end (point))) + (list 'subscript + `(:begin ,begin + :end ,end + :use-brackets-p ,bracketsp + :contents-begin ,contents-begin + :contents-end ,contents-end + :post-blank ,post-blank))))) + +(defun org-element-subscript-interpreter (subscript contents) + "Interpret SUBSCRIPT object as Org syntax. +CONTENTS is the contents of the object." + (format + (if (org-element-get-property :use-brackets-p subscript) "_{%s}" "_%s") + contents)) + +(defun org-element-sub/superscript-successor (limit) + "Search for the next sub/superscript and return beginning +position. + +LIMIT bounds the search. + +Return value is a cons cell whose car is either `subscript' or +`superscript' and cdr is beginning position." + (save-excursion + (when (re-search-forward org-match-substring-regexp limit t) + (cons (if (string= (match-string 2) "_") 'subscript 'superscript) + (match-beginning 2))))) + +;;;; Superscript +(defun org-element-superscript-parser () + "Parse superscript at point. + +Return a list whose car is `superscript' and cdr a plist with +`:begin', `:end', `:contents-begin', `:contents-end', +`:use-brackets-p' and `:post-blank' as keywords. + +Assume point is at the caret." + (save-excursion + (unless (bolp) (backward-char)) + (let ((bracketsp (if (looking-at org-match-substring-with-braces-regexp) + t + (not (looking-at org-match-substring-regexp)))) + (begin (match-beginning 2)) + (contents-begin (or (match-beginning 5) + (match-beginning 3))) + (contents-end (or (match-end 5) (match-end 3))) + (post-blank (progn (goto-char (match-end 0)) + (skip-chars-forward " \t"))) + (end (point))) + (list 'superscript + `(:begin ,begin + :end ,end + :use-brackets-p ,bracketsp + :contents-begin ,contents-begin + :contents-end ,contents-end + :post-blank ,post-blank))))) + +(defun org-element-superscript-interpreter (superscript contents) + "Interpret SUPERSCRIPT object as Org syntax. +CONTENTS is the contents of the object." + (format + (if (org-element-get-property :use-brackets-p superscript) "^{%s}" "^%s") + contents)) + +;;;; Target +(defun org-element-target-parser () + "Parse target at point. + +Return a list whose car is `target' and cdr a plist with +`:begin', `:end', `:contents-begin', `:contents-end', `raw-value' +and `:post-blank' as keywords. + +Assume point is at the target." + (save-excursion + (looking-at org-target-regexp) + (let ((begin (point)) + (contents-begin (match-beginning 1)) + (contents-end (match-end 1)) + (raw-value (org-match-string-no-properties 1)) + (post-blank (progn (goto-char (match-end 0)) + (skip-chars-forward " \t"))) + (end (point))) + (list 'target + `(:begin ,begin + :end ,end + :contents-begin ,contents-begin + :contents-end ,contents-end + :raw-value ,raw-value + :post-blank ,post-blank))))) + +(defun org-element-target-interpreter (target contents) + "Interpret TARGET object as Org syntax. +CONTENTS is the contents of target." + (concat "")) + +(defun org-element-target-successor (limit) + "Search for the next target and return position. + +LIMIT bounds the search. + +Return value is a cons cell whose car is `target' and cdr is +beginning position." + (save-excursion + (when (re-search-forward org-target-regexp limit t) + (cons 'target (match-beginning 0))))) + +;;;; Time-stamp +(defun org-element-time-stamp-parser () + "Parse time stamp at point. + +Return a list whose car is `time-stamp', and cdr a plist with +`:appt-type', `:type', `:begin', `:end', `:value' and +`:post-blank' keywords. + +Assume point is at the beginning of the time-stamp." + (save-excursion + (let* ((appt-type (cond + ((looking-at (concat org-deadline-string " +")) + (goto-char (match-end 0)) + 'deadline) + ((looking-at (concat org-scheduled-string " +")) + (goto-char (match-end 0)) + 'scheduled) + ((looking-at (concat org-closed-string " +")) + (goto-char (match-end 0)) + 'closed))) + (begin (and appt-type (match-beginning 0))) + (type (cond + ((looking-at org-tsr-regexp) + (if (match-string 2) 'active-range 'active)) + ((looking-at org-tsr-regexp-both) + (if (match-string 2) 'inactive-range 'inactive)) + ((looking-at (concat + "\\(<[0-9]+-[0-9]+-[0-9]+[^>\n]+?\\+[0-9]+[dwmy]>\\)" + "\\|" + "\\(<%%\\(([^>\n]+)\\)>\\)")) + 'diary))) + (begin (or begin (match-beginning 0))) + (value (buffer-substring-no-properties + (match-beginning 0) (match-end 0))) + (post-blank (progn (goto-char (match-end 0)) + (skip-chars-forward " \t"))) + (end (point))) + (list 'time-stamp + `(:appt-type ,appt-type + :type ,type + :value ,value + :begin ,begin + :end ,end + :post-blank ,post-blank))))) + +(defun org-element-time-stamp-interpreter (time-stamp contents) + "Interpret TIME-STAMP object as Org syntax. +CONTENTS is nil." + (concat + (case (org-element-get-property :appt-type time-stamp) + (closed (concat org-closed-string " ")) + (deadline (concat org-deadline-string " ")) + (scheduled (concat org-scheduled-string " "))) + (org-element-get-property :value time-stamp))) + +(defun org-element-time-stamp-successor (limit) + "Search for the next time-stamp and return position. + +LIMIT bounds the search. + +Return value is a cons cell whose car is `time-stamp' and cdr is +beginning position." + (save-excursion + (when (re-search-forward + (concat "\\(?:" org-scheduled-string " +\\|" + org-deadline-string " +\\|" org-closed-string " +\\)?" + org-ts-regexp-both + "\\|" + "\\(?:<[0-9]+-[0-9]+-[0-9]+[^>\n]+?\\+[0-9]+[dwmy]>\\)" + "\\|" + "\\(?:<%%\\(?:([^>\n]+)\\)>\\)") + limit t) + (cons 'time-stamp (match-beginning 0))))) + +;;;; Verbatim +(defun org-element-verbatim-parser () + "Parse verbatim object at point. + +Return a list whose car is `verbatim' and cdr is a plist with +`:marker', `:begin', `:end' and `:post-blank' keywords. + +Assume point is at the first verbatim marker." + (save-excursion + (unless (bolp) (backward-char 1)) + (looking-at org-emph-re) + (let ((begin (match-beginning 2)) + (marker (org-match-string-no-properties 3)) + (value (org-match-string-no-properties 4)) + (post-blank (progn (goto-char (match-end 2)) + (skip-chars-forward " \t"))) + (end (point))) + (list 'verbatim + `(:marker ,marker + :begin ,begin + :end ,end + :value ,value + :post-blank ,post-blank))))) + +(defun org-element-verbatim-interpreter (verbatim contents) + "Interpret VERBATIM object as Org syntax. +CONTENTS is nil." + (let ((marker (org-element-get-property :marker verbatim)) + (value (org-element-get-property :value verbatim))) + (concat marker value marker))) + + + +;;; Definitions And Rules + +;; Define elements, greater elements and specify recursive objects, +;; along with the affiliated keywords recognized. Also set up +;; restrictions on recursive objects combinations. + +;; These variables really act as a control center for the parsing +;; process. +(defconst org-element-paragraph-separate + (concat "\f" "\\|" "^[ \t]*$" "\\|" + ;; Headlines and inlinetasks. + org-outline-regexp-bol "\\|" + ;; Comments, blocks (any type), keywords and babel calls. + "^[ \t]*#\\+" "\\|" "^#\\( \\|$\\)" "\\|" + ;; Lists. + (org-item-beginning-re) "\\|" + ;; Fixed-width, drawers (any type) and tables. + "^[ \t]*[:|]" "\\|" + ;; Footnote definitions. + org-footnote-definition-re "\\|" + ;; Horizontal rules. + "^[ \t]*-\\{5,\\}[ \t]*$" "\\|" + ;; LaTeX environments. + "^[ \t]*\\\\\\(begin\\|end\\)") + "Regexp to separate paragraphs in an Org buffer.") + +(defconst org-element-all-elements + '(center-block comment comment-block drawer dynamic-block example-block + export-block fixed-width footnote-definition headline + horizontal-rule inlinetask item keyword latex-environment + babel-call paragraph plain-list property-drawer quote-block + quote-section special-block src-block table verse-block) + "Complete list of elements.") + +(defconst org-element-greater-elements + '(center-block drawer dynamic-block footnote-definition headline inlinetask + item plain-list quote-block special-block) + "List of recursive element types aka Greater Elements.") + +(defconst org-element-all-successors + '(export-snippet footnote-reference inline-babel-call inline-src-block + latex-or-entity line-break link macro radio-target + statistics-cookie sub/superscript target text-markup + time-stamp) + "Complete list of successors.") + +(defconst org-element-object-successor-alist + '((subscript . sub/superscript) (superscript . sub/superscript) + (emphasis . text-markup) (verbatim . text-markup) + (entity . latex-or-entity) (latex-fragment . latex-or-entity)) + "Alist of translations between object type and successor name. + +Sharing the same successor comes handy when, for example, the +regexp matching one object can also match the other object.") + +(defconst org-element-recursive-objects + '(emphasis link subscript superscript target radio-target) + "List of recursive object types.") + +(defconst org-element-non-recursive-block-alist + '(("ascii" . export-block) + ("comment" . comment-block) + ("docbook" . export-block) + ("example" . example-block) + ("html" . export-block) + ("latex" . latex-block) + ("odt" . export-block) + ("src" . src-block) + ("verse" . verse-block)) + "Alist between non-recursive block name and their element type.") + +(defconst org-element-affiliated-keywords + '("attr_ascii" "attr_docbook" "attr_html" "attr_latex" "attr_odt" "caption" + "data" "header" "headers" "label" "name" "plot" "resname" "result" "results" + "source" "srcname" "tblname") + "List of affiliated keywords as strings.") + +(defconst org-element-keyword-translation-alist + '(("tblname" . "name") ("srcname" . "name") ("resname" . "name") + ("source" . "name") ("result" . "results") ("headers" . "header") + ("label" . "name")) + "Alist of usual translations for keywords. +The key is the old name and the value the new one. The property +holding their value will be named after the translated name.") + +(defconst org-element-multiple-keywords + '("attr_ascii" "attr_docbook" "attr_html" "attr_latex" "attr_odt" "header") + "List of affiliated keywords that can occur more that once in an element. + +Their value will be consed into a list of strings, which will be +returned as the value of the property. + +This list is checked after translations have been applied. See +`org-element-keyword-translation-alist'.") + +(defconst org-element-parsed-keywords '("author" "caption" "title") + "List of keywords whose value can be parsed. + +Their value will be stored as a secondary string: a list of +strings and objects. + +This list is checked after translations have been applied. See +`org-element-keyword-translation-alist'.") + +(defconst org-element-dual-keywords '("results") + "List of keywords which can have a secondary value. + +In Org syntax, they can be written with optional square brackets +before the colons. For example, results keyword can be +associated to a hash value with the following: + + #+results[hash-string]: some-source + +This list is checked after translations have been applied. See +`org-element-keyword-translation-alist'.") + +(defconst org-element-object-restrictions + '((emphasis entity export-snippet inline-babel-call inline-src-block + radio-target sub/superscript target text-markup time-stamp) + (link entity export-snippet inline-babel-call inline-src-block + latex-fragment sub/superscript text-markup) + (radio-target entity export-snippet latex-fragment sub/superscript) + (subscript entity export-snippet inline-babel-call inline-src-block + latex-fragment sub/superscript text-markup) + (superscript entity export-snippet inline-babel-call inline-src-block + latex-fragment sub/superscript text-markup) + (target entity export-snippet latex-fragment sub/superscript text-markup)) + "Alist of recursive objects restrictions. + +Car is a recursive object type and cdr is a list of successors +that will be called within an object of such type. + +For example, in a `radio-target' object, one can only find +entities, export snippets, latex-fragments, subscript and +superscript.") + +(defconst org-element-string-restrictions + '((headline entity inline-babel-call latex-fragment link macro radio-target + statistics-cookie sub/superscript text-markup time-stamp) + (inlinetask entity inline-babel-call latex-fragment link macro radio-target + sub/superscript text-markup time-stamp) + (item entity inline-babel-call latex-fragment macro radio-target + sub/superscript target verbatim) + (keyword entity latex-fragment macro sub/superscript text-markup) + (table entity latex-fragment macro text-markup) + (verse entity footnote-reference inline-babel-call inline-src-block + latex-fragment line-break link macro radio-target sub/superscript + target text-markup time-stamp)) + "Alist of secondary strings restrictions. + +When parsed, some elements have a secondary string which could +contain various objects (i.e. headline's name, or table's cells). +For association, the car is the element type, and the cdr a list +of successors that will be called in that secondary string. + +Note: `keyword' secondary string type only applies to keywords +matching `org-element-parsed-keywords'.") + + + +;;; Accessors +;; +;; Provide two accessors: `org-element-get-property' and +;; `org-element-get-contents'. +(defun org-element-get-property (property element) + "Extract the value from the PROPERTY of an ELEMENT." + (plist-get (nth 1 element) property)) + +(defun org-element-get-contents (element) + "Extract contents from an ELEMENT." + (nthcdr 2 element)) + + + +;; Obtaining The Smallest Element Containing Point + +;; `org-element-at-point' is the core function of this section. It +;; returns the Lisp representation of the element at point. It uses +;; `org-element-guess-type' and `org-element-skip-keywords' as helper +;; functions. + +;; When point is at an item, there is no automatic way to determine if +;; the function should return the `plain-list' element, or the +;; corresponding `item' element. By default, `org-element-at-point' +;; works at the `plain-list' level. But, by providing an optional +;; argument, one can make it switch to the `item' level. +(defconst org-element--affiliated-re + (format "[ \t]*#\\+\\(%s\\):" + (mapconcat + (lambda (keyword) + (if (member keyword org-element-dual-keywords) + (format "\\(%s\\)\\(?:\\[\\(.*?\\)\\]\\)?" + (regexp-quote keyword)) + (regexp-quote keyword))) + org-element-affiliated-keywords "\\|")) + "Regexp matching any affiliated keyword. + +Keyword name is put in match group 1. Moreover, if keyword +belongs to `org-element-dual-keywords', put the dual value in +match group 2. + +Don't modify it, set `org-element--affiliated-keywords' instead.") + +(defun org-element-at-point (&optional toggle-item structure) + "Determine closest element around point. + +Return value is a list \(TYPE PROPS\) where TYPE is the type of +the element and PROPS a plist of properties associated to the +element. + +Possible types are defined in `org-element-all-elements'. + +If optional argument TOGGLE-ITEM is non-nil, parse item wise +instead of plain-list wise, using STRUCTURE as the current list +structure. + +If STRUCTURE isn't provided but TOGGLE-ITEM is non-nil, it will +be computed." + (save-excursion + (beginning-of-line) + ;; Move before any blank line. + (when (looking-at "[ \t]*$") + (skip-chars-backward " \r\t\n") + (beginning-of-line)) + (let ((case-fold-search t)) + ;; Check if point is at an affiliated keyword. In that case, + ;; try moving to the beginning of the associated element. If + ;; the keyword is orphaned, treat it as plain text. + (when (looking-at org-element--affiliated-re) + (let ((opoint (point))) + (while (looking-at org-element--affiliated-re) (forward-line)) + (when (looking-at "[ \t]*$") (goto-char opoint)))) + (let ((type (org-element-guess-type))) + (cond + ;; Guessing element type on the current line is impossible: + ;; try to find the beginning of the current element to get + ;; more information. + ((not type) + (let ((search-origin (point)) + (opoint-in-item-p (org-in-item-p)) + (par-found-p + (progn + (end-of-line) + (re-search-backward org-element-paragraph-separate nil 'm)))) + (cond + ;; Unable to find a paragraph delimiter above: we're at + ;; bob and looking at a paragraph. + ((not par-found-p) (org-element-paragraph-parser)) + ;; Trying to find element's beginning set point back to + ;; its original position. There's something peculiar on + ;; this line that prevents parsing, probably an + ;; ill-formed keyword or an undefined drawer name. Parse + ;; it as plain text anyway. + ((< search-origin (point-at-eol)) (org-element-paragraph-parser)) + ;; Original point wasn't in a list but previous paragraph + ;; is. It means that either point was inside some block, + ;; or current list was ended without using a blank line. + ;; In the last case, paragraph really starts at list end. + ((let (item) + (and (not opoint-in-item-p) + (not (looking-at "[ \t]*#\\+begin")) + (setq item (org-in-item-p)) + (let ((struct (save-excursion (goto-char item) + (org-list-struct)))) + (goto-char (org-list-get-bottom-point struct)) + (org-skip-whitespace) + (beginning-of-line) + (org-element-paragraph-parser))))) + ((org-footnote-at-definition-p) + (org-element-footnote-definition-parser)) + ((and opoint-in-item-p (org-at-item-p) (= opoint-in-item-p (point))) + (if toggle-item + (org-element-item-parser (or structure (org-list-struct))) + (org-element-plain-list-parser (or structure (org-list-struct))))) + ;; In any other case, the paragraph started the line + ;; below. + (t (forward-line) (org-element-paragraph-parser))))) + ((eq type 'plain-list) + (if toggle-item + (org-element-item-parser (or structure (org-list-struct))) + (org-element-plain-list-parser (or structure (org-list-struct))))) + ;; Straightforward case: call the appropriate parser. + (t (funcall (intern (format "org-element-%s-parser" type))))))))) + + +;; It is obvious to tell if point is in most elements, either by +;; looking for a specific regexp in the current line, or by using +;; already implemented functions. This is the goal of +;; `org-element-guess-type'. +(defconst org-element--element-block-types + (mapcar 'car org-element-non-recursive-block-alist) + "List of non-recursive block types, as strings. +Used internally by `org-element-guess-type'. Do not modify it +directly, set `org-element-non-recursive-block-alist' instead.") + +(defun org-element-guess-type () + "Return the type of element at point, or nil if undetermined. +This function may move point to an appropriate position for +parsing. Used internally by `org-element-at-point'." + ;; Beware: Order matters for some cases in that function. + (beginning-of-line) + (let ((case-fold-search t)) + (cond + ((org-with-limited-levels (org-at-heading-p)) 'headline) + ((let ((headline (ignore-errors (nth 4 (org-heading-components))))) + (and headline + (let (case-fold-search) + (string-match (format "^%s\\(?: \\|$\\)" org-quote-string) + headline)))) + 'quote-section) + ;; Non-recursive block. + ((let ((type (org-in-block-p org-element--element-block-types))) + (and type (cdr (assoc type org-element-non-recursive-block-alist))))) + ((org-at-heading-p) 'inlinetask) + ((org-between-regexps-p + "^[ \t]*\\\\begin{" "^[ \t]*\\\\end{[^}]*}[ \t]*") 'latex-environment) + ;; Property drawer. Almost `org-at-property-p', but allow drawer + ;; boundaries. + ((org-with-wide-buffer + (and (not (org-before-first-heading-p)) + (let ((pblock (org-get-property-block))) + (and pblock + (<= (point) (cdr pblock)) + (>= (point-at-eol) (1- (car pblock))))))) + 'property-drawer) + ;; Recursive block. If the block isn't complete, parse the + ;; current part as a paragraph. + ((looking-at "[ \t]*#\\+\\(begin\\|end\\)_\\([-A-Za-z0-9]+\\)\\(?:$\\|\\s-\\)") + (let ((type (downcase (match-string 2)))) + (cond + ((not (org-in-block-p (list type))) 'paragraph) + ((string= type "center") 'center-block) + ((string= type "quote") 'quote-block) + (t 'special-block)))) + ;; Regular drawers must be tested after property drawer as both + ;; elements share the same ending regexp. + ((or (looking-at org-drawer-regexp) (looking-at "[ \t]*:END:[ \t]*$")) + (let ((completep (org-between-regexps-p + org-drawer-regexp "^[ \t]*:END:[ \t]*$"))) + (if (not completep) + 'paragraph + (goto-char (car completep)) 'drawer))) + ((looking-at "[ \t]*:\\( \\|$\\)") 'fixed-width) + ;; Babel calls must be tested before general keywords as they are + ;; a subset of them. + ((looking-at org-babel-block-lob-one-liner-regexp) 'babel-call) + ((looking-at org-footnote-definition-re) 'footnote-definition) + ((looking-at "[ \t]*#\\+\\([a-z]+\\(:?_[a-z]+\\)*\\):") + (if (member (downcase (match-string 1)) org-element-affiliated-keywords) + 'paragraph + 'keyword)) + ;; Dynamic block: simplify regexp used for match. If it isn't + ;; complete, parse the current part as a paragraph. + ((looking-at "[ \t]*#\\+\\(begin\\end\\):\\(?:\\s-\\|$\\)") + (let ((completep (org-between-regexps-p + "^[ \t]*#\\+begin:\\(?:\\s-\\|$\\)" + "^[ \t]*#\\+end:\\(?:\\s-\\|$\\)"))) + (if (not completep) + 'paragraph + (goto-char (car completep)) 'dynamic-block))) + ((looking-at "\\(#\\|[ \t]*#\\+\\( \\|$\\)\\)") 'comment) + ((looking-at "[ \t]*-\\{5,\\}[ \t]*$") 'horizontal-rule) + ((org-at-table-p t) 'table) + ((looking-at "[ \t]*#\\+tblfm:") + (forward-line -1) + ;; A TBLFM line separated from any table is just plain text. + (if (org-at-table-p) + 'table + (forward-line) 'paragraph)) + ((looking-at (org-item-re)) 'plain-list)))) + +;; Most elements can have affiliated keywords. When looking for an +;; element beginning, we want to move before them, as they belong to +;; that element, and, in the meantime, collect information they give +;; into appropriate properties. Hence the following function. + +;; Usage of optional arguments may not be obvious at first glance: + +;; - TRANS-LIST is used to polish keywords names that have evolved +;; during Org history. In example, even though =result= and +;; =results= coexist, we want to have them under the same =result= +;; property. It's also true for "srcname" and "name", where the +;; latter seems to be preferred nowadays (thus the "name" property). + +;; - CONSED allows to regroup multi-lines keywords under the same +;; property, while preserving their own identity. This is mostly +;; used for "attr_latex" and al. + +;; - PARSED prepares a keyword value for export. This is useful for +;; "caption". Objects restrictions for such keywords are defined in +;; `org-element-string-restrictions'. + +;; - DUALS is used to take care of keywords accepting a main and an +;; optional secondary values. For example "results" has its +;; source's name as the main value, and may have an hash string in +;; optional square brackets as the secondary one. + +;; A keyword may belong to more than one category. +(defun org-element-collect-affiliated-keywords (&optional key-re trans-list + consed parsed duals) + "Collect affiliated keywords before point. + +Optional argument KEY-RE is a regexp matching keywords, which +puts matched keyword in group 1. It defaults to +`org-element--affiliated-re'. + +TRANS-LIST is an alist where key is the keyword and value the +property name it should be translated to, without the colons. It +defaults to `org-element-keyword-translation-alist'. + +CONSED is a list of strings. Any keyword belonging to that list +will have its value consed. The check is done after keyword +translation. It defaults to `org-element-multiple-keywords'. + +PARSED is a list of strings. Any keyword member of this list +will have its value parsed. The check is done after keyword +translation. If a keyword is a member of both CONSED and PARSED, +it's value will be a list of parsed strings. It defaults to +`org-element-parsed-keywords'. + +DUALS is a list of strings. Any keyword member of this list can +have two parts: one mandatory and one optional. Its value is +a cons cell whose car is the former, and the cdr the latter. If +a keyword is a member of both PARSED and DUALS, only the primary +part will be parsed. It defaults to `org-element-dual-keywords'. + +Return a list whose car is the position at the first of them and +cdr a plist of keywords and values." + (save-excursion + (let ((case-fold-search t) + (key-re (or key-re org-element--affiliated-re)) + (trans-list (or trans-list org-element-keyword-translation-alist)) + (consed (or consed org-element-multiple-keywords)) + (parsed (or parsed org-element-parsed-keywords)) + (duals (or duals org-element-dual-keywords)) + output) + (unless (bobp) + (while (and (not (bobp)) + (progn (forward-line -1) (looking-at key-re))) + (let* ((raw-kwd (downcase (or (match-string 2) (match-string 1)))) + ;; Apply translation to RAW-KWD. From there, KWD is + ;; the official keyword. + (kwd (or (cdr (assoc raw-kwd trans-list)) raw-kwd)) + ;; If KWD is a dual keyword, find it secondary value. + (dual-value (and (member kwd duals) + (org-match-string-no-properties 3))) + ;; Find main value for any keyword. + (value (org-trim (buffer-substring-no-properties + (match-end 0) (point-at-eol)))) + ;; Attribute a property name to KWD. + (kwd-sym (and kwd (intern (concat ":" kwd))))) + ;; Now set final shape for VALUE. + (when (member kwd parsed) + (setq value + (org-element-parse-secondary-string + value + (cdr (assq 'keyword org-element-string-restrictions))))) + (when (member kwd duals) (setq value (cons value dual-value))) + (when (member kwd consed) + (setq value (cons value (plist-get output kwd-sym)))) + ;; Eventually store the new value in OUTPUT. + (setq output (plist-put output kwd-sym value)))) + (unless (looking-at key-re) (forward-line 1))) + (list (point) output)))) + + + +;;; The Org Parser + +;; The two major functions here are `org-element-parse-buffer', which +;; parses Org syntax inside the current buffer, taking into account +;; region, narrowing, or even visibility if specified, and +;; `org-element-parse-secondary-string', which parses objects within +;; a given string. + +;; The (almost) almighty `org-element-map' allows to apply a function +;; on elements or objects matching some type, and accumulate the +;; resulting values. In an export situation, it also skips unneeded +;; parts of the parse tree, transparently walks into included files, +;; and maintain a list of local properties (i.e. those inherited from +;; parent headlines) for function's consumption. +(defun org-element-parse-buffer (&optional granularity visible-only) + "Recursively parse the buffer and return structure. +If narrowing is in effect, only parse the visible part of the +buffer. + +Optional argument GRANULARITY determines the depth of the +recursion. It can be set to the following symbols: + +`headline' Only parse headlines. +`greater-element' Don't recurse into greater elements. Thus, + elements parsed are the top-level ones. +`element' Parse everything but objects and plain text. +`object' Parse the complete buffer (default). + +When VISIBLE-ONLY is non-nil, don't parse contents of hidden +elements. + +Assume buffer is in Org mode." + (save-excursion + (goto-char (point-min)) + (org-skip-whitespace) + (nconc (list 'org-data nil) + (org-element-parse-elements + (point-at-bol) (point-max) + nil nil granularity visible-only nil)))) + +(defun org-element-parse-secondary-string (string restriction &optional buffer) + "Recursively parse objects in STRING and return structure. + +RESTRICTION, when non-nil, is a symbol limiting the object types +that will be looked after. + +Optional argument BUFFER indicates the buffer from where the +secondary string was extracted. It is used to determine where to +get extraneous information for an object \(i.e. when resolving +a link or looking for a footnote definition\). It defaults to +the current buffer." + (with-temp-buffer + (insert string) + (org-element-parse-objects (point-min) (point-max) nil restriction))) + +(defun org-element-map (data types fun &optional options first-match) + "Map a function on selected elements or objects. + +DATA is the parsed tree, as returned by, i.e, +`org-element-parse-buffer'. TYPES is a symbol or list of symbols +of elements or objects types. FUN is the function called on the +matching element or object. It must accept two arguments: the +element or object itself and a plist holding contextual +information. + +When optional argument OPTIONS is non-nil, it should be a plist +holding export options. In that case, parts of the parse tree +not exportable according to that property list will be skipped +and files included through a keyword will be visited. + +When optional argument FIRST-MATCH is non-nil, stop at the first +match for which FUN doesn't return nil, and return that value. + +Nil values returned from FUN are ignored in the result." + ;; Ensure TYPES is a list, even of one element. + (unless (listp types) (setq types (list types))) + ;; Recursion depth is determined by TYPE-CATEGORY, to avoid + ;; unnecessary steps. + (let* ((type-category + (cond + ((loop for type in types + always (memq type org-element-greater-elements)) + 'greater-elements) + ((loop for type in types + always (memq type org-element-all-elements)) + 'elements) + (t 'objects))) + walk-tree ; For byte-compiler + acc ; Accumulate results into ACC. + (accumulate-maybe + (function + ;; Check if TYPE is matching among TYPES. If so, apply FUN + ;; to BLOB and accumulate return value into ACC. INFO is + ;; the communication channel. + (lambda (type types fun blob info) + (when (memq type types) + (let ((result (funcall fun blob info))) + (cond + ((not result)) + (first-match (throw 'first-match result)) + (t (push result acc)))))))) + (walk-tree + (function + ;; Recursively walk DATA. INFO, if non-nil, is a plist + ;; holding contextual information. + (lambda (data info) + (mapc + (lambda (blob) + (let ((type (if (stringp blob) 'plain-text (car blob)))) + ;; Determine if a recursion into BLOB is possible + ;; and allowed. + (cond + ;; Element or object not exportable. + ((and info (org-export-skip-p blob info))) + ;; Archived headline: skip it. + ((and info + (eq type 'headline) + (and (eq (plist-get info :with-archived-trees) + 'headline) + (org-element-get-property :archivedp blob))) + (funcall accumulate-maybe type types fun blob info)) + ;; At an include keyword: apply mapping to its + ;; contents. + ((and info + (eq type 'keyword) + (string= + (downcase (org-element-get-property :key blob)) + "include")) + (funcall accumulate-maybe type types fun blob info) + (let* ((data (org-export-parse-included-file blob info)) + (value (org-element-get-property :value blob)) + (file (and (string-match "^\"\\(\\S-+\\)\"" value) + (match-string 1 value)))) + (funcall + walk-tree + data + (org-combine-plists + info + ;; Store full path of already included files + ;; to avoid recursive file inclusion. + `(:included-files + ,(cons (expand-file-name file) + (plist-get info :included-files)) + ;; Ensure that a top-level headline in the + ;; included file becomes a direct child of + ;; the current headline in the buffer. + :headline-offset + ,(- (+ (plist-get + (plist-get info :inherited-properties) :level) + (or (plist-get info :headline-offset) 0)) + (1- (org-export-get-min-level data info)))))))) + ;; Limiting recursion to greater elements, and BLOB + ;; isn't one. + ((and (eq type-category 'greater-elements) + (not (memq type org-element-greater-elements))) + (funcall accumulate-maybe type types fun blob info)) + ;; Limiting recursion to elements, and BLOB only + ;; contains objects. + ((and (eq type-category 'elements) (eq type 'paragraph))) + ;; No limitation on recursion, but BLOB hasn't got + ;; a recursive type. + ((and (eq type-category 'objects) + (not (or (eq type 'paragraph) + (memq type org-element-greater-elements) + (memq type org-element-recursive-objects)))) + (funcall accumulate-maybe type types fun blob info)) + ;; Recursion is possible and allowed: Update local + ;; informations and move into BLOB. + (t (funcall accumulate-maybe type types fun blob info) + (funcall + walk-tree + blob + (and options (org-export-update-info blob info t))))))) + (org-element-get-contents data)))))) + (catch 'first-match + (funcall walk-tree data options) + ;; Return value in a proper order. + (reverse acc)))) + +;; The following functions are internal parts of the parser. The +;; first one, `org-element-parse-elements' acts at the element's +;; level. The second one, `org-element-parse-objects' applies on all +;; objects of a paragraph or a secondary string. It uses +;; `org-element-get-candidates' to optimize the search of the next +;; object in the buffer. +;; +;; More precisely, that function looks for every allowed object type +;; first. Then, it discards failed searches, keeps further matches, +;; and searches again types matched behind point, for subsequent +;; calls. Thus, searching for a given type fails only once, and every +;; object is searched only once at top level (but sometimes more for +;; nested types). +(defun org-element-parse-elements (beg end item structure granularity visible-only acc) + "Parse ELEMENT with point at its beginning. + +If ITEM is non-nil, parse item wise instead of plain-list wise, +using STRUCTURE as the current list structure. + +GRANULARITY determines the depth of the recursion. It can be set +to the following symbols: + +`headline' Only parse headlines. +`greater-element' Don't recurse into greater elements. Thus, + elements parsed are the top-level ones. +`element' Parse everything but objects and plain text. +`object' or nil Parse the complete buffer. + +When VISIBLE-ONLY is non-nil, don't parse contents of hidden +greater elements. + +Elements are accumulated into ACC." + (save-excursion + (goto-char beg) + ;; Shortcut when parsing only headlines. + (when (and (eq granularity 'headline) (not (org-at-heading-p))) + (org-with-limited-levels (outline-next-heading))) + ;; Main loop start. + (while (and (< (point) end) (not (eobp))) + (push + ;; 1. If ITEM is toggled, point is at an item. Knowing that, + ;; there's no need to go through `org-element-at-point'. + (if item + (let* ((element (org-element-item-parser structure)) + (cbeg (org-element-get-property :contents-begin element)) + (cend (org-element-get-property :contents-end element))) + (goto-char (org-element-get-property :end element)) + ;; Narrow region to contents, so that item bullet don't + ;; interfere with paragraph parsing. + (save-restriction + (narrow-to-region cbeg cend) + (org-element-parse-elements + cbeg cend nil structure granularity visible-only + (reverse element)))) + ;; 2. When ITEM is nil, find current element's type and parse + ;; it accordingly to its category. + (let ((element (org-element-at-point nil structure))) + (goto-char (org-element-get-property :end element)) + (cond + ;; Case 1: ELEMENT is a footnote-definition. If + ;; GRANURALITY allows parsing, use narrowing so that + ;; footnote label don't interfere with paragraph + ;; recognition. + ((and (eq (car element) 'footnote-definition) + (not (memq granularity '(headline greater-element)))) + (let ((cbeg (org-element-get-property :contents-begin element)) + (cend (org-element-get-property :contents-end element))) + (save-restriction + (narrow-to-region cbeg cend) + (org-element-parse-elements + cbeg cend nil structure granularity visible-only + (reverse element))))) + ;; Case 1: ELEMENT is a paragraph. Parse objects inside, + ;; if GRANULARITY allows it. + ((and (eq (car element) 'paragraph) + (or (not granularity) (eq granularity 'object))) + (org-element-parse-objects + (org-element-get-property :contents-begin element) + (org-element-get-property :contents-end element) + (reverse element) + nil)) + ;; Case 2: ELEMENT is recursive: parse it between + ;; `contents-begin' and `contents-end'. If it's + ;; a plain list, also switch to item mode. Make + ;; sure GRANULARITY allows the recursion, or + ;; ELEMENT is an headline, in which case going + ;; inside is mandatory, in order to get sub-level + ;; headings. If VISIBLE-ONLY is true and element + ;; is hidden, do not recurse into it. + ((and (memq (car element) org-element-greater-elements) + (or (not granularity) + (memq granularity '(element object)) + (eq (car element) 'headline)) + (not (and visible-only + (org-element-get-property :hiddenp element)))) + (org-element-parse-elements + (org-element-get-property :contents-begin element) + (org-element-get-property :contents-end element) + (eq (car element) 'plain-list) + (org-element-get-property :structure element) + granularity + visible-only + (reverse element))) + ;; Case 3: Else, just accumulate ELEMENT, unless + ;; GRANULARITY is set to `headline'. + ((not (eq granularity 'headline)) element)))) + acc) + (org-skip-whitespace)) + ;; Return result. + (nreverse acc))) + +(defun org-element-parse-objects (beg end acc restriction) + "Parse objects between BEG and END and return recursive structure. + +Objects are accumulated in ACC. + +RESTRICTION, when non-nil, is a list of object types which are +allowed in the current object." + (let ((get-next-object + (function + (lambda (cand) + ;; Return the parsing function associated to the nearest + ;; object among list of candidates CAND. + (let ((pos (apply #'min (mapcar #'cdr cand)))) + (save-excursion + (goto-char pos) + (funcall + (intern + (format "org-element-%s-parser" (car (rassq pos cand)))))))))) + next-object candidates) + (save-excursion + (goto-char beg) + (while (setq candidates (org-element-get-next-object-candidates + end restriction candidates)) + (setq next-object (funcall get-next-object candidates)) + ;; 1. Text before any object. + (let ((obj-beg (org-element-get-property :begin next-object))) + (unless (= beg obj-beg) + (push (buffer-substring-no-properties (point) obj-beg) acc))) + ;; 2. Object... + (let ((obj-end (org-element-get-property :end next-object)) + (cont-beg (org-element-get-property :contents-begin next-object))) + (push (if (and (memq (car next-object) org-element-recursive-objects) + cont-beg) + ;; ... recursive. The CONT-BEG check is for + ;; links, as some of them might not be recursive + ;; (i.e. plain links). + (save-restriction + (narrow-to-region + cont-beg + (org-element-get-property :contents-end next-object)) + (org-element-parse-objects + (point-min) (point-max) (reverse next-object) + ;; Restrict allowed objects. This is the + ;; intersection of current restriction and next + ;; object's restriction. + (let ((new-restr + (cdr (assq (car next-object) + org-element-object-restrictions)))) + (if (not restriction) + new-restr + (delq nil + (mapcar (lambda (e) + (and (memq e restriction) e)) + new-restr)))))) + ;; ... not recursive. + next-object) + acc) + (goto-char obj-end))) + ;; 3. Text after last object. + (unless (= (point) end) + (push (buffer-substring-no-properties (point) end) acc)) + ;; Result. + (nreverse acc)))) + +(defun org-element-get-next-object-candidates (limit restriction objects) + "Return an alist of candidates for the next object. + +LIMIT bounds the search, and RESTRICTION, when non-nil, bounds +the possible object types. + +Return value is an alist whose car is position and cdr the object +type, as a string. There is an association for the closest +object of each type within RESTRICTION when non-nil, or for every +type otherwise. + +OBJECTS is the previous candidates alist." + (let ((restriction (or restriction org-element-all-successors)) + next-candidates types-to-search) + ;; If no previous result, search every object type in RESTRICTION. + ;; Otherwise, keep potential candidates (old objects located after + ;; point) and ask to search again those which had matched before. + (if objects + (mapc (lambda (obj) + (if (< (cdr obj) (point)) + (push (car obj) types-to-search) + (push obj next-candidates))) + objects) + (setq types-to-search restriction)) + ;; Call the appropriate "get-next" function for each type to + ;; search and accumulate matches. + (mapc + (lambda (type) + (let* ((successor-fun + (intern + (format "org-element-%s-successor" + (or (cdr (assq type org-element-object-successor-alist)) + type)))) + (obj (funcall successor-fun limit))) + (and obj (push obj next-candidates)))) + types-to-search) + ;; Return alist. + next-candidates)) + + + +;;; Towards A Bijective Process + +;; The parse tree obtained with `org-element-parse-buffer' is really +;; a snapshot of the corresponding Org buffer. Therefore, it can be +;; interpreted and expanded into a string with canonical Org +;; syntax. Hence `org-element-interpret-data'. +;; +;; Data parsed from secondary strings, whose shape is slightly +;; different than the standard parse tree, is expanded with the +;; equivalent function `org-element-interpret-secondary'. +;; +;; Both functions rely internally on +;; `org-element-interpret--affiliated-keywords'. +(defun org-element-interpret-data (data &optional genealogy previous) + "Interpret a parse tree representing Org data. + +DATA is the parse tree to interpret. + +Optional arguments GENEALOGY and PREVIOUS are used for recursive +calls: +GENEALOGY is the list of its parents types. +PREVIOUS is the type of the element or object at the same level +interpreted before. + +Return Org syntax as a string." + (mapconcat + (lambda (blob) + ;; BLOB can be an element, an object, a string, or nil. + (cond + ((not blob) nil) + ((equal blob "") nil) + ((stringp blob) blob) + (t + (let* ((type (car blob)) + (interpreter + (if (eq type 'org-data) + 'identity + (intern (format "org-element-%s-interpreter" type)))) + (contents + (cond + ;; Full Org document. + ((eq type 'org-data) + (org-element-interpret-data blob genealogy previous)) + ;; Recursive objects. + ((memq type org-element-recursive-objects) + (org-element-interpret-data + blob (cons type genealogy) nil)) + ;; Recursive elements. + ((memq type org-element-greater-elements) + (org-element-normalize-string + (org-element-interpret-data + blob (cons type genealogy) nil))) + ;; Paragraphs. + ((eq type 'paragraph) + (let ((paragraph + (org-element-normalize-contents + blob + ;; When normalizing contents of an item, + ;; ignore first line's indentation. + (and (not previous) + (memq (car genealogy) + '(footnote-definiton item)))))) + (org-element-interpret-data + paragraph (cons type genealogy) nil))))) + (results (funcall interpreter blob contents))) + ;; Update PREVIOUS. + (setq previous type) + ;; Build white spaces. + (cond + ((eq type 'org-data) results) + ((memq type org-element-all-elements) + (concat + (org-element-interpret--affiliated-keywords blob) + (org-element-normalize-string results) + (make-string (org-element-get-property :post-blank blob) 10))) + (t (concat + results + (make-string + (org-element-get-property :post-blank blob) 32)))))))) + (org-element-get-contents data) "")) + +(defun org-element-interpret-secondary (secondary) + "Interpret SECONDARY string as Org syntax. + +SECONDARY-STRING is a nested list as returned by +`org-element-parse-secondary-string'. + +Return interpreted string." + ;; Make SECONDARY acceptable for `org-element-interpret-data'. + (let ((s (if (listp secondary) secondary (list secondary)))) + (org-element-interpret-data `(org-data nil ,@s) nil nil))) + +;; Both functions internally use `org-element--affiliated-keywords'. + +(defun org-element-interpret--affiliated-keywords (element) + "Return ELEMENT's affiliated keywords as Org syntax. +If there is no affiliated keyword, return the empty string." + (let ((keyword-to-org + (function + (lambda (key value) + (let (dual) + (when (member key org-element-dual-keywords) + (setq dual (cdr value) value (car value))) + (concat "#+" key (and dual (format "[%s]" dual)) ": " + (if (member key org-element-parsed-keywords) + (org-element-interpret-secondary value) + value) + "\n")))))) + (mapconcat + (lambda (key) + (let ((value (org-element-get-property (intern (concat ":" key)) element))) + (when value + (if (member key org-element-multiple-keywords) + (mapconcat (lambda (line) + (funcall keyword-to-org key line)) + value "") + (funcall keyword-to-org key value))))) + ;; Remove translated keywords. + (delq nil + (mapcar + (lambda (key) + (and (not (assoc key org-element-keyword-translation-alist)) key)) + org-element-affiliated-keywords)) + ""))) + +;; Because interpretation of the parse tree must return the same +;; number of blank lines between elements and the same number of white +;; space after objects, some special care must be given to white +;; spaces. +;; +;; The first function, `org-element-normalize-string', ensures any +;; string different from the empty string will end with a single +;; newline character. +;; +;; The second function, `org-element-normalize-contents', removes +;; global indentation from the contents of the current element. +(defun org-element-normalize-string (s) + "Ensure string S ends with a single newline character. + +If S isn't a string return it unchanged. If S is the empty +string, return it. Otherwise, return a new string with a single +newline character at its end." + (cond + ((not (stringp s)) s) + ((string= "" s) "") + (t (and (string-match "\\(\n[ \t]*\\)*\\'" s) + (replace-match "\n" nil nil s))))) + +(defun org-element-normalize-contents (element &optional ignore-first) + "Normalize plain text in ELEMENT's contents. + +ELEMENT must only contain plain text and objects. + +The following changes are applied to plain text: + - Remove global indentation, preserving relative one. + - Untabify it. + +If optional argument IGNORE-FIRST is non-nil, ignore first line's +indentation to compute maximal common indentation. + +Return the normalized element." + (nconc + (list (car element) (nth 1 element)) + (let ((contents (org-element-get-contents element))) + (cond + ((and (not ignore-first) (not (stringp (car contents)))) contents) + (t + (catch 'exit + ;; 1. Remove tabs from each string in CONTENTS. Get maximal + ;; common indentation (MCI) along the way. + (let* ((ind-list (unless ignore-first + (list (org-get-string-indentation (car contents))))) + (contents + (mapcar (lambda (object) + (if (not (stringp object)) + object + (let ((start 0) + (object (org-remove-tabs object))) + (while (string-match "\n\\( *\\)" object start) + (setq start (match-end 0)) + (push (length (match-string 1 object)) + ind-list)) + object))) + contents)) + (mci (if ind-list + (apply 'min ind-list) + (throw 'exit contents)))) + ;; 2. Remove that indentation from CONTENTS. First string + ;; must be treated differently because it's the only one + ;; whose indentation doesn't happen after a newline + ;; character. + (let ((first-obj (car contents))) + (unless (or (not (stringp first-obj)) ignore-first) + (setq contents + (cons (replace-regexp-in-string + (format "\\` \\{%d\\}" mci) "" first-obj) + (cdr contents))))) + (mapcar (lambda (object) + (if (not (stringp object)) + object + (replace-regexp-in-string + (format "\n \\{%d\\}" mci) "\n" object))) + contents)))))))) + + + +;;; The Toolbox + +;; Once the structure of an Org file is well understood, it's easy to +;; implement some replacements for `forward-paragraph' +;; `backward-paragraph', namely `org-element-forward' and +;; `org-element-backward'. + +;; Also, `org-transpose-elements' mimics the behaviour of +;; `transpose-words', at the element's level, whereas +;; `org-element-drag-forward', `org-element-drag-backward', and +;; `org-element-up' generalize, respectively, functions +;; `org-subtree-down', `org-subtree-up' and `outline-up-heading'. + +;; `org-element-unindent-buffer' will, as its name almost suggests, +;; smartly remove global indentation from buffer, making it possible +;; to use Org indent mode on a file created with hard indentation. + +;; `org-element-nested-p' and `org-element-swap-A-B' are used +;; internally by some of the previously cited tools. +(defsubst org-element-nested-p (elem-A elem-B) + "Non-nil when elements ELEM-A and ELEM-B are nested." + (let ((beg-A (org-element-get-property :begin elem-A)) + (beg-B (org-element-get-property :begin elem-B)) + (end-A (org-element-get-property :end elem-A)) + (end-B (org-element-get-property :end elem-B))) + (or (and (>= beg-A beg-B) (<= end-A end-B)) + (and (>= beg-B beg-A) (<= end-B end-A))))) + +(defun org-element-swap-A-B (elem-A elem-B) + "Swap elements ELEM-A and ELEM-B. + +Leave point at the end of ELEM-A. + +Assume ELEM-A is before ELEM-B and that they are not nested." + (goto-char (org-element-get-property :begin elem-A)) + (let* ((beg-B (org-element-get-property :begin elem-B)) + (end-B-no-blank (save-excursion + (goto-char (org-element-get-property :end elem-B)) + (skip-chars-backward " \r\t\n") + (forward-line) + (point))) + (beg-A (org-element-get-property :begin elem-A)) + (end-A-no-blank (save-excursion + (goto-char (org-element-get-property :end elem-A)) + (skip-chars-backward " \r\t\n") + (forward-line) + (point))) + (body-A (buffer-substring beg-A end-A-no-blank)) + (body-B (buffer-substring beg-B end-B-no-blank)) + (between-A-B (buffer-substring end-A-no-blank beg-B))) + (delete-region beg-A end-B-no-blank) + (insert body-B between-A-B body-A) + (goto-char (org-element-get-property :end elem-B)))) + +(defun org-element-backward () + "Move backward by one element." + (interactive) + (let* ((opoint (point)) + (element (org-element-at-point)) + (start-el-beg (org-element-get-property :begin element))) + ;; At an headline. The previous element is the previous sibling, + ;; or the parent if any. + (cond + ;; Already at the beginning of the current element: move to the + ;; beginning of the previous one. + ((= opoint start-el-beg) + (forward-line -1) + (skip-chars-backward " \r\t\n") + (let* ((prev-element (org-element-at-point)) + (itemp (org-in-item-p)) + (struct (and itemp + (save-excursion (goto-char itemp) + (org-list-struct))))) + ;; When moving into a new list, go directly at the + ;; beginning of the top list structure. + (if (and itemp (<= (org-list-get-bottom-point struct) opoint)) + (progn + (goto-char (org-list-get-top-point struct)) + (goto-char (org-element-get-property + :begin (org-element-at-point)))) + (goto-char (org-element-get-property :begin prev-element)))) + (while (org-truely-invisible-p) (org-element-up))) + ;; Else, move at the element beginning. One exception: if point + ;; was in the blank lines after the end of a list, move directly + ;; to the top item. + (t + (let (struct itemp) + (if (and (setq itemp (org-in-item-p)) + (<= (org-list-get-bottom-point + (save-excursion (goto-char itemp) + (setq struct (org-list-struct)))) + opoint)) + (progn (goto-char (org-list-get-top-point struct)) + (goto-char (org-element-get-property + :begin (org-element-at-point)))) + (goto-char start-el-beg))))))) + +(defun org-element-drag-backward () + "Drag backward element at point." + (interactive) + (let* ((pos (point)) + (elem (org-element-at-point))) + (when (= (progn (goto-char (point-min)) + (org-skip-whitespace) + (point-at-bol)) + (org-element-get-property :end elem)) + (error "Cannot drag element backward")) + (goto-char (org-element-get-property :begin elem)) + (org-element-backward) + (let ((prev-elem (org-element-at-point))) + (when (or (org-element-nested-p elem prev-elem) + (and (eq (car elem) 'headline) + (not (eq (car prev-elem) 'headline)))) + (goto-char pos) + (error "Cannot drag element backward")) + ;; Compute new position of point: it's shifted by PREV-ELEM + ;; body's length. + (let ((size-prev (- (org-element-get-property :end prev-elem) + (org-element-get-property :begin prev-elem)))) + (org-element-swap-A-B prev-elem elem) + (goto-char (- pos size-prev)))))) + +(defun org-element-drag-forward () + "Move forward element at point." + (interactive) + (let* ((pos (point)) + (elem (org-element-at-point))) + (when (= (point-max) (org-element-get-property :end elem)) + (error "Cannot drag element forward")) + (goto-char (org-element-get-property :end elem)) + (let ((next-elem (org-element-at-point))) + (when (or (org-element-nested-p elem next-elem) + (and (eq (car next-elem) 'headline) + (not (eq (car elem) 'headline)))) + (goto-char pos) + (error "Cannot drag element forward")) + ;; Compute new position of point: it's shifted by NEXT-ELEM + ;; body's length (without final blanks) and by the length of + ;; blanks between ELEM and NEXT-ELEM. + (let ((size-next (- (save-excursion + (goto-char (org-element-get-property :end next-elem)) + (skip-chars-backward " \r\t\n") + (forward-line) + (point)) + (org-element-get-property :begin next-elem))) + (size-blank (- (org-element-get-property :end elem) + (save-excursion + (goto-char (org-element-get-property :end elem)) + (skip-chars-backward " \r\t\n") + (forward-line) + (point))))) + (org-element-swap-A-B elem next-elem) + (goto-char (+ pos size-next size-blank)))))) + +(defun org-element-forward () + "Move forward by one element." + (interactive) + (beginning-of-line) + (cond ((eobp) (error "Cannot move further down")) + ((looking-at "[ \t]*$") + (org-skip-whitespace) + (goto-char (if (eobp) (point) (point-at-bol)))) + (t + (let ((element (org-element-at-point t)) + (origin (point))) + (cond + ;; At an item: Either move to the next element inside, or + ;; to its end if it's hidden. + ((eq (car element) 'item) + (if (org-element-get-property :hiddenp element) + (goto-char (org-element-get-property :end element)) + (end-of-line) + (re-search-forward org-element-paragraph-separate nil t) + (org-skip-whitespace) + (beginning-of-line))) + ;; At a recursive element: Either move inside, or if it's + ;; hidden, move to its end. + ((memq (car element) org-element-greater-elements) + (let ((cbeg (org-element-get-property :contents-begin element))) + (goto-char + (if (or (org-element-get-property :hiddenp element) + (> origin cbeg)) + (org-element-get-property :end element) + cbeg)))) + ;; Else: move to the current element's end. + (t (goto-char (org-element-get-property :end element)))))))) + +(defun org-element-mark-element () + "Put point at beginning of this element, mark at end. + +Interactively, if this command is repeated or (in Transient Mark +mode) if the mark is active, it marks the next element after the +ones already marked." + (interactive) + (let (deactivate-mark) + (if (or (and (eq last-command this-command) (mark t)) + (and transient-mark-mode mark-active)) + (set-mark + (save-excursion + (goto-char (mark)) + (goto-char (org-element-get-property :end (org-element-at-point))))) + (let ((element (org-element-at-point))) + (end-of-line) + (push-mark (org-element-get-property :end element) t t) + (goto-char (org-element-get-property :begin element)))))) + +(defun org-narrow-to-element () + "Narrow buffer to current element." + (interactive) + (let ((elem (org-element-at-point))) + (cond + ((eq (car elem) 'headline) + (narrow-to-region + (org-element-get-property :begin elem) + (org-element-get-property :end elem))) + ((memq (car elem) org-element-greater-elements) + (narrow-to-region + (org-element-get-property :contents-begin elem) + (org-element-get-property :contents-end elem))) + (t + (narrow-to-region + (org-element-get-property :begin elem) + (org-element-get-property :end elem)))))) + +(defun org-transpose-elements () + "Transpose current and previous elements, keeping blank lines between. +Point is moved after both elements." + (interactive) + (org-skip-whitespace) + (let ((pos (point)) + (cur (org-element-at-point))) + (when (= (save-excursion (goto-char (point-min)) + (org-skip-whitespace) + (point-at-bol)) + (org-element-get-property :begin cur)) + (error "No previous element")) + (goto-char (org-element-get-property :begin cur)) + (forward-line -1) + (let ((prev (org-element-at-point))) + (when (org-element-nested-p cur prev) + (goto-char pos) + (error "Cannot transpose nested elements")) + (org-element-swap-A-B prev cur)))) + +(defun org-element-unindent-buffer () + "Un-indent the visible part of the buffer. +Relative indentation \(between items, inside blocks, etc.\) isn't +modified." + (interactive) + (unless (eq major-mode 'org-mode) + (error "Cannot un-indent a buffer not in Org mode")) + (let* ((parse-tree (org-element-parse-buffer 'greater-element)) + unindent-tree ; For byte-compiler. + (unindent-tree + (function + (lambda (contents) + (mapc (lambda (element) + (if (eq (car element) 'headline) + (funcall unindent-tree + (org-element-get-contents element)) + (save-excursion + (save-restriction + (narrow-to-region + (org-element-get-property :begin element) + (org-element-get-property :end element)) + (org-do-remove-indentation))))) + (reverse contents)))))) + (funcall unindent-tree (org-element-get-contents parse-tree)))) + +(defun org-element-up () + "Move to upper element. +Return position at the beginning of the upper element." + (interactive) + (let ((opoint (point)) elem) + (cond + ((bobp) (error "No surrounding element")) + ((org-with-limited-levels (org-at-heading-p)) + (or (org-up-heading-safe) (error "No surronding element"))) + ((and (org-at-item-p) + (setq elem (org-element-at-point)) + (let* ((top-list-p (zerop (org-element-get-property :level elem)))) + (unless top-list-p + ;; If parent is bound to be in the same list as the + ;; original point, move to that parent. + (let ((struct (org-element-get-property :structure elem))) + (goto-char + (org-list-get-parent + (point-at-bol) struct (org-list-parents-alist struct)))))))) + (t + (let* ((elem (or elem (org-element-at-point))) + (end (save-excursion + (goto-char (org-element-get-property :end elem)) + (skip-chars-backward " \r\t\n") + (forward-line) + (point))) + prev-elem) + (goto-char (org-element-get-property :begin elem)) + (forward-line -1) + (while (and (< (org-element-get-property + :end (setq prev-elem (org-element-at-point))) + end) + (not (bobp))) + (goto-char (org-element-get-property :begin prev-elem)) + (forward-line -1)) + (if (and (bobp) (< (org-element-get-property :end prev-elem) end)) + (progn (goto-char opoint) + (error "No surrounding element")) + (goto-char (org-element-get-property :begin prev-elem)))))))) + + +(provide 'org-element) +;;; org-element.el ends here diff -Nru org-mode-7.7/contrib/lisp/org-elisp-symbol.el org-mode-7.8.02/contrib/lisp/org-elisp-symbol.el --- org-mode-7.7/contrib/lisp/org-elisp-symbol.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/contrib/lisp/org-elisp-symbol.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,12 +1,14 @@ ;;; org-elisp-symbol.el --- Org links to emacs-lisp symbols ;; -;; Copyright 2007, 2008, 2009 Bastien Guerry +;; Copyright 2007-2011 Free Software Foundation, Inc. ;; -;; Author: bzg AT altern DOT org +;; Author: bzg AT gnu DOT org ;; Version: 0.2 ;; Keywords: org, remember, lisp ;; URL: http://www.cognition.ens.fr/~guerry/u/org-elisp-symbol.el ;; +;; This file is not part of GNU Emacs. +;; ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 3, or (at your option) @@ -102,8 +104,9 @@ (stype (cond ((commandp sym-name) "Command") ((functionp sym-name) "Function") ((user-variable-p sym-name) "User variable") - ((eq def "defvar") "Variable") - ((eq def "defmacro") "Macro") + ((string= def "defvar") "Variable") + ((string= def "defmacro") "Macro") + ((string= def "defun") "Function or command") (t "Symbol"))) (args (if (match-string 3) (mapconcat (lambda (a) (unless (string-match "^&" a) a)) @@ -155,5 +158,4 @@ ;;;; User Options, Variables ;;;;########################################################################## - ;;; org-elisp-symbol.el ends here diff -Nru org-mode-7.7/contrib/lisp/org-eval.el org-mode-7.8.02/contrib/lisp/org-eval.el --- org-mode-7.7/contrib/lisp/org-eval.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/contrib/lisp/org-eval.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,5 +1,5 @@ ;;; org-eval.el --- Display result of evaluating code in various languages -;; Copyright (C) 2008 Free Software Foundation, Inc. +;; Copyright (C) 2008-2011 Free Software Foundation, Inc. ;; ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp diff -Nru org-mode-7.7/contrib/lisp/org-eval-light.el org-mode-7.8.02/contrib/lisp/org-eval-light.el --- org-mode-7.7/contrib/lisp/org-eval-light.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/contrib/lisp/org-eval-light.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,6 +1,6 @@ ;;; org-eval-light.el --- Display result of evaluating code in various languages (light) -;; Copyright (C) 2008 Free Software Foundation, Inc. +;; Copyright (C) 2008-2011 Free Software Foundation, Inc. ;; Author: Carsten Dominik , ;; Eric Schulte @@ -197,4 +197,5 @@ ad-do-it)) (provide 'org-eval-light) -;;; org-eval-light.el ends here \ No newline at end of file + +;;; org-eval-light.el ends here diff -Nru org-mode-7.7/contrib/lisp/org-exp-bibtex.el org-mode-7.8.02/contrib/lisp/org-exp-bibtex.el --- org-mode-7.7/contrib/lisp/org-exp-bibtex.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/contrib/lisp/org-exp-bibtex.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,6 +1,6 @@ ;;; org-exp-bibtex.el --- Export bibtex fragments -;; Copyright (C) 2009 Taru Karttunen +;; Copyright (C) 2009-2011 Taru Karttunen ;; Author: Taru Karttunen @@ -102,7 +102,7 @@ (save-match-data (insert-file-contents (concat file ".html")) (goto-char (point-min)) - (while (re-search-forward "a name=\"\\(\\w+\\)\">\\(\\w+\\)" nil t) + (while (re-search-forward (org-re "a name=\"\\([-_[:word:]]+\\)\">\\([[:word:]]+\\)") nil t) (setq oebp-cite-plist (cons (cons (match-string 1) (match-string 2)) oebp-cite-plist))) (goto-char (point-min)) (while (re-search-forward "
" nil t) diff -Nru org-mode-7.7/contrib/lisp/org-expiry.el org-mode-7.8.02/contrib/lisp/org-expiry.el --- org-mode-7.7/contrib/lisp/org-expiry.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/contrib/lisp/org-expiry.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,12 +1,13 @@ ;;; org-expiry.el --- expiry mechanism for Org entries ;; -;; Copyright 2007 2008 Bastien Guerry +;; Copyright 2007-2011 Free Software Foundation, Inc. ;; -;; Author: bzg AT altern DOT org +;; Author: bzg AT gnu DOT org ;; Version: 0.2 ;; Keywords: org expiry -;; URL: http://www.cognition.ens.fr/~guerry/u/org-expiry.el -;; + +;; This file is not part of GNU Emacs. + ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 3, or (at your option) @@ -184,7 +185,7 @@ (lambda() (add-hook 'before-save-hook 'org-expiry-process-entries t t))) ;; need this to refresh org-mode hooks - (when (org-mode-p) + (when (eq major-mode 'org-mode) (org-mode) (if (org-called-interactively-p) (message "Org-expiry insinuated, `org-mode' restarted."))))) @@ -205,7 +206,7 @@ 'org-expiry-process-entries t t))) (when arg ;; need this to refresh org-mode hooks - (when (org-mode-p) + (when (eq major-mode 'org-mode) (org-mode) (if (org-called-interactively-p) (message "Org-expiry de-insinuated, `org-mode' restarted."))))) diff -Nru org-mode-7.7/contrib/lisp/org-export.el org-mode-7.8.02/contrib/lisp/org-export.el --- org-mode-7.7/contrib/lisp/org-export.el 1970-01-01 00:00:00.000000000 +0000 +++ org-mode-7.8.02/contrib/lisp/org-export.el 2011-12-13 00:34:24.000000000 +0000 @@ -0,0 +1,2672 @@ +;;; org-export.el --- Generic Export Engine For Org + +;; Copyright (C) 2011 Free Software Foundation, Inc. + +;; Author: Nicolas Goaziou +;; Keywords: outlines, hypermedia, calendar, wp + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see . + +;;; Commentary: + +;; This library implements a generic export engine for Org, built on +;; its syntactical parser: Org Elements. + +;; Besides that parser, the generic exporter is made of three distinct +;; parts: + +;; - The communication channel consists in a property list, which is +;; created and updated during the process. Its use is to offer +;; every piece of information, would it be export options or +;; contextual data, all in a single place. The exhaustive list of +;; properties is given in "The Communication Channel" section of +;; this file. + +;; - The transcoder walks the parse tree, ignores or treat as plain +;; text elements and objects according to export options, and +;; eventually calls back-end specific functions to do the real +;; transcoding, concatenating their return value along the way. + +;; - The filter system is activated at the very beginning and the very +;; end of the export process, and each time an element or an object +;; has been converted. It is the entry point to fine-tune standard +;; output from back-end transcoders. + +;; The core function is `org-export-as'. It returns the transcoded +;; buffer as a string. + +;; In order to derive an exporter out of this generic implementation, +;; one can define a transcode function for each element or object. +;; Such function should return a string for the corresponding element, +;; without any trailing space, or nil. It must accept three +;; arguments: +;; 1. the element or object itself, +;; 2. its contents, or nil when it isn't recursive, +;; 3. the property list used as a communication channel. + +;; If no such function is found, that element or object type will +;; simply be ignored, along with any separating blank line. The same +;; will happen if the function returns the nil value. If that +;; function returns the empty string, the type will be ignored, but +;; the blank lines will be kept. + +;; Contents, when not nil, are stripped from any global indentation +;; (although the relative one is preserved). They also always end +;; with a single newline character. + +;; These functions must follow a strict naming convention: +;; `org-BACKEND-TYPE' where, obviously, BACKEND is the name of the +;; export back-end and TYPE the type of the element or object handled. + +;; Moreover, two additional functions can be defined. On the one +;; hand, `org-BACKEND-template' returns the final transcoded string, +;; and can be used to add a preamble and a postamble to document's +;; body. It must accept two arguments: the transcoded string and the +;; property list containing export options. On the other hand, +;; `org-BACKEND-plain-text', when defined, is to be called on every +;; text not recognized as an element or an object. It must accept two +;; arguments: the text string and the information channel. + +;; Any back-end can define its own variables. Among them, those +;; customizables should belong to the `org-export-BACKEND' group. +;; Also, a special variable, `org-BACKEND-option-alist', allows to +;; define buffer keywords and "#+options:" items specific to that +;; back-end. See `org-export-option-alist' for supported defaults and +;; syntax. + +;; Tools for common tasks across back-ends are implemented in the last +;; part of this file. + +;;; Code: +(eval-when-compile (require 'cl)) +(require 'org-element) + + +;;; Internal Variables + +;; Among internal variables, the most important is +;; `org-export-option-alist'. This variable define the global export +;; options, shared between every exporter, and how they are acquired. + +(defconst org-export-max-depth 19 + "Maximum nesting depth for headlines, counting from 0.") + +(defconst org-export-option-alist + '((:author "AUTHOR" nil user-full-name t) + (:creator "CREATOR" nil org-export-creator-string) + (:date "DATE" nil nil t) + (:description "DESCRIPTION" nil nil newline) + (:email "EMAIL" nil user-mail-address t) + (:exclude-tags "EXPORT_EXCLUDE_TAGS" nil org-export-exclude-tags split) + (:headline-levels nil "H" org-export-headline-levels) + (:keywords "KEYWORDS" nil nil space) + (:language "LANGUAGE" nil org-export-default-language t) + (:preserve-breaks nil "\\n" org-export-preserve-breaks) + (:section-numbers nil "num" org-export-with-section-numbers) + (:select-tags "EXPORT_SELECT_TAGS" nil org-export-select-tags split) + (:time-stamp-file nil "timestamp" org-export-time-stamp-file) + (:title "TITLE" nil nil space) + (:with-archived-trees nil "arch" org-export-with-archived-trees) + (:with-author nil "author" org-export-with-author) + (:with-creator nil "creator" org-export-with-creator) + (:with-drawers nil "drawer" org-export-with-drawers) + (:with-email nil "email" org-export-with-email) + (:with-emphasize nil "*" org-export-with-emphasize) + (:with-entities nil "e" org-export-with-entities) + (:with-fixed-width nil ":" org-export-with-fixed-width) + (:with-footnotes nil "f" org-export-with-footnotes) + (:with-priority nil "pri" org-export-with-priority) + (:with-special-strings nil "-" org-export-with-special-strings) + (:with-sub-superscript nil "^" org-export-with-sub-superscripts) + (:with-toc nil "toc" org-export-with-toc) + (:with-tables nil "|" org-export-with-tables) + (:with-tags nil "tags" org-export-with-tags) + (:with-tasks nil "tasks" org-export-with-tasks) + (:with-timestamps nil "<" org-export-with-timestamps) + (:with-todo-keywords nil "todo" org-export-with-todo-keywords)) + "Alist between export properties and ways to set them. + +The car of the alist is the property name, and the cdr is a list +like \(KEYWORD OPTION DEFAULT BEHAVIOUR\) where: + +KEYWORD is a string representing a buffer keyword, or nil. +OPTION is a string that could be found in an #+OPTIONS: line. +DEFAULT is the default value for the property. +BEHAVIOUR determine how Org should handle multiple keywords for +the same property. It is a symbol among: + nil Keep old value and discard the new one. + t Replace old value with the new one. + `space' Concatenate the values, separating them with a space. + `newline' Concatenate the values, separating them with + a newline. + `split' Split values at white spaces, and cons them to the + previous list. + +KEYWORD and OPTION have precedence over DEFAULT. + +All these properties should be back-end agnostic. For back-end +specific properties, define a similar variable named +`org-BACKEND-option-alist', replacing BACKEND with the name of +the appropriate back-end. You can also redefine properties +there, as they have precedence over these.") + +(defconst org-export-special-keywords + '("SETUP_FILE" "OPTIONS" "MACRO") + "List of in-buffer keywords that require special treatment. +These keywords are not directly associated to a property. The +way they are handled must be hard-coded into +`org-export-get-inbuffer-options' function.") + + + +;;; User-configurable Variables + +;; Configuration for the masses. + +;; They should never be evaled directly, as their value is to be +;; stored in a property list (cf. `org-export-option-alist'). + +(defgroup org-export nil + "Options for exporting Org mode files." + :tag "Org Export" + :group 'org) + +(defgroup org-export-general nil + "General options for export engine." + :tag "Org Export General" + :group 'org-export) + +(defcustom org-export-with-archived-trees 'headline + "Whether sub-trees with the ARCHIVE tag should be exported. + +This can have three different values: +nil Do not export, pretend this tree is not present. +t Do export the entire tree. +`headline' Only export the headline, but skip the tree below it. + +This option can also be set with the #+OPTIONS line, +e.g. \"arch:nil\"." + :group 'org-export-general + :type '(choice + (const :tag "Not at all" nil) + (const :tag "Headline only" 'headline) + (const :tag "Entirely" t))) + +(defcustom org-export-with-author t + "Non-nil means insert author name into the exported file. +This option can also be set with the #+OPTIONS line, +e.g. \"author:nil\"." + :group 'org-export-general + :type 'boolean) + +(defcustom org-export-with-creator 'comment + "Non-nil means the postamble should contain a creator sentence. + +The sentence can be set in `org-export-creator-string' and +defaults to \"Generated by Org mode XX in Emacs XXX.\". + +If the value is `comment' insert it as a comment." + :group 'org-export-general + :type '(choice + (const :tag "No creator sentence" nil) + (const :tag "Sentence as a comment" 'comment) + (const :tag "Insert the sentence" t))) + +(defcustom org-export-creator-string + (format "Generated by Org mode %s in Emacs %s." org-version emacs-version) + "String to insert at the end of the generated document." + :group 'org-export-general + :type '(string :tag "Creator string")) + +(defcustom org-export-with-drawers nil + "Non-nil means export with drawers like the property drawer. +When t, all drawers are exported. This may also be a list of +drawer names to export." + :group 'org-export-general + :type '(choice + (const :tag "All drawers" t) + (const :tag "None" nil) + (repeat :tag "Selected drawers" + (string :tag "Drawer name")))) + +(defcustom org-export-with-email nil + "Non-nil means insert author email into the exported file. +This option can also be set with the #+OPTIONS line, +e.g. \"email:t\"." + :group 'org-export-general + :type 'boolean) + +(defcustom org-export-with-emphasize t + "Non-nil means interpret *word*, /word/, and _word_ as emphasized text. + +If the export target supports emphasizing text, the word will be +typeset in bold, italic, or underlined, respectively. Not all +export backends support this. + +This option can also be set with the #+OPTIONS line, e.g. \"*:nil\"." + :group 'org-export-general + :type 'boolean) + +(defcustom org-export-exclude-tags '("noexport") + "Tags that exclude a tree from export. +All trees carrying any of these tags will be excluded from +export. This is without condition, so even subtrees inside that +carry one of the `org-export-select-tags' will be removed." + :group 'org-export-general + :type '(repeat (string :tag "Tag"))) + +(defcustom org-export-with-fixed-width t + "Non-nil means lines starting with \":\" will be in fixed width font. + +This can be used to have pre-formatted text, fragments of code +etc. For example: + : ;; Some Lisp examples + : (while (defc cnt) + : (ding)) +will be looking just like this in also HTML. See also the QUOTE +keyword. Not all export backends support this. + +This option can also be set with the #+OPTIONS line, e.g. \"::nil\"." + :group 'org-export-translation + :type 'boolean) + +(defcustom org-export-with-footnotes t + "Non-nil means Org footnotes should be exported. +This option can also be set with the #+OPTIONS line, +e.g. \"f:nil\"." + :group 'org-export-general + :type 'boolean) + +(defcustom org-export-headline-levels 3 + "The last level which is still exported as a headline. + +Inferior levels will produce itemize lists when exported. Note +that a numeric prefix argument to an exporter function overrides +this setting. + +This option can also be set with the #+OPTIONS line, e.g. \"H:2\"." + :group 'org-export-general + :type 'integer) + +(defcustom org-export-default-language "en" + "The default language for export and clocktable translations, as a string. +This may have an association in +`org-clock-clocktable-language-setup'." + :group 'org-export-general + :type '(string :tag "Language")) + +(defcustom org-export-preserve-breaks nil + "Non-nil means preserve all line breaks when exporting. + +Normally, in HTML output paragraphs will be reformatted. + +This option can also be set with the #+OPTIONS line, +e.g. \"\\n:t\"." + :group 'org-export-general + :type 'boolean) + +(defcustom org-export-with-entities t + "Non-nil means interpret entities when exporting. + +For example, HTML export converts \\alpha to α and \\AA to +Å. + +For a list of supported names, see the constant `org-entities' +and the user option `org-entities-user'. + +This option can also be set with the #+OPTIONS line, +e.g. \"e:nil\"." + :group 'org-export-general + :type 'boolean) + +(defcustom org-export-with-priority nil + "Non-nil means include priority cookies in export. +When nil, remove priority cookies for export." + :group 'org-export-general + :type 'boolean) + +(defcustom org-export-with-section-numbers t + "Non-nil means add section numbers to headlines when exporting. + +This option can also be set with the #+OPTIONS line, +e.g. \"num:t\"." + :group 'org-export-general + :type 'boolean) + +(defcustom org-export-select-tags '("export") + "Tags that select a tree for export. +If any such tag is found in a buffer, all trees that do not carry +one of these tags will be deleted before export. Inside trees +that are selected like this, you can still deselect a subtree by +tagging it with one of the `org-export-exclude-tags'." + :group 'org-export-general + :type '(repeat (string :tag "Tag"))) + +(defcustom org-export-with-special-strings t + "Non-nil means interpret \"\-\", \"--\" and \"---\" for export. + +When this option is turned on, these strings will be exported as: + + Org HTML LaTeX + -----+----------+-------- + \\- ­ \\- + -- – -- + --- — --- + ... … \ldots + +This option can also be set with the #+OPTIONS line, +e.g. \"-:nil\"." + :group 'org-export-general + :type 'boolean) + +(defcustom org-export-with-sub-superscripts t + "Non-nil means interpret \"_\" and \"^\" for export. + +When this option is turned on, you can use TeX-like syntax for +sub- and superscripts. Several characters after \"_\" or \"^\" +will be considered as a single item - so grouping with {} is +normally not needed. For example, the following things will be +parsed as single sub- or superscripts. + + 10^24 or 10^tau several digits will be considered 1 item. + 10^-12 or 10^-tau a leading sign with digits or a word + x^2-y^3 will be read as x^2 - y^3, because items are + terminated by almost any nonword/nondigit char. + x_{i^2} or x^(2-i) braces or parenthesis do grouping. + +Still, ambiguity is possible - so when in doubt use {} to enclose +the sub/superscript. If you set this variable to the symbol +`{}', the braces are *required* in order to trigger +interpretations as sub/superscript. This can be helpful in +documents that need \"_\" frequently in plain text. + +This option can also be set with the #+OPTIONS line, +e.g. \"^:nil\"." + :group 'org-export-general + :type '(choice + (const :tag "Interpret them" t) + (const :tag "Curly brackets only" {}) + (const :tag "Do not interpret them" nil))) + +(defcustom org-export-with-toc t + "Non-nil means create a table of contents in exported files. + +The TOC contains headlines with levels up +to`org-export-headline-levels'. When an integer, include levels +up to N in the toc, this may then be different from +`org-export-headline-levels', but it will not be allowed to be +larger than the number of headline levels. When nil, no table of +contents is made. + +This option can also be set with the #+OPTIONS line, +e.g. \"toc:nil\" or \"toc:3\"." + :group 'org-export-general + :type '(choice + (const :tag "No Table of Contents" nil) + (const :tag "Full Table of Contents" t) + (integer :tag "TOC to level"))) + +(defcustom org-export-with-tables t + "If non-nil, lines starting with \"|\" define a table. +For example: + + | Name | Address | Birthday | + |-------------+----------+-----------| + | Arthur Dent | England | 29.2.2100 | + +This option can also be set with the #+OPTIONS line, e.g. \"|:nil\"." + :group 'org-export-general + :type 'boolean) + +(defcustom org-export-with-tags t + "If nil, do not export tags, just remove them from headlines. + +If this is the symbol `not-in-toc', tags will be removed from +table of contents entries, but still be shown in the headlines of +the document. + +This option can also be set with the #+OPTIONS line, +e.g. \"tags:nil\"." + :group 'org-export-general + :type '(choice + (const :tag "Off" nil) + (const :tag "Not in TOC" not-in-toc) + (const :tag "On" t))) + +(defcustom org-export-with-tasks t + "Non-nil means include TODO items for export. +This may have the following values: +t include tasks independent of state. +todo include only tasks that are not yet done. +done include only tasks that are already done. +nil remove all tasks before export +list of keywords keep only tasks with these keywords" + :group 'org-export-general + :type '(choice + (const :tag "All tasks" t) + (const :tag "No tasks" nil) + (const :tag "Not-done tasks" todo) + (const :tag "Only done tasks" done) + (repeat :tag "Specific TODO keywords" + (string :tag "Keyword")))) + +(defcustom org-export-time-stamp-file t + "Non-nil means insert a time stamp into the exported file. +The time stamp shows when the file was created. + +This option can also be set with the #+OPTIONS line, +e.g. \"timestamp:nil\"." + :group 'org-export-general + :type 'boolean) + +(defcustom org-export-with-timestamps t + "If nil, do not export time stamps and associated keywords." + :group 'org-export-general + :type 'boolean) + +(defcustom org-export-with-todo-keywords t + "Non-nil means include TODO keywords in export. +When nil, remove all these keywords from the export.") + +(defcustom org-export-allow-BIND 'confirm + "Non-nil means allow #+BIND to define local variable values for export. +This is a potential security risk, which is why the user must +confirm the use of these lines." + :group 'org-export-general + :type '(choice + (const :tag "Never" nil) + (const :tag "Always" t) + (const :tag "Ask a confirmation for each file" confirm))) + +(defcustom org-export-snippet-translation-alist nil + "Alist between export snippets back-ends and exporter back-ends. + +This variable allows to provide shortcuts for export snippets. + +For example, with a value of '\(\(\"h\" . \"html\"\)\), the HTML +back-end will recognize the contents of \"@h{}\" as HTML code +while every other back-end will ignore it." + :group 'org-export-general + :type '(repeat + (cons + (string :tag "Shortcut") + (string :tag "Back-end")))) + + + +;;; The Communication Channel + +;; During export process, every function has access to a number of +;; properties. They are of three types: + +;; 1. Export options are collected once at the very beginning of the +;; process, out of the original buffer and environment. The task +;; is handled by `org-export-collect-options' function. +;; +;; All export options are defined through the +;; `org-export-option-alist' variable. +;; +;; 2. Persistent properties are stored in +;; `org-export-persistent-properties' and available at every level +;; of recursion. Their value is extracted directly from the parsed +;; tree, and depends on export options (whole trees may be filtered +;; out of the export process). +;; +;; Properties belonging to that type are defined in the +;; `org-export-persistent-properties-list' variable. +;; +;; 3. Every other property is considered local, and available at +;; a precise level of recursion and below. + +;; Managing properties during transcode process is mainly done with +;; `org-export-update-info'. Even though they come from different +;; sources, the function transparently concatenates them in a single +;; property list passed as an argument to each transcode function. +;; Thus, during export, all necessary information is available through +;; that single property list, and the element or object itself. +;; Though, modifying a property will still require some special care, +;; and should be done with `org-export-set-property' instead of plain +;; `plist-put'. + +;; Here is the full list of properties available during transcode +;; process, with their category (option, persistent or local), their +;; value type and the function updating them, when appropriate. + +;; + `author' :: Author's name. +;; - category :: option +;; - type :: string + +;; + `back-end' :: Current back-end used for transcoding. +;; - category :: persistent +;; - type :: symbol + +;; + `code-refs' :: Association list between reference name and real +;; labels in source code. It is used to properly +;; resolve links inside source blocks. +;; - category :: persistent +;; - type :: alist (INT-OR-STRING . STRING) +;; - update :: `org-export-handle-code' + +;; + `creator' :: String to write as creation information. +;; - category :: option +;; - type :: string + +;; + `date' :: String to use as date. +;; - category :: option +;; - type :: string + +;; + `description' :: Description text for the current data. +;; - category :: option +;; - type :: string + +;; + `email' :: Author's email. +;; - category :: option +;; - type :: string + +;; + `exclude-tags' :: Tags for exclusion of subtrees from export +;; process. +;; - category :: option +;; - type :: list of strings + +;; + `footnotes-labels-alist' :: Alist between footnote labels and +;; their definition, as parsed data. Once retrieved, the +;; definition should be exported with `org-export-data'. +;; - category :: option +;; - type :: alist (STRING . LIST) + +;; + `genealogy' :: List of current element's parents types. +;; - category :: local +;; - type :: list of symbols +;; - update :: `org-export-update-info' + +;; + `headline-alist' :: Alist between headlines raw name and their +;; boundaries. It is used to resolve "fuzzy" links +;; (cf. `org-export-resolve-fuzzy-link'). +;; - category :: persistent +;; - type :: alist (STRING INTEGER INTEGER) + +;; + `headline-levels' :: Maximum level being exported as an +;; headline. Comparison is done with the relative level of +;; headlines in the parse tree, not necessarily with their +;; actual level. +;; - category :: option +;; - type :: integer + +;; + `headline-offset' :: Difference between relative and real level +;; of headlines in the parse tree. For example, a value of -1 +;; means a level 2 headline should be considered as level +;; 1 (cf. `org-export-get-relative-level'). +;; - category :: persistent +;; - type :: integer + +;; + `headline-numbering' :: Alist between headlines' beginning +;; position and their numbering, as a list of numbers +;; (cf. `org-export-get-headline-number'). +;; - category :: persistent +;; - type :: alist (INTEGER . LIST) + +;; + `included-files' :: List of files, with full path, included in +;; the current buffer, through the "#+include:" keyword. It is +;; mainly used to verify that no infinite recursive inclusion +;; happens. +;; - category :: persistent +;; - type :: list of strings + +;; + `inherited-properties' :: Properties of the headline ancestors +;; of the current element or object. Those from the closest +;; headline have precedence over the others. +;; - category :: local +;; - type :: plist + +;; + `keywords' :: List of keywords attached to data. +;; - category :: option +;; - type :: string + +;; + `language' :: Default language used for translations. +;; - category :: option +;; - type :: string + +;; + `parent-properties' :: Properties of the parent element. +;; - category :: local +;; - type :: plist +;; - update :: `org-export-update-info' + +;; + `parse-tree' :: Whole parse tree, available at any time during +;; transcoding. +;; - category :: global +;; - type :: list (as returned by `org-element-parse-buffer') + +;; + `point-max' :: Last ending position in the parse tree. +;; - category :: global +;; - type :: integer + +;; + `preserve-breaks' :: Non-nil means transcoding should preserve +;; all line breaks. +;; - category :: option +;; - type :: symbol (nil, t) + +;; + `previous-element' :: Previous element's type at the same +;; level. +;; - category :: local +;; - type :: symbol +;; - update :: `org-export-update-info' + +;; + `previous-object' :: Previous object type (or `plain-text') at +;; the same level. +;; - category :: local +;; - type :: symbol +;; - update :: `org-export-update-info' + +;; + `previous-section-number' :: Numbering of the previous +;; headline. As it might not be practical for direct use, the +;; function `org-export-get-headline-level' is provided +;; to extract useful information out of it. +;; - category :: local +;; - type :: vector + +;; + `section-numbers' :: Non-nil means transcoding should add +;; section numbers to headlines. +;; - category :: option +;; - type :: symbol (nil, t) + +;; + `seen-footnote-labels' :: List of already transcoded footnote +;; labels. +;; - category :: persistent +;; - type :: list of strings +;; - update :: `org-export-update-info' + +;; + `select-tags' :: List of tags enforcing inclusion of sub-trees in +;; transcoding. When such a tag is present, +;; subtrees without it are de facto excluded from +;; the process. See `use-select-tags'. +;; - category :: option +;; - type :: list of strings + +;; + `target-list' :: List of targets raw names encoutered in the +;; parse tree. This is used to partly resolve +;; "fuzzy" links +;; (cf. `org-export-resolve-fuzzy-link'). +;; - category :: persistent +;; - type :: list of strings + +;; + `time-stamp-file' :: Non-nil means transcoding should insert +;; a time stamp in the output. +;; - category :: option +;; - type :: symbol (nil, t) + +;; + `total-loc' :: Contains total lines of code accumulated by source +;; blocks with the "+n" option so far. +;; - category :: option +;; - type :: integer +;; - update :: `org-export-handle-code' + +;; + `use-select-tags' :: When non-nil, a select tags has been found +;; in the parse tree. Thus, any headline without one will be +;; filtered out. See `select-tags'. +;; - category :: persistent +;; - type :: interger or nil + +;; + `with-archived-trees' :: Non-nil when archived subtrees should +;; also be transcoded. If it is set to the `headline' symbol, +;; only the archived headline's name is retained. +;; - category :: option +;; - type :: symbol (nil, t, `headline') + +;; + `with-author' :: Non-nil means author's name should be included +;; in the output. +;; - category :: option +;; - type :: symbol (nil, t) + +;; + `with-creator' :: Non-nild means a creation sentence should be +;; inserted at the end of the transcoded string. If the value +;; is `comment', it should be commented. +;; - category :: option +;; - type :: symbol (`comment', nil, t) + +;; + `with-drawers' :: Non-nil means drawers should be exported. If +;; its value is a list of names, only drawers with such names +;; will be transcoded. +;; - category :: option +;; - type :: symbol (nil, t) or list of strings + +;; + `with-email' :: Non-nil means output should contain author's +;; email. +;; - category :: option +;; - type :: symbol (nil, t) + +;; + `with-emphasize' :: Non-nil means emphasized text should be +;; interpreted. +;; - category :: option +;; - type :: symbol (nil, t) + +;; + `with-fixed-width' :: Non-nil if transcoder should interpret +;; strings starting with a colon as a fixed-with (verbatim) +;; area. +;; - category :: option +;; - type :: symbol (nil, t) + +;; + `with-footnotes' :: Non-nil if transcoder should interpret +;; footnotes. +;; - category :: option +;; - type :: symbol (nil, t) + +;; + `with-priority' :: Non-nil means transcoding should include +;; priority cookies. +;; - category :: option +;; - type :: symbol (nil, t) + +;; + `with-special-strings' :: Non-nil means transcoding should +;; interpret special strings in plain text. +;; - category :: option +;; - type :: symbol (nil, t) + +;; + `with-sub-superscript' :: Non-nil means transcoding should +;; interpret subscript and superscript. With a value of "{}", +;; only interpret those using curly brackets. +;; - category :: option +;; - type :: symbol (nil, {}, t) + +;; + `with-tables' :: Non-nil means transcoding should interpret +;; tables. +;; - category :: option +;; - type :: symbol (nil, t) + +;; + `with-tags' :: Non-nil means transcoding should keep tags in +;; headlines. A `not-in-toc' value will remove them +;; from the table of contents, if any, nonetheless. +;; - category :: option +;; - type :: symbol (nil, t, `not-in-toc') + +;; + `with-tasks' :: Non-nil means transcoding should include +;; headlines with a TODO keyword. A `todo' value +;; will only include headlines with a todo type +;; keyword while a `done' value will do the +;; contrary. If a list of strings is provided, only +;; tasks with keywords belonging to that list will +;; be kept. +;; - category :: option +;; - type :: symbol (t, todo, done, nil) or list of strings + +;; + `with-timestamps' :: Non-nil means transcoding should include +;; time stamps and associated keywords. Otherwise, completely +;; remove them. +;; - category :: option +;; - type :: symbol: (t, nil) + +;; + `with-toc' :: Non-nil means that a table of contents has to be +;; added to the output. An integer value limits its +;; depth. +;; - category :: option +;; - type :: symbol (nil, t or integer) + +;; + `with-todo-keywords' :: Non-nil means transcoding should +;; include TODO keywords. +;; - category :: option +;; - type :: symbol (nil, t) + +;;;; Export Options + +;; Export options come from five sources, in increasing precedence +;; order: + +;; - Global variables, +;; - External options provided at export time, +;; - Options keyword symbols, +;; - Buffer keywords, +;; - Subtree properties. + +;; The central internal function with regards to export options is +;; `org-export-collect-options'. It updates global variables with +;; "#+BIND:" keywords, then retrieve and prioritize properties from +;; the different sources. + +;; The internal functions doing the retrieval are: +;; `org-export-parse-option-keyword' , +;; `org-export-get-subtree-options' , +;; `org-export-get-inbuffer-options' and +;; `org-export-get-global-options'. +;; +;; Some properties do not rely on the previous sources but still +;; depend on the original buffer are taken care of in +;; `org-export-initial-options'. + +;; Also, `org-export-confirm-letbind' and `org-export-install-letbind' +;; take care of the part relative to "#+BIND:" keywords. + +(defun org-export-collect-options (backend subtreep ext-plist) + "Collect export options from the current buffer. + +BACKEND is a symbol specifying the back-end to use. + +When SUBTREEP is non-nil, assume the export is done against the +current sub-tree. + +EXT-PLIST is a property list with external parameters overriding +org-mode's default settings, but still inferior to file-local +settings." + ;; First install #+BIND variables. + (org-export-install-letbind-maybe) + ;; Get and prioritize export options... + (let ((options (org-combine-plists + ;; ... from global variables... + (org-export-get-global-options backend) + ;; ... from an external property list... + ext-plist + ;; ... from in-buffer settings... + (org-export-get-inbuffer-options + (org-with-wide-buffer (buffer-string)) backend + (and buffer-file-name + (org-remove-double-quotes buffer-file-name))) + ;; ... and from subtree, when appropriate. + (and subtreep + (org-export-get-subtree-options))))) + ;; Add initial options. + (setq options (append (org-export-initial-options options) + options)) + ;; Set a default title if none has been specified so far. + (unless (plist-get options :title) + (setq options (plist-put options :title + (or (and buffer-file-name + (file-name-sans-extension + (file-name-nondirectory + buffer-file-name))) + (buffer-name))))) + ;; Return plist. + options)) + +(defun org-export-parse-option-keyword (options backend) + "Parse an OPTIONS line and return values as a plist. +BACKEND is a symbol specifying the back-end to use." + (let* ((all (append org-export-option-alist + (let ((var (intern + (format "org-%s-option-alist" backend)))) + (and (boundp var) (eval var))))) + ;; Build an alist between #+OPTION: item and property-name. + (alist (delq nil + (mapcar (lambda (e) + (when (nth 2 e) (cons (regexp-quote (nth 2 e)) + (car e)))) + all))) + plist) + (mapc (lambda (e) + (when (string-match (concat "\\(\\`\\|[ \t]\\)" + (car e) + ":\\(([^)\n]+)\\|[^ \t\n\r;,.]*\\)") + options) + (setq plist (plist-put plist + (cdr e) + (car (read-from-string + (match-string 2 options))))))) + alist) + plist)) + +(defun org-export-get-subtree-options () + "Get export options in subtree at point. +Return the options as a plist." + (org-with-wide-buffer + (when (ignore-errors (org-back-to-heading t)) + (let (prop plist) + (when (setq prop (progn (looking-at org-todo-line-regexp) + (or (org-entry-get (point) "EXPORT_TITLE") + (org-match-string-no-properties 3)))) + (setq plist (plist-put plist :title prop))) + (when (setq prop (org-entry-get (point) "EXPORT_TEXT")) + (setq plist (plist-put plist :text prop))) + (when (setq prop (org-entry-get (point) "EXPORT_AUTHOR")) + (setq plist (plist-put plist :author prop))) + (when (setq prop (org-entry-get (point) "EXPORT_DATE")) + (setq plist (plist-put plist :date prop))) + (when (setq prop (org-entry-get (point) "EXPORT_OPTIONS")) + (setq plist (org-export-add-options-to-plist plist prop))) + plist)))) + +(defun org-export-get-inbuffer-options (buffer-string backend files) + "Return in-buffer options as a plist. +BUFFER-STRING is the string of the buffer. BACKEND is a symbol +specifying which back-end should be used." + (let ((case-fold-search t) plist) + ;; 1. Special keywords, as in `org-export-special-keywords'. + (let ((start 0) + (special-re (org-make-options-regexp org-export-special-keywords))) + (while (string-match special-re buffer-string start) + (setq start (match-end 0)) + (let ((key (upcase (org-match-string-no-properties 1 buffer-string))) + ;; Special keywords do not have their value expanded. + (val (org-match-string-no-properties 2 buffer-string))) + (setq plist + (org-combine-plists + (cond + ((string= key "SETUP_FILE") + (let ((file (expand-file-name + (org-remove-double-quotes (org-trim val))))) + ;; Avoid circular dependencies. + (unless (member file files) + (org-export-get-inbuffer-options + (org-file-contents file 'noerror) + backend + (cons file files))))) + ((string= key "OPTIONS") + (org-export-parse-option-keyword val backend)) + ((string= key "MACRO") + (string-match "^\\([-a-zA-Z0-9_]+\\)[ \t]+\\(.*?[ \t]*$\\)" + val) + (plist-put nil + (intern (concat ":macro-" + (downcase (match-string 1 val)))) + (match-string 2 val)))) + plist))))) + ;; 2. Standard options, as in `org-export-option-alist'. + (let* ((all (append org-export-option-alist + (let ((var (intern + (format "org-%s-option-alist" backend)))) + (and (boundp var) (eval var))))) + ;; Build alist between keyword name and property name. + (alist (delq nil (mapcar (lambda (e) + (when (nth 1 e) (cons (nth 1 e) (car e)))) + all))) + ;; Build regexp matching all keywords associated to export + ;; options. Note: the search is case insensitive. + (opt-re (org-make-options-regexp + (delq nil (mapcar (lambda (e) (nth 1 e)) all)))) + (start 0)) + (while (string-match opt-re buffer-string start) + (setq start (match-end 0)) + (let* ((key (upcase (org-match-string-no-properties 1 buffer-string))) + ;; Expand value, applying restrictions for keywords. + (val (org-match-string-no-properties 2 buffer-string)) + (prop (cdr (assoc key alist))) + (behaviour (nth 4 (assq prop all)))) + (setq plist + (plist-put + plist prop + ;; Handle value depending on specified BEHAVIOUR. + (case behaviour + (space (if (plist-get plist prop) + (concat (plist-get plist prop) " " (org-trim val)) + (org-trim val))) + (newline (org-trim + (concat + (plist-get plist prop) "\n" (org-trim val)))) + (split `(,@(plist-get plist prop) ,@(org-split-string val))) + ('t val) + (otherwise (plist-get plist prop))))))) + ;; Parse keywords specified in `org-element-parsed-keywords'. + (mapc + (lambda (key) + (let* ((prop (cdr (assoc (upcase key) alist))) + (value (and prop (plist-get plist prop)))) + (when (stringp value) + (setq plist + (plist-put + plist prop + (org-element-parse-secondary-string + value + (cdr (assq 'keyword org-element-string-restrictions)))))))) + org-element-parsed-keywords)) + ;; Return final value. + plist)) + +(defun org-export-get-global-options (backend) + "Return global export options as a plist. +BACKEND is a symbol specifying which back-end should be used." + (let ((all (append org-export-option-alist + (let ((var (intern + (format "org-%s-option-alist" backend)))) + (and (boundp var) (eval var))))) + ;; Output value. + plist) + (mapc (lambda (cell) + (setq plist + (plist-put plist (car cell) (eval (nth 3 cell))))) + all) + ;; Return value. + plist)) + +(defun org-export-initial-options (options) + "Return a plist with non-optional properties. +OPTIONS is the export options plist computed so far." + (list + :macro-date "(eval (format-time-string \"$1\"))" + :macro-time "(eval (format-time-string \"$1\"))" + :macro-property "(eval (org-entry-get nil \"$1\" 'selective))" + :macro-modification-time + (and (buffer-file-name) + (file-exists-p (buffer-file-name)) + (concat "(eval (format-time-string \"$1\" '" + (prin1-to-string (nth 5 (file-attributes (buffer-file-name)))) + "))")) + :macro-input-file (and (buffer-file-name) + (file-name-nondirectory (buffer-file-name))) + :footnotes-labels-alist + (let (alist) + (org-with-wide-buffer + (goto-char (point-min)) + (while (re-search-forward org-footnote-definition-re nil t) + (let ((def (org-footnote-at-definition-p))) + (org-skip-whitespace) + (push (cons (car def) + (save-restriction + (narrow-to-region (point) (nth 2 def)) + (org-element-parse-buffer))) + alist))) + alist)))) + +(defvar org-export-allow-BIND-local nil) +(defun org-export-confirm-letbind () + "Can we use #+BIND values during export? +By default this will ask for confirmation by the user, to divert +possible security risks." + (cond + ((not org-export-allow-BIND) nil) + ((eq org-export-allow-BIND t) t) + ((local-variable-p 'org-export-allow-BIND-local) org-export-allow-BIND-local) + (t (org-set-local 'org-export-allow-BIND-local + (yes-or-no-p "Allow BIND values in this buffer? "))))) + +(defun org-export-install-letbind-maybe () + "Install the values from #+BIND lines as local variables. +Variables must be installed before in-buffer options are +retrieved." + (let (letbind pair) + (org-with-wide-buffer + (goto-char (point-min)) + (while (re-search-forward (org-make-options-regexp '("BIND")) nil t) + (when (org-export-confirm-letbind) + (push (read (concat "(" (org-match-string-no-properties 2) ")")) + letbind)))) + (while (setq pair (pop letbind)) + (org-set-local (car pair) (nth 1 pair))))) + + +;;;; Persistent Properties + +;; Persistent properties are declared in +;; `org-export-persistent-properties-list' variable. Most of them are +;; initialized at the beginning of the transcoding process by +;; `org-export-initialize-persistent-properties'. The others are +;; updated during that process. + +;; Dedicated functions focus on computing the value of specific +;; persistent properties during initialization. Thus, +;; `org-export-use-select-tag-p' determines if an headline makes use +;; of an export tag enforcing inclusion. `org-export-get-min-level' +;; gets the minimal exportable level, used as a basis to compute +;; relative level for headlines. `org-export-get-point-max' returns +;; the maximum exportable ending position in the parse tree. +;; Eventually `org-export-collect-headline-numbering' builds an alist +;; between headlines' beginning position and their numbering. + +(defconst org-export-persistent-properties-list + '(:code-refs :headline-alist :headline-offset :headline-offset :parse-tree + :point-max :seen-footnote-labels :total-loc :use-select-tags) + "List of persistent properties.") + +(defconst org-export-persistent-properties nil + "Used internally to store properties and values during transcoding. + +Only properties that should survive recursion are saved here. + +This variable is reset before each transcoding.") + +(defun org-export-initialize-persistent-properties (data options backend) + "Initialize `org-export-persistent-properties'. + +DATA is the parse tree from which information is retrieved. +OPTIONS is a list holding export options. BACKEND is the +back-end called for transcoding, as a symbol. + +Following initial persistent properties are set: +`:back-end' Back-end used for transcoding. + +`:headline-alist' Alist of all headlines' name as key and a list + holding beginning and ending positions as + value. + +`:headline-offset' Offset between true level of headlines and + local level. An offset of -1 means an headline + of level 2 should be considered as a level + 1 headline in the context. + +`:headline-numbering' Alist of all headlines' beginning position + as key an the associated numbering as value. + +`:parse-tree' Whole parse tree. + +`:point-max' Last position in the parse tree + +`:target-list' List of all targets' raw name in the parse tree. + +`:use-select-tags' Non-nil when parsed tree use a special tag to + enforce transcoding of the headline." + ;; First delete any residual persistent property. + (setq org-export-persistent-properties nil) + ;; Immediately after, set `:use-select-tags' property, as it will be + ;; required for further computations. + (setq options + (org-export-set-property + options + :use-select-tags + (org-export-use-select-tags-p data options))) + ;; Get the rest of the initial persistent properties, now + ;; `:use-select-tags' is set... + ;; 1. `:parse-tree' ... + (setq options (org-export-set-property options :parse-tree data)) + ;; 2. `:headline-offset' ... + (setq options + (org-export-set-property + options :headline-offset + (- 1 (org-export-get-min-level data options)))) + ;; 3. `:point-max' ... + (setq options (org-export-set-property + options :point-max + (org-export-get-point-max data options))) + ;; 4. `:target-list'... + (setq options (org-export-set-property + options :target-list + (org-element-map + data 'target + (lambda (target info) + (org-element-get-property :raw-value target))))) + ;; 5. `:headline-alist' + (setq options (org-export-set-property + options :headline-alist + (org-element-map + data 'headline + (lambda (headline info) + (list (org-element-get-property :raw-value headline) + (org-element-get-property :begin headline) + (org-element-get-property :end headline)))))) + ;; 6. `:headline-numbering' + (setq options (org-export-set-property + options :headline-numbering + (org-export-collect-headline-numbering data options))) + ;; 7. `:back-end' + (setq options (org-export-set-property options :back-end backend))) + +(defun org-export-use-select-tags-p (data options) + "Non-nil when data use a tag enforcing transcoding. +DATA is parsed data as returned by `org-element-parse-buffer'. +OPTIONS is a plist holding export options." + (org-element-map + data + 'headline + (lambda (headline info) + (let ((tags (org-element-get-property :with-tags headline))) + (and tags (string-match + (format ":%s:" (plist-get info :select-tags)) tags)))) + options + 'stop-at-first-match)) + +(defun org-export-get-min-level (data options) + "Return minimum exportable headline's level in DATA. +DATA is parsed tree as returned by `org-element-parse-buffer'. +OPTIONS is a plist holding export options." + (catch 'exit + (let ((min-level 10000)) + (mapc (lambda (blob) + (when (and (eq (car blob) 'headline) + (not (org-export-skip-p blob options))) + (setq min-level + (min (org-element-get-property :level blob) min-level))) + (when (= min-level 1) (throw 'exit 1))) + (org-element-get-contents data)) + ;; If no headline was found, for the sake of consistency, set + ;; minimum level to 1 nonetheless. + (if (= min-level 10000) 1 min-level)))) + +(defun org-export-get-point-max (data options) + "Return last exportable ending position in DATA. +DATA is parsed tree as returned by `org-element-parse-buffer'. +OPTIONS is a plist holding export options." + (let ((pos-max 1)) + (mapc (lambda (blob) + (unless (and (eq (car blob) 'headline) + (org-export-skip-p blob options)) + (setq pos-max (org-element-get-property :end blob)))) + (org-element-get-contents data)) + pos-max)) + +(defun org-export-collect-headline-numbering (data options) + "Return numbering of all exportable headlines in a parse tree. + +DATA is the parse tree. OPTIONS is the plist holding export +options. + +Return an alist whose key is headline's beginning position and +value is its associated numbering (in the shape of a list of +numbers)." + (let ((numbering (make-vector org-export-max-depth 0))) + (org-element-map + data + 'headline + (lambda (headline info) + (let ((relative-level (1- (org-export-get-relative-level blob info)))) + (cons + (org-element-get-property :begin headline) + (loop for n across numbering + for idx from 0 to org-export-max-depth + when (< idx relative-level) collect n + when (= idx relative-level) collect (aset numbering idx (1+ n)) + when (> idx relative-level) do (aset numbering idx 0))))) + options))) + + +;;;; Properties Management + +;; This is mostly done with the help of two functions. On the one +;; hand `org-export-update-info' is used to keep up-to-date local +;; information while walking the nested list representing the parsed +;; document. On the other end, `org-export-set-property' handles +;; properties modifications according to their type (persistent or +;; local). + +;; As exceptions, `:code-refs' and `:total-loc' properties are updated +;; with `org-export-handle-code' function. + +(defun org-export-update-info (blob info recursep) + "Update export options depending on context. + +BLOB is the element or object being parsed. INFO is the plist +holding the export options. + +When RECURSEP is non-nil, assume the following element or object +will be inside the current one. + +The following properties are updated: +`genealogy' List of current element's parents + (symbol list). +`inherited-properties' List of inherited properties from + parent headlines (plist). +`parent-properties' List of last element's properties + (plist). +`previous-element' Previous element's type (symbol). +`previous-object' Previous object's type (symbol). +`seen-footnote-labels' List of already parsed footnote + labels (string list) + +Return the property list." + (let* ((type (and (not (stringp blob)) (car blob)))) + (cond + ;; Case 1: We're moving into a recursive blob. + (recursep + (org-combine-plists + info + `(:genealogy ,(cons type (plist-get info :genealogy)) + :previous-element nil + :previous-object nil + :parent-properties + ,(if (memq type org-element-all-elements) + (nth 1 blob) + (plist-get info :parent-properties)) + :inherited-properties + ,(if (eq type 'headline) + (org-combine-plists + (plist-get info :inherited-properties) (nth 1 blob)) + (plist-get info :inherited-properties))) + ;; Add persistent properties. + org-export-persistent-properties)) + ;; Case 2: No recursion. + (t + ;; At a footnote reference: mark its label as seen, if not + ;; already the case. + (when (eq type 'footnote-reference) + (let ((label (org-element-get-property :label blob)) + (seen-labels (plist-get org-export-persistent-properties + :seen-footnote-labels))) + ;; Store anonymous footnotes (nil label) without checking if + ;; another anonymous footnote was seen before. + (unless (and label (member label seen-labels)) + (setq info (org-export-set-property + info :seen-footnote-labels (push label seen-labels)))))) + ;; Set `:previous-element' or `:previous-object' according to + ;; BLOB. + (setq info (cond ((not type) + (org-export-set-property + info :previous-object 'plain-text)) + ((memq type org-element-all-elements) + (org-export-set-property info :previous-element type)) + (t (org-export-set-property info :previous-object type)))) + ;; Return updated value. + info)))) + +(defun org-export-set-property (info prop value) + "Set property PROP to VALUE in plist INFO. +Return the new plist." + (when (memq prop org-export-persistent-properties-list) + (setq org-export-persistent-properties + (plist-put org-export-persistent-properties prop value))) + (plist-put info prop value)) + + + +;;; The Transcoder + +;; This function reads Org data (obtained with, i.e. +;; `org-element-parse-buffer') and transcodes it into a specified +;; back-end output. It takes care of updating local properties, +;; filtering out elements or objects according to export options and +;; organizing the output blank lines and white space are preserved. + +;; Though, this function is inapropriate for secondary strings, which +;; require a fresh copy of the plist passed as INFO argument. Thus, +;; `org-export-secondary-string' is provided for that specific task. + +;; Internally, three functions handle the filtering of objects and +;; elements during the export. More precisely, `org-export-skip-p' +;; determines if the considered object or element should be ignored +;; altogether, `org-export-interpret-p' tells which elements or +;; objects should be seen as real Org syntax and `org-export-expand' +;; transforms the others back into their original shape. + +(defun org-export-data (data backend info) + "Convert DATA to a string into BACKEND format. + +DATA is a nested list as returned by `org-element-parse-buffer'. + +BACKEND is a symbol among supported exporters. + +INFO is a plist holding export options and also used as +a communication channel between elements when walking the nested +list. See `org-export-update-info' function for more +details. + +Return transcoded string." + (mapconcat + ;; BLOB can be an element, an object, a string, or nil. + (lambda (blob) + (cond + ((not blob) nil) ((equal blob "") nil) + ;; BLOB is a string. Check if the optional transcoder for plain + ;; text exists, and call it in that case. Otherwise, simply + ;; return string. Also update INFO and call + ;; `org-export-filter-plain-text-functions'. + ((stringp blob) + (setq info (org-export-update-info blob info nil)) + (let ((transcoder (intern (format "org-%s-plain-text" backend)))) + (org-export-filter-apply-functions + org-export-filter-plain-text-functions + (if (fboundp transcoder) (funcall transcoder blob info) blob) + backend))) + ;; BLOB is an element or an object. + (t + (let* ((type (if (stringp blob) 'plain-text (car blob))) + ;; 1. Determine the appropriate TRANSCODER. + (transcoder + (cond + ;; 1.0 A full Org document is inserted. + ((eq type 'org-data) 'identity) + ;; 1.1. BLOB should be ignored. + ((org-export-skip-p blob info) nil) + ;; 1.2. BLOB shouldn't be transcoded. Interpret it + ;; back into Org syntax. + ((not (org-export-interpret-p blob info)) + 'org-export-expand) + ;; 1.3. Else apply naming convention. + (t (let ((trans (intern + (format "org-%s-%s" backend type)))) + (and (fboundp trans) trans))))) + ;; 2. Compute CONTENTS of BLOB. + (contents + (cond + ;; Case 0. No transcoder defined: ignore BLOB. + ((not transcoder) nil) + ;; Case 1. Transparently export an Org document. + ((eq type 'org-data) + (org-export-data blob backend info)) + ;; Case 2. For a recursive object. + ((memq type org-element-recursive-objects) + (org-export-data + blob backend (org-export-update-info blob info t))) + ;; Case 3. For a recursive element. + ((memq type org-element-greater-elements) + ;; Ignore contents of an archived tree + ;; when `:with-archived-trees' is `headline'. + (unless (and + (eq type 'headline) + (eq (plist-get info :with-archived-trees) 'headline) + (org-element-get-property :archivedp blob)) + (org-element-normalize-string + (org-export-data + blob backend (org-export-update-info blob info t))))) + ;; Case 4. For a paragraph. + ((eq type 'paragraph) + (let ((paragraph + (org-element-normalize-contents + blob + ;; When normalizing contents of an item or + ;; a footnote definition, ignore first line's + ;; indentation: there is none and it might be + ;; misleading. + (and (not (plist-get info :previous-element)) + (let ((parent (car (plist-get info :genealogy)))) + (memq parent '(footnote-definition item))))))) + (org-export-data + paragraph + backend + (org-export-update-info blob info t)))))) + ;; 3. Transcode BLOB into RESULTS string. + (results (cond + ((not transcoder) nil) + ((eq transcoder 'org-export-expand) + (org-export-data + `(org-data nil ,(funcall transcoder blob contents)) + backend info)) + (t (funcall transcoder blob contents info))))) + ;; 4. Discard nil results. Otherwise, update INFO, append + ;; the same white space between elements or objects as in + ;; the original buffer, and call appropriate filters. + (when results + (setq info (org-export-update-info blob info nil)) + ;; No filter for a full document. + (if (eq type 'org-data) + results + (org-export-filter-apply-functions + (eval (intern (format "org-export-filter-%s-functions" type))) + (if (memq type org-element-all-elements) + (concat + (org-element-normalize-string results) + (make-string (org-element-get-property :post-blank blob) 10)) + (concat + results + (make-string + (org-element-get-property :post-blank blob) 32))) + backend))))))) + (org-element-get-contents data) "")) + +(defun org-export-secondary-string (secondary backend info) + "Convert SECONDARY string into BACKEND format. + +SECONDARY is a nested list as returned by +`org-element-parse-secondary-string'. + +BACKEND is a symbol among supported exporters. + +INFO is a plist holding export options and also used as +a communication channel between elements when walking the nested +list. See `org-export-update-info' function for more +details. + +Return transcoded string." + ;; Make SECONDARY acceptable for `org-export-data'. + (let ((s (if (listp secondary) secondary (list secondary)))) + (org-export-data `(org-data nil ,@s) backend (copy-sequence info)))) + +(defun org-export-skip-p (blob info) + "Non-nil when element or object BLOB should be skipped during export. +INFO is the plist holding export options." + ;; Check headline. + (unless (stringp blob) + (case (car blob) + ('headline + (let ((with-tasks (plist-get info :with-tasks)) + (todo (org-element-get-property :todo-keyword blob)) + (todo-type (org-element-get-property :todo-type blob)) + (archived (plist-get info :with-archived-trees)) + (tag-list (let ((tags (org-element-get-property :tags blob))) + (and tags (org-split-string tags ":"))))) + (or + ;; Ignore subtrees with an exclude tag. + (loop for k in (plist-get info :exclude-tags) + thereis (member k tag-list)) + ;; Ignore subtrees without a select tag, when such tag is found + ;; in the buffer. + (and (plist-get info :use-select-tags) + (loop for k in (plist-get info :select-tags) + never (member k tag-list))) + ;; Ignore commented sub-trees. + (org-element-get-property :commentedp blob) + ;; Ignore archived subtrees if `:with-archived-trees' is nil. + (and (not archived) (org-element-get-property :archivedp blob)) + ;; Ignore tasks, if specified by `:with-tasks' property. + (and todo (not with-tasks)) + (and todo + (memq with-tasks '(todo done)) + (not (eq todo-type with-tasks))) + (and todo + (consp with-tasks) + (not (member todo with-tasks)))))) + ;; Check time-stamp. + ('time-stamp (not (plist-get info :with-timestamps))) + ;; Check drawer. + ('drawer + (or (not (plist-get info :with-drawers)) + (and (consp (plist-get info :with-drawers)) + (not (member (org-element-get-property :drawer-name blob) + (plist-get info :with-drawers)))))) + ;; Check export snippet. + ('export-snippet + (let* ((raw-back-end (org-element-get-property :back-end blob)) + (true-back-end + (or (cdr (assoc raw-back-end org-export-snippet-translation-alist)) + raw-back-end))) + (not (string= (symbol-name (plist-get info :back-end)) + true-back-end))))))) + +(defun org-export-interpret-p (blob info) + "Non-nil if element or object BLOB should be interpreted as Org syntax. +Check is done according to export options INFO, stored as +a plist." + (case (car blob) + ;; ... entities... + (entity (plist-get info :with-entities)) + ;; ... emphasis... + (emphasis (plist-get info :with-emphasize)) + ;; ... fixed-width areas. + (fixed-width (plist-get info :with-fixed-width)) + ;; ... footnotes... + ((footnote-definition footnote-reference) + (plist-get info :with-footnotes)) + ;; ... sub/superscripts... + ((subscript superscript) + (let ((sub/super-p (plist-get info :with-sub-superscript))) + (if (eq sub/super-p '{}) + (org-element-get-property :use-brackets-p blob) + sub/super-p))) + ;; ... tables... + (table (plist-get info :with-tables)) + (otherwise t))) + +(defsubst org-export-expand (blob contents) + "Expand a parsed element or object to its original state. +BLOB is either an element or an object. CONTENTS is its +contents, as a string or nil." + (funcall + (intern (format "org-element-%s-interpreter" (car blob))) blob contents)) + + + +;;; The Filter System + +;; Filters allow end-users to tweak easily the transcoded output. +;; They are the functional counterpart of hooks, as every filter in +;; a set is applied to the return value of the previous one. + +;; Every set is back-end agnostic. Although, a filter is always +;; called, in addition to the string it applies to, with the back-end +;; used as argument, so it's easy enough for the end-user to add +;; back-end specific filters in the set. + +;; Filters sets are defined below. There are of four types: + +;; - `org-export-filter-parse-tree-functions' applies directly on the +;; complete parsed tree. It's the only filters set that doesn't +;; apply to a string. +;; - `org-export-filter-final-output-functions' applies to the final +;; transcoded string. +;; - `org-export-filter-plain-text-functions' applies to any string +;; not recognized as Org syntax. +;; - `org-export-filter-TYPE-functions' applies on the string returned +;; after an element or object of type TYPE has been transcoded. + +;; All filters sets are applied through +;; `org-export-filter-apply-functions' function. Filters in a set are +;; applied in reverse order, that is in the order of consing. It +;; allows developers to be reasonably sure that their filters will be +;; applied first. + +;;;; Special Filters +(defvar org-export-filter-parse-tree-functions nil + "Filter, or list of filters, applied to the parsed tree. +Each filter is called with two arguments: the parse tree, as +returned by `org-element-parse-buffer', and the back-end as +a symbol. It must return the modified parse tree to transcode.") + +(defvar org-export-filter-final-output-functions nil + "Filter, or list of filters, applied to the transcoded string. +Each filter is called with two arguments: the full transcoded +string, and the back-end as a symbol. It must return a string +that will be used as the final export output.") + +(defvar org-export-filter-plain-text-functions nil + "Filter, or list of filters, applied to plain text. +Each filter is called with two arguments: a string which contains +no Org syntax, and the back-end as a symbol. It must return +a string or nil.") + + +;;;; Elements Filters + +(defvar org-export-filter-center-block-functions nil + "Filter, or list of filters, applied to a transcoded center block. +Each filter is called with two arguments: the transcoded center +block, as a string, and the back-end, as a symbol. It must +return a string or nil.") + +(defvar org-export-filter-drawer-functions nil + "Filter, or list of filters, applied to a transcoded drawer. +Each filter is called with two arguments: the transcoded drawer, +as a string, and the back-end, as a symbol. It must return +a string or nil.") + +(defvar org-export-filter-dynamic-block-functions nil + "Filter, or list of filters, applied to a transcoded dynamic-block. +Each filter is called with two arguments: the transcoded +dynamic-block, as a string, and the back-end, as a symbol. It +must return a string or nil.") + +(defvar org-export-filter-headline-functions nil + "Filter, or list of filters, applied to a transcoded headline. +Each filter is called with two arguments: the transcoded +headline, as a string, and the back-end, as a symbol. It must +return a string or nil.") + +(defvar org-export-filter-inlinetask-functions nil + "Filter, or list of filters, applied to a transcoded inlinetask. +Each filter is called with two arguments: the transcoded +inlinetask, as a string, and the back-end, as a symbol. It must +return a string or nil.") + +(defvar org-export-filter-plain-list-functions nil + "Filter, or list of filters, applied to a transcoded plain-list. +Each filter is called with two arguments: the transcoded +plain-list, as a string, and the back-end, as a symbol. It must +return a string or nil.") + +(defvar org-export-filter-item-functions nil + "Filter, or list of filters, applied to a transcoded item. +Each filter is called with two arguments: the transcoded item, as +a string, and the back-end, as a symbol. It must return a string +or nil.") + +(defvar org-export-filter-comment-functions nil + "Filter, or list of filters, applied to a transcoded comment. +Each filter is called with two arguments: the transcoded comment, +as a string, and the back-end, as a symbol. It must return +a string or nil.") + +(defvar org-export-filter-comment-block-functions nil + "Filter, or list of filters, applied to a transcoded comment-comment. +Each filter is called with two arguments: the transcoded +comment-block, as a string, and the back-end, as a symbol. It +must return a string or nil.") + +(defvar org-export-filter-example-block-functions nil + "Filter, or list of filters, applied to a transcoded example-block. +Each filter is called with two arguments: the transcoded +example-block, as a string, and the back-end, as a symbol. It +must return a string or nil.") + +(defvar org-export-filter-export-block-functions nil + "Filter, or list of filters, applied to a transcoded export-block. +Each filter is called with two arguments: the transcoded +export-block, as a string, and the back-end, as a symbol. It +must return a string or nil.") + +(defvar org-export-filter-fixed-width-functions nil + "Filter, or list of filters, applied to a transcoded fixed-width. +Each filter is called with two arguments: the transcoded +fixed-width, as a string, and the back-end, as a symbol. It must +return a string or nil.") + +(defvar org-export-filter-footnote-definition-functions nil + "Filter, or list of filters, applied to a transcoded footnote-definition. +Each filter is called with two arguments: the transcoded +footnote-definition, as a string, and the back-end, as a symbol. +It must return a string or nil.") + +(defvar org-export-filter-horizontal-rule-functions nil + "Filter, or list of filters, applied to a transcoded horizontal-rule. +Each filter is called with two arguments: the transcoded +horizontal-rule, as a string, and the back-end, as a symbol. It +must return a string or nil.") + +(defvar org-export-filter-keyword-functions nil + "Filter, or list of filters, applied to a transcoded keyword. +Each filter is called with two arguments: the transcoded keyword, +as a string, and the back-end, as a symbol. It must return +a string or nil.") + +(defvar org-export-filter-latex-environment-functions nil + "Filter, or list of filters, applied to a transcoded latex-environment. +Each filter is called with two arguments: the transcoded +latex-environment, as a string, and the back-end, as a symbol. +It must return a string or nil.") + +(defvar org-export-filter-babel-call-functions nil + "Filter, or list of filters, applied to a transcoded babel-call. +Each filter is called with two arguments: the transcoded +babel-call, as a string, and the back-end, as a symbol. It must +return a string or nil.") + +(defvar org-export-filter-paragraph-functions nil + "Filter, or list of filters, applied to a transcoded paragraph. +Each filter is called with two arguments: the transcoded +paragraph, as a string, and the back-end, as a symbol. It must +return a string or nil.") + +(defvar org-export-filter-property-drawer-functions nil + "Filter, or list of filters, applied to a transcoded property-drawer. +Each filter is called with two arguments: the transcoded +property-drawer, as a string, and the back-end, as a symbol. It +must return a string or nil.") + +(defvar org-export-filter-quote-block-functions nil + "Filter, or list of filters, applied to a transcoded quote block. +Each filter is called with two arguments: the transcoded quote +block, as a string, and the back-end, as a symbol. It must +return a string or nil.") + +(defvar org-export-filter-quote-section-functions nil + "Filter, or list of filters, applied to a transcoded quote-section. +Each filter is called with two arguments: the transcoded +quote-section, as a string, and the back-end, as a symbol. It +must return a string or nil.") + +(defvar org-export-filter-special-block-functions nil + "Filter, or list of filters, applied to a transcoded special block. +Each filter is called with two arguments: the transcoded special +block, as a string, and the back-end, as a symbol. It must +return a string or nil.") + +(defvar org-export-filter-src-block-functions nil + "Filter, or list of filters, applied to a transcoded src-block. +Each filter is called with two arguments: the transcoded +src-block, as a string, and the back-end, as a symbol. It must +return a string or nil.") + +(defvar org-export-filter-table-functions nil + "Filter, or list of filters, applied to a transcoded table. +Each filter is called with two arguments: the transcoded table, +as a string, and the back-end, as a symbol. It must return +a string or nil.") + +(defvar org-export-filter-verse-block-functions nil + "Filter, or list of filters, applied to a transcoded verse block. +Each filter is called with two arguments: the transcoded verse +block, as a string, and the back-end, as a symbol. It must +return a string or nil.") + + +;;;; Objects Filters + +(defvar org-export-filter-emphasis-functions nil + "Filter, or list of filters, applied to a transcoded emphasis. +Each filter is called with two arguments: the transcoded +emphasis, as a string, and the back-end, as a symbol. It must +return a string or nil.") + +(defvar org-export-filter-entity-functions nil + "Filter, or list of filters, applied to a transcoded entity. +Each filter is called with two arguments: the transcoded entity, +as a string, and the back-end, as a symbol. It must return +a string or nil.") + +(defvar org-export-filter-export-snippet-functions nil + "Filter, or list of filters, applied to a transcoded export-snippet. +Each filter is called with two arguments: the transcoded +export-snippet, as a string, and the back-end, as a symbol. It +must return a string or nil.") + +(defvar org-export-filter-footnote-reference-functions nil + "Filter, or list of filters, applied to a transcoded footnote-reference. +Each filter is called with two arguments: the transcoded +footnote-reference, as a string, and the back-end, as a symbol. +It must return a string or nil.") + +(defvar org-export-filter-inline-babel-call-functions nil + "Filter, or list of filters, applied to a transcoded inline-babel-call. +Each filter is called with two arguments: the transcoded +inline-babel-call, as a string, and the back-end, as a symbol. It +must return a string or nil.") + +(defvar org-export-filter-inline-src-block-functions nil + "Filter, or list of filters, applied to a transcoded inline-src-block. +Each filter is called with two arguments: the transcoded +inline-src-block, as a string, and the back-end, as a symbol. It +must return a string or nil.") + +(defvar org-export-filter-latex-fragment-functions nil + "Filter, or list of filters, applied to a transcoded latex-fragment. +Each filter is called with two arguments: the transcoded +latex-fragment, as a string, and the back-end, as a symbol. It +must return a string or nil.") + +(defvar org-export-filter-line-break-functions nil + "Filter, or list of filters, applied to a transcoded line-break. +Each filter is called with two arguments: the transcoded +line-break, as a string, and the back-end, as a symbol. It must +return a string or nil.") + +(defvar org-export-filter-link-functions nil + "Filter, or list of filters, applied to a transcoded link. +Each filter is called with two arguments: the transcoded link, as +a string, and the back-end, as a symbol. It must return a string +or nil.") + +(defvar org-export-filter-macro-functions nil + "Filter, or list of filters, applied to a transcoded macro. +Each filter is called with two arguments: the transcoded macro, +as a string, and the back-end, as a symbol. It must return +a string or nil.") + +(defvar org-export-filter-radio-target-functions nil + "Filter, or list of filters, applied to a transcoded radio-target. +Each filter is called with two arguments: the transcoded +radio-target, as a string, and the back-end, as a symbol. It +must return a string or nil.") + +(defvar org-export-filter-statistics-cookie-functions nil + "Filter, or list of filters, applied to a transcoded statistics-cookie. +Each filter is called with two arguments: the transcoded +statistics-cookie, as a string, and the back-end, as a symbol. +It must return a string or nil.") + +(defvar org-export-filter-subscript-functions nil + "Filter, or list of filters, applied to a transcoded subscript. +Each filter is called with two arguments: the transcoded +subscript, as a string, and the back-end, as a symbol. It must +return a string or nil.") + +(defvar org-export-filter-superscript-functions nil + "Filter, or list of filters, applied to a transcoded superscript. +Each filter is called with two arguments: the transcoded +superscript, as a string, and the back-end, as a symbol. It must +return a string or nil.") + +(defvar org-export-filter-target-functions nil + "Filter, or list of filters, applied to a transcoded target. +Each filter is called with two arguments: the transcoded target, +as a string, and the back-end, as a symbol. It must return +a string or nil.") + +(defvar org-export-filter-time-stamp-functions nil + "Filter, or list of filters, applied to a transcoded time-stamp. +Each filter is called with two arguments: the transcoded +time-stamp, as a string, and the back-end, as a symbol. It must +return a string or nil.") + +(defvar org-export-filter-verbatim-functions nil + "Filter, or list of filters, applied to a transcoded verbatim. +Each filter is called with two arguments: the transcoded +verbatim, as a string, and the back-end, as a symbol. It must +return a string or nil.") + +(defun org-export-filter-apply-functions (filters value backend) + "Call every function in FILTERS with arguments VALUE and BACKEND. +Functions are called in reverse order, to be reasonably sure that +developer-specified filters, if any, are called first." + ;; Ensure FILTERS is a list. + (let ((filters (if (listp filters) (reverse filters) (list filters)))) + (loop for filter in filters + if (not value) return nil else + do (setq value (funcall filter value backend)))) + value) + + + +;;; Core functions + +;; This is the room for the main function, `org-export-as', along with +;; its derivative, `org-export-to-buffer'. They differ only by the +;; way they output the resulting code. + +;; Note that `org-export-as' doesn't really parse the current buffer, +;; but a copy of it (with the same buffer-local variables and +;; visibility), where Babel blocks are executed, if appropriate. +;; `org-export-with-current-buffer-copy' macro prepares that copy. + +(defun org-export-as (backend + &optional subtreep visible-only body-only ext-plist) + "Transcode current Org buffer into BACKEND code. + +If narrowing is active in the current buffer, only transcode its +narrowed part. + +If a region is active, transcode that region. + +When optional argument SUBTREEP is non-nil, transcode the +sub-tree at point, extracting information from the headline +properties first. + +When optional argument VISIBLE-ONLY is non-nil, don't export +contents of hidden elements. + +When optional argument BODY-ONLY is non-nil, only return body +code, without preamble nor postamble. + +EXT-PLIST, when provided, is a property list with external +parameters overriding Org default settings, but still inferior to +file-local settings. + +Return code as a string." + (save-excursion + (save-restriction + ;; Narrow buffer to an appropriate region for parsing. + (when (org-region-active-p) + (narrow-to-region (region-beginning) (region-end))) + (goto-char (point-min)) + (when subtreep + (unless (org-at-heading-p) + (org-with-limited-levels (outline-next-heading))) + (let ((end (save-excursion (org-end-of-subtree t))) + (begin (progn (forward-line) + (org-skip-whitespace) + (point-at-bol)))) + (narrow-to-region begin end))) + ;; Retrieve export options (INFO) and parsed tree (RAW-DATA). + ;; Buffer isn't parsed directly. Instead, a temporary copy is + ;; created, where all code blocks are evaluated. RAW-DATA is + ;; the parsed tree of the buffer resulting from that process. + ;; Eventually call `org-export-filter-parse-tree-functions'.. + (let ((info (org-export-collect-options backend subtreep ext-plist)) + (raw-data (org-export-filter-apply-functions + org-export-filter-parse-tree-functions + (org-export-with-current-buffer-copy + (org-export-blocks-preprocess) + (org-element-parse-buffer nil visible-only)) + backend))) + ;; Initialize the communication system and combine it to INFO. + (setq info + (org-combine-plists + info + (org-export-initialize-persistent-properties + raw-data info backend))) + ;; Now transcode RAW-DATA. Also call + ;; `org-export-filter-final-output-functions'. + (let ((body (org-element-normalize-string + (org-export-data raw-data backend info))) + (template (intern (format "org-%s-template" backend)))) + (if (and (not body-only) (fboundp template)) + (org-trim + (org-export-filter-apply-functions + org-export-filter-final-output-functions + (funcall template body info) + backend)) + (org-export-filter-apply-functions + org-export-filter-final-output-functions body backend))))))) + +(defun org-export-to-buffer (backend buffer &optional subtreep visible-only body-only ext-plist) + "Call `org-export-as' with output to a specified buffer. + +BACKEND is the back-end used for transcoding, as a symbol. + +BUFFER is the output buffer. If it already exists, it will be +erased first, otherwise, it will be created. + +Arguments SUBTREEP, VISIBLE-ONLY and BODY-ONLY are similar to +those used in `org-export-as'. + +EXT-PLIST, when provided, is a property list with external +parameters overriding Org default settings, but still inferior to +file-local settings. + +Return buffer." + (let ((out (org-export-as backend subtreep visible-only body-only ext-plist)) + (buffer (get-buffer-create buffer))) + (with-current-buffer buffer + (erase-buffer) + (insert out) + (goto-char (point-min))) + buffer)) + +(defmacro org-export-with-current-buffer-copy (&rest body) + "Apply BODY in a copy of the current buffer. + +The copy preserves local variables and visibility of the original +buffer. + +Point is at buffer's beginning when BODY is applied." + (org-with-gensyms (original-buffer offset buffer-string overlays) + `(let ((,original-buffer ,(current-buffer)) + (,offset ,(1- (point-min))) + (,buffer-string ,(buffer-string)) + (,overlays (mapcar + 'copy-overlay (overlays-in (point-min) (point-max))))) + (with-temp-buffer + (let ((buffer-invisibility-spec nil)) + (org-clone-local-variables + ,original-buffer "^\\(org-\\|orgtbl-\\|major-mode$\\)") + (insert ,buffer-string) + (mapc (lambda (ov) + (move-overlay + ov + (- (overlay-start ov) ,offset) + (- (overlay-end ov) ,offset) + (current-buffer))) + ,overlays) + (goto-char (point-min)) + (progn ,@body)))))) +(def-edebug-spec org-export-with-current-buffer-copy (body)) + + + +;;; Tools For Back-Ends + +;; A whole set of tools is available to help build new exporters. Any +;; function general enough to have its use across many back-ends +;; should be added here. + +;; As of now, functions operating on headlines, include keywords, +;; links, macros, src-blocks, tables and tables of contents are +;; implemented. + + +;;;; For Headlines + +;; `org-export-get-relative-level' is a shortcut to get headline +;; level, relatively to the lower headline level in the parsed tree. + +;; `org-export-get-headline-number' returns the section number of an +;; headline, while `org-export-number-to-roman' allows to convert it +;; to roman numbers. + +;; `org-export-first-sibling-p' and `org-export-last-sibling-p' are +;; two useful predicates when it comes to fulfill the +;; `:headline-levels' property. + +(defun org-export-get-relative-level (headline info) + "Return HEADLINE relative level within current parsed tree. +INFO is a plist holding contextual information." + (+ (org-element-get-property :level headline) + (or (plist-get info :headline-offset) 0))) + +(defun org-export-get-headline-number (headline info) + "Return HEADLINE numbering as a list of numbers. +INFO is a plist holding contextual information." + (cdr (assq (org-element-get-property :begin headline) + (plist-get info :headline-numbering)))) + +(defun org-export-number-to-roman (n) + "Convert integer N into a roman numeral." + (let ((roman '((1000 . "M") (900 . "CM") (500 . "D") (400 . "CD") + ( 100 . "C") ( 90 . "XC") ( 50 . "L") ( 40 . "XL") + ( 10 . "X") ( 9 . "IX") ( 5 . "V") ( 4 . "IV") + ( 1 . "I"))) + (res "")) + (if (<= n 0) + (number-to-string n) + (while roman + (if (>= n (caar roman)) + (setq n (- n (caar roman)) + res (concat res (cdar roman))) + (pop roman))) + res))) + +(defun org-export-first-sibling-p (headline info) + "Non-nil when HEADLINE is the first sibling in its sub-tree. +INFO is the plist used as a communication channel." + (not (eq (plist-get info :previous-element) 'headline))) + +(defun org-export-last-sibling-p (headline info) + "Non-nil when HEADLINE is the last sibling in its sub-tree. +INFO is the plist used as a communication channel." + (= (org-element-get-property :end headline) + (or (plist-get (plist-get info :parent-properties) :end) + (plist-get info :point-max)))) + + +;;;; For Include Keywords + +;; This section provides a tool to properly handle insertion of files +;; during export: `org-export-included-files'. It recursively +;; transcodes a file specfied by an include keyword. + +;; It uses two helper functions: `org-export-get-file-contents' +;; returns contents of a file according to parameters specified in the +;; keyword while `org-export-parse-included-file' parses the file +;; specified by it. + +(defun org-export-included-file (keyword backend info) + "Transcode file specified with include KEYWORD. + +KEYWORD is the include keyword element transcoded. BACKEND is +the language back-end used for transcoding. INFO is the plist +used as a communication channel. + +This function updates `:included-files' and `:headline-offset' +properties. + +Return the transcoded string." + (let ((data (org-export-parse-included-file keyword info)) + (file (let ((value (org-element-get-property :value keyword))) + (and (string-match "^\"\\(\\S-+\\)\"" value) + (match-string 1 value))))) + (org-element-normalize-string + (org-export-data + data backend + (org-combine-plists + info + ;; Store full path of already included files to avoid + ;; recursive file inclusion. + `(:included-files + ,(cons (expand-file-name file) (plist-get info :included-files)) + ;; Ensure that a top-level headline in the included + ;; file becomes a direct child of the current headline + ;; in the buffer. + :headline-offset + ,(- (+ (plist-get (plist-get info :inherited-properties) :level) + (plist-get info :headline-offset)) + (1- (org-export-get-min-level data info))))))))) + +(defun org-export-get-file-contents (file &optional lines) + "Get the contents of FILE and return them as a string. +When optional argument LINES is a string specifying a range of +lines, include only those lines." + (with-temp-buffer + (insert-file-contents file) + (when lines + (let* ((lines (split-string lines "-")) + (lbeg (string-to-number (car lines))) + (lend (string-to-number (cadr lines))) + (beg (if (zerop lbeg) (point-min) + (goto-char (point-min)) + (forward-line (1- lbeg)) + (point))) + (end (if (zerop lend) (point-max) + (goto-char (point-min)) + (forward-line (1- lend)) + (point)))) + (narrow-to-region beg end))) + (buffer-string))) + +(defun org-export-parse-included-file (keyword info) + "Parse file specified by include KEYWORD. + +KEYWORD is the include keyword element transcoded. BACKEND is the +language back-end used for transcoding. INFO is the plist used as +a communication channel. + +Return the parsed tree." + (let* ((value (org-element-get-property :value keyword)) + (file (and (string-match "^\"\\(\\S-+\\)\"" value) + (prog1 (match-string 1 value) + (setq value (replace-match "" nil nil value))))) + (lines (and (string-match + ":lines +\"\\(\\(?:[0-9]+\\)?-\\(?:[0-9]+\\)?\\)\"" value) + (prog1 (match-string 1 value) + (setq value (replace-match "" nil nil value))))) + (env (cond ((string-match "\\" value) "example") + ((string-match "\\ link-begin (nth 1 head)) + (<= link-end (nth 2 head))) + collect (cons (nth 1 head) (nth 2 head))))) + (loop named main for ancestor in (nreverse ancestors) do + (loop for candidate in cands + when (and (>= (car candidate) (car ancestor)) + (<= (cdr candidate) (cdr ancestor))) + do (return-from main (car candidate)))))) + ;; No candidate have a common ancestor with link: First match + ;; will do. Return its beginning position. + (t (caar cands))))))) + + +;;;; For Macros + +;; `org-export-expand-macro' simply takes care of expanding macros. + +(defun org-export-expand-macro (macro info) + "Expand MACRO and return it as a string. +INFO is a plist holding export options." + (let* ((key (org-element-get-property :key macro)) + (args (org-element-get-property :args macro)) + (value (plist-get info (intern (format ":macro-%s" key))))) + ;; Replace arguments in VALUE. + (let ((s 0) n) + (while (string-match "\\$\\([0-9]+\\)" value s) + (setq s (1+ (match-beginning 0)) + n (string-to-number (match-string 1 value))) + (and (>= (length args) n) + (setq value (replace-match (nth (1- n) args) t t value))))) + ;; VALUE starts with "(eval": it is a s-exp, `eval' it. + (when (string-match "\\`(eval\\>" value) + (setq value (eval (read value)))) + ;; Return expanded string. + (format "%s" value))) + + +;;;; For Src-Blocks + +;; `org-export-handle-code' takes care of line numbering and reference +;; cleaning in source code, when appropriate. It also updates global +;; LOC count (`:total-loc' property) and code references alist +;; (`:code-refs' property). + +(defun org-export-handle-code (code switches info + &optional language num-fmt ref-fmt) + "Handle line numbers and code references in CODE. + +CODE is the string to process. SWITCHES is the option string +determining which changes will be applied to CODE. INFO is the +plist used as a communication channel during export. + +Optional argument LANGUAGE, when non-nil, is a string specifying +code's language. + +If optional argument NUM-FMT is a string, it will be used as +a format string for numbers at beginning of each line. + +If optional argument REF-FMT is a string, it will be used as +a format string for each line of code containing a reference. + +Update the following INFO properties by side-effect: `:total-loc' +and `:code-refs'. + +Return new code as a string." + (let* ((switches (or switches "")) + (numberp (string-match "[-+]n\\>" switches)) + (continuep (string-match "\\+n\\>" switches)) + (total-LOC (if (and numberp (not continuep)) + 0 + (or (plist-get info :total-loc) 0))) + (preserve-indent-p (or org-src-preserve-indentation + (string-match "-i\\>" switches))) + (replace-labels (when (string-match "-r\\>" switches) + (if (string-match "-k\\>" switches) 'keep t))) + ;; Get code and clean it. Remove blank lines at its + ;; beginning and end. Also remove protective commas. + (code (let ((c (replace-regexp-in-string + "\\`\\([ \t]*\n\\)+" "" + (replace-regexp-in-string + "\\(:?[ \t]*\n\\)*[ \t]*\\'" "\n" code)))) + ;; If appropriate, remove global indentation. + (unless preserve-indent-p (setq c (org-remove-indentation c))) + ;; Free up the protected lines. Note: Org blocks + ;; have commas at the beginning or every line. + (if (string= language "org") + (replace-regexp-in-string "^," "" c) + (replace-regexp-in-string + "^\\(,\\)\\(:?\\*\\|[ \t]*#\\+\\)" "" c nil nil 1)))) + ;; Split code to process it line by line. + (code-lines (org-split-string code "\n")) + ;; Ensure line numbers will be correctly padded before + ;; applying the format string. + (num-fmt (format (if (stringp num-fmt) num-fmt "%s: ") + (format "%%%ds" + (length (number-to-string + (+ (length code-lines) + total-LOC)))))) + ;; Get format used for references. + (label-fmt (or (and (string-match "-l +\"\\([^\"\n]+\\)\"" switches) + (match-string 1 switches)) + org-coderef-label-format)) + ;; Build a regexp matching a loc with a reference. + (with-ref-re (format "^.*?\\S-.*?\\([ \t]*\\(%s\\)\\)[ \t]*$" + (replace-regexp-in-string + "%s" "\\([-a-zA-Z0-9_ ]+\\)" label-fmt nil t))) + coderefs) + (org-element-normalize-string + (mapconcat (lambda (loc) + ;; Maybe add line number to current line of code + ;; (LOC). + (when numberp + (setq loc (concat (format num-fmt (incf total-LOC)) loc))) + ;; Take action if at a ref line. + (when (string-match with-ref-re loc) + (let ((ref (match-string 3 loc))) + (setq loc + (cond + ;; Option "-k": don't remove labels. Use + ;; numbers for references when lines are + ;; numbered, use labels otherwise. + ((eq replace-labels 'keep) + (let ((full-ref (format "(%s)" ref))) + (push (cons ref (if numberp total-LOC full-ref)) + coderefs) + (replace-match full-ref nil nil loc 2)) + (replace-match (format "(%s)" ref) nil nil loc 2)) + ;; Option "-r" without "-k": remove labels. + ;; Use numbers for references when lines are + ;; numbered, use labels otherwise. + (replace-labels + (push (cons ref (if numberp total-LOC ref)) + coderefs) + (replace-match "" nil nil loc 1)) + ;; Else: don't remove labels and don't use + ;; numbers for references. + (t + (let ((full-ref (format "(%s)" ref))) + (push (cons ref full-ref) coderefs) + (replace-match full-ref nil nil loc 2))))))) + ;; If REF-FMT is defined, apply it to current LOC. + (when (stringp ref-fmt) (setq loc (format ref-fmt loc))) + ;; Update by side-effect communication channel. + ;; Return updated LOC. + (setq info (org-export-set-property + (org-export-set-property + info :code-refs coderefs) + :total-loc total-LOC)) + loc) + code-lines "\n")))) + + +;;;; For Tables + +;; `org-export-table-format-info' extracts formatting information +;; (alignment, column groups and presence of a special column) from +;; a raw table and returns it as a property list. +;; +;; `org-export-clean-table' cleans the raw table from any Org +;; table-specific syntax. + +(defun org-export-table-format-info (table) + "Extract info from TABLE. +Return a plist whose properties and values are: +`:alignment' vector of strings among \"r\", \"l\" and \"c\", +`:column-groups' vector of symbols among `start', `end', `start-end', +`:row-groups' list of integers representing row groups. +`:special-column-p' non-nil if table has a special column. +`:width' vector of integers representing desired width of + current column, or nil." + (with-temp-buffer + (insert table) + (goto-char 1) + (org-table-align) + (let ((align (vconcat (mapcar (lambda (c) (if c "r" "l")) + org-table-last-alignment))) + (width (make-vector (length org-table-last-alignment) nil)) + (colgroups (make-vector (length org-table-last-alignment) nil)) + (row-group 0) + (rowgroups) + (special-column-p 'empty)) + (mapc (lambda (row) + (if (string-match "^[ \t]*|[-+]+|[ \t]*$" row) + (incf row-group) + (push row-group rowgroups) + ;; Determine if a special column is present by looking + ;; for special markers in the first column. More + ;; accurately, the first column is considered special + ;; if it only contains special markers and, maybe, + ;; empty cells. + (setq special-column-p + (cond + ((not special-column-p) nil) + ((string-match "^[ \t]*| *\\\\?\\([\#!$*_^]\\) *|" + row) 'special) + ((string-match "^[ \t]*| +|" row) special-column-p)))) + (cond + ;; Read forced alignment and width information, if any, + ;; and determine final alignment for the table. + ((org-table-cookie-line-p row) + (let ((col 0)) + (mapc (lambda (field) + (when (string-match "<\\([lrc]\\)\\([0-9]+\\)?>" field) + (aset align col (match-string 1 field)) + (aset width col (let ((w (match-string 2 field))) + (and w (string-to-number w))))) + (incf col)) + (org-split-string row "[ \t]*|[ \t]*")))) + ;; Read column groups information. + ((org-table-colgroup-line-p row) + (let ((col 0)) + (mapc (lambda (field) + (aset colgroups col + (cond ((string= "<" field) 'start) + ((string= ">" field) 'end) + ((string= "<>" field) 'start-end))) + (incf col)) + (org-split-string row "[ \t]*|[ \t]*")))))) + (org-split-string table "\n")) + ;; Return plist. + (list :alignment align + :column-groups colgroups + :row-groups (reverse rowgroups) + :special-column-p (eq special-column-p 'special) + :width width)))) + +(defun org-export-clean-table (table specialp) + "Clean string TABLE from its formatting elements. +Remove any row containing column groups or formatting cookies and +rows starting with a special marker. If SPECIALP is non-nil, +assume the table contains a special formatting column and remove +it also." + (let ((rows (org-split-string table "\n"))) + (mapconcat 'identity + (delq nil + (mapcar + (lambda (row) + (cond + ((org-table-colgroup-line-p row) nil) + ((org-table-cookie-line-p row) nil) + ;; Ignore rows starting with a special marker. + ((string-match "^[ \t]*| *[!_^/] *|" row) nil) + ;; Remove special column. + ((and specialp + (or (string-match "^\\([ \t]*\\)|-+\\+" row) + (string-match "^\\([ \t]*\\)|[^|]*|" row))) + (replace-match "\\1|" t nil row)) + (t row))) + rows)) + "\n"))) + + +;;;; For Tables Of Contents + +;; `org-export-get-headlines' builds a table of contents in the shape +;; of a nested list of cons cells whose car is headline's name and cdr +;; an unique identifier. One can then easily parse it and transcode +;; it in a back-end. Identifiers can be used to construct internal +;; links. + +;; Building lists of tables, figures or listings is quite similar. +;; Once the generic function `org-export-collect-elements' is defined, +;; `org-export-collect-tables', `org-export-collect-figures' and +;; `org-export-collect-listings' can be derived from it. + +(defun org-export-get-headlines (backend info &optional n) + "Build a table of contents. + +BACKEND is the back-end used to transcode headline's name. INFO +is a plist holding export options. + +When non-nil, optional argument N must be an integer. It +specifies the depth of the table of contents. + +Return an alist whose keys are headlines' name and value their +relative level and an unique identifier that might be used for +internal links. + +For example, on the following tree, where numbers in parens are +buffer position at beginning of the line: + +* Title 1 (1) +** Sub-title 1 (21) +** Sub-title 2 (42) +* Title 2 (62) + +the function will return: + +\(\(\"Title 1\" 1 1\) + \(\"Sub-title 1\" 2 21\) + \(\"Sub-title 2\" 2 42\) + \(\"Title 2\" 1 62\)\)" + (org-element-map + (plist-get info :parse-tree) + 'headline + (lambda (headline local-info) + ;; Get HEADLINE's relative level. + (let ((level (+ (or (plist-get local-info :headline-offset) 0) + (org-element-get-property :level headline)))) + (unless (and (wholenump n) (> level n)) + (list + (org-export-secondary-string + (org-element-get-property :title headline) backend info) + level + (org-element-get-property :begin headline))))) + info)) + +(defun org-export-collect-elements (type backend info) + "Collect named elements of type TYPE. + +Only elements with a caption or a name are collected. + +BACKEND is the back-end used to transcode their caption or name. +INFO is a plist holding export options. + +Return an alist where key is entry's name and value an unique +identifier that might be used for internal links." + (org-element-map + (plist-get info :parse-tree) + type + (lambda (element info) + (let ((entry + (cond + ((org-element-get-property :caption element) + (org-export-secondary-string + (org-element-get-property :caption element) backend info)) + ((org-element-get-property :name element) + (org-export-secondary-string + (org-element-get-property :name element) backend info))))) + ;; Skip elements with neither a caption nor a name. + (when entry (cons entry (org-element-get-property :begin element))))) + info)) + +(defun org-export-collect-tables (backend info) + "Build a list of tables. + +BACKEND is the back-end used to transcode table's name. INFO is +a plist holding export options. + +Return an alist where key is the caption of the table and value +an unique identifier that might be used for internal links." + (org-export-collect-elements 'table backend info)) + +(defun org-export-get-figures (backend info) + "Build a list of figures. + +A figure is a paragraph type element with a caption or a name. + +BACKEND is the back-end used to transcode headline's name. INFO +is a plist holding export options. + +Return an alist where key is the caption of the figure and value +an unique indentifier that might be used for internal links." + (org-export-collect-elements 'paragraph backend info)) + +(defun org-export-collect-listings (backend info) + "Build a list of src blocks. + +BACKEND is the back-end used to transcode src block's name. INFO +is a plist holding export options. + +Return an alist where key is the caption of the src block and +value an unique indentifier that might be used for internal +links." + (org-export-collect-elements 'src-block backend info)) + + +(provide 'org-export) +;;; org-export.el ends here diff -Nru org-mode-7.7/contrib/lisp/org-export-generic.el org-mode-7.8.02/contrib/lisp/org-export-generic.el --- org-mode-7.7/contrib/lisp/org-export-generic.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/contrib/lisp/org-export-generic.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,6 +1,6 @@ ;; org-export-generic.el --- Export frameworg with custom backends -;; Copyright (C) 2009 Free Software Foundation, Inc. +;; Copyright (C) 2009-2011 Free Software Foundation, Inc. ;; Author: Wes Hardaker ;; Keywords: outlines, hypermedia, calendar, wp, export @@ -87,7 +87,9 @@ ;; *** allow different open/closing prefixes ;; * properties ;; * drawers -;; * oh my +;; * Escape camel-case for wiki exporters. +;; * Adjust to depth limits on headers --- need to roll-over from headers +;; to lists, as per other exporters ;; * optmization (many plist extracts should be in let vars) ;; * define defcustom spec for the specifier list ;; * fonts: at least monospace is not handled at all here. @@ -187,8 +189,8 @@ ; section prefixes/suffixes can be direct strings or lists as well :body-section-prefix "\n" :body-section-suffix "\n" -; :body-section-prefix ("\n" "\n" "\n") -; :body-section-suffix ("\n" "\n" "\n") + ; :body-section-prefix ("\n" "\n" "\n") + ; :body-section-suffix ("\n" "\n" "\n") ; if preformated text should be included (eg, : prefixed) @@ -263,28 +265,28 @@ :body-header-section-numbers 3 :body-section-prefix "\n" -; :body-section-header-prefix "\n" -; :body-section-header-format "%s\n" -; :body-section-header-suffix (?\$ ?\# ?^ ?\~ ?\= ?\-) + ; :body-section-header-prefix "\n" + ; :body-section-header-format "%s\n" + ; :body-section-header-suffix (?\$ ?\# ?^ ?\~ ?\= ?\-) :body-section-header-prefix ("" "" "" "* " " + " " - ") :body-section-header-format "%s\n" :body-section-header-suffix (?~ ?= ?- "\n" "\n" "\n") -; :body-section-marker-prefix "" -; :body-section-marker-chars (?\$ ?\# ?^ ?\~ ?\= ?\-) -; :body-section-marker-suffix "\n" + ; :body-section-marker-prefix "" + ; :body-section-marker-chars (?\$ ?\# ?^ ?\~ ?\= ?\-) + ; :body-section-marker-suffix "\n" :body-line-export-preformated t :body-line-format "%s\n" :body-line-wrap 75 -; :body-text-prefix "\n" -; :body-text-suffix "\n" + ; :body-text-prefix "\n" + ; :body-text-suffix "\n" :body-bullet-list-prefix (?* ?+ ?-) -; :body-bullet-list-suffix (?* ?+ ?-) + ; :body-bullet-list-suffix (?* ?+ ?-) ) ;; @@ -322,47 +324,6 @@ :body-bullet-list-prefix ("* " "** " "*** " "**** " "***** ") ) - - ;; - ;; minimal html exporter - ;; - ("html" - ;; simple html output - :file-suffix ".html" - :key-binding ?h - - :header-prefix "" - - :title-format "

%s

\n\n" - - :date-export t - :date-format "
Date: %s
\n\n" - - :toc-export nil - - :body-header-section-numbers 3 - - :body-section-header-prefix ("

" "

" "

" - "

" "

" "
") - :body-section-header-format "%s" - :body-section-header-suffix ("
\n" "\n" "\n" - "\n" "\n" "\n") - - :body-section-prefix "\n" - :body-section-suffix "\n" -; :body-section-prefix ("\n" "\n" "\n") -; :body-section-suffix ("\n" "\n" "\n") - - :body-line-export-preformated t - :body-line-format "%s\n" - - :body-text-prefix "

\n" - :body-text-suffix "

\n" - - :body-bullet-list-prefix (?* ?+ ?-) -; :body-bullet-list-suffix (?* ?+ ?-) - ) - ;; ;; internet-draft .xml for xml2rfc exporter ;; @@ -429,6 +390,85 @@ :body-list-format "%s\n" ) + ("trac-wiki" + :file-suffix ".txt" + :key-binding ?T + + ;; lifted from wikipedia exporter + :header-prefix "" + :header-suffix "" + + :title-format "= %s =\n" + + :date-export nil + + :toc-export nil + + :body-header-section-numbers nil + :body-section-prefix "\n" + + :body-section-header-prefix (" == " " === " " ==== " + " ===== " ) + :body-section-header-suffix (" ==\n\n" " ===\n\n" " ====\n\n" + " =====\n\n" " ======\n\n" " =======\n\n") + + :body-line-export-preformated t ;; yes/no/maybe??? + :body-line-format "%s\n" + :body-line-wrap 75 + + :body-line-fixed-format " %s\n" + + :body-list-format " * %s\n" + :body-number-list-format " # %s\n" + ;; :body-list-prefix "LISTSTART" + ;; :body-list-suffix "LISTEND" + + ;; this is ignored! [2010/02/02:rpg] + :body-bullet-list-prefix ("* " "** " "*** " "**** " "***** ") + ) + ("tikiwiki" + :file-suffix ".txt" + :key-binding ?U + + ;; lifted from wikipedia exporter + :header-prefix "" + :header-suffix "" + + :title-format "-= %s =-\n" + + :date-export nil + + :toc-export nil + + :body-header-section-numbers nil + :body-section-prefix "\n" + + :body-section-header-prefix ("! " "!! " "!!! " "!!!! " + "!!!!! " "!!!!!! " "!!!!!!! ") + :body-section-header-suffix (" \n" " \n" " \n" + " \n" " \n" " \n") + + + :body-line-export-preformated t ;; yes/no/maybe??? + :body-line-format "%s " + :body-line-wrap nil + + :body-line-fixed-format " %s\n" + + :body-list-format "* %s\n" + :body-number-list-format "# %s\n" + ;; :body-list-prefix "LISTSTART" + ;; :body-list-suffix "LISTEND" + :blockquote-start "\n^\n" + :blockquote-end "^\n\n" + :body-newline-paragraph "\n" + :bold-format "__%s__" + :italic-format "''%s''" + :underline-format "===%s===" + :strikethrough-format "--%s--" + :code-format "-+%s+-" + :verbatim-format "~pp~%s~/pp~" + ) ) "A assoc list of property lists to specify export definitions" ) @@ -617,6 +657,7 @@ (buffer-substring (if (org-region-active-p) (region-beginning) (point-min)) (if (org-region-active-p) (region-end) (point-max)))) + (org-export-current-backend 'org-export-generic) (lines (org-split-string (org-export-preprocess-string region diff -Nru org-mode-7.7/contrib/lisp/org-git-link.el org-mode-7.8.02/contrib/lisp/org-git-link.el --- org-mode-7.7/contrib/lisp/org-git-link.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/contrib/lisp/org-git-link.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,6 +1,6 @@ ;;; org-git-link.el --- Provide org links to specific file version -;; Copyright (C) 2009 Reimar Finken +;; Copyright (C) 2009-2011 Reimar Finken ;; Author: Reimar Finken ;; Keywords: files, calendar, hypermedia @@ -216,4 +216,5 @@ (buffer-substring 12 (1- (point-max))))))) ; to strip off final newline (provide 'org-git-link) + ;;; org-git-link.el ends here diff -Nru org-mode-7.7/contrib/lisp/org-interactive-query.el org-mode-7.8.02/contrib/lisp/org-interactive-query.el --- org-mode-7.7/contrib/lisp/org-interactive-query.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/contrib/lisp/org-interactive-query.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,11 +1,13 @@ ;;; org-interactive-query.el --- Interactive modification of agenda query ;; -;; Copyright 2007 Free Software Foundation, Inc. +;; Copyright 2007-2011 Free Software Foundation, Inc. ;; ;; Author: Christopher League ;; Version: 1.0 ;; Keywords: org, wp ;; +;; This file is not part of GNU Emacs. +;; ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 3, or (at your option) @@ -307,4 +309,4 @@ (interactive) (org-agenda-query-generic-cmd "-")) -(provide 'org-interactive-query) \ No newline at end of file +(provide 'org-interactive-query) diff -Nru org-mode-7.7/contrib/lisp/org-invoice.el org-mode-7.8.02/contrib/lisp/org-invoice.el --- org-mode-7.7/contrib/lisp/org-invoice.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/contrib/lisp/org-invoice.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,6 +1,8 @@ ;;; org-invoice.el --- Help manage client invoices in OrgMode ;; -;; Copyright (C) 2008 pmade inc. (Peter Jones pjones@pmade.com) +;; Copyright (C) 2008-2011 pmade inc. (Peter Jones pjones@pmade.com) +;; +;; This file is not part of GNU Emacs. ;; ;; Permission is hereby granted, free of charge, to any person obtaining ;; a copy of this software and associated documentation files (the diff -Nru org-mode-7.7/contrib/lisp/org-jira.el org-mode-7.8.02/contrib/lisp/org-jira.el --- org-mode-7.7/contrib/lisp/org-jira.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/contrib/lisp/org-jira.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,6 +1,6 @@ ;;; org-jira.el --- add a jira:ticket protocol to Org (defconst org-jira-version "0.1") -;; Copyright (c)2008 Jonathan Arkell. (by)(nc)(sa) Some rights reserved. +;; Copyright (C) 2008-2011 Jonathan Arkell. ;; Author: Jonathan Arkell ;; This file is not part of GNU Emacs. diff -Nru org-mode-7.7/contrib/lisp/org-learn.el org-mode-7.8.02/contrib/lisp/org-learn.el --- org-mode-7.7/contrib/lisp/org-learn.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/contrib/lisp/org-learn.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,7 +1,6 @@ ;;; org-learn.el --- Implements SuperMemo's incremental learning algorithm -;; Copyright (C) 2009 -;; Free Software Foundation, Inc. +;; Copyright (C) 2009-2011 Free Software Foundation, Inc. ;; Author: John Wiegley ;; Keywords: outlines, hypermedia, calendar, wp @@ -175,6 +174,4 @@ (provide 'org-learn) -;; arch-tag: a46bb0e5-e4fb-4004-a9b8-63933c55af33 - ;;; org-learn.el ends here diff -Nru org-mode-7.7/contrib/lisp/org-lparse.el org-mode-7.8.02/contrib/lisp/org-lparse.el --- org-mode-7.7/contrib/lisp/org-lparse.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/contrib/lisp/org-lparse.el 1970-01-01 00:00:00.000000000 +0000 @@ -1,2040 +0,0 @@ -;;; org-lparse.el --- Line-oriented parser-exporter for Org-mode - -;; Copyright (C) 2010, 2011 -;; Jambunathan - -;; Author: Jambunathan K -;; Keywords: outlines, hypermedia, calendar, wp -;; Homepage: http://orgmode.org -;; Version: 0.8 - -;; This file is not (yet) part of GNU Emacs. -;; However, it is distributed under the same license. - -;; GNU Emacs is free software: you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; GNU Emacs is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs. If not, see . -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; -;;; Commentary: - -;; `org-lparse' is the entry point for the generic line-oriented -;; exporter. `org-do-lparse' is the genericized version of the -;; original `org-export-as-html' routine. - -;; `org-lparse-native-backends' is a good starting point for -;; exploring the generic exporter. - -;; Following new interactive commands are provided by this library. -;; `org-lparse', `org-lparse-and-open', `org-lparse-to-buffer' -;; `org-replace-region-by', `org-lparse-region'. - -;; Note that the above routines correspond to the following routines -;; in the html exporter `org-export-as-html', -;; `org-export-as-html-and-open', `org-export-as-html-to-buffer', -;; `org-replace-region-by-html' and `org-export-region-as-html'. - -;; The new interactive command `org-lparse-convert' can be used to -;; convert documents between various formats. Use this to command, -;; for example, to convert odt file to doc or pdf format. - -;; See README.org file that comes with this library for answers to -;; FAQs and more information on using this library. - -;;; Code: - -(require 'org-exp) -(require 'org-list) - -;;;###autoload -(defun org-lparse-and-open (target-backend native-backend arg) - "Export the outline to TARGET-BACKEND via NATIVE-BACKEND and open exported file. -If there is an active region, export only the region. The prefix -ARG specifies how many levels of the outline should become -headlines. The default is 3. Lower levels will become bulleted -lists." - ;; (interactive "Mbackend: \nP") - (interactive - (let* ((input (if (featurep 'ido) 'ido-completing-read 'completing-read)) - (all-backends (org-lparse-all-backends)) - (target-backend - (funcall input "Export to: " all-backends nil t nil)) - (native-backend - (or - ;; (and (org-lparse-backend-is-native-p target-backend) - ;; target-backend) - (funcall input "Use Native backend: " - (cdr (assoc target-backend all-backends)) nil t nil)))) - (list target-backend native-backend current-prefix-arg))) - (let (f (file-or-buf (org-lparse target-backend native-backend - arg 'hidden))) - (when file-or-buf - (setq f (cond - ((bufferp file-or-buf) buffer-file-name) - ((file-exists-p file-or-buf) file-or-buf) - (t (error "org-lparse-and-open: This shouldn't happen")))) - (message "Opening file %s" f) - (org-open-file f) - (when org-export-kill-product-buffer-when-displayed - (kill-buffer (current-buffer)))))) - -;;;###autoload -(defun org-lparse-batch (target-backend &optional native-backend) - "Call the function `org-lparse'. -This function can be used in batch processing as: -emacs --batch - --load=$HOME/lib/emacs/org.el - --eval \"(setq org-export-headline-levels 2)\" - --visit=MyFile --funcall org-lparse-batch" - (setq native-backend (or native-backend target-backend)) - (org-lparse target-backend native-backend - org-export-headline-levels 'hidden)) - -;;;###autoload -(defun org-lparse-to-buffer (backend arg) - "Call `org-lparse' with output to a temporary buffer. -No file is created. The prefix ARG is passed through to -`org-lparse'." - (interactive "Mbackend: \nP") - (let ((tempbuf (format "*Org %s Export*" (upcase backend)))) - (org-lparse backend backend arg nil nil tempbuf) - (when org-export-show-temporary-export-buffer - (switch-to-buffer-other-window tempbuf)))) - -;;;###autoload -(defun org-replace-region-by (backend beg end) - "Assume the current region has org-mode syntax, and convert it to HTML. -This can be used in any buffer. For example, you could write an -itemized list in org-mode syntax in an HTML buffer and then use this -command to convert it." - (interactive "Mbackend: \nr") - (let (reg backend-string buf pop-up-frames) - (save-window-excursion - (if (org-mode-p) - (setq backend-string (org-lparse-region backend beg end t 'string)) - (setq reg (buffer-substring beg end) - buf (get-buffer-create "*Org tmp*")) - (with-current-buffer buf - (erase-buffer) - (insert reg) - (org-mode) - (setq backend-string (org-lparse-region backend (point-min) - (point-max) t 'string))) - (kill-buffer buf))) - (delete-region beg end) - (insert backend-string))) - -;;;###autoload -(defun org-lparse-region (backend beg end &optional body-only buffer) - "Convert region from BEG to END in org-mode buffer to HTML. -If prefix arg BODY-ONLY is set, omit file header, footer, and table of -contents, and only produce the region of converted text, useful for -cut-and-paste operations. -If BUFFER is a buffer or a string, use/create that buffer as a target -of the converted HTML. If BUFFER is the symbol `string', return the -produced HTML as a string and leave not buffer behind. For example, -a Lisp program could call this function in the following way: - - (setq html (org-lparse-region \"html\" beg end t 'string)) - -When called interactively, the output buffer is selected, and shown -in a window. A non-interactive call will only return the buffer." - (interactive "Mbackend: \nr\nP") - (when (org-called-interactively-p 'any) - (setq buffer (format "*Org %s Export*" (upcase backend)))) - (let ((transient-mark-mode t) (zmacs-regions t) - ext-plist rtn) - (setq ext-plist (plist-put ext-plist :ignore-subtree-p t)) - (goto-char end) - (set-mark (point)) ;; to activate the region - (goto-char beg) - (setq rtn (org-lparse backend backend nil nil ext-plist buffer body-only)) - (if (fboundp 'deactivate-mark) (deactivate-mark)) - (if (and (org-called-interactively-p 'any) (bufferp rtn)) - (switch-to-buffer-other-window rtn) - rtn))) - -(defvar org-lparse-par-open nil) - -(defun org-lparse-should-inline-p (filename descp) - "Return non-nil if link FILENAME should be inlined. -The decision to inline the FILENAME link is based on the current -settings. DESCP is the boolean of whether there was a link -description. See variables `org-export-html-inline-images' and -`org-export-html-inline-image-extensions'." - (let ((inline-images (org-lparse-get 'INLINE-IMAGES)) - (inline-image-extensions - (org-lparse-get 'INLINE-IMAGE-EXTENSIONS))) - (and (or (eq t inline-images) (and inline-images (not descp))) - (org-file-image-p filename inline-image-extensions)))) - -(defun org-lparse-format-org-link (line opt-plist) - "Return LINE with markup of Org mode links. -OPT-PLIST is the export options list." - (let ((start 0) - (current-dir (if buffer-file-name - (file-name-directory buffer-file-name) - default-directory)) - (link-validate (plist-get opt-plist :link-validation-function)) - type id-file fnc - rpl path attr desc descp desc1 desc2 link - org-lparse-link-description-is-image) - (while (string-match org-bracket-link-analytic-regexp++ line start) - (setq org-lparse-link-description-is-image nil) - (setq start (match-beginning 0)) - (setq path (save-match-data (org-link-unescape - (match-string 3 line)))) - (setq type (cond - ((match-end 2) (match-string 2 line)) - ((save-match-data - (or (file-name-absolute-p path) - (string-match "^\\.\\.?/" path))) - "file") - (t "internal"))) - (setq path (org-extract-attributes (org-link-unescape path))) - (setq attr (get-text-property 0 'org-attributes path)) - (setq desc1 (if (match-end 5) (match-string 5 line)) - desc2 (if (match-end 2) (concat type ":" path) path) - descp (and desc1 (not (equal desc1 desc2))) - desc (or desc1 desc2)) - ;; Make an image out of the description if that is so wanted - (when (and descp (org-file-image-p - desc (org-lparse-get 'INLINE-IMAGE-EXTENSIONS))) - (setq org-lparse-link-description-is-image t) - (save-match-data - (if (string-match "^file:" desc) - (setq desc (substring desc (match-end 0))))) - (save-match-data - (setq desc (org-add-props - (org-lparse-format 'INLINE-IMAGE desc) - '(org-protected t))))) - (cond - ((equal type "internal") - (let - ((frag-0 - (if (= (string-to-char path) ?#) - (substring path 1) - path))) - (setq rpl - (org-lparse-format - 'ORG-LINK opt-plist "" "" (org-solidify-link-text - (save-match-data - (org-link-unescape frag-0)) - nil) desc attr descp)))) - ((and (equal type "id") - (setq id-file (org-id-find-id-file path))) - ;; This is an id: link to another file (if it was the same file, - ;; it would have become an internal link...) - (save-match-data - (setq id-file (file-relative-name - id-file - (file-name-directory org-current-export-file))) - (setq rpl - (org-lparse-format - 'ORG-LINK opt-plist type id-file - (concat (if (org-uuidgen-p path) "ID-") path) - desc attr descp)))) - ((member type '("http" "https")) - ;; standard URL, can inline as image - (setq rpl - (org-lparse-format - 'ORG-LINK opt-plist type path nil desc attr descp))) - ((member type '("ftp" "mailto" "news")) - ;; standard URL, can't inline as image - (setq rpl - (org-lparse-format - 'ORG-LINK opt-plist type path nil desc attr descp))) - - ((string= type "coderef") - (setq rpl - (org-lparse-format - 'ORG-LINK opt-plist type "" (format "coderef-%s" path) - (format - (org-export-get-coderef-format - path - (and descp desc)) - (cdr (assoc path org-export-code-refs))) nil descp))) - - ((functionp (setq fnc (nth 2 (assoc type org-link-protocols)))) - ;; The link protocol has a function for format the link - (setq rpl - (save-match-data - (funcall fnc (org-link-unescape path) desc1 'html)))) - - ((string= type "file") - ;; FILE link - (save-match-data - (let* - ((components - (if - (string-match "::\\(.*\\)" path) - (list - (replace-match "" t nil path) - (match-string 1 path)) - (list path nil))) - - ;;The proper path, without a fragment - (path-1 - (first components)) - - ;;The raw fragment - (fragment-0 - (second components)) - - ;;Check the fragment. If it can't be used as - ;;target fragment we'll pass nil instead. - (fragment-1 - (if - (and fragment-0 - (not (string-match "^[0-9]*$" fragment-0)) - (not (string-match "^\\*" fragment-0)) - (not (string-match "^/.*/$" fragment-0))) - (org-solidify-link-text - (org-link-unescape fragment-0)) - nil)) - (desc-2 - ;;Description minus "file:" and ".org" - (if (string-match "^file:" desc) - (let - ((desc-1 (replace-match "" t t desc))) - (if (string-match "\\.org$" desc-1) - (replace-match "" t t desc-1) - desc-1)) - desc))) - - (setq rpl - (if - (and - (functionp link-validate) - (not (funcall link-validate path-1 current-dir))) - desc - (org-lparse-format - 'ORG-LINK opt-plist "file" path-1 fragment-1 - desc-2 attr descp)))))) - - (t - ;; just publish the path, as default - (setq rpl (concat "<" type ":" - (save-match-data (org-link-unescape path)) - ">")))) - (setq line (replace-match rpl t t line) - start (+ start (length rpl)))) - line)) - -(defmacro with-org-lparse-preserve-paragraph-state (&rest body) - `(let ((org-lparse-do-open-par org-lparse-par-open)) - (org-lparse-end-paragraph) - ,@body - (when org-lparse-do-open-par - (org-lparse-begin-paragraph)))) - -(defvar org-lparse-native-backends nil - "List of native backends registered with `org-lparse'. -A backend can use `org-lparse-register-backend' to add itself to -this list. - -All native backends must implement a get routine and a mandatory -set of callback routines. - -The get routine must be named as org--get where backend -is the name of the backend. The exporter uses `org-lparse-get' -and retrieves the backend-specific callback by querying for -ENTITY-CONTROL and ENTITY-FORMAT variables. - -For the sake of illustration, the html backend implements -`org-xhtml-get'. It returns -`org-xhtml-entity-control-callbacks-alist' and -`org-xhtml-entity-format-callbacks-alist' as the values of -ENTITY-CONTROL and ENTITY-FORMAT settings.") - -(defun org-lparse-register-backend (backend) - "Make BACKEND known to org-lparse library. -Add BACKEND to `org-lparse-native-backends'." - (when backend - (setq backend (cond - ((symbolp backend) (symbol-name backend)) - ((stringp backend) backend) - (t (error "Error while registering backend: %S" backend)))) - (add-to-list 'org-lparse-native-backends backend))) - -(defun org-lparse-get-other-backends (native-backend) - (org-lparse-backend-get native-backend 'OTHER-BACKENDS)) - -(defun org-lparse-all-backends () - (let (all-backends) - (flet ((add (other native) - (let ((val (assoc-string other all-backends t))) - (if val (setcdr val (nconc (list native) (cdr val))) - (push (cons other (list native)) all-backends))))) - (loop for backend in org-lparse-native-backends - do (loop for other in (org-lparse-get-other-backends backend) - do (add other backend)))) - all-backends)) - -(defun org-lparse-backend-is-native-p (backend) - (member backend org-lparse-native-backends)) - -(defun org-lparse (target-backend native-backend arg - &optional hidden ext-plist - to-buffer body-only pub-dir) - "Export the outline to various formats. -If there is an active region, export only the region. The outline -is first exported to NATIVE-BACKEND and optionally converted to -TARGET-BACKEND. See `org-lparse-native-backends' for list of -known native backends. Each native backend can specify a -converter and list of target backends it exports to using the -CONVERT-PROCESS and OTHER-BACKENDS settings of it's get -method. See `org-xhtml-get' for an illustrative example. - -ARG is a prefix argument that specifies how many levels of -outline should become headlines. The default is 3. Lower levels -will become bulleted lists. - -HIDDEN is obsolete and does nothing. - -EXT-PLIST is a property list that controls various aspects of -export. The settings here override org-mode's default settings -and but are inferior to file-local settings. - -TO-BUFFER dumps the exported lines to a buffer or a string -instead of a file. If TO-BUFFER is the symbol `string' return the -exported lines as a string. If TO-BUFFER is non-nil, create a -buffer with that name and export to that buffer. - -BODY-ONLY controls the presence of header and footer lines in -exported text. If BODY-ONLY is non-nil, don't produce the file -header and footer, simply return the content of ..., -without even the body tags themselves. - -PUB-DIR specifies the publishing directory." - (interactive - (let* ((input (if (featurep 'ido) 'ido-completing-read 'completing-read)) - (all-backends (org-lparse-all-backends)) - (target-backend - (funcall input "Export to: " all-backends nil t nil)) - (native-backend - (or - ;; (and (org-lparse-backend-is-native-p target-backend) - ;; target-backend) - (funcall input "Use Native backend: " - (cdr (assoc target-backend all-backends)) nil t nil)))) - (list target-backend native-backend current-prefix-arg))) - (let* ((org-lparse-backend (intern native-backend)) - (org-lparse-other-backend (intern target-backend))) - (unless (org-lparse-backend-is-native-p native-backend) - (error "Don't know how to export natively to backend %s" native-backend)) - (unless (or (not target-backend) - (equal target-backend native-backend) - (member target-backend (org-lparse-get 'OTHER-BACKENDS))) - (error "Don't know how to export to backend %s %s" target-backend - (format "via %s" native-backend))) - (run-hooks 'org-export-first-hook) - (org-do-lparse arg hidden ext-plist to-buffer body-only pub-dir))) - -(defcustom org-lparse-convert-process - '("soffice" "-norestore" "-invisible" "-headless" "\"macro:///BasicODConverter.Main.Convert(%I,%f,%O)\"") - "Command to covert a Org exported format to other formats. -The variable is an list of the form (PROCESS ARG1 ARG2 ARG3 -...). Format specifiers used in the ARGs are replaced as below. -%i input file name in full -%I input file name as a URL -%f format of the output file -%o output file name in full -%O output file name as a URL -%d output dir in full -%D output dir as a URL" - :group 'org-lparse) - -(defcustom org-lparse-use-flashy-warning nil - "Use flashy warnings when exporting to ODT." - :type 'boolean - :group 'org-export) - -(defun org-lparse-convert (&optional in-file fmt) - "Convert file from one format to another using a converter. -IN-FILE is the file to be converted. If unspecified, it defaults -to variable `buffer-file-name'. FMT is the desired output format. If the -backend has registered a CONVERT-METHOD via it's get function -then that converter is used. Otherwise -`org-export-conver-process' is used." - (interactive - (let* ((input (if (featurep 'ido) 'ido-completing-read 'completing-read)) - (in-file (read-file-name "File to be converted: " - nil buffer-file-name t)) - (fmt (funcall input "Output format: " - (or (ignore-errors - (org-lparse-get-other-backends - (file-name-extension in-file))) - (org-lparse-all-backends)) - nil nil nil))) - (list in-file fmt))) - (require 'browse-url) - (let* ((in-file (expand-file-name (or in-file buffer-file-name))) - (fmt (or fmt "doc") ) - (out-file (concat (file-name-sans-extension in-file) "." fmt)) - (out-dir (file-name-directory in-file)) - (backend (when (boundp 'org-lparse-backend) org-lparse-backend)) - (convert-process - (or (ignore-errors (org-lparse-backend-get backend 'CONVERT-METHOD)) - org-lparse-convert-process)) - program arglist) - - (setq program (and convert-process (consp convert-process) - (car convert-process))) - (unless (executable-find program) - (error "Unable to locate the converter %s" program)) - - (setq arglist - (mapcar (lambda (arg) - (format-spec arg `((?i . ,in-file) - (?I . ,(browse-url-file-url in-file)) - (?f . ,fmt) - (?o . ,out-file) - (?O . ,(browse-url-file-url out-file)) - (?d . ,out-dir) - (?D . ,(browse-url-file-url out-dir))))) - (cdr convert-process))) - (ignore-errors (delete-file out-file)) - - (message "Executing %s %s" program (mapconcat 'identity arglist " ")) - (apply 'call-process program nil nil nil arglist) - - (cond - ((file-exists-p out-file) - (message "Exported to %s using %s" out-file program) - out-file - ;; (set-buffer (find-file-noselect out-file)) - ) - (t - (message "Export to %s failed" out-file) - nil)))) - -(defvar org-lparse-insert-tag-with-newlines 'both) - -;; Following variables are let-bound during `org-lparse' -(defvar org-lparse-dyn-first-heading-pos) -(defvar org-lparse-toc) -(defvar org-lparse-entity-control-callbacks-alist) -(defvar org-lparse-entity-format-callbacks-alist) -(defvar org-lparse-backend nil - "The native backend to which the document is currently exported. -This variable is let bound during `org-lparse'. Valid values are -one of the symbols corresponding to `org-lparse-native-backends'. - -Compare this variable with `org-export-current-backend' which is -bound only during `org-export-preprocess-string' stage of the -export process. - -See also `org-lparse-other-backend'.") - -(defvar org-lparse-other-backend nil - "The target backend to which the document is currently exported. -This variable is let bound during `org-lparse'. This variable is -set to either `org-lparse-backend' or one of the symbols -corresponding to OTHER-BACKENDS specification of the -org-lparse-backend. - -For example, if a document is exported to \"odt\" then both -org-lparse-backend and org-lparse-other-backend are bound to -'odt. On the other hand, if a document is exported to \"odt\" -and then converted to \"doc\" then org-lparse-backend is set to -'odt and org-lparse-other-backend is set to 'doc.") - -(defvar org-lparse-body-only nil - "Bind this to BODY-ONLY arg of `org-lparse'.") - -(defvar org-lparse-to-buffer nil - "Bind this to TO-BUFFER arg of `org-lparse'.") - -(defun org-do-lparse (arg &optional hidden ext-plist - to-buffer body-only pub-dir) - "Export the outline to various formats. -See `org-lparse' for more information. This function is a -html-agnostic version of the `org-export-as-html' function in 7.5 -version." - ;; Make sure we have a file name when we need it. - (when (and (not (or to-buffer body-only)) - (not buffer-file-name)) - (if (buffer-base-buffer) - (org-set-local 'buffer-file-name - (with-current-buffer (buffer-base-buffer) - buffer-file-name)) - (error "Need a file name to be able to export"))) - - (org-lparse-warn - (format "Exporting to %s using org-lparse..." - (upcase (symbol-name - (or org-lparse-backend org-lparse-other-backend))))) - - (setq-default org-todo-line-regexp org-todo-line-regexp) - (setq-default org-deadline-line-regexp org-deadline-line-regexp) - (setq-default org-done-keywords org-done-keywords) - (setq-default org-maybe-keyword-time-regexp org-maybe-keyword-time-regexp) - (let* (org-lparse-encode-pending - org-lparse-par-open - org-lparse-outline-text-open - (org-lparse-latex-fragment-fallback ; currently used only by - ; odt exporter - (or (ignore-errors (org-lparse-get 'LATEX-FRAGMENT-FALLBACK)) - (if (and (org-check-external-command "latex" "" t) - (org-check-external-command "dvipng" "" t)) - 'dvipng - 'verbatim))) - (org-lparse-insert-tag-with-newlines 'both) - (org-lparse-to-buffer to-buffer) - (org-lparse-body-only body-only) - (org-lparse-entity-control-callbacks-alist - (org-lparse-get 'ENTITY-CONTROL)) - (org-lparse-entity-format-callbacks-alist - (org-lparse-get 'ENTITY-FORMAT)) - (opt-plist - (org-export-process-option-filters - (org-combine-plists (org-default-export-plist) - ext-plist - (org-infile-export-plist)))) - (body-only (or body-only (plist-get opt-plist :body-only))) - valid org-lparse-dyn-first-heading-pos - (odd org-odd-levels-only) - (region-p (org-region-active-p)) - (rbeg (and region-p (region-beginning))) - (rend (and region-p (region-end))) - (subtree-p - (if (plist-get opt-plist :ignore-subtree-p) - nil - (when region-p - (save-excursion - (goto-char rbeg) - (and (org-at-heading-p) - (>= (org-end-of-subtree t t) rend)))))) - (level-offset (if subtree-p - (save-excursion - (goto-char rbeg) - (+ (funcall outline-level) - (if org-odd-levels-only 1 0))) - 0)) - (opt-plist (setq org-export-opt-plist - (if subtree-p - (org-export-add-subtree-options opt-plist rbeg) - opt-plist))) - ;; The following two are dynamically scoped into other - ;; routines below. - (org-current-export-dir - (or pub-dir (org-lparse-get 'EXPORT-DIR opt-plist))) - (org-current-export-file buffer-file-name) - (level 0) (line "") (origline "") txt todo - (umax nil) - (umax-toc nil) - (filename (if to-buffer nil - (expand-file-name - (concat - (file-name-sans-extension - (or (and subtree-p - (org-entry-get (region-beginning) - "EXPORT_FILE_NAME" t)) - (file-name-nondirectory buffer-file-name))) - "." (org-lparse-get 'FILE-NAME-EXTENSION opt-plist)) - (file-name-as-directory - (or pub-dir (org-lparse-get 'EXPORT-DIR opt-plist)))))) - (current-dir (if buffer-file-name - (file-name-directory buffer-file-name) - default-directory)) - (buffer (if to-buffer - (cond - ((eq to-buffer 'string) - (get-buffer-create (org-lparse-get 'EXPORT-BUFFER-NAME))) - (t (get-buffer-create to-buffer))) - (find-file-noselect - (or (let ((f (org-lparse-get 'INIT-METHOD))) - (and f (functionp f) (funcall f filename))) - filename)))) - (org-levels-open (make-vector org-level-max nil)) - (date (plist-get opt-plist :date)) - (date (cond - ((and date (string-match "%" date)) - (format-time-string date)) - (date date) - (t (format-time-string "%Y-%m-%d %T %Z")))) - (dummy (setq opt-plist (plist-put opt-plist :effective-date date))) - (title (org-xml-encode-org-text-skip-links - (or (and subtree-p (org-export-get-title-from-subtree)) - (plist-get opt-plist :title) - (and (not body-only) - (not - (plist-get opt-plist :skip-before-1st-heading)) - (org-export-grab-title-from-buffer)) - (and buffer-file-name - (file-name-sans-extension - (file-name-nondirectory buffer-file-name))) - "UNTITLED"))) - (dummy (setq opt-plist (plist-put opt-plist :title title))) - (html-table-tag (plist-get opt-plist :html-table-tag)) - (quote-re0 (concat "^[ \t]*" org-quote-string "\\>")) - (quote-re (concat "^\\(\\*+\\)\\([ \t]+" org-quote-string "\\>\\)")) - (org-lparse-dyn-current-environment nil) - ;; Get the language-dependent settings - (lang-words (or (assoc (plist-get opt-plist :language) - org-export-language-setup) - (assoc "en" org-export-language-setup))) - (dummy (setq opt-plist (plist-put opt-plist :lang-words lang-words))) - (head-count 0) cnt - (start 0) - (coding-system-for-write - (or (ignore-errors (org-lparse-get 'CODING-SYSTEM-FOR-WRITE)) - (and (boundp 'buffer-file-coding-system) - buffer-file-coding-system))) - (save-buffer-coding-system - (or (ignore-errors (org-lparse-get 'CODING-SYSTEM-FOR-SAVE)) - (and (boundp 'buffer-file-coding-system) - buffer-file-coding-system))) - (region - (buffer-substring - (if region-p (region-beginning) (point-min)) - (if region-p (region-end) (point-max)))) - (org-export-have-math nil) - (org-export-footnotes-seen nil) - (org-export-footnotes-data (org-footnote-all-labels 'with-defs)) - (org-footnote-insert-pos-for-preprocessor 'point-min) - (lines - (org-split-string - (org-export-preprocess-string - region - :emph-multiline t - :for-backend (if (equal org-lparse-backend 'xhtml) ; hack - 'html - org-lparse-backend) - :skip-before-1st-heading - (plist-get opt-plist :skip-before-1st-heading) - :drawers (plist-get opt-plist :drawers) - :todo-keywords (plist-get opt-plist :todo-keywords) - :tasks (plist-get opt-plist :tasks) - :tags (plist-get opt-plist :tags) - :priority (plist-get opt-plist :priority) - :footnotes (plist-get opt-plist :footnotes) - :timestamps (plist-get opt-plist :timestamps) - :archived-trees - (plist-get opt-plist :archived-trees) - :select-tags (plist-get opt-plist :select-tags) - :exclude-tags (plist-get opt-plist :exclude-tags) - :add-text - (plist-get opt-plist :text) - :LaTeX-fragments - (plist-get opt-plist :LaTeX-fragments)) - "[\r\n]")) - table-open - table-buffer table-orig-buffer - ind - rpl path attr desc descp desc1 desc2 link - snumber fnc - footnotes footref-seen - org-lparse-output-buffer - org-lparse-footnote-definitions - org-lparse-footnote-number - org-lparse-footnote-buffer - org-lparse-toc - href - ) - - (let ((inhibit-read-only t)) - (org-unmodified - (remove-text-properties (point-min) (point-max) - '(:org-license-to-kill t)))) - - (message "Exporting...") - (org-init-section-numbers) - - ;; Switch to the output buffer - (setq org-lparse-output-buffer buffer) - (set-buffer org-lparse-output-buffer) - (let ((inhibit-read-only t)) (erase-buffer)) - (fundamental-mode) - (org-install-letbind) - - (and (fboundp 'set-buffer-file-coding-system) - (set-buffer-file-coding-system coding-system-for-write)) - - (let ((case-fold-search nil) - (org-odd-levels-only odd)) - ;; create local variables for all options, to make sure all called - ;; functions get the correct information - (mapc (lambda (x) - (set (make-local-variable (nth 2 x)) - (plist-get opt-plist (car x)))) - org-export-plist-vars) - (setq umax (if arg (prefix-numeric-value arg) - org-export-headline-levels)) - (setq umax-toc (if (integerp org-export-with-toc) - (min org-export-with-toc umax) - umax)) - - (when (and org-export-with-toc (not body-only)) - (setq lines (org-lparse-prepare-toc - lines level-offset opt-plist umax-toc))) - - (unless body-only - (org-lparse-begin 'DOCUMENT-CONTENT opt-plist) - (org-lparse-begin 'DOCUMENT-BODY opt-plist)) - - (setq head-count 0) - (org-init-section-numbers) - - (org-lparse-begin-paragraph) - - (while (setq line (pop lines) origline line) - (catch 'nextline - (when (and (org-lparse-current-environment-p 'quote) - (string-match org-outline-regexp-bol line)) - (org-lparse-end-environment 'quote)) - - (when (org-lparse-current-environment-p 'quote) - (org-lparse-insert 'LINE line) - (throw 'nextline nil)) - - ;; Fixed-width, verbatim lines (examples) - (when (and org-export-with-fixed-width - (string-match "^[ \t]*:\\(\\([ \t]\\|$\\)\\(.*\\)\\)" line)) - (when (not (org-lparse-current-environment-p 'fixedwidth)) - (org-lparse-begin-environment 'fixedwidth)) - (org-lparse-insert 'LINE (match-string 3 line)) - (when (or (not lines) - (not (string-match "^[ \t]*:\\(\\([ \t]\\|$\\)\\(.*\\)\\)" - (car lines)))) - (org-lparse-end-environment 'fixedwidth)) - (throw 'nextline nil)) - - ;; Notes: The baseline version of org-html.el (git commit - ;; 3d802e), while encoutering a *line-long* protected text, - ;; does one of the following two things based on the state - ;; of the export buffer. - - ;; 1. If a paragraph element has just been opened and - ;; contains only whitespace as content, insert the - ;; protected text as part of the previous paragraph. - - ;; 2. If the paragraph element has already been opened and - ;; contains some valid content insert the protected text - ;; as part of the current paragraph. - - ;; I think ---> - - ;; Scenario 1 mentioned above kicks in when a block of - ;; protected text has to be inserted enbloc. For example, - ;; this happens, when inserting an source or example block - ;; or preformatted content enclosed in #+backend, - ;; #+begin_bakend ... #+end_backend) - - ;; Scenario 2 mentioned above kicks in when the protected - ;; text is part of a running sentence. For example this - ;; happens in the case of an *multiline* LaTeX equation that - ;; needs to be inserted verbatim. - - ;; org-html.el in the master branch seems to do some - ;; jugglery by moving paragraphs around. Inorder to make - ;; these changes backend-agnostic introduce a new text - ;; property org-native-text and impose the added semantics - ;; that these protected blocks appear outside of a - ;; conventional paragraph element. - ;; - ;; Extra Note: Check whether org-example and org-native-text - ;; are entirely equivalent. - - ;; Fixes bug reported by Christian Moe concerning verbatim - ;; LaTeX fragments. - ;; on git commit 533ba3f90250a1f25f494c390d639ea6274f235c - ;; http://repo.or.cz/w/org-mode/org-jambu.git/shortlog/refs/heads/staging - ;; See http://lists.gnu.org/archive/html/emacs-orgmode/2011-03/msg01379.html - - ;; Native Text - (when (and (get-text-property 0 'org-native-text line) - ;; Make sure it is the entire line that is protected - (not (< (or (next-single-property-change - 0 'org-native-text line) 10000) - (length line)))) - (let ((ind (get-text-property 0 'original-indentation line))) - (org-lparse-begin-environment 'native) - (org-lparse-insert 'LINE line) - (while (and lines - (or (= (length (car lines)) 0) - (not ind) - (equal ind (get-text-property - 0 'original-indentation (car lines)))) - (or (= (length (car lines)) 0) - (get-text-property 0 'org-native-text (car lines)))) - (org-lparse-insert 'LINE (pop lines))) - (org-lparse-end-environment 'native)) - (throw 'nextline nil)) - - ;; Protected HTML - (when (and (get-text-property 0 'org-protected line) - ;; Make sure it is the entire line that is protected - (not (< (or (next-single-property-change - 0 'org-protected line) 10000) - (length line)))) - (let ((ind (get-text-property 0 'original-indentation line))) - (org-lparse-insert 'LINE line) - (while (and lines - (or (= (length (car lines)) 0) - (not ind) - (equal ind (get-text-property - 0 'original-indentation (car lines)))) - (or (= (length (car lines)) 0) - (get-text-property 0 'org-protected (car lines)))) - (org-lparse-insert 'LINE (pop lines)))) - (throw 'nextline nil)) - - ;; Blockquotes, verse, and center - (when (string-match "^ORG-\\(.+\\)-\\(START\\|END\\)$" line) - (let* ((style (intern (downcase (match-string 1 line)))) - (f (cdr (assoc (match-string 2 line) - '(("START" . org-lparse-begin-environment) - ("END" . org-lparse-end-environment)))))) - (when (memq style '(blockquote verse center)) - (funcall f style) - (throw 'nextline nil)))) - - (run-hooks 'org-export-html-after-blockquotes-hook) - (when (org-lparse-current-environment-p 'verse) - (let ((i (org-get-string-indentation line))) - (if (> i 0) - (setq line (concat - (let ((org-lparse-encode-pending t)) - (org-lparse-format 'SPACES (* 2 i))) - " " (org-trim line)))) - (unless (string-match "\\\\\\\\[ \t]*$" line) - (setq line (concat line "\\\\"))))) - - ;; make targets to anchors - (setq start 0) - (while (string-match - "<<]*\\)>>>?\\((INVISIBLE)\\)?[ \t]*\n?" line start) - (cond - ((get-text-property (match-beginning 1) 'org-protected line) - (setq start (match-end 1))) - ((match-end 2) - (setq line (replace-match - (let ((org-lparse-encode-pending t)) - (org-lparse-format - 'ANCHOR "" (org-solidify-link-text - (match-string 1 line)))) - t t line))) - ((and org-export-with-toc (equal (string-to-char line) ?*)) - ;; FIXME: NOT DEPENDENT on TOC????????????????????? - (setq line (replace-match - (let ((org-lparse-encode-pending t)) - (org-lparse-format - 'FONTIFY (match-string 1 line) "target")) - ;; (concat "@" (match-string 1 line) "@ ") - t t line))) - (t - (setq line (replace-match - (concat - (let ((org-lparse-encode-pending t)) - (org-lparse-format - 'ANCHOR (match-string 1 line) - (org-solidify-link-text (match-string 1 line)) - "target")) " ") - t t line))))) - - (let ((org-lparse-encode-pending t)) - (setq line (org-lparse-handle-time-stamps line))) - - ;; replace "&" by "&", "<" and ">" by "<" and ">" - ;; handle @<..> HTML tags (replace "@>..<" by "<..>") - ;; Also handle sub_superscripts and checkboxes - (or (string-match org-table-hline-regexp line) - (string-match "^[ \t]*\\([+]-\\||[ ]\\)[-+ |]*[+|][ \t]*$" line) - (setq line (org-xml-encode-org-text-skip-links line))) - - (setq line (org-lparse-format-org-link line opt-plist)) - - ;; TODO items - (if (and (string-match org-todo-line-regexp line) - (match-beginning 2)) - (setq line (concat - (substring line 0 (match-beginning 2)) - (org-lparse-format 'TODO (match-string 2 line)) - (substring line (match-end 2))))) - - ;; Does this contain a reference to a footnote? - (when org-export-with-footnotes - (setq start 0) - (while (string-match "\\([^* \t].*?\\)[ \t]*\\[\\([0-9]+\\)\\]" line start) - ;; Discard protected matches not clearly identified as - ;; footnote markers. - (if (or (get-text-property (match-beginning 2) 'org-protected line) - (not (get-text-property (match-beginning 2) 'org-footnote line))) - (setq start (match-end 2)) - (let ((n (match-string 2 line)) refcnt a) - (if (setq a (assoc n footref-seen)) - (progn - (setcdr a (1+ (cdr a))) - (setq refcnt (cdr a))) - (setq refcnt 1) - (push (cons n 1) footref-seen)) - (setq line - (replace-match - (concat - (or (match-string 1 line) "") - (org-lparse-format - 'FOOTNOTE-REFERENCE - n (cdr (assoc n org-lparse-footnote-definitions)) - refcnt) - ;; If another footnote is following the - ;; current one, add a separator. - (if (save-match-data - (string-match "\\`\\[[0-9]+\\]" - (substring line (match-end 0)))) - (ignore-errors - (org-lparse-get 'FOOTNOTE-SEPARATOR)) - "")) - t t line)))))) - - (cond - ((string-match "^\\(\\*+\\)[ \t]+\\(.*\\)" line) - ;; This is a headline - (setq level (org-tr-level (- (match-end 1) (match-beginning 1) - level-offset)) - txt (match-string 2 line)) - (if (string-match quote-re0 txt) - (setq txt (replace-match "" t t txt))) - (if (<= level (max umax umax-toc)) - (setq head-count (+ head-count 1))) - (unless org-lparse-dyn-first-heading-pos - (setq org-lparse-dyn-first-heading-pos (point))) - (org-lparse-begin-level level txt umax head-count) - - ;; QUOTES - (when (string-match quote-re line) - (org-lparse-begin-environment 'quote))) - - ((and org-export-with-tables - (string-match "^\\([ \t]*\\)\\(|\\|\\+-+\\+\\)" line)) - (when (not table-open) - ;; New table starts - (setq table-open t table-buffer nil table-orig-buffer nil)) - - ;; Accumulate lines - (setq table-buffer (cons line table-buffer) - table-orig-buffer (cons origline table-orig-buffer)) - (when (or (not lines) - (not (string-match "^\\([ \t]*\\)\\(|\\|\\+-+\\+\\)" - (car lines)))) - (setq table-open nil - table-buffer (nreverse table-buffer) - table-orig-buffer (nreverse table-orig-buffer)) - (org-lparse-end-paragraph) - (org-lparse-insert 'TABLE table-buffer table-orig-buffer))) - - ;; Normal lines - - (t - ;; This line either is list item or end a list. - (when (get-text-property 0 'list-item line) - (setq line (org-lparse-export-list-line - line - (get-text-property 0 'list-item line) - (get-text-property 0 'list-struct line) - (get-text-property 0 'list-prevs line)))) - - ;; Horizontal line - (when (string-match "^[ \t]*-\\{5,\\}[ \t]*$" line) - (with-org-lparse-preserve-paragraph-state - (org-lparse-insert 'HORIZONTAL-LINE)) - (throw 'nextline nil)) - - ;; Empty lines start a new paragraph. If hand-formatted lists - ;; are not fully interpreted, lines starting with "-", "+", "*" - ;; also start a new paragraph. - (when (string-match "^ [-+*]-\\|^[ \t]*$" line) - (when org-lparse-footnote-number - (org-lparse-end-footnote-definition org-lparse-footnote-number) - (setq org-lparse-footnote-number nil)) - (org-lparse-begin-paragraph)) - - ;; Is this the start of a footnote? - (when org-export-with-footnotes - (when (and (boundp 'footnote-section-tag-regexp) - (string-match (concat "^" footnote-section-tag-regexp) - line)) - ;; ignore this line - (throw 'nextline nil)) - (when (string-match "^[ \t]*\\[\\([0-9]+\\)\\]" line) - (org-lparse-end-paragraph) - (setq org-lparse-footnote-number (match-string 1 line)) - (setq line (replace-match "" t t line)) - (org-lparse-begin-footnote-definition org-lparse-footnote-number))) - ;; Check if the line break needs to be conserved - (cond - ((string-match "\\\\\\\\[ \t]*$" line) - (setq line (replace-match - (org-lparse-format 'LINE-BREAK) - t t line))) - (org-export-preserve-breaks - (setq line (concat line (org-lparse-format 'LINE-BREAK))))) - - ;; Check if a paragraph should be started - (let ((start 0)) - (while (and org-lparse-par-open - (string-match "\\\\par\\>" line start)) - (error "FIXME") - ;; Leave a space in the

so that the footnote matcher - ;; does not see this. - (if (not (get-text-property (match-beginning 0) - 'org-protected line)) - (setq line (replace-match "

" t t line))) - (setq start (match-end 0)))) - - (org-lparse-insert 'LINE line))))) - - ;; Properly close all local lists and other lists - (when (org-lparse-current-environment-p 'quote) - (org-lparse-end-environment 'quote)) - - (org-lparse-end-level 1 umax) - - ;; the to close the last text-... div. - (when (and (> umax 0) org-lparse-dyn-first-heading-pos) - (org-lparse-end-outline-text-or-outline)) - - (org-lparse-end 'DOCUMENT-BODY opt-plist) - (unless body-only - (org-lparse-end 'DOCUMENT-CONTENT)) - - (unless (plist-get opt-plist :buffer-will-be-killed) - (set-auto-mode t)) - - (org-lparse-end 'EXPORT) - - (goto-char (point-min)) - (or (org-export-push-to-kill-ring - (upcase (symbol-name org-lparse-backend))) - (message "Exporting... done")) - - (cond - ((not to-buffer) - (let ((f (org-lparse-get 'SAVE-METHOD))) - (or (and f (functionp f) (funcall f filename opt-plist)) - (save-buffer))) - (or (when (and (boundp 'org-lparse-other-backend) - org-lparse-other-backend - (not (equal org-lparse-backend org-lparse-other-backend))) - (let ((org-lparse-convert-process (org-lparse-get 'CONVERT-METHOD))) - (when org-lparse-convert-process - (org-lparse-convert buffer-file-name - (symbol-name org-lparse-other-backend))))) - (current-buffer))) - ((eq to-buffer 'string) - (prog1 (buffer-substring (point-min) (point-max)) - (kill-buffer (current-buffer)))) - (t (current-buffer)))))) - -(defun org-lparse-format-table (lines olines) - "Retuns backend-specific code for org-type and table-type -tables." - (if (stringp lines) - (setq lines (org-split-string lines "\n"))) - (if (string-match "^[ \t]*|" (car lines)) - ;; A normal org table - (org-lparse-format-org-table lines nil) - ;; Table made by table.el - (or (org-lparse-format-table-table-using-table-generate-source - org-lparse-backend olines - (not org-export-prefer-native-exporter-for-tables)) - ;; We are here only when table.el table has NO col or row - ;; spanning and the user prefers using org's own converter for - ;; exporting of such simple table.el tables. - (org-lparse-format-table-table lines)))) - -(defun org-lparse-table-get-colalign-info (lines) - (let ((forced-aligns (org-find-text-property-in-string - 'org-forced-aligns (car lines)))) - (when (and forced-aligns org-table-clean-did-remove-column) - (setq forced-aligns - (mapcar (lambda (x) (cons (1- (car x)) (cdr x))) forced-aligns))) - - forced-aligns)) - -(defvar org-lparse-table-style) -(defvar org-lparse-table-ncols) -(defvar org-lparse-table-rownum) -(defvar org-lparse-table-is-styled) -(defvar org-lparse-table-begin-marker) -(defvar org-lparse-table-num-numeric-items-per-column) -(defvar org-lparse-table-colalign-info) -(defvar org-lparse-table-colalign-vector) - -;; Following variables are defined in org-table.el -(defvar org-table-number-fraction) -(defvar org-table-number-regexp) - -(defun org-lparse-do-format-org-table (lines &optional splice) - "Format a org-type table into backend-specific code. -LINES is a list of lines. Optional argument SPLICE means, do not -insert header and surrounding tags, just format the lines. -Optional argument NO-CSS means use XHTML attributes instead of CSS -for formatting. This is required for the DocBook exporter." - (require 'org-table) - ;; Get rid of hlines at beginning and end - (if (string-match "^[ \t]*|-" (car lines)) (setq lines (cdr lines))) - (setq lines (nreverse lines)) - (if (string-match "^[ \t]*|-" (car lines)) (setq lines (cdr lines))) - (setq lines (nreverse lines)) - (when org-export-table-remove-special-lines - ;; Check if the table has a marking column. If yes remove the - ;; column and the special lines - (setq lines (org-table-clean-before-export lines))) - - (let* ((caption (org-find-text-property-in-string 'org-caption (car lines))) - (caption (and caption (org-xml-encode-org-text caption))) - (label (org-find-text-property-in-string 'org-label (car lines))) - (org-lparse-table-colalign-info (org-lparse-table-get-colalign-info lines)) - (attributes (org-find-text-property-in-string 'org-attributes - (car lines))) - (head (and org-export-highlight-first-table-line - (delq nil (mapcar - (lambda (x) (string-match "^[ \t]*|-" x)) - (cdr lines))))) - (org-lparse-table-rownum -1) org-lparse-table-ncols i (cnt 0) - tbopen line fields - org-lparse-table-cur-rowgrp-is-hdr - org-lparse-table-rowgrp-open - org-lparse-table-num-numeric-items-per-column - org-lparse-table-colalign-vector n - org-lparse-table-rowgrp-info - org-lparse-table-begin-marker - (org-lparse-table-style 'org-table) - org-lparse-table-is-styled) - (cond - (splice - (setq org-lparse-table-is-styled nil) - (while (setq line (pop lines)) - (unless (string-match "^[ \t]*|-" line) - (insert - (org-lparse-format-table-row - (org-split-string line "[ \t]*|[ \t]*")) "\n")))) - (t - (setq org-lparse-table-is-styled t) - (org-lparse-begin 'TABLE caption label attributes) - (setq org-lparse-table-begin-marker (point)) - (org-lparse-begin-table-rowgroup head) - (while (setq line (pop lines)) - (cond - ((string-match "^[ \t]*|-" line) - (when lines (org-lparse-begin-table-rowgroup))) - (t - (insert - (org-lparse-format-table-row - (org-split-string line "[ \t]*|[ \t]*")) "\n")))) - (org-lparse-end 'TABLE-ROWGROUP) - (org-lparse-end-table))))) - -(defun org-lparse-format-org-table (lines &optional splice) - (with-temp-buffer - (org-lparse-do-format-org-table lines splice) - (buffer-substring-no-properties (point-min) (point-max)))) - -(defun org-lparse-do-format-table-table (lines) - "Format a table generated by table.el into backend-specific code. -This conversion does *not* use `table-generate-source' from table.el. -This has the advantage that Org-mode's HTML conversions can be used. -But it has the disadvantage, that no cell- or row-spanning is allowed." - (let (line field-buffer - (org-lparse-table-cur-rowgrp-is-hdr - org-export-highlight-first-table-line) - (caption nil) - (attributes nil) - (label nil) - (org-lparse-table-style 'table-table) - (org-lparse-table-is-styled nil) - fields org-lparse-table-ncols i (org-lparse-table-rownum -1) - (empty (org-lparse-format 'SPACES 1))) - (org-lparse-begin 'TABLE caption label attributes) - (while (setq line (pop lines)) - (cond - ((string-match "^[ \t]*\\+-" line) - (when field-buffer - (let ((org-export-table-row-tags '("" . "")) - ;; (org-export-html-table-use-header-tags-for-first-column nil) - ) - (insert (org-lparse-format-table-row field-buffer empty))) - (setq org-lparse-table-cur-rowgrp-is-hdr nil) - (setq field-buffer nil))) - (t - ;; Break the line into fields and store the fields - (setq fields (org-split-string line "[ \t]*|[ \t]*")) - (if field-buffer - (setq field-buffer (mapcar - (lambda (x) - (concat x (org-lparse-format 'LINE-BREAK) - (pop fields))) - field-buffer)) - (setq field-buffer fields))))) - (org-lparse-end-table))) - -(defun org-lparse-format-table-table (lines) - (with-temp-buffer - (org-lparse-do-format-table-table lines) - (buffer-substring-no-properties (point-min) (point-max)))) - -(defvar table-source-languages) ; defined in table.el -(defun org-lparse-format-table-table-using-table-generate-source (backend - lines - &optional - spanned-only) - "Format a table into BACKEND, using `table-generate-source' from table.el. -Use SPANNED-ONLY to suppress exporting of simple table.el tables. - -When SPANNED-ONLY is nil, all table.el tables are exported. When -SPANNED-ONLY is non-nil, only tables with either row or column -spans are exported. - -This routine returns the generated source or nil as appropriate. - -Refer docstring of `org-export-prefer-native-exporter-for-tables' -for further information." - (require 'table) - (with-current-buffer (get-buffer-create " org-tmp1 ") - (erase-buffer) - (insert (mapconcat 'identity lines "\n")) - (goto-char (point-min)) - (if (not (re-search-forward "|[^+]" nil t)) - (error "Error processing table")) - (table-recognize-table) - (when (or (not spanned-only) - (let* ((dim (table-query-dimension)) - (c (nth 4 dim)) (r (nth 5 dim)) (cells (nth 6 dim))) - (not (= (* c r) cells)))) - (with-current-buffer (get-buffer-create " org-tmp2 ") (erase-buffer)) - (cond - ((member backend table-source-languages) - (table-generate-source backend " org-tmp2 ") - (set-buffer " org-tmp2 ") - (buffer-substring (point-min) (point-max))) - (t - ;; table.el doesn't support the given backend. Currently this - ;; happens in case of odt export. Strip the table from the - ;; generated document. A better alternative would be to embed - ;; the table as ascii text in the output document. - (org-lparse-warn - (concat - "Found table.el-type table in the source org file. " - (format "table.el doesn't support %s backend. " - (upcase (symbol-name backend))) - "Skipping ahead ...")) - ""))))) - -(defun org-lparse-handle-time-stamps (s) - "Format time stamps in string S, or remove them." - (catch 'exit - (let (r b) - (while (string-match org-maybe-keyword-time-regexp s) - (or b (setq b (substring s 0 (match-beginning 0)))) - (setq r (concat - r (substring s 0 (match-beginning 0)) " " - (org-lparse-format - 'FONTIFY - (concat - (if (match-end 1) - (org-lparse-format - 'FONTIFY - (match-string 1 s) "timestamp-kwd")) - " " - (org-lparse-format - 'FONTIFY - (substring (org-translate-time (match-string 3 s)) 1 -1) - "timestamp")) - "timestamp-wrapper")) - s (substring s (match-end 0)))) - ;; Line break if line started and ended with time stamp stuff - (if (not r) - s - (setq r (concat r s)) - (unless (string-match "\\S-" (concat b s)) - (setq r (concat r (org-lparse-format 'LINE-BREAK)))) - r)))) - -(defun org-xml-encode-plain-text (s) - "Convert plain text characters to HTML equivalent. -Possible conversions are set in `org-export-html-protect-char-alist'." - (let ((cl (org-lparse-get 'PLAIN-TEXT-MAP)) c) - (while (setq c (pop cl)) - (let ((start 0)) - (while (string-match (car c) s start) - (setq s (replace-match (cdr c) t t s) - start (1+ (match-beginning 0)))))) - s)) - -(defun org-xml-encode-org-text-skip-links (string) - "Prepare STRING for HTML export. Apply all active conversions. -If there are links in the string, don't modify these." - (let* ((re (concat org-bracket-link-regexp "\\|" - (org-re "[ \t]+\\(:[[:alnum:]_@#%:]+:\\)[ \t]*$"))) - m s l res) - (while (setq m (string-match re string)) - (setq s (substring string 0 m) - l (match-string 0 string) - string (substring string (match-end 0))) - (push (org-xml-encode-org-text s) res) - (push l res)) - (push (org-xml-encode-org-text string) res) - (apply 'concat (nreverse res)))) - -(defun org-xml-encode-org-text (s) - "Apply all active conversions to translate special ASCII to HTML." - (setq s (org-xml-encode-plain-text s)) - (if org-export-html-expand - (while (string-match "@<\\([^&]*\\)>" s) - (setq s (replace-match "<\\1>" t nil s)))) - (if org-export-with-emphasize - (setq s (org-lparse-apply-char-styles s))) - (if org-export-with-special-strings - (setq s (org-lparse-convert-special-strings s))) - (if org-export-with-sub-superscripts - (setq s (org-lparse-apply-sub-superscript-styles s))) - (if org-export-with-TeX-macros - (let ((start 0) wd rep) - (while (setq start (string-match "\\\\\\([a-zA-Z]+[0-9]*\\)\\({}\\)?" - s start)) - (if (get-text-property (match-beginning 0) 'org-protected s) - (setq start (match-end 0)) - (setq wd (match-string 1 s)) - (if (setq rep (org-lparse-format 'ORG-ENTITY wd)) - (setq s (replace-match rep t t s)) - (setq start (+ start (length wd)))))))) - s) - -(defun org-lparse-convert-special-strings (string) - "Convert special characters in STRING to HTML." - (let ((all (org-lparse-get 'SPECIAL-STRING-REGEXPS)) - e a re rpl start) - (while (setq a (pop all)) - (setq re (car a) rpl (cdr a) start 0) - (while (string-match re string start) - (if (get-text-property (match-beginning 0) 'org-protected string) - (setq start (match-end 0)) - (setq string (replace-match rpl t nil string))))) - string)) - -(defun org-lparse-apply-sub-superscript-styles (string) - "Apply subscript and superscript styles to STRING. -Use `org-export-with-sub-superscripts' to control application of -sub and superscript styles." - (let (key c (s 0) (requireb (eq org-export-with-sub-superscripts '{}))) - (while (string-match org-match-substring-regexp string s) - (cond - ((and requireb (match-end 8)) (setq s (match-end 2))) - ((get-text-property (match-beginning 2) 'org-protected string) - (setq s (match-end 2))) - (t - (setq s (match-end 1) - key (if (string= (match-string 2 string) "_") - 'subscript 'superscript) - c (or (match-string 8 string) - (match-string 6 string) - (match-string 5 string)) - string (replace-match - (concat (match-string 1 string) - (org-lparse-format 'FONTIFY c key)) - t t string))))) - (while (string-match "\\\\\\([_^]\\)" string) - (setq string (replace-match (match-string 1 string) t t string))) - string)) - -(defvar org-lparse-char-styles - `(("*" bold) - ("/" emphasis) - ("_" underline) - ("=" code) - ("~" verbatim) - ("+" strike)) - "Map Org emphasis markers to char styles. -This is an alist where each element is of the -form (ORG-EMPHASIS-CHAR . CHAR-STYLE).") - -(defun org-lparse-apply-char-styles (string) - "Apply char styles to STRING. -The variable `org-lparse-char-styles' controls how the Org -emphasis markers are interpreted." - (let ((s 0) rpl) - (while (string-match org-emph-re string s) - (if (not (equal - (substring string (match-beginning 3) (1+ (match-beginning 3))) - (substring string (match-beginning 4) (1+ (match-beginning 4))))) - (setq s (match-beginning 0) - rpl - (concat - (match-string 1 string) - (org-lparse-format - 'FONTIFY (match-string 4 string) - (nth 1 (assoc (match-string 3 string) - org-lparse-char-styles))) - (match-string 5 string)) - string (replace-match rpl t t string) - s (+ s (- (length rpl) 2))) - (setq s (1+ s)))) - string)) - -(defun org-lparse-export-list-line (line pos struct prevs) - "Insert list syntax in export buffer. Return LINE, maybe modified. - -POS is the item position or line position the line had before -modifications to buffer. STRUCT is the list structure. PREVS is -the alist of previous items." - (let* ((get-type - (function - ;; Translate type of list containing POS to "d", "o" or - ;; "u". - (lambda (pos struct prevs) - (let ((type (org-list-get-list-type pos struct prevs))) - (cond - ((eq 'ordered type) "o") - ((eq 'descriptive type) "d") - (t "u")))))) - (get-closings - (function - ;; Return list of all items and sublists ending at POS, in - ;; reverse order. - (lambda (pos) - (let (out) - (catch 'exit - (mapc (lambda (e) - (let ((end (nth 6 e)) - (item (car e))) - (cond - ((= end pos) (push item out)) - ((>= item pos) (throw 'exit nil))))) - struct)) - out))))) - ;; First close any previous item, or list, ending at POS. - (mapc (lambda (e) - (let* ((lastp (= (org-list-get-last-item e struct prevs) e)) - (first-item (org-list-get-list-begin e struct prevs)) - (type (funcall get-type first-item struct prevs))) - (org-lparse-end-paragraph) - ;; Ending for every item - (org-lparse-end-list-item type) - ;; We're ending last item of the list: end list. - (when lastp - (org-lparse-end 'LIST type) - (org-lparse-begin-paragraph)))) - (funcall get-closings pos)) - (cond - ;; At an item: insert appropriate tags in export buffer. - ((assq pos struct) - (string-match - (concat "[ \t]*\\(\\S-+[ \t]*\\)" - "\\(?:\\[@\\(?:start:\\)?\\([0-9]+\\|[A-Za-z]\\)\\][ \t]*\\)?" - "\\(?:\\(\\[[ X-]\\]\\)[ \t]+\\)?" - "\\(?:\\(.*\\)[ \t]+::\\(?:[ \t]+\\|$\\)\\)?" - "\\(.*\\)") line) - (let* ((checkbox (match-string 3 line)) - (desc-tag (or (match-string 4 line) "???")) - (body (or (match-string 5 line) "")) - (list-beg (org-list-get-list-begin pos struct prevs)) - (firstp (= list-beg pos)) - ;; Always refer to first item to determine list type, in - ;; case list is ill-formed. - (type (funcall get-type list-beg struct prevs)) - (counter (let ((count-tmp (org-list-get-counter pos struct))) - (cond - ((not count-tmp) nil) - ((string-match "[A-Za-z]" count-tmp) - (- (string-to-char (upcase count-tmp)) 64)) - ((string-match "[0-9]+" count-tmp) - count-tmp))))) - (when firstp - (org-lparse-end-paragraph) - (org-lparse-begin 'LIST type)) - - (let ((arg (cond ((equal type "d") desc-tag) - ((equal type "o") counter)))) - (org-lparse-begin 'LIST-ITEM type arg)) - - ;; If line had a checkbox, some additional modification is required. - (when checkbox - (setq body - (concat - (org-lparse-format - 'FONTIFY (concat - "[" - (cond - ((string-match "X" checkbox) "X") - ((string-match " " checkbox) - (org-lparse-format 'SPACES 1)) - (t "-")) - "]") - 'code) - " " - body))) - ;; Return modified line - body)) - ;; At a list ender: go to next line (side-effects only). - ((equal "ORG-LIST-END-MARKER" line) (throw 'nextline nil)) - ;; Not at an item: return line unchanged (side-effects only). - (t line)))) - -(defun org-lparse-bind-local-variables (opt-plist) - (mapc (lambda (x) - (set (make-local-variable (nth 2 x)) - (plist-get opt-plist (car x)))) - org-export-plist-vars)) - -(defvar org-lparse-table-rowgrp-open) -(defvar org-lparse-table-cur-rowgrp-is-hdr) -(defvar org-lparse-footnote-number) -(defvar org-lparse-footnote-definitions) -(defvar org-lparse-footnote-buffer) -(defvar org-lparse-output-buffer) - -(defcustom org-lparse-debug nil - "Enable or Disable logging of `org-lparse' callbacks. -The parameters passed to the backend-registered ENTITY-CONTROL -and ENTITY-FORMAT callbacks are logged as comment strings in the -exported buffer. (org-lparse-format 'COMMENT fmt args) is used -for logging. Customize this variable only if you are an expert -user. Valid values of this variable are: -nil : Disable logging -control : Log all invocations of `org-lparse-begin' and - `org-lparse-end' callbacks. -format : Log invocations of `org-lparse-format' callbacks. -t : Log all invocations of `org-lparse-begin', `org-lparse-end' - and `org-lparse-format' callbacks," - :group 'org-lparse - :type '(choice - (const :tag "Disable" nil) - (const :tag "Format callbacks" format) - (const :tag "Control callbacks" control) - (const :tag "Format and Control callbacks" t))) - -(defun org-lparse-begin (entity &rest args) - "Begin ENTITY in current buffer. ARGS is entity specific. -ENTITY can be one of PARAGRAPH, LIST, LIST-ITEM etc. - -Use (org-lparse-begin 'LIST \"o\") to begin a list in current -buffer. - -See `org-xhtml-entity-control-callbacks-alist' for more -information." - (when (and (member org-lparse-debug '(t control)) - (not (eq entity 'DOCUMENT-CONTENT))) - (insert (org-lparse-format 'COMMENT "%s BEGIN %S" entity args))) - - (let ((f (cadr (assoc entity org-lparse-entity-control-callbacks-alist)))) - (unless f (error "Unknown entity: %s" entity)) - (apply f args))) - -(defun org-lparse-end (entity &rest args) - "Close ENTITY in current buffer. ARGS is entity specific. -ENTITY can be one of PARAGRAPH, LIST, LIST-ITEM -etc. - -Use (org-lparse-end 'LIST \"o\") to close a list in current -buffer. - -See `org-xhtml-entity-control-callbacks-alist' for more -information." - (when (and (member org-lparse-debug '(t control)) - (not (eq entity 'DOCUMENT-CONTENT))) - (insert (org-lparse-format 'COMMENT "%s END %S" entity args))) - - (let ((f (caddr (assoc entity org-lparse-entity-control-callbacks-alist)))) - (unless f (error "Unknown entity: %s" entity)) - (apply f args))) - -(defun org-lparse-begin-paragraph (&optional style) - "Insert

, but first close previous paragraph if any." - (org-lparse-end-paragraph) - (org-lparse-begin 'PARAGRAPH style) - (setq org-lparse-par-open t)) - -(defun org-lparse-end-paragraph () - "Close paragraph if there is one open." - (when org-lparse-par-open - (org-lparse-end 'PARAGRAPH) - (setq org-lparse-par-open nil))) - -(defun org-lparse-end-list-item (&optional type) - "Close

  • if necessary." - (org-lparse-end-paragraph) - (org-lparse-end 'LIST-ITEM (or type "u"))) - -(defvar org-lparse-dyn-current-environment nil) -(defun org-lparse-begin-environment (style) - (assert (not org-lparse-dyn-current-environment) t) - (setq org-lparse-dyn-current-environment style) - (org-lparse-begin 'ENVIRONMENT style)) - -(defun org-lparse-end-environment (style) - (org-lparse-end 'ENVIRONMENT style) - - (assert (eq org-lparse-dyn-current-environment style) t) - (setq org-lparse-dyn-current-environment nil)) - -(defun org-lparse-current-environment-p (style) - (eq org-lparse-dyn-current-environment style)) - -(defun org-lparse-begin-footnote-definition (n) - (unless org-lparse-footnote-buffer - (setq org-lparse-footnote-buffer - (get-buffer-create "*Org HTML Export Footnotes*"))) - (set-buffer org-lparse-footnote-buffer) - (erase-buffer) - (setq org-lparse-insert-tag-with-newlines nil) - (org-lparse-begin 'FOOTNOTE-DEFINITION n)) - -(defun org-lparse-end-footnote-definition (n) - (org-lparse-end 'FOOTNOTE-DEFINITION n) - (setq org-lparse-insert-tag-with-newlines 'both) - (push (cons n (buffer-string)) org-lparse-footnote-definitions) - (set-buffer org-lparse-output-buffer)) - -(defun org-lparse-format (entity &rest args) - "Format ENTITY in backend-specific way and return it. -ARGS is specific to entity being formatted. - -Use (org-lparse-format 'HEADING \"text\" 1) to format text as -level 1 heading. - -See `org-xhtml-entity-format-callbacks-alist' for more information." - (when (and (member org-lparse-debug '(t format)) - (not (equal entity 'COMMENT))) - (insert (org-lparse-format 'COMMENT "%s: %S" entity args))) - (cond - ((consp entity) - (let ((text (pop args))) - (apply 'org-lparse-format 'TAGS entity text args))) - (t - (let ((f (cdr (assoc entity org-lparse-entity-format-callbacks-alist)))) - (unless f (error "Unknown entity: %s" entity)) - (apply f args))))) - -(defun org-lparse-insert (entity &rest args) - (insert (apply 'org-lparse-format entity args))) - -(defun org-lparse-prepare-toc (lines level-offset opt-plist umax-toc) - (let* ((quote-re0 (concat "^[ \t]*" org-quote-string "\\>")) - (org-min-level (org-get-min-level lines level-offset)) - (org-last-level org-min-level) - level) - (with-temp-buffer - (org-lparse-bind-local-variables opt-plist) - (erase-buffer) - (org-lparse-begin 'TOC (nth 3 (plist-get opt-plist :lang-words))) - (setq - lines - (mapcar - #'(lambda (line) - (when (and (string-match org-todo-line-regexp line) - (not (get-text-property 0 'org-protected line)) - (<= (setq level (org-tr-level - (- (match-end 1) (match-beginning 1) - level-offset))) - umax-toc)) - (let ((txt (save-match-data - (org-xml-encode-org-text-skip-links - (org-export-cleanup-toc-line - (match-string 3 line))))) - (todo (and - org-export-mark-todo-in-toc - (or (and (match-beginning 2) - (not (member (match-string 2 line) - org-done-keywords))) - (and (= level umax-toc) - (org-search-todo-below - line lines level))))) - tags) - ;; Check for targets - (while (string-match org-any-target-regexp line) - (setq line - (replace-match - (let ((org-lparse-encode-pending t)) - (org-lparse-format 'FONTIFY - (match-string 1 line) "target")) - t t line))) - (when (string-match - (org-re "[ \t]+:\\([[:alnum:]_@:]+\\):[ \t]*$") txt) - (setq tags (match-string 1 txt) - txt (replace-match "" t nil txt))) - (when (string-match quote-re0 txt) - (setq txt (replace-match "" t t txt))) - (while (string-match "<\\(<\\)+\\|>\\(>\\)+" txt) - (setq txt (replace-match "" t t txt))) - (org-lparse-format - 'TOC-ITEM - (let* ((snumber (org-section-number level)) - (href (replace-regexp-in-string - "\\." "-" (format "sec-%s" snumber))) - (href - (or - (cdr (assoc - href org-export-preferred-target-alist)) - href)) - (href (org-solidify-link-text href))) - (org-lparse-format 'TOC-ENTRY snumber todo txt tags href)) - level org-last-level) - (setq org-last-level level))) - line) - lines)) - (org-lparse-end 'TOC) - (setq org-lparse-toc (buffer-string)))) - lines) - -(defun org-lparse-format-table-row (fields &optional text-for-empty-fields) - (unless org-lparse-table-ncols - ;; first row of the table - (setq org-lparse-table-ncols (length fields)) - (when org-lparse-table-is-styled - (setq org-lparse-table-num-numeric-items-per-column - (make-vector org-lparse-table-ncols 0)) - (setq org-lparse-table-colalign-vector - (make-vector org-lparse-table-ncols nil)) - (let ((c -1)) - (while (< (incf c) org-lparse-table-ncols) - (let ((cookie (cdr (assoc (1+ c) org-lparse-table-colalign-info)))) - (setf (aref org-lparse-table-colalign-vector c) - (cond - ((string= cookie "l") "left") - ((string= cookie "r") "right") - ((string= cookie "c") "center") - (t nil)))))))) - (incf org-lparse-table-rownum) - (let ((i -1)) - (org-lparse-format - 'TABLE-ROW - (mapconcat - (lambda (x) - (when (and (string= x "") text-for-empty-fields) - (setq x text-for-empty-fields)) - (incf i) - (and org-lparse-table-is-styled - (< i org-lparse-table-ncols) - (string-match org-table-number-regexp x) - (incf (aref org-lparse-table-num-numeric-items-per-column i))) - (org-lparse-format 'TABLE-CELL x org-lparse-table-rownum i)) - fields "\n")))) - -(defun org-lparse-get (what &optional opt-plist) - "Query for value of WHAT for the current backend `org-lparse-backend'. -See also `org-lparse-backend-get'." - (if (boundp 'org-lparse-backend) - (org-lparse-backend-get (symbol-name org-lparse-backend) what opt-plist) - (error "org-lparse-backend is not bound yet"))) - -(defun org-lparse-backend-get (backend what &optional opt-plist) - "Query BACKEND for value of WHAT. -Dispatch the call to `org--user-get'. If that throws an -error, dispatch the call to `org--get'. See -`org-xhtml-get' for all known settings queried for by -`org-lparse' during the course of export." - (assert (stringp backend) t) - (unless (org-lparse-backend-is-native-p backend) - (error "Unknown native backend %s" backend)) - (let ((backend-get-method (intern (format "org-%s-get" backend))) - (backend-user-get-method (intern (format "org-%s-user-get" backend)))) - (cond - ((functionp backend-get-method) - (condition-case nil - (funcall backend-user-get-method what opt-plist) - (error (funcall backend-get-method what opt-plist)))) - (t - (error "Native backend %s doesn't define %s" backend backend-get-method))))) - -(defun org-lparse-insert-tag (tag &rest args) - (when (member org-lparse-insert-tag-with-newlines '(lead both)) - (insert "\n")) - (insert (apply 'format tag args)) - (when (member org-lparse-insert-tag-with-newlines '(trail both)) - (insert "\n"))) - -(defun org-lparse-get-targets-from-title (title) - (let* ((target (org-get-text-property-any 0 'target title)) - (extra-targets (assoc target org-export-target-aliases)) - (target (or (cdr (assoc target org-export-preferred-target-alist)) - target))) - (cons target (remove target extra-targets)))) - -(defun org-lparse-suffix-from-snumber (snumber) - (let* ((snu (replace-regexp-in-string "\\." "-" snumber)) - (href (cdr (assoc (concat "sec-" snu) - org-export-preferred-target-alist)))) - (org-solidify-link-text (or href snu)))) - -(defun org-lparse-begin-level (level title umax head-count) - "Insert a new LEVEL in HTML export. -When TITLE is nil, just close all open levels." - (org-lparse-end-level level umax) - (unless title (error "Why is heading nil")) - (let* ((targets (org-lparse-get-targets-from-title title)) - (target (car targets)) (extra-targets (cdr targets)) - (target (and target (org-solidify-link-text target))) - (extra-class (org-get-text-property-any 0 'html-container-class title)) - snumber tags level1 class) - (when (string-match (org-re "\\(:[[:alnum:]_@#%:]+:\\)[ \t]*$") title) - (setq tags (and org-export-with-tags (match-string 1 title))) - (setq title (replace-match "" t t title))) - (if (> level umax) - (progn - (if (aref org-levels-open (1- level)) - (org-lparse-end-list-item) - (aset org-levels-open (1- level) t) - (org-lparse-end-paragraph) - (org-lparse-begin 'LIST 'unordered)) - (org-lparse-begin - 'LIST-ITEM 'unordered target - (org-lparse-format 'HEADLINE title extra-targets tags))) - (aset org-levels-open (1- level) t) - (setq snumber (org-section-number level)) - (setq level1 (+ level (or (org-lparse-get 'TOPLEVEL-HLEVEL) 1) -1)) - (unless (= head-count 1) - (org-lparse-end-outline-text-or-outline)) - (org-lparse-begin-outline-and-outline-text - level1 snumber title tags target extra-targets extra-class) - (org-lparse-begin-paragraph)))) - -(defun org-lparse-end-level (level umax) - (org-lparse-end-paragraph) - (loop for l from org-level-max downto level - do (when (aref org-levels-open (1- l)) - ;; Terminate one level in HTML export - (if (<= l umax) - (org-lparse-end-outline-text-or-outline) - (org-lparse-end-list-item) - (org-lparse-end 'LIST 'unordered)) - (aset org-levels-open (1- l) nil)))) - -(defvar org-lparse-outline-text-open) -(defun org-lparse-begin-outline-and-outline-text (level1 snumber title tags - target extra-targets - extra-class) - (org-lparse-begin - 'OUTLINE level1 snumber title tags target extra-targets extra-class) - (org-lparse-begin-outline-text level1 snumber extra-class)) - -(defun org-lparse-end-outline-text-or-outline () - (cond - (org-lparse-outline-text-open - (org-lparse-end 'OUTLINE-TEXT) - (setq org-lparse-outline-text-open nil)) - (t (org-lparse-end 'OUTLINE)))) - -(defun org-lparse-begin-outline-text (level1 snumber extra-class) - (assert (not org-lparse-outline-text-open) t) - (setq org-lparse-outline-text-open t) - (org-lparse-begin 'OUTLINE-TEXT level1 snumber extra-class)) - -(defun org-lparse-html-list-type-to-canonical-list-type (ltype) - (cdr (assoc ltype '(("o" . ordered) - ("u" . unordered) - ("d" . description))))) - -(defvar org-lparse-table-rowgrp-info) -(defun org-lparse-begin-table-rowgroup (&optional is-header-row) - (push (cons (1+ org-lparse-table-rownum) :start) org-lparse-table-rowgrp-info) - (org-lparse-begin 'TABLE-ROWGROUP is-header-row)) - -(defun org-lparse-end-table () - (when org-lparse-table-is-styled - ;; column groups - (unless (car org-table-colgroup-info) - (setq org-table-colgroup-info - (cons :start (cdr org-table-colgroup-info)))) - - ;; column alignment - (let ((c -1)) - (mapc - (lambda (x) - (incf c) - (setf (aref org-lparse-table-colalign-vector c) - (or (aref org-lparse-table-colalign-vector c) - (if (> (/ (float x) (1+ org-lparse-table-rownum)) - org-table-number-fraction) - "right" "left")))) - org-lparse-table-num-numeric-items-per-column))) - (org-lparse-end 'TABLE)) - -(defvar org-lparse-encode-pending nil) - -(defun org-lparse-format-tags (tag text prefix suffix &rest args) - (cond - ((consp tag) - (concat prefix (apply 'format (car tag) args) text suffix - (format (cdr tag)))) - ((stringp tag) ; singleton tag - (concat prefix (apply 'format tag args) text)))) - -(defun org-xml-fix-class-name (kwd) ; audit callers of this function - "Turn todo keyword into a valid class name. -Replaces invalid characters with \"_\"." - (save-match-data - (while (string-match "[^a-zA-Z0-9_]" kwd) - (setq kwd (replace-match "_" t t kwd)))) - kwd) - -(defun org-lparse-format-todo (todo) - (org-lparse-format 'FONTIFY - (concat - (ignore-errors (org-lparse-get 'TODO-KWD-CLASS-PREFIX)) - (org-xml-fix-class-name todo)) - (list (if (member todo org-done-keywords) "done" "todo") - todo))) - -(defun org-lparse-format-extra-targets (extra-targets) - (if (not extra-targets) "" - (mapconcat (lambda (x) - (setq x (org-solidify-link-text - (if (org-uuidgen-p x) (concat "ID-" x) x))) - (org-lparse-format 'ANCHOR "" x)) - extra-targets ""))) - -(defun org-lparse-format-org-tags (tags) - (if (not tags) "" - (org-lparse-format - 'FONTIFY (mapconcat - (lambda (x) - (org-lparse-format - 'FONTIFY x - (concat - (ignore-errors (org-lparse-get 'TAG-CLASS-PREFIX)) - (org-xml-fix-class-name x)))) - (org-split-string tags ":") - (org-lparse-format 'SPACES 1)) "tag"))) - -(defun org-lparse-format-section-number (&optional snumber level) - (and org-export-with-section-numbers - (not org-lparse-body-only) snumber level - (org-lparse-format 'FONTIFY snumber (format "section-number-%d" level)))) - -(defun org-lparse-warn (msg) - (if (not org-lparse-use-flashy-warning) - (message msg) - (put-text-property 0 (length msg) 'face 'font-lock-warning-face msg) - (message msg) - (sleep-for 3))) - -(defun org-xml-format-href (s) - "Make sure the S is valid as a href reference in an XHTML document." - (save-match-data - (let ((start 0)) - (while (string-match "&" s start) - (setq start (+ (match-beginning 0) 3) - s (replace-match "&" t t s))))) - s) - -(defun org-xml-format-desc (s) - "Make sure the S is valid as a description in a link." - (if (and s (not (get-text-property 1 'org-protected s))) - (save-match-data - (org-xml-encode-org-text s)) - s)) - -(provide 'org-lparse) - -;;; org-lparse.el ends here diff -Nru org-mode-7.7/contrib/lisp/org-mac-iCal.el org-mode-7.8.02/contrib/lisp/org-mac-iCal.el --- org-mode-7.7/contrib/lisp/org-mac-iCal.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/contrib/lisp/org-mac-iCal.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,6 +1,6 @@ ;;; org-mac-iCal.el --- Imports events from iCal.app to the Emacs diary -;; Copyright (C) 2009 Christopher Suckling +;; Copyright (C) 2009-2011 Christopher Suckling ;; Author: Christopher Suckling @@ -162,23 +162,25 @@ (re-search-forward "\\(^DTSTART;.*:\\)\\([0-9][0-9][0-9][0-9]\\)\\([0-9][0-9]\\)" nil t) (if (or (eq (match-string 2) nil) (eq (match-string 3) nil)) (progn - (setq yearEntry 0) - (setq monthEntry 0)) + (setq yearEntry 1) + (setq monthEntry 1)) (setq yearEntry (string-to-number (match-string 2))) (setq monthEntry (string-to-number (match-string 3)))) (setq year (string-to-number (format-time-string "%Y"))) (setq month (string-to-number (format-time-string "%m"))) - (when (or - (and - (= yearEntry year) - (or (< monthEntry (- month (/ org-mac-iCal-range 2))) (> monthEntry (+ month (/ org-mac-iCal-range 2))))) - (< yearEntry (- year 1)) - (> yearEntry (+ year 1)) - (and - (= yearEntry (- year 1)) (/= monthEntry 12)) - (and - (= yearEntry (+ year 1)) (/= monthEntry 1))) - (delete-region startEntry endEntry)))) + (setq now (list month 1 year)) + (setq entryDate (list monthEntry 1 yearEntry)) + ;; Check to see if this is a repeating event + (goto-char (point-min)) + (setq isRepeating (re-search-forward "^RRULE:" nil t)) + ;; Delete if outside range and not repeating + (when (and + (not isRepeating) + (> (abs (- (calendar-absolute-from-gregorian now) + (calendar-absolute-from-gregorian entryDate))) + (* (/ org-mac-iCal-range 2) 30)) + (delete-region startEntry endEntry))) + (goto-char (point-max)))) (while (re-search-forward "^END:VEVENT$" nil t) (delete-blank-lines)) diff -Nru org-mode-7.7/contrib/lisp/org-mac-link-grabber.el org-mode-7.8.02/contrib/lisp/org-mac-link-grabber.el --- org-mode-7.7/contrib/lisp/org-mac-link-grabber.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/contrib/lisp/org-mac-link-grabber.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,12 +1,14 @@ ;;; org-mac-link-grabber.el --- Grab links and url from various mac ;;; application and insert them as links into org-mode documents ;; -;; Copyright (c) 2010 Free Software Foundation, Inc. +;; Copyright (c) 2010-2011 Free Software Foundation, Inc. ;; ;; Author: Anthony Lander ;; Version: 1.0.1 ;; Keywords: org, mac, hyperlink ;; +;; This file is not part of GNU Emacs. +;; ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 3, or (at your option) diff -Nru org-mode-7.7/contrib/lisp/org-mairix.el org-mode-7.8.02/contrib/lisp/org-mairix.el --- org-mode-7.7/contrib/lisp/org-mairix.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/contrib/lisp/org-mairix.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,6 +1,6 @@ ;;; org-mairix.el - Support for hooking mairix search into Org for different MUAs ;; -;; Copyright (C) 2007 Georg C. F. Greve +;; Copyright (C) 2007-2011 Georg C. F. Greve ;; mutt support by Adam Spiers ;; ;; Author: Georg C. F. Greve diff -Nru org-mode-7.7/contrib/lisp/org-mime.el org-mode-7.8.02/contrib/lisp/org-mime.el --- org-mode-7.7/contrib/lisp/org-mime.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/contrib/lisp/org-mime.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,12 +1,14 @@ ;;; org-mime.el --- org html export for text/html MIME emails -;; Copyright (C) 2010 Eric Schulte +;; Copyright (C) 2010-2011 Eric Schulte ;; Author: Eric Schulte ;; Keywords: mime, mail, email, html ;; Homepage: http://orgmode.org/worg/org-contrib/org-mime.php ;; Version: 0.01 +;; This file is not part of GNU Emacs. + ;;; License: ;; This program is free software; you can redistribute it and/or modify @@ -203,6 +205,8 @@ (org-export-htmlize-output-type 'inline-css) ;; makes the replies with ">"s look nicer (org-export-preserve-breaks org-mime-preserve-breaks) + ;; dvipng for inline latex because MathJax doesn't work in mail + (org-export-with-LaTeX-fragments "dvipng") ;; to hold attachments for inline html images (html-and-images (org-mime-replace-images diff -Nru org-mode-7.7/contrib/lisp/org-mtags.el org-mode-7.8.02/contrib/lisp/org-mtags.el --- org-mode-7.7/contrib/lisp/org-mtags.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/contrib/lisp/org-mtags.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,5 +1,5 @@ ;;; org-mtags.el --- Muse-like tags in Org-mode -;; Copyright (C) 2008, 2009 Free Software Foundation, Inc. +;; Copyright (C) 2008-2011 Free Software Foundation, Inc. ;; ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp diff -Nru org-mode-7.7/contrib/lisp/org-notmuch.el org-mode-7.8.02/contrib/lisp/org-notmuch.el --- org-mode-7.7/contrib/lisp/org-notmuch.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/contrib/lisp/org-notmuch.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,6 +1,6 @@ ;;; org-notmuch.el --- Support for links to notmuch messages from within Org-mode -;; Copyright (C) 2010 Matthieu Lemerre +;; Copyright (C) 2010-2011 Matthieu Lemerre ;; Author: Matthieu Lemerre ;; Keywords: outlines, hypermedia, calendar, wp diff -Nru org-mode-7.7/contrib/lisp/org-odt.el org-mode-7.8.02/contrib/lisp/org-odt.el --- org-mode-7.7/contrib/lisp/org-odt.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/contrib/lisp/org-odt.el 1970-01-01 00:00:00.000000000 +0000 @@ -1,1572 +0,0 @@ -;;; org-odt.el --- OpenDocumentText export for Org-mode - -;; Copyright (C) 2010, 2011 -;; Jambunathan - -;; Author: Jambunathan K -;; Keywords: outlines, hypermedia, calendar, wp -;; Homepage: http://orgmode.org -;; Version: 0.8 - -;; This file is not (yet) part of GNU Emacs. -;; However, it is distributed under the same license. - -;; GNU Emacs is free software: you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; GNU Emacs is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs. If not, see . -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; -;;; Commentary: - -;;; Code: -(eval-when-compile (require 'cl)) -(require 'org-lparse) - -(defun org-odt-end-export () - ;; remove empty paragraphs - (goto-char (point-min)) - (while (re-search-forward - "[ \r\n\t]*" - nil t) - (replace-match "")) - (goto-char (point-min)) - - ;; Convert whitespace place holders - (goto-char (point-min)) - (let (beg end n) - (while (setq beg (next-single-property-change (point) 'org-whitespace)) - (setq n (get-text-property beg 'org-whitespace) - end (next-single-property-change beg 'org-whitespace)) - (goto-char beg) - (delete-region beg end) - (insert (format "%s" - (make-string n ?x))))) - - ;; Remove empty lines at the beginning of the file. - (goto-char (point-min)) - (when (looking-at "\\s-+\n") (replace-match "")) - - ;; Remove display properties - (remove-text-properties (point-min) (point-max) '(display t))) - -(defvar org-odt-suppress-xref nil) -(defconst org-export-odt-special-string-regexps - '(("\\\\-" . "­\\1") ; shy - ("---\\([^-]\\)" . "—\\1") ; mdash - ("--\\([^-]\\)" . "–\\1") ; ndash - ("\\.\\.\\." . "…")) ; hellip - "Regular expressions for special string conversion.") - -(defconst org-odt-lib-dir (file-name-directory load-file-name)) -(defconst org-odt-data-dir - (let ((dir1 (expand-file-name "../odt" org-odt-lib-dir)) ; git - (dir2 (expand-file-name "./contrib/odt" org-odt-lib-dir))) ; elpa - (cond - ((file-directory-p dir1) dir1) - ((file-directory-p dir2) dir2) - (t (error "Cannot find factory styles file. Check package dir layout")))) - "Directory that holds auxiliary files used by the ODT exporter. - -The 'styles' subdir contains the following xml files - - 'OrgOdtStyles.xml' and 'OrgOdtAutomaticStyles.xml' - which are - used as factory settings of `org-export-odt-styles-file' and - `org-export-odt-automatic-styles-file'. - -The 'etc/schema' subdir contains rnc files for validating of -OpenDocument xml files.") - -(defvar org-odt-file-extensions - '(("odt" . "OpenDocument Text") - ("ott" . "OpenDocument Text Template") - ("odm" . "OpenDocument Master Document") - ("ods" . "OpenDocument Spreadsheet") - ("ots" . "OpenDocument Spreadsheet Template") - ("odg" . "OpenDocument Drawing (Graphics)") - ("otg" . "OpenDocument Drawing Template") - ("odp" . "OpenDocument Presentation") - ("otp" . "OpenDocument Presentation Template") - ("odi" . "OpenDocument Image") - ("odf" . "OpenDocument Formula") - ("odc" . "OpenDocument Chart") - ("doc" . "Microsoft Text") - ("docx" . "Microsoft Text") - ("xls" . "Microsoft Spreadsheet") - ("xlsx" . "Microsoft Spreadsheet") - ("ppt" . "Microsoft Presentation") - ("pptx" . "Microsoft Presentation"))) - -(defvar org-odt-ms-file-extensions - '(("doc" . "Microsoft Text") - ("docx" . "Microsoft Text") - ("xls" . "Microsoft Spreadsheet") - ("xlsx" . "Microsoft Spreadsheet") - ("ppt" . "Microsoft Presentation") - ("pptx" . "Microsoft Presentation"))) - -;; RelaxNG validation of OpenDocument xml files -(eval-after-load 'rng-nxml - '(setq rng-nxml-auto-validate-flag t)) - -(eval-after-load 'rng-loc - '(add-to-list 'rng-schema-locating-files - (expand-file-name "etc/schema/schemas.xml" org-odt-data-dir))) - -(mapc - (lambda (desc) - ;; Let Org open all OpenDocument files using system-registered app - (add-to-list 'org-file-apps - (cons (concat "\\." (car desc) "\\'") 'system)) - ;; Let Emacs open all OpenDocument files in archive mode - (add-to-list 'auto-mode-alist - (cons (concat "\\." (car desc) "\\'") 'archive-mode))) - org-odt-file-extensions) - -(mapc - (lambda (desc) - ;; Let Org open all Microsoft files using system-registered app - (add-to-list 'org-file-apps - (cons (concat "\\." (car desc) "\\'") 'system))) - org-odt-ms-file-extensions) - -;; register the odt exporter with the pre-processor -(add-to-list 'org-export-backends 'odt) - -;; register the odt exporter with org-lparse library -(org-lparse-register-backend 'odt) - -(defcustom org-export-odt-automatic-styles-file nil - "Automatic styles for use with ODT exporter. -If unspecified, the file under `org-odt-data-dir' is used." - :type 'file - :group 'org-export-odt) - -(defcustom org-export-odt-styles-file nil - "Default styles file for use with ODT export. -Valid values are one of: -1. nil -2. path to a styles.xml file -3. path to a *.odt or a *.ott file -4. list of the form (ODT-OR-OTT-FILE (FILE-MEMBER-1 FILE-MEMBER-2 -...)) - -In case of option 1, an in-built styles.xml is used. See -`org-odt-data-dir' for more information. - -In case of option 3, the specified file is unzipped and the -styles.xml embedded therein is used. - -In case of option 4, the specified ODT-OR-OTT-FILE is unzipped -and FILE-MEMBER-1, FILE-MEMBER-2 etc are copied in to the -generated odt file. Use relative path for specifying the -FILE-MEMBERS. styles.xml must be specified as one of the -FILE-MEMBERS. - -Use options 1, 2 or 3 only if styles.xml alone suffices for -achieving the desired formatting. Use option 4, if the styles.xml -references additional files like header and footer images for -achieving the desired formattting." - :group 'org-export-odt - :type - '(choice - (const :tag "Factory settings" nil) - (file :must-match t :tag "styles.xml") - (file :must-match t :tag "ODT or OTT file") - (list :tag "ODT or OTT file + Members" - (file :must-match t :tag "ODF Text or Text Template file") - (cons :tag "Members" - (file :tag " Member" "styles.xml") - (repeat (file :tag "Member")))))) - -(defconst org-export-odt-tmpdir-prefix "odt-") -(defconst org-export-odt-bookmark-prefix "OrgXref.") -(defcustom org-export-odt-use-bookmarks-for-internal-links t - "Export Internal links as bookmarks?." - :type 'boolean - :group 'org-export-odt) - -(defcustom org-export-odt-embed-images t - "Should the images be copied in to the odt file or just linked?" - :type 'boolean - :group 'org-export-odt) - -(defcustom org-odt-export-inline-images 'maybe - "Non-nil means inline images into exported HTML pages. -This is done using an tag. When nil, an anchor with href is used to -link to the image. If this option is `maybe', then images in links with -an empty description will be inlined, while images with a description will -be linked only." - :group 'org-odt-export - :type '(choice (const :tag "Never" nil) - (const :tag "Always" t) - (const :tag "When there is no description" maybe))) - -(defcustom org-odt-export-inline-image-extensions - '("png" "jpeg" "jpg" "gif") - "Extensions of image files that can be inlined into HTML." - :type '(repeat (string :tag "Extension")) - :group 'org-odt-export) - -(defcustom org-export-odt-pixels-per-inch display-pixels-per-inch - ;; FIXME add docstring - "" - :type 'float - :group 'org-export-odt) - -(defvar org-export-odt-default-org-styles-alist - '((paragraph . ((default . "Text_20_body") - (fixedwidth . "OrgSourceBlock") - (verse . "OrgVerse") - (quote . "Quotations") - (blockquote . "Quotations") - (center . "OrgCenter") - (left . "OrgLeft") - (right . "OrgRight") - (title . "Heading_20_1.title") - (footnote . "Footnote") - (src . "OrgSourceBlock") - (illustration . "Illustration") - (table . "Table") - (definition-term . "Text_20_body_20_bold") - (horizontal-line . "Horizontal_20_Line"))) - (character . ((bold . "Bold") - (emphasis . "Emphasis") - (code . "OrgCode") - (verbatim . "OrgCode") - (strike . "Strikethrough") - (underline . "Underline") - (subscript . "OrgSubscript") - (superscript . "OrgSuperscript"))) - (list . ((ordered . "OrgNumberedList") - (unordered . "OrgBulletedList") - (description . "OrgDescriptionList")))) - "Default styles for various entities.") - -(defvar org-export-odt-org-styles-alist org-export-odt-default-org-styles-alist) -(defun org-odt-get-style-name-for-entity (category &optional entity) - (let ((entity (or entity 'default))) - (or - (cdr (assoc entity (cdr (assoc category - org-export-odt-org-styles-alist)))) - (cdr (assoc entity (cdr (assoc category - org-export-odt-default-org-styles-alist)))) - (error "Cannot determine style name for entity %s of type %s" - entity category)))) - -;;;###autoload -(defun org-export-as-odt-and-open (arg) - "Export the outline as ODT and immediately open it with a browser. -If there is an active region, export only the region. -The prefix ARG specifies how many levels of the outline should become -headlines. The default is 3. Lower levels will become bulleted lists." - (interactive "P") - (org-lparse-and-open "odt" "odt" arg)) - -;;;###autoload -(defun org-export-as-odt-batch () - "Call the function `org-lparse-batch'. -This function can be used in batch processing as: -emacs --batch - --load=$HOME/lib/emacs/org.el - --eval \"(setq org-export-headline-levels 2)\" - --visit=MyFile --funcall org-export-as-odt-batch" - (org-lparse-batch "odt")) - -;;;###autoload -(defun org-export-as-odt-to-buffer (arg) - "Call `org-lparse-odt` with output to a temporary buffer. -No file is created. The prefix ARG is passed through to `org-lparse-to-buffer'." - (interactive "P") - (org-lparse-to-buffer "odt" arg)) - -;;;###autoload -(defun org-replace-region-by-odt (beg end) - "Assume the current region has org-mode syntax, and convert it to ODT. -This can be used in any buffer. For example, you could write an -itemized list in org-mode syntax in an ODT buffer and then use this -command to convert it." - (interactive "r") - (org-replace-region-by "odt" beg end)) - -;;;###autoload -(defun org-export-region-as-odt (beg end &optional body-only buffer) - "Convert region from BEG to END in org-mode buffer to ODT. -If prefix arg BODY-ONLY is set, omit file header, footer, and table of -contents, and only produce the region of converted text, useful for -cut-and-paste operations. -If BUFFER is a buffer or a string, use/create that buffer as a target -of the converted ODT. If BUFFER is the symbol `string', return the -produced ODT as a string and leave not buffer behind. For example, -a Lisp program could call this function in the following way: - - (setq odt (org-export-region-as-odt beg end t 'string)) - -When called interactively, the output buffer is selected, and shown -in a window. A non-interactive call will only return the buffer." - (interactive "r\nP") - (org-lparse-region "odt" beg end body-only buffer)) - -;;; org-export-as-odt -;;;###autoload -(defun org-export-as-odt (arg &optional hidden ext-plist - to-buffer body-only pub-dir) - "Export the outline as a OpenDocumentText file. -If there is an active region, export only the region. The prefix -ARG specifies how many levels of the outline should become -headlines. The default is 3. Lower levels will become bulleted -lists. HIDDEN is obsolete and does nothing. -EXT-PLIST is a property list with external parameters overriding -org-mode's default settings, but still inferior to file-local -settings. When TO-BUFFER is non-nil, create a buffer with that -name and export to that buffer. If TO-BUFFER is the symbol -`string', don't leave any buffer behind but just return the -resulting XML as a string. When BODY-ONLY is set, don't produce -the file header and footer, simply return the content of -..., without even the body tags themselves. When -PUB-DIR is set, use this as the publishing directory." - (interactive "P") - (org-lparse "odt" "odt" arg hidden ext-plist to-buffer body-only pub-dir)) - -(defvar org-odt-entity-control-callbacks-alist - `((EXPORT - . (org-odt-begin-export org-odt-end-export)) - (DOCUMENT-CONTENT - . (org-odt-begin-document-content org-odt-end-document-content)) - (DOCUMENT-BODY - . (org-odt-begin-document-body org-odt-end-document-body)) - (TOC - . (org-odt-begin-toc org-odt-end-toc)) - (ENVIRONMENT - . (org-odt-begin-environment org-odt-end-environment)) - (FOOTNOTE-DEFINITION - . (org-odt-begin-footnote-definition org-odt-end-footnote-definition)) - (TABLE - . (org-odt-begin-table org-odt-end-table)) - (TABLE-ROWGROUP - . (org-odt-begin-table-rowgroup org-odt-end-table-rowgroup)) - (LIST - . (org-odt-begin-list org-odt-end-list)) - (LIST-ITEM - . (org-odt-begin-list-item org-odt-end-list-item)) - (OUTLINE - . (org-odt-begin-outline org-odt-end-outline)) - (OUTLINE-TEXT - . (org-odt-begin-outline-text org-odt-end-outline-text)) - (PARAGRAPH - . (org-odt-begin-paragraph org-odt-end-paragraph))) - "") - -(defvar org-odt-entity-format-callbacks-alist - `((EXTRA-TARGETS . org-lparse-format-extra-targets) - (ORG-TAGS . org-lparse-format-org-tags) - (SECTION-NUMBER . org-lparse-format-section-number) - (HEADLINE . org-odt-format-headline) - (TOC-ENTRY . org-odt-format-toc-entry) - (TOC-ITEM . org-odt-format-toc-item) - (TAGS . org-odt-format-tags) - (SPACES . org-odt-format-spaces) - (TABS . org-odt-format-tabs) - (LINE-BREAK . org-odt-format-line-break) - (FONTIFY . org-odt-format-fontify) - (TODO . org-lparse-format-todo) - (LINK . org-odt-format-link) - (INLINE-IMAGE . org-odt-format-inline-image) - (ORG-LINK . org-odt-format-org-link) - (HEADING . org-odt-format-heading) - (ANCHOR . org-odt-format-anchor) - (TABLE . org-lparse-format-table) - (TABLE-ROW . org-odt-format-table-row) - (TABLE-CELL . org-odt-format-table-cell) - (FOOTNOTES-SECTION . ignore) - (FOOTNOTE-REFERENCE . org-odt-format-footnote-reference) - (HORIZONTAL-LINE . org-odt-format-horizontal-line) - (COMMENT . org-odt-format-comment) - (LINE . org-odt-format-line) - (ORG-ENTITY . org-odt-format-org-entity)) - "") - -;;;_. callbacks -;;;_. control callbacks -;;;_ , document body -(defun org-odt-begin-office-body () - (insert " - - - - - - - - ")) - -;; Following variable is let bound when `org-do-lparse' is in -;; progress. See org-html.el. -(defvar org-lparse-toc) -(defun org-odt-begin-document-body (opt-plist) - (org-odt-begin-office-body) - (let ((title (plist-get opt-plist :title))) - (when title - (insert - (org-odt-format-stylized-paragraph 'title title)))) - - ;; insert toc - (when org-lparse-toc - (insert "\n" org-lparse-toc "\n"))) - -(defvar org-lparse-body-only) ; let bound during org-do-lparse -(defvar org-lparse-to-buffer) ; let bound during org-do-lparse -(defun org-odt-end-document-body (opt-plist) - (unless org-lparse-body-only - (org-lparse-insert-tag "") - (org-lparse-insert-tag ""))) - -(defconst org-odt-document-content-header - " - -") - -(defun org-odt-begin-document-content (opt-plist) - ;; document header - (insert org-odt-document-content-header) - - ;; automatic styles - (insert-file-contents - (or org-export-odt-automatic-styles-file - (expand-file-name "styles/OrgOdtAutomaticStyles.xml" - org-odt-data-dir))) - (goto-char (point-max))) - -(defun org-odt-end-document-content () - (org-lparse-insert-tag "")) - -(defun org-odt-begin-outline (level1 snumber title tags - target extra-targets class) - (org-lparse-insert - 'HEADING (org-lparse-format - 'HEADLINE title extra-targets tags snumber level1) - level1 target)) - -(defun org-odt-end-outline () - (ignore)) - -(defun org-odt-begin-outline-text (level1 snumber class) - (ignore)) - -(defun org-odt-end-outline-text () - (ignore)) - -(defun org-odt-begin-paragraph (&optional style) - (org-lparse-insert-tag - "" (org-odt-get-extra-attrs-for-paragraph-style style))) - -(defun org-odt-end-paragraph () - (org-lparse-insert-tag "")) - -(defun org-odt-get-extra-attrs-for-paragraph-style (style) - (let (style-name) - (setq style-name - (cond - ((stringp style) style) - ((symbolp style) (org-odt-get-style-name-for-entity - 'paragraph style)))) - (unless style-name - (error "Don't know how to handle paragraph style %s" style)) - (format " text:style-name=\"%s\"" style-name))) - -(defun org-odt-format-stylized-paragraph (style text) - (org-odt-format-tags - '("" . "") text - (org-odt-get-extra-attrs-for-paragraph-style style))) - -(defun org-odt-begin-environment (style) - (case style - ((blockquote verse center quote) - (org-lparse-begin-paragraph style) - (list)) - ((fixedwidth native) - (org-lparse-end-paragraph) - (list)) - (t (error "Unknown environment %s" style)))) - -(defun org-odt-end-environment (style) - (case style - ((blockquote verse center quote) - (org-lparse-end-paragraph) - (list)) - ((fixedwidth native) - (org-lparse-begin-paragraph) - (list)) - (t (error "Unknown environment %s" style)))) - -(defun org-odt-begin-list (ltype &optional arg1) - (setq ltype (or (org-lparse-html-list-type-to-canonical-list-type ltype) - ltype)) - (let* ((style-name (org-odt-get-style-name-for-entity 'list ltype)) - (extra (if style-name - (format " text:style-name=\"%s\"" style-name) ""))) - - ;; FIXME: Handle arg1 incase of ordered lists. - (case ltype - ((ordered unordered description) - (org-lparse-end-paragraph) - (org-lparse-insert-tag "" extra)) - (t (error "Unknown list type: %s" ltype))))) - -(defun org-odt-end-list (ltype) - (setq ltype (or (org-lparse-html-list-type-to-canonical-list-type ltype) - ltype)) - (if ltype - (org-lparse-insert-tag "") - (error "Unknown list type: %s" ltype))) - -(defun org-odt-begin-list-item (ltype &optional arg headline) - (setq ltype (or (org-lparse-html-list-type-to-canonical-list-type ltype) - ltype)) - (case ltype - (ordered - (assert (not headline) t) - (let* ((counter arg) (extra "")) - (org-lparse-insert-tag "") - (org-lparse-begin-paragraph))) - (unordered - (let* ((id arg) (extra "")) - (org-lparse-insert-tag "") - (org-lparse-begin-paragraph) - (insert (if headline (org-odt-format-target headline id) - (org-odt-format-bookmark "" id))))) - (description - (assert (not headline) t) - (let ((term (or arg "(no term)"))) - (insert - (org-odt-format-tags - '("" . "") - (org-odt-format-stylized-paragraph 'definition-term term))) - (org-lparse-begin 'LIST-ITEM 'unordered) - (org-lparse-begin 'LIST 'description) - (org-lparse-begin 'LIST-ITEM 'unordered))) - (t (error "Unknown list type")))) - -(defun org-odt-end-list-item (ltype) - (setq ltype (or (org-lparse-html-list-type-to-canonical-list-type ltype) - ltype)) - (case ltype - ((ordered unordered) - (org-lparse-insert-tag "")) - (description - (org-lparse-end-list-item) - (org-lparse-end 'LIST 'description) - (org-lparse-end-list-item)) - (t (error "Unknown list type")))) - -;; Following variables are let bound when table emission is in -;; progress. See org-lparse.el. -(defvar org-lparse-table-begin-marker) -(defvar org-lparse-table-ncols) -(defvar org-lparse-table-rowgrp-open) -(defvar org-lparse-table-rownum) -(defvar org-lparse-table-cur-rowgrp-is-hdr) -(defvar org-lparse-table-is-styled) -(defvar org-lparse-table-rowgrp-info) -(defvar org-lparse-table-colalign-vector) -(defun org-odt-begin-table (caption label attributes) - (when label - (insert - (org-odt-format-stylized-paragraph - 'table (org-odt-format-entity-caption label caption "Table")))) - - (org-lparse-insert-tag - "" - (or label "") "OrgTable") - (setq org-lparse-table-begin-marker (point))) - -(defun org-odt-end-table () - (goto-char org-lparse-table-begin-marker) - (loop for level from 0 below org-lparse-table-ncols - do (insert (org-odt-format-tags "" ""))) - - ;; fill style attributes for table cells - (when org-lparse-table-is-styled - (while (re-search-forward "@@\\(table-cell:p\\|table-cell:style-name\\)@@\\([0-9]+\\)@@\\([0-9]+\\)@@" nil t) - (let ((spec (match-string 1)) - (r (string-to-number (match-string 2))) - (c (string-to-number (match-string 3)))) - (cond - ((equal spec "table-cell:p") - (let ((style-name (org-odt-get-paragraph-style-for-table-cell r c))) - (replace-match style-name t t))) - ((equal spec "table-cell:style-name") - (let ((style-name (org-odt-get-style-name-for-table-cell r c))) - (replace-match style-name t t))))))) - - (goto-char (point-max)) - (org-lparse-insert-tag "")) - -(defun org-odt-begin-table-rowgroup (&optional is-header-row) - (when org-lparse-table-rowgrp-open - (org-lparse-end 'TABLE-ROWGROUP)) - (org-lparse-insert-tag (if is-header-row - "" - "")) - (setq org-lparse-table-rowgrp-open t) - (setq org-lparse-table-cur-rowgrp-is-hdr is-header-row)) - -(defun org-odt-end-table-rowgroup () - (when org-lparse-table-rowgrp-open - (setq org-lparse-table-rowgrp-open nil) - (org-lparse-insert-tag - (if org-lparse-table-cur-rowgrp-is-hdr - "" "")))) - -(defun org-odt-format-table-row (row) - (org-odt-format-tags - '("" . "") row)) - -(defun org-odt-get-style-name-for-table-cell (r c) - (concat - "OrgTblCell" - (cond - ((= r 0) "T") - ((eq (cdr (assoc r org-lparse-table-rowgrp-info)) :start) "T") - (t "")) - (when (= r org-lparse-table-rownum) "B") - (cond - ((= c 0) "") - ((or (memq (nth c org-table-colgroup-info) '(:start :startend)) - (memq (nth (1- c) org-table-colgroup-info) '(:end :startend))) "L") - (t "")))) - -(defun org-odt-get-paragraph-style-for-table-cell (r c) - (capitalize (aref org-lparse-table-colalign-vector c))) - -(defun org-odt-format-table-cell (data r c) - (if (not org-lparse-table-is-styled) - (org-odt-format-tags - '("" . "") - (org-odt-format-stylized-paragraph - (cond - (org-lparse-table-cur-rowgrp-is-hdr "OrgTableHeading") - ((and (= c 0) (org-lparse-get 'TABLE-FIRST-COLUMN-AS-LABELS)) - "OrgTableHeading") - (t "OrgTableContents")) - data)) - (let* ((style-name-cookie - (format "@@table-cell:style-name@@%03d@@%03d@@" r c)) - (paragraph-style-cookie - (concat - (cond - (org-lparse-table-cur-rowgrp-is-hdr "OrgTableHeading") - ((and (= c 0) (org-lparse-get 'TABLE-FIRST-COLUMN-AS-LABELS)) - "OrgTableHeading") - (t "OrgTableContents")) - (format "@@table-cell:p@@%03d@@%03d@@" r c)))) - (org-odt-format-tags - '("" . - "") - (org-odt-format-stylized-paragraph paragraph-style-cookie data) - style-name-cookie)))) - -(defun org-odt-begin-footnote-definition (n) - (org-lparse-begin-paragraph 'footnote)) - -(defun org-odt-end-footnote-definition (n) - (org-lparse-end-paragraph)) - -(defun org-odt-begin-toc (lang-specific-heading) - (insert - (format " - - - %s -" lang-specific-heading)) - - (loop for level from 1 upto 10 - do (insert (format - " - - - - - - -" level level))) - - (insert - (format " - - - - - %s - -" lang-specific-heading))) - -(defun org-odt-end-toc () - (insert " - - -")) - -(defun org-odt-format-toc-entry (snumber todo headline tags href) - (setq headline (concat - (and org-export-with-section-numbers - (concat snumber ". ")) - headline - (and tags - (concat - (org-lparse-format 'SPACES 3) - (org-lparse-format 'FONTIFY tags "tag"))))) - (when todo - (setq headline (org-lparse-format 'FONTIFY headline "todo"))) - - (let ((org-odt-suppress-xref t)) - (org-odt-format-link headline (concat "#" href)))) - -(defun org-odt-format-toc-item (toc-entry level org-last-level) - (let ((style (format "Contents_20_%d" - (+ level (or (org-lparse-get 'TOPLEVEL-HLEVEL) 1) -1)))) - (insert "\n" (org-odt-format-stylized-paragraph style toc-entry) "\n"))) - -;; Following variable is let bound during 'ORG-LINK callback. See -;; org-html.el -(defvar org-lparse-link-description-is-image nil) -(defun org-odt-format-link (desc href &optional attr) - (cond - ((and (= (string-to-char href) ?#) (not org-odt-suppress-xref)) - (setq href (concat org-export-odt-bookmark-prefix (substring href 1))) - (org-odt-format-tags - '("" . - "") - desc href)) - (org-lparse-link-description-is-image - (org-odt-format-tags - '("" . "") - desc href (or attr ""))) - (t - (org-odt-format-tags - '("" . "") - desc href (or attr ""))))) - -(defun org-odt-format-spaces (n) - (org-odt-format-tags "" "" n)) - -(defun org-odt-format-tabs (&optional n) - (let ((tab "") - (n (or n 1))) - (insert tab))) - -(defun org-odt-format-line-break () - (org-odt-format-tags "" "")) - -(defun org-odt-format-horizontal-line () - (org-odt-format-stylized-paragraph 'horizontal-line "")) - -(defun org-odt-format-line (line) - (case org-lparse-dyn-current-environment - (fixedwidth (concat (org-odt-format-source-code-or-example-line - (org-xml-encode-plain-text line)) "\n")) - (t (concat line "\n")))) - -(defun org-odt-format-comment (fmt &rest args) - (let ((comment (apply 'format fmt args))) - (format "\n\n" comment))) - -(defun org-odt-format-org-entity (wd) - (org-entity-get-representation wd 'utf8)) - -(defun org-odt-fill-tabs-and-spaces (line) - (replace-regexp-in-string - "\\([\t]\\|\\([ ]+\\)\\)" (lambda (s) - (cond - ((string= s "\t") (org-odt-format-tabs)) - ((> (length s) 1) - (org-odt-format-spaces (length s))) - (t " "))) line)) - -(defun org-odt-format-source-code-or-example-line (line) - (org-odt-format-stylized-paragraph 'src (org-odt-fill-tabs-and-spaces line))) - -(defun org-odt-format-example (lines) - (mapconcat - (lambda (line) - (org-odt-format-source-code-or-example-line line)) - (org-split-string lines "[\r\n]") "\n")) - -(defun org-odt-format-source-code-or-example (lines lang caption textareap - cols rows num cont - rpllbl fmt) - (org-odt-format-example (org-export-number-lines - (org-xml-encode-plain-text-lines lines) - 0 0 num cont rpllbl fmt))) - -(defun org-xml-encode-plain-text-lines (rtn) - (mapconcat 'org-xml-encode-plain-text (org-split-string rtn "[\r\n]") "\n")) - -(defun org-odt-remap-stylenames (style-name) - (or - (cdr (assoc style-name '(("timestamp-wrapper" . "OrgTimestampWrapper") - ("timestamp" . "OrgTimestamp") - ("timestamp-kwd" . "OrgTimestampKeyword") - ("tag" . "OrgTag") - ("todo" . "OrgTodo") - ("done" . "OrgDone") - ("target" . "OrgTarget")))) - style-name)) - -(defun org-odt-format-fontify (text style &optional id) - (let* ((style-name - (cond - ((stringp style) - (org-odt-remap-stylenames style)) - ((symbolp style) - (org-odt-get-style-name-for-entity 'character style)) - ((listp style) - (assert (< 1 (length style))) - (let ((parent-style (pop style))) - (mapconcat (lambda (s) - ;; (assert (stringp s) t) - (org-odt-remap-stylenames s)) style "") - (org-odt-remap-stylenames parent-style))) - (t (error "Don't how to handle style %s" style))))) - (org-odt-format-tags - '("" . "") - text style-name))) - -(defun org-odt-relocate-relative-path (path dir) - (if (file-name-absolute-p path) path - (file-relative-name (expand-file-name path dir) - (expand-file-name "eyecandy" dir)))) - -(defun org-odt-format-inline-image (thefile) - (let* ((thelink (if (file-name-absolute-p thefile) thefile - (org-xml-format-href - (org-odt-relocate-relative-path - thefile org-current-export-file)))) - (href - (org-odt-format-tags - "" "" - (if org-export-odt-embed-images - (org-odt-copy-image-file thefile) thelink)))) - (org-export-odt-format-image thefile href))) - -(defun org-odt-format-org-link (opt-plist type-1 path fragment desc attr - descp) - "Make an HTML link. -OPT-PLIST is an options list. -TYPE is the device-type of the link (THIS://foo.html) -PATH is the path of the link (http://THIS#locationx) -FRAGMENT is the fragment part of the link, if any (foo.html#THIS) -DESC is the link description, if any. -ATTR is a string of other attributes of the a element. -MAY-INLINE-P allows inlining it as an image." - - (declare (special org-lparse-par-open)) - (save-match-data - (let* ((may-inline-p - (and (member type-1 '("http" "https" "file")) - (org-lparse-should-inline-p path descp) - (not fragment))) - (type (if (equal type-1 "id") "file" type-1)) - (filename path) - (thefile path)) - - (cond - ;; check for inlined images - ((and (member type '("file")) - (not fragment) - (org-file-image-p - filename org-odt-export-inline-image-extensions) - (or (eq t org-odt-export-inline-images) - (and org-odt-export-inline-images (not descp)))) - - ;; (when (and (string= type "file") (file-name-absolute-p path)) - ;; (setq thefile (concat "file://" (expand-file-name path)))) - ;; (setq thefile (org-xml-format-href thefile)) - ;; (org-export-html-format-image thefile) - (org-odt-format-inline-image thefile)) - (t - (when (string= type "file") - (setq thefile - (cond - ((file-name-absolute-p path) - (concat "file://" (expand-file-name path))) - (t (org-odt-relocate-relative-path - thefile org-current-export-file))))) - - (when (and (member type '("" "http" "https" "file" "coderef")) - fragment) - (setq thefile (concat thefile "#" fragment))) - - (setq thefile (org-xml-format-href thefile)) - - (when (not (member type '("" "file" "coderef"))) - (setq thefile (concat type ":" thefile))) - - (let ((org-odt-suppress-xref (string= type "coderef"))) - (org-odt-format-link - (org-xml-format-desc desc) thefile attr))))))) - -(defun org-odt-format-heading (text level &optional id) - (let* ((text (if id (org-odt-format-target text id) text))) - (org-odt-format-tags - '("" . - "") text level level))) - -(defun org-odt-format-headline (title extra-targets tags - &optional snumber level) - (concat - (org-lparse-format 'EXTRA-TARGETS extra-targets) - - ;; No need to generate section numbers. They are auto-generated by - ;; the application - - ;; (concat (org-lparse-format 'SECTION-NUMBER snumber level) " ") - title - (and tags (concat (org-lparse-format 'SPACES 3) - (org-lparse-format 'ORG-TAGS tags))))) - -(defun org-odt-format-anchor (text name &optional class) - (org-odt-format-target text name)) - -(defun org-odt-format-bookmark (text id) - (if id - (org-odt-format-tags "" text id) - text)) - -(defun org-odt-format-target (text id) - (let ((name (concat org-export-odt-bookmark-prefix id))) - (concat - (and id (org-odt-format-tags - "" "" name)) - (org-odt-format-bookmark text id) - (and id (org-odt-format-tags - "" "" name))))) - -(defun org-odt-format-footnote (n def) - (let ((id (concat "fn" n)) - (note-class "footnote") - (par-style "Footnote")) - (org-odt-format-tags - '("" . - "") - (concat - (org-odt-format-tags - '("" . "") - n) - (org-odt-format-tags - '("" . "") - def)) - id note-class))) - -(defun org-odt-format-footnote-reference (n def refcnt) - (if (= refcnt 1) - (org-odt-format-footnote n def) - (org-odt-format-footnote-ref n))) - -(defun org-odt-format-footnote-ref (n) - (let ((note-class "footnote") - (ref-format "text") - (ref-name (concat "fn" n))) - (org-odt-format-tags - '("" . "") - (org-odt-format-tags - '("" . "") - n note-class ref-format ref-name) - "OrgSuperscript"))) - -(defun org-odt-get-image-name (file-name) - (require 'sha1) - (file-relative-name - (expand-file-name - (concat (sha1 file-name) "." (file-name-extension file-name)) "Pictures"))) - -(defun org-export-odt-format-image (src href - ;; par-open - ) - "Create image tag with source and attributes." - (save-match-data - - (let (embed-as caption attr label attr-plist size width height) - - (cond - ((string-match "^ltxpng/" src) - ;; FIXME: Anyway the latex src can be embedded as an - ;; annotation - - ;; (org-find-text-property-in-string 'org-latex-src src) - (setq caption nil attr nil label nil embed-as 'character)) - - (t - (setq caption (org-find-text-property-in-string 'org-caption src) - caption (and caption (org-xml-format-desc caption)) - attr (org-find-text-property-in-string 'org-attributes src) - label (org-find-text-property-in-string 'org-label src) - embed-as 'paragraph))) - - (setq attr-plist (when attr (read attr))) - (setq size (org-odt-image-size-from-file - src (plist-get attr-plist :width) - (plist-get attr-plist :height) - (plist-get attr-plist :scale) nil embed-as)) - - (org-export-odt-do-format-image embed-as caption attr label - size href)))) - -(defun org-export-odt-do-format-image (embed-as caption attr label - size href) - "Create image tag with source and attributes." - (save-match-data - (let ((width (car size)) (height (cdr size)) - (draw-frame-pair - '("" . ""))) - (cond - ((and (not caption) (not label)) - (let (style-name anchor-type) - (cond - ((eq embed-as 'paragraph) - (setq style-name "OrgGraphicsParagraph" anchor-type "paragraph")) - ((eq embed-as 'character) - (setq style-name "OrgGraphicsBaseline" anchor-type "as-char"))) - (org-odt-format-tags - draw-frame-pair href style-name anchor-type 0 - (org-odt-image-attrs-from-size width height)))) - - (t - (concat - ;; (when par-open (org-odt-close-par)) - (org-odt-format-tags - draw-frame-pair - (org-odt-format-tags - '("" . "") - (org-odt-format-stylized-paragraph - 'illustration - (concat - (let ((extra " style:rel-width=\"100%\" style:rel-height=\"scale\"")) - (org-odt-format-tags - draw-frame-pair href "OrgGraphicsParagraphContent" "paragraph" 2 - (concat (org-odt-image-attrs-from-size width height) extra))) - (org-odt-format-entity-caption label caption))) - height) - "OrgFrame" "paragraph" 1 - (org-odt-image-attrs-from-size width)) - - ;; (when par-open (org-odt-open-par)) - )))))) - -;; xml files generated on-the-fly -(defconst org-export-odt-save-list - '("mimetype" "META-INF/manifest.xml" "content.xml" "meta.xml" "styles.xml")) - -;; xml files that are copied -(defconst org-export-odt-nosave-list '()) - -;; xml files that contribute to the final odt file -(defvar org-export-odt-file-list nil) - -(defconst org-export-odt-manifest-lines - '(("" - "" - "" - "" - "" - "" - "") . (""))) - -(defconst org-export-odt-meta-lines - '(("" - "" - " ") . (" " ""))) - -(defun org-odt-copy-image-file (path &optional target-file) - "Returns the internal name of the file" - (let* ((image-type (file-name-extension path)) - (media-type (format "image/%s" image-type)) - (src-file (expand-file-name - path (file-name-directory org-current-export-file))) - (target-file (or target-file (org-odt-get-image-name src-file))) - ;; FIXME - (body-only nil)) - - (when (not org-lparse-to-buffer) - (message "Embedding %s as %s ..." - (substring-no-properties path) target-file) - (copy-file src-file target-file 'overwrite) - (org-odt-update-manifest-file media-type target-file) - (push target-file org-export-odt-file-list)) target-file)) - -(defun org-odt-image-attrs-from-size (&optional width height) - (concat - (when width (format "svg:width=\"%0.2fcm\"" width)) - " " - (when height (format "svg:height=\"%0.2fcm\"" height)))) - -(defvar org-export-odt-image-size-probe-method - '(emacs imagemagick force) - "Ordered list of methods by for determining size of an embedded - image.") - -(defvar org-export-odt-default-image-sizes-alist - '(("character" . (5 . 0.4)) - ("paragraph" . (5 . 5))) - "Hardcoded image dimensions one for each of the anchor - methods.") - -(defun org-odt-do-image-size (probe-method file &optional dpi anchor-type) - (setq dpi (or dpi org-export-odt-pixels-per-inch)) - (setq anchor-type (or anchor-type "paragraph")) - (flet ((size-in-cms (size-in-pixels) - (flet ((pixels-to-cms (pixels) - (let* ((cms-per-inch 2.54) - (inches (/ pixels dpi))) - (* cms-per-inch inches)))) - (and size-in-pixels - (cons (pixels-to-cms (car size-in-pixels)) - (pixels-to-cms (cdr size-in-pixels))))))) - (case probe-method - (emacs - (size-in-cms (ignore-errors (image-size (create-image file) 'pixels)))) - (imagemagick - (size-in-cms - (let ((dim (shell-command-to-string - (format "identify -format \"%%w:%%h\" \"%s\"" file)))) - (when (string-match "\\([0-9]+\\):\\([0-9]+\\)" dim) - (cons (string-to-number (match-string 1 dim)) - (string-to-number (match-string 2 dim))))))) - (t - (cdr (assoc-string anchor-type - org-export-odt-default-image-sizes-alist)))))) - -(defun org-odt-image-size-from-file (file &optional user-width - user-height scale dpi embed-as) - (unless (file-name-absolute-p file) - (setq file (expand-file-name - file (file-name-directory org-current-export-file)))) - (let* (size width height) - (unless (and user-height user-width) - (loop for probe-method in org-export-odt-image-size-probe-method - until size - do (setq size (org-odt-do-image-size - probe-method file dpi embed-as))) - (or size (error "Cannot determine Image size. Aborting ...")) - (setq width (car size) height (cdr size))) - (cond - (scale - (setq width (* width scale) height (* height scale))) - ((and user-height user-width) - (setq width user-width height user-height)) - (user-height - (setq width (* user-height (/ width height)) height user-height)) - (user-width - (setq height (* user-width (/ height width)) width user-width)) - (t (ignore))) - (cons width height))) - -(defvar org-odt-default-entity "Illustration") -(defun org-odt-format-entity-caption (label caption &optional default-entity) - (if (not label) (or caption "") - (let* ((label-components (org-odt-parse-label label)) - (entity (car label-components)) - (seqno (cdr label-components)) - (caption (and caption (concat ": " caption)))) - (unless seqno - (setq seqno label - entity (or default-entity org-odt-default-entity))) - (concat - entity " " - (org-odt-format-tags - '("" . "") - seqno label entity entity) - caption)))) - -(defun org-odt-format-tags (tag text &rest args) - (let ((prefix (when org-lparse-encode-pending "@")) - (suffix (when org-lparse-encode-pending "@"))) - (apply 'org-lparse-format-tags tag text prefix suffix args))) - -(defun org-odt-init-outfile (filename) - (unless (executable-find "zip") - ;; Not at all OSes ship with zip by default - (error "Executable \"zip\" needed for creating OpenDocument files. Aborting.")) - - (let* ((outdir (make-temp-file org-export-odt-tmpdir-prefix t)) - (mimetype-file (expand-file-name "mimetype" outdir)) - (content-file (expand-file-name "content.xml" outdir)) - (manifest-file (expand-file-name "META-INF/manifest.xml" outdir)) - (meta-file (expand-file-name "meta.xml" outdir)) - (styles-file (expand-file-name "styles.xml" outdir)) - (pictures-dir (expand-file-name "Pictures" outdir)) - (body-only nil)) - - ;; content file - (with-current-buffer (find-file-noselect content-file t) - (erase-buffer)) - - ;; FIXME: How to factor in body-only here - (unless body-only - ;; manifest file - (make-directory (file-name-directory manifest-file)) - (with-current-buffer (find-file-noselect manifest-file t) - (erase-buffer) - (insert (mapconcat 'identity (car org-export-odt-manifest-lines) "\n")) - (insert "\n") - (save-excursion - (insert (mapconcat 'identity (cdr org-export-odt-manifest-lines) "\n")))) - - ;; meta file - (with-current-buffer (find-file-noselect meta-file t) - (erase-buffer) - (insert (mapconcat 'identity (car org-export-odt-meta-lines) "\n")) - (insert "\n") - (save-excursion - (insert (mapconcat 'identity (cdr org-export-odt-meta-lines) "\n")))) - - ;; mimetype - (with-current-buffer (find-file-noselect mimetype-file t) - (insert "application/vnd.oasis.opendocument.text")) - - ;; styles file - ;; (copy-file org-export-odt-styles-file styles-file t) - - ;; Pictures dir - (make-directory pictures-dir) - - ;; initialize list of files that contribute to the odt file - (setq org-export-odt-file-list - (append org-export-odt-save-list org-export-odt-nosave-list))) - content-file)) - -(defconst org-odt-manifest-file-entry-tag - "") - -(defun org-odt-save-as-outfile (target opt-plist) - ;; write meta file - (org-odt-update-meta-file opt-plist) - - ;; write styles file - (org-odt-copy-styles-file) - - ;; Update styles.xml - take care of outline numbering - (with-current-buffer - (find-file-noselect (expand-file-name "styles.xml") t) - ;; Don't make automatic backup of styles.xml file. This setting - ;; prevents the backedup styles.xml file from being zipped in to - ;; odt file. This is more of a hackish fix. Better alternative - ;; would be to fix the zip command so that the output odt file - ;; includes only the needed files and excludes any auto-generated - ;; extra files like backups and auto-saves etc etc. Note that - ;; currently the zip command zips up the entire temp directory so - ;; that any auto-generated files created under the hood ends up in - ;; the resulting odt file. - (set (make-local-variable 'backup-inhibited) t) - - ;; Import local setting of `org-export-with-section-numbers' - (org-lparse-bind-local-variables opt-plist) - (org-odt-configure-outline-numbering - (if org-export-with-section-numbers org-export-headline-levels 0))) - - (let ((zipdir default-directory)) - (message "Switching to directory %s" (expand-file-name zipdir)) - - ;; save all xml files - (mapc (lambda (file) - (with-current-buffer - (find-file-noselect (expand-file-name file) t) - ;; prettify output - (indent-region (point-min) (point-max)) - (save-buffer))) - org-export-odt-save-list) - - (let* ((target-name (file-name-nondirectory target)) - (target-dir (file-name-directory target)) - (cmds `(("zip" "-mX0" ,target-name "mimetype") - ("zip" "-rmTq" ,target-name ".")))) - (when (file-exists-p target) - ;; FIXME: If the file is locked this throws a cryptic error - (delete-file target)) - - (let ((coding-system-for-write 'no-conversion) exitcode) - (message "Creating odt file...") - (mapc - (lambda (cmd) - (message "Running %s" (mapconcat 'identity cmd " ")) - (setq exitcode - (apply 'call-process (car cmd) nil nil nil (cdr cmd))) - (or (zerop exitcode) - (error "Unable to create odt file (%S)" exitcode))) - cmds)) - - ;; move the file from outdir to target-dir - (rename-file target-name target-dir) - - ;; kill all xml buffers - (mapc (lambda (file) - (kill-buffer - (find-file-noselect (expand-file-name file zipdir) t))) - org-export-odt-save-list) - - (delete-directory zipdir))) - - (message "Created %s" target) - (set-buffer (find-file-noselect target t))) - -(defun org-odt-format-date (date) - (let ((warning-msg - "OpenDocument files require that dates be in ISO-8601 format. Please review your DATE options for compatibility.")) - ;; If the user is not careful with the date specification, an - ;; invalid meta.xml will be emitted. - - ;; For now honor user's diktat and let him off with a warning - ;; message. This is OK as LibreOffice (and possibly other - ;; apps) doesn't deem this deviation as critical and continue - ;; to load the file. - - ;; FIXME: Surely there a better way to handle this. Revisit this - ;; later. - (cond - ((and date (string-match "%" date)) - ;; Honor user's diktat. See comments above - (org-lparse-warn warning-msg) - (format-time-string date)) - (date - ;; Honor user's diktat. See comments above - (org-lparse-warn warning-msg) - date) - (t - ;; ISO 8601 format - (format-time-string "%Y-%m-%dT%T%:z"))))) - -(defun org-odt-update-meta-file (opt-plist) - (with-current-buffer - (find-file-noselect (expand-file-name "meta.xml") t) - (let ((date (org-odt-format-date (plist-get opt-plist :date))) - (author (or (plist-get opt-plist :author) "")) - (email (plist-get opt-plist :email)) - (keywords (plist-get opt-plist :keywords)) - (description (plist-get opt-plist :description)) - (title (plist-get opt-plist :title))) - - (insert - "\n" - (org-odt-format-tags '("" . "") author) - (org-odt-format-tags - '("\n" . "") author) - (org-odt-format-tags '("\n" . "") date) - (org-odt-format-tags - '("\n" . "") date) - (org-odt-format-tags '("\n" . "") - (when org-export-creator-info - (format "Org-%s/Emacs-%s" - org-version emacs-version))) - (org-odt-format-tags '("\n" . "") keywords) - (org-odt-format-tags '("\n" . "") description) - (org-odt-format-tags '("\n" . "") title) - "\n")))) - -(defun org-odt-update-manifest-file (media-type full-path) - (with-current-buffer - (find-file-noselect (expand-file-name "META-INF/manifest.xml") t) - (insert (format org-odt-manifest-file-entry-tag media-type full-path)))) - -(defun org-odt-finalize-outfile () - (message "org-newodt: Finalizing outfile") - (org-odt-delete-empty-paragraphs)) - -(defun org-odt-delete-empty-paragraphs () - (goto-char (point-min)) - (let ((open "]*>") - (close "")) - (while (re-search-forward (format "%s[ \r\n\t]*%s" open close) nil t) - (replace-match "")))) - -(defun org-odt-get (what &optional opt-plist) - (case what - (BACKEND 'odt) - (EXPORT-DIR (org-export-directory :html opt-plist)) - (FILE-NAME-EXTENSION "odt") - (EXPORT-BUFFER-NAME "*Org ODT Export*") - (ENTITY-CONTROL org-odt-entity-control-callbacks-alist) - (ENTITY-FORMAT org-odt-entity-format-callbacks-alist) - (INIT-METHOD 'org-odt-init-outfile) - (FINAL-METHOD 'org-odt-finalize-outfile) - (SAVE-METHOD 'org-odt-save-as-outfile) - (OTHER-BACKENDS - '("bib" "doc" "doc6" "doc95" "html" "xhtml" "latex" "odt" "ott" "pdf" "rtf" - "sdw" "sdw3" "sdw4" "stw " "sxw" "mediawiki" "text" "txt" "uot" "vor" - "vor3" "vor4" "docbook" "ooxml" "ppt" "odp")) - (CONVERT-METHOD org-lparse-convert-process) - (TOPLEVEL-HLEVEL 1) - (SPECIAL-STRING-REGEXPS org-export-odt-special-string-regexps) - (INLINE-IMAGES 'maybe) - (INLINE-IMAGE-EXTENSIONS '("png" "jpeg" "jpg" "gif" "svg")) - (PLAIN-TEXT-MAP '(("&" . "&") ("<" . "<") (">" . ">"))) - (TABLE-FIRST-COLUMN-AS-LABELS nil) - (FOOTNOTE-SEPARATOR (org-lparse-format 'FONTIFY "," 'superscript)) - (CODING-SYSTEM-FOR-WRITE 'utf-8) - (CODING-SYSTEM-FOR-SAVE 'utf-8) - (t (error "Unknown property: %s" what)))) - -(defun org-odt-parse-label (label) - (save-match-data - (if (not (string-match "\\`[a-zA-Z]+:\\(.+\\)" label)) - (cons label nil) - (cons - (capitalize (substring label 0 (1- (match-beginning 1)))) - (substring label (match-beginning 1)))))) - -(defvar org-lparse-latex-fragment-fallback) ; set by org-do-lparse -(defun org-export-odt-preprocess (parameters) - "Convert LaTeX fragments to images." - (when (and org-current-export-file - (plist-get parameters :LaTeX-fragments)) - (org-format-latex - (concat "ltxpng/" (file-name-sans-extension - (file-name-nondirectory - org-current-export-file))) - org-current-export-dir nil "Creating LaTeX image %s" - nil nil - (cond - ((eq (plist-get parameters :LaTeX-fragments) 'verbatim) 'verbatim) - ;; Investigate MathToWeb for converting TeX equations to MathML - ;; See http://lists.gnu.org/archive/html/emacs-orgmode/2011-03/msg01755.html - ((or (eq (plist-get parameters :LaTeX-fragments) 'mathjax ) - (eq (plist-get parameters :LaTeX-fragments) t )) - (org-lparse-warn - (concat - "Use of MathJax is incompatible with ODT exporter. " - (format "Using %S instead." org-lparse-latex-fragment-fallback))) - org-lparse-latex-fragment-fallback) - ((eq (plist-get parameters :LaTeX-fragments) 'dvipng ) 'dvipng) - (t nil)))) - (goto-char (point-min)) - (let (label label-components category value pretty-label) - (while (re-search-forward "\\\\ref{\\([^{}\n]+\\)}" nil t) - (org-if-unprotected-at (match-beginning 1) - (setq label (match-string 1) - label-components (org-odt-parse-label label) - category (car label-components) - value (cdr label-components) - pretty-label (if value (concat category " " value) label)) - (replace-match - (let ((org-lparse-encode-pending t)) - (org-odt-format-tags - '("" - . "") pretty-label label)) t t))))) - -(declare-function archive-zip-extract "arc-mode.el" (archive name)) -(defun org-odt-zip-extract-one (archive member &optional target) - (require 'arc-mode) - (let* ((target (or target default-directory)) - (archive (expand-file-name archive)) - (archive-zip-extract - (list "unzip" "-qq" "-o" "-d" target)) - exit-code command-output) - (setq command-output - (with-temp-buffer - (setq exit-code (archive-zip-extract archive member)) - (buffer-string))) - (unless (zerop exit-code) - (message command-output) - (error "Extraction failed")))) - -(defun org-odt-zip-extract (archive members &optional target) - (when (atom members) (setq members (list members))) - (mapc (lambda (member) - (org-odt-zip-extract-one archive member target)) - members)) - -(defun org-odt-copy-styles-file (&optional styles-file) - ;; Non-availability of styles.xml is not a critical error. For now - ;; throw an error purely for aesthetic reasons. - (setq styles-file (or styles-file - org-export-odt-styles-file - (expand-file-name "styles/OrgOdtStyles.xml" - org-odt-data-dir) - (error "org-odt: Missing styles file?"))) - (cond - ((listp styles-file) - (let ((archive (nth 0 styles-file)) - (members (nth 1 styles-file))) - (org-odt-zip-extract archive members) - (mapc - (lambda (member) - (when (org-file-image-p member) - (let* ((image-type (file-name-extension member)) - (media-type (format "image/%s" image-type))) - (org-odt-update-manifest-file media-type member)))) - members))) - ((and (stringp styles-file) (file-exists-p styles-file)) - (let ((styles-file-type (file-name-extension styles-file))) - (cond - ((string= styles-file-type "xml") - (copy-file styles-file "styles.xml" t)) - ((member styles-file-type '("odt" "ott")) - (org-odt-zip-extract styles-file "styles.xml"))))) - (t - (error (format "Invalid specification of styles.xml file: %S" - org-export-odt-styles-file))))) - -(defvar org-export-odt-factory-settings - "d4328fb9d1b6cb211d4320ff546829f26700dc5e" - "SHA1 hash of OrgOdtStyles.xml.") - -(defun org-odt-configure-outline-numbering (level) - "Outline numbering is retained only upto LEVEL. -To disable outline numbering pass a LEVEL of 0." - (if (not (string= org-export-odt-factory-settings (sha1 (current-buffer)))) - (org-lparse-warn - "org-odt: Using custom styles file? Consider tweaking styles.xml for better output. To suppress this warning update `org-export-odt-factory-settings'") - (goto-char (point-min)) - (let ((regex - "") - (replacement - "")) - (while (re-search-forward regex nil t) - (when (> (string-to-number (match-string 1)) level) - (replace-match replacement t nil)))) - (save-buffer 0))) - -(provide 'org-odt) - -;;; org-odt.el ends here diff -Nru org-mode-7.7/contrib/lisp/org-panel.el org-mode-7.8.02/contrib/lisp/org-panel.el --- org-mode-7.7/contrib/lisp/org-panel.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/contrib/lisp/org-panel.el 2011-12-13 00:34:24.000000000 +0000 @@ -637,6 +637,7 @@ (provide 'org-panel) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ;;; org-panel.el ends here diff -Nru org-mode-7.7/contrib/lisp/org-registry.el org-mode-7.8.02/contrib/lisp/org-registry.el --- org-mode-7.7/contrib/lisp/org-registry.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/contrib/lisp/org-registry.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,12 +1,12 @@ ;;; org-registry.el --- a registry for Org links ;; -;; Copyright 2007, 2008 Bastien Guerry +;; Copyright 2007-2011 Bastien Guerry ;; ;; Emacs Lisp Archive Entry ;; Filename: org-registry.el ;; Version: 0.1a -;; Author: Bastien Guerry -;; Maintainer: Bastien Guerry +;; Author: Bastien Guerry +;; Maintainer: Bastien Guerry ;; Keywords: org, wp, registry ;; Description: Shows Org files where the current buffer is linked ;; URL: http://www.cognition.ens.fr/~guerry/u/org-registry.el @@ -219,7 +219,7 @@ (defun org-registry-update () "Update the registry for the current Org file." (interactive) - (unless (org-mode-p) (error "Not in org-mode")) + (unless (eq major-mode 'org-mode) (error "Not in org-mode")) (let* ((from-file (expand-file-name (buffer-file-name))) (new-entries (org-registry-get-entries from-file))) (with-temp-buffer diff -Nru org-mode-7.7/contrib/lisp/org-screen.el org-mode-7.8.02/contrib/lisp/org-screen.el --- org-mode-7.7/contrib/lisp/org-screen.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/contrib/lisp/org-screen.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,6 +1,6 @@ ;;; org-screen.el --- Integreate Org-mode with screen. -;; Copyright (c) 2008 Andrew Hyatt +;; Copyright (c) 2008-2011 Andrew Hyatt ;; ;; Author: Andrew Hyatt ;; Maintainer: Carsten Dominik diff -Nru org-mode-7.7/contrib/lisp/org-secretary.el org-mode-7.8.02/contrib/lisp/org-secretary.el --- org-mode-7.7/contrib/lisp/org-secretary.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/contrib/lisp/org-secretary.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,5 +1,5 @@ ;;; org-secretary.el --- Team management with org-mode -;; Copyright (C) 2010 Juan Reyero +;; Copyright (C) 2010-2011 Juan Reyero ;; ;; Author: Juan Reyero ;; Keywords: outlines, tasks, team, management diff -Nru org-mode-7.7/contrib/lisp/org-sudoku.el org-mode-7.8.02/contrib/lisp/org-sudoku.el --- org-mode-7.7/contrib/lisp/org-sudoku.el 1970-01-01 00:00:00.000000000 +0000 +++ org-mode-7.8.02/contrib/lisp/org-sudoku.el 2011-12-13 00:34:24.000000000 +0000 @@ -0,0 +1,289 @@ +;;; org-sudoku.el --- Greate and solve SUDOKU games in Org tables +;; Copyright (C) 2011 Free Software Foundation, Inc. +;; +;; Author: Carsten Dominik +;; Keywords: outlines, hypermedia, calendar, wp, games +;; Homepage: http://orgmode.org +;; Version: 0.01 +;; +;; This file is not yet part of GNU Emacs. +;; +;; GNU Emacs is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 3, or (at your option) +;; any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;;; Commentary: +;; +;; This is a quick hack to create and solve SUDOKU games in org tables. +;; +;; Commands: +;; +;; org-sudoku-create Create a new SUDOKU game +;; org-sudoku-solve-field Solve the field at point in a SUDOKU game +;; (this is for cheeting when you are stuck) +;; org-sudoku-solve Solve the entire game +;; + +;;; Code + +(require 'org) +(require 'org-table) + +;;; Customization + +(defvar org-sudoku-size 9 + "The size of the sudoku game, 9 for a 9x9 game and 4 for a 4x4 game. +Larger games do not seem to work because of limited resources - even though +the algorithm is general.") + +(defvar org-sudoku-timeout 2.0 + "Timeout for finding a solution when creating a new game. +After this timeout, the program starts over from scratch to create +a game.") + +;;; Interactive commands + +(defun org-sudoku-create (nfilled) + "Create a sudoku game." + (interactive "nNumber of pre-filled fields: ") + (let ((sizesq org-sudoku-size) + game) + (loop for i from 1 to org-sudoku-size do + (loop for j from 1 to org-sudoku-size do + (push (list (cons i j) 0) game))) + (setq game (nreverse game)) + (random t) + (setq game (org-sudoku-build-allowed game)) + (setq game (org-sudoku-set-field game (cons 1 1) + (1+ (random org-sudoku-size)))) + (catch 'solved + (let ((cnt 0)) + (while t + (catch 'abort + (message "Attempt %d to create a game" (setq cnt (1+ cnt))) + (setq game1 (org-sudoku-deep-copy game)) + (setq game1 (org-sudoku-solve-game + game1 'random (+ (float-time) org-sudoku-timeout))) + (when game1 + (setq game game1) + (throw 'solved t)))))) + (let ((sqrtsize (floor (sqrt org-sudoku-size)))) + (loop for i from 1 to org-sudoku-size do + (insert "| |\n") + (if (and (= (mod i sqrtsize) 0) (< i org-sudoku-size)) + (insert "|-\n"))) + (backward-char 5) + (org-table-align)) + (while (> (length game) nfilled) + (setq game (delete (nth (1+ (random (length game))) game) game))) + (mapc (lambda (e) + (org-table-put (caar e) (cdar e) (int-to-string (nth 1 e)))) + game) + (org-table-align) + (org-table-goto-line 1) + (org-table-goto-column 1) + (message "Enjoy!"))) + +(defun org-sudoku-solve () + "Solve the sudoku game in the table at point." + (interactive) + (unless (org-at-table-p) + (error "not at a table")) + (let (game) + (setq game (org-sudoku-get-game)) + (setq game (org-sudoku-build-allowed game)) + (setq game (org-sudoku-solve-game game)) + ;; Insert the values + (mapc (lambda (e) + (org-table-put (caar e) (cdar e) (int-to-string (nth 1 e)))) + game) + (org-table-align))) + +(defun org-sudoku-solve-field () + "Just solve the field at point. +This works by solving the whole game, then inserting only the single field." + (interactive) + (unless (org-at-table-p) + (error "Not at a table")) + (org-table-check-inside-data-field) + (let ((i (org-table-current-dline)) + (j (org-table-current-column)) + game) + (setq game (org-sudoku-get-game)) + (setq game (org-sudoku-build-allowed game)) + (setq game (org-sudoku-solve-game game)) + (if game + (progn + (org-table-put i j (number-to-string + (nth 1 (assoc (cons i j) game))) + 'align) + (org-table-goto-line i) + (org-table-goto-column j)) + (error "No solution")))) + +;;; Internal functions + +(defun org-sudoku-get-game () + "Interpret table at point as sudoku game and read it. +A game structure is returned." + (let (b e g i j game) + + (org-table-goto-line 1) + (org-table-goto-column 1) + (setq b (point)) + (org-table-goto-line org-sudoku-size) + (org-table-goto-column org-sudoku-size) + (setq e (point)) + (setq g (org-table-copy-region b e)) + (setq i 0 j 0) + (mapc (lambda (c) + (setq i (1+ i) j 0) + (mapc + (lambda (v) + (setq j (1+ j)) + (push (list (cons i j) + (string-to-number v)) + game)) + c)) + g) + (nreverse game))) + +(defun org-sudoku-build-allowed (game) + (let (i j v numbers) + (loop for i from 1 to org-sudoku-size do + (push i numbers)) + (setq numbers (nreverse numbers)) + ;; add the lists of allowed values for each entry + (setq game (mapcar + (lambda (e) + (list (car e) (nth 1 e) + (if (= (nth 1 e) 0) + (copy-sequence numbers) + nil))) + game)) + ;; remove the known values from the list of allowed values + (mapc + (lambda (e) + (setq i (caar e) j (cdar e) v (cadr e)) + (when (> v 0) + ;; We do have a value here + (mapc + (lambda (f) + (setq a (assoc f game)) + (setf (nth 2 a) (delete v (nth 2 a)))) + (cons (cons i j) (org-sudoku-rel-fields i j))))) + game) + game)) + +(defun org-sudoku-find-next-constrained-field (game) + (setq game (mapcar (lambda (e) (if (nth 2 e) e nil)) game)) + (setq game (delq nil game)) + (let (va vb la lb) + (setq game + (sort game (lambda (a b) + (setq va (nth 1 a) vb (nth 1 b) + la (length (nth 2 a)) lb (length (nth 2 b))) + (cond + ((and (= va 0) (> vb 0)) t) + ((and (> va 0) (= vb 0)) nil) + ((not (= (* va vb) 0)) nil) + (t (< la lb)))))) + (if (or (not game) (> 0 (nth 1 (car game)))) + nil + (caar game)))) + +(defun org-sudoku-solve-game (game &optional random stop-at) + "Solve GAME. +If RANDOM is non-nit, select candidates randomly from a fields option. +If RANDOM is nil, always start with the first allowed value and try +solving from there. +STOP-AT can be a float time, the solver will abort at that time because +it is probably stuck." + (let (e v v1 allowed next g) + (when (and stop-at + (> (float-time) stop-at)) + (setq game nil) + (throw 'abort nil)) + (while (setq next (org-sudoku-find-next-constrained-field game)) + (setq e (assoc next game) + v (nth 1 e) + allowed (nth 2 e)) + (catch 'solved + (if (= (length allowed) 1) + (setq game (org-sudoku-set-field game next (car allowed))) + (while allowed + (setq g (org-sudoku-deep-copy game)) + (if (not random) + (setq v1 (car allowed)) + (setq v1 (nth (random (length allowed)) allowed))) + (setq g (org-sudoku-set-field g next v1)) + (setq g (org-sudoku-solve-game g random stop-at)) + (when g + (setq game g) + (throw 'solved g))) + (setq game nil)))) + (if (or (not game) + (org-sudoku-unknown-field-p game)) + nil + game))) + +(defun org-sudoku-unknown-field-p (game) + "Are there still unknown fields in the game?" + (delq nil (mapcar (lambda (e) (if (> (nth 1 e) 0) nil t)) game))) + +(defun org-sudoku-deep-copy (game) + "Make a copy of the game so that manipulating the copy does not change the parent." + (mapcar (lambda(e) + (list (car e) (nth 1 e) (copy-sequence (nth 2 e)))) + game)) + +(defun org-sudoku-set-field (game field value) + "Put VALUE into FIELD, and tell related fields that they cannot be VALUE." + (let (i j) + (setq i (car field) j (cdr field)) + (setq a (assoc field game)) + (setf (nth 1 a) value) + (setf (nth 2 a) nil) + + ;; Remove value from all related fields + (mapc + (lambda (f) + (setq a (assoc f game)) + (setf (nth 2 a) (delete value (nth 2 a)))) + (org-sudoku-rel-fields i j)) + game)) + +(defun org-sudoku-rel-fields (i j) + "Compute the list of related fields for field (i j)." + (let ((sqrtsize (floor (sqrt org-sudoku-size))) + ll imin imax jmin jmax f) + (setq f (cons i j)) + (loop for ii from 1 to org-sudoku-size do + (or (= ii i) (push (cons ii j) ll))) + (loop for jj from 1 to org-sudoku-size do + (or (= jj j) (push (cons i jj) ll))) + (setq imin (1+ (* sqrtsize (/ (1- i) sqrtsize))) + imax (+ imin sqrtsize -1)) + (setq jmin (1+ (* sqrtsize (/ (1- j) sqrtsize))) + jmax (+ jmin sqrtsize -1)) + (loop for ii from imin to imax do + (loop for jj from jmin to jmax do + (setq ff (cons ii jj)) + (or (equal ff f) + (member ff ll) + (push ff ll)))) + ll)) + +;;; org-sudoku ends here diff -Nru org-mode-7.7/contrib/lisp/orgtbl-sqlinsert.el org-mode-7.8.02/contrib/lisp/orgtbl-sqlinsert.el --- org-mode-7.7/contrib/lisp/orgtbl-sqlinsert.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/contrib/lisp/orgtbl-sqlinsert.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,6 +1,6 @@ ;;; orgtbl-sqlinsert.el --- orgtbl to SQL insert statements. -;; Copyright (C) 2008 Free Software Foundation +;; Copyright (C) 2008-2011 Free Software Foundation ;; Author: Jason Riedy ;; Keywords: org, tables, sql @@ -112,4 +112,5 @@ (t nil))) (provide 'orgtbl-sqlinsert) + ;;; orgtbl-sqlinsert.el ends here diff -Nru org-mode-7.7/contrib/lisp/org-toc.el org-mode-7.8.02/contrib/lisp/org-toc.el --- org-mode-7.7/contrib/lisp/org-toc.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/contrib/lisp/org-toc.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,12 +1,14 @@ ;;; org-toc.el --- Table of contents for Org-mode buffer -;; Copyright 2007 Bastien Guerry +;; Copyright 2007-2011 Free Software Foundation, Inc. ;; -;; Author: Bastien Guerry +;; Author: Bastien Guerry ;; Keywords: Org table of contents ;; Homepage: http://www.cognition.ens.fr/~guerry/u/org-toc.el ;; Version: 0.8 +;; This file is not part of GNU Emacs. + ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 3, or (at your option) @@ -216,7 +218,7 @@ (defun org-toc-show (&optional depth position) "Show the table of contents of the current Org-mode buffer." (interactive "P") - (if (org-mode-p) + (if (eq major-mode 'org-mode) (progn (setq org-toc-base-buffer (current-buffer)) (setq org-toc-odd-levels-only org-odd-levels-only)) (if (eq major-mode 'org-toc-mode) @@ -483,6 +485,4 @@ ;;;; User Options, Variables ;;;;########################################################################## - - ;;; org-toc.el ends here diff -Nru org-mode-7.7/contrib/lisp/org-track.el org-mode-7.8.02/contrib/lisp/org-track.el --- org-mode-7.7/contrib/lisp/org-track.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/contrib/lisp/org-track.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,6 +1,6 @@ ;;; org-track.el --- Track the most recent Org-mode version available. ;; -;; Copyright (C) 2009 +;; Copyright (C) 2009-2011 ;; Free Software Foundation, Inc. ;; ;; Author: Bastien Guerry diff -Nru org-mode-7.7/contrib/lisp/org-velocity.el org-mode-7.8.02/contrib/lisp/org-velocity.el --- org-mode-7.7/contrib/lisp/org-velocity.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/contrib/lisp/org-velocity.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,10 +1,10 @@ ;;; org-velocity.el --- something like Notational Velocity for Org. -;; Copyright (C) 2010, 2011 Paul M. Rodriguez +;; Copyright (C) 2010-2011 Paul M. Rodriguez ;; Author: Paul M. Rodriguez ;; Created: 2010-05-05 -;; Version: 2.4 +;; Version: 3.0 ;; This file is not part of GNU Emacs. @@ -58,7 +58,7 @@ ;;; Usage: ;; (require 'org-velocity) ;; (setq org-velocity-bucket (expand-file-name "bucket.org" org-directory)) -;; (global-set-key (kbd "C-c v") 'org-velocity-read) +;; (global-set-key (kbd "C-c v") 'org-velocity) ;;; Code: (require 'org) @@ -85,6 +85,12 @@ :type 'boolean :safe 'booleanp) +(defcustom org-velocity-show-previews t + "Show previews of the text of each heading?" + :group 'velocity + :type 'boolean + :safe 'booleanp) + (defcustom org-velocity-exit-on-match nil "When searching incrementally, exit on a single match?" :group 'org-velocity @@ -97,14 +103,6 @@ :type 'boolean :safe 'booleanp) -(defcustom org-velocity-max-depth nil - "Ignore headings deeper than this." - :group 'org-velocity - :type '(choice - (const :tag "No maximum depth" nil) - (integer :tag "Set maximum depth")) - :safe (lambda (v) (or (null v) (wholenump v)))) - (defcustom org-velocity-use-search-ring t "Push search to `search-ring' when visiting an entry? @@ -132,12 +130,6 @@ (const :tag "Use completion" t)) :safe 'booleanp) -(defcustom org-velocity-edit-indirectly t - "Edit entries in an indirect buffer or just visit the file?" - :group 'org-velocity - :type 'boolean - :safe 'booleanp) - (defcustom org-velocity-search-method 'phrase "Match on whole phrase, any word, or all words?" :group 'org-velocity @@ -148,28 +140,6 @@ (const :tag "Match a regular expression" regexp)) :safe (lambda (v) (memq v '(phrase any all regexp)))) -(defcustom org-velocity-create-method 'capture - "Prefer `org-capture', `org-remember', or neither?" - :group 'org-velocity - :type '(choice - (const :tag "Prefer capture > remember > default." capture) - (const :tag "Prefer remember > default." remember) - (const :tag "Edit in buffer." buffer)) - :safe (lambda (v) (memq v '(capture remember buffer)))) - -(defcustom org-velocity-remember-templates - '(("Velocity entry" - ?v - "* %:search\n\n%i%?" - nil - bottom)) - "Use these templates with `org-remember'. -Meanwhile `org-default-notes-file' is bound to `org-velocity-use-file'. -The keyword :search inserts the current search. -See the documentation for `org-remember-templates'." - :group 'org-velocity - :type (or (get 'org-remember-templates 'custom-type) 'list)) - (defcustom org-velocity-capture-templates '(("v" "Velocity entry" @@ -177,19 +147,48 @@ (file "") "* %:search\n\n%i%?")) "Use these template with `org-capture'. -Meanwhile `org-default-notes-file' is bound to `org-velocity-use-file'. +Meanwhile `org-default-notes-file' is bound to `org-velocity-bucket-file'. The keyword :search inserts the current search. See the documentation for `org-capture-templates'." :group 'org-velocity :type (or (get 'org-capture-templates 'custom-type) 'list)) -(defstruct (org-velocity-heading - (:constructor org-velocity-make-heading - (&aux (components (org-heading-components)))) - (:type list)) - (marker (point-marker)) - (name (nth 4 components)) - (level (nth 0 components))) +(defsubst org-velocity-grab-preview () + "Grab preview of a subtree. +The length of the preview is determined by `window-width'. + +Replace all contiguous whitespace with single spaces." + (let ((start (progn + (forward-line 1) + (if (looking-at org-property-start-re) + (re-search-forward org-property-end-re) + (1- (point)))))) + (mapconcat + #'identity + (split-string + (buffer-substring-no-properties + start + (min + (+ start (window-width)) + (point-max)))) + " "))) + +(defstruct org-velocity-heading buffer position name level preview) + +(defsubst org-velocity-nearest-heading (position) + "Return last heading at POSITION. +If there is no last heading, return nil." + (save-excursion + (goto-char position) + (re-search-backward org-velocity-heading-regexp) + (let ((components (org-heading-components))) + (make-org-velocity-heading + :buffer (current-buffer) + :position (point) + :name (nth 4 components) + :level (nth 0 components) + :preview (if org-velocity-show-previews + (org-velocity-grab-preview)))))) (defconst org-velocity-index (eval-when-compile @@ -198,15 +197,18 @@ (number-sequence 65 90))) ;uppercase letters "List of chars for indexing results.") -(defconst org-velocity-display-buffer-name "*Velocity headings*") +(defconst org-velocity-match-buffer-name "*Velocity matches*") + +(defconst org-velocity-heading-regexp "^\\* " + "Regexp to match only top-level headings.") (defvar org-velocity-search nil "Variable to bind to current search.") -(defsubst org-velocity-buffer-file-name (&optional buffer) +(defun org-velocity-buffer-file-name (&optional buffer) "Return the name of the file BUFFER saves to. Same as function `buffer-file-name' unless BUFFER is an indirect -buffer or a minibuffer. In the former case, return the file name +buffer or a minibuffer. In the former case, return the file name of the base buffer; in the latter, return the file name of `minibuffer-selected-window' (or its base buffer)." (let ((buffer (if (minibufferp buffer) @@ -222,71 +224,55 @@ (with-current-buffer (window-buffer (active-minibuffer-window)) (minibuffer-contents)))) -(defun org-velocity-use-file () +(defsubst org-velocity-singlep (object) + "Return t when OBJECT is a list or sequence of one element." + (if (consp object) + (null (cdr object)) + (= (length object) 1))) + +(defun org-velocity-bucket-file () "Return the proper file for Org-Velocity to search. -If `org-velocity-always-use-bucket' is t, use bucket file; complain -if missing. Otherwise if this is an Org file, use it." - (or - ;; Use the target in in remember buffers. - (if (and (boundp 'org-remember-mode) org-remember-mode) - org-default-notes-file) - (let ((org-velocity-bucket - (and org-velocity-bucket (expand-file-name org-velocity-bucket))) - (buffer (if (org-velocity-buffer-file-name) - ;; Use the target in capture buffers. - (org-find-base-buffer-visiting (org-velocity-buffer-file-name))))) - (if org-velocity-always-use-bucket - (or org-velocity-bucket (error "Bucket required but not defined")) - (if (and (eq (buffer-local-value 'major-mode (or buffer (current-buffer))) - 'org-mode) - (org-velocity-buffer-file-name)) - (org-velocity-buffer-file-name) - (or org-velocity-bucket - (error "No bucket and not an Org file"))))))) +If `org-velocity-always-use-bucket' is t, use bucket file; +complain if missing. Otherwise, if an Org file is current, then +use it." + (let ((org-velocity-bucket + (when org-velocity-bucket (expand-file-name org-velocity-bucket))) + (buffer + (let ((buffer-file (org-velocity-buffer-file-name))) + (when buffer-file + ;; Use the target in capture buffers. + (org-find-base-buffer-visiting buffer-file))))) + (if org-velocity-always-use-bucket + (or org-velocity-bucket (error "Bucket required but not defined")) + (if (and (eq (buffer-local-value 'major-mode (or buffer (current-buffer))) + 'org-mode) + (org-velocity-buffer-file-name)) + (org-velocity-buffer-file-name) + (or org-velocity-bucket + (error "No bucket and not an Org file")))))) -(defsubst org-velocity-display-buffer () - "Return the proper buffer for Org-Velocity to display in." - (get-buffer-create org-velocity-display-buffer-name)) +(defvar org-velocity-bucket-buffer nil) (defsubst org-velocity-bucket-buffer () - "Return proper buffer for bucket operations." - (find-file-noselect (org-velocity-use-file))) + (or org-velocity-bucket-buffer + (find-file-noselect (org-velocity-bucket-file)))) -(defun org-velocity-nearest-heading (position) - "Return last heading at POSITION. -If there is no last heading, return nil." - (save-excursion - (goto-char position) - ;; If we are before the first heading we could still be at the - ;; first heading. - (unless (and (org-before-first-heading-p) - (not (org-at-heading-p))) - (org-back-to-heading t) - (let ((heading (org-velocity-make-heading))) - (if org-velocity-max-depth - (if (<= (org-velocity-heading-level heading) - org-velocity-max-depth) - heading) - heading))))) - -(defun org-velocity-make-button-action (heading) - "Return a form to visit HEADING." - `(lambda (button) - (run-hooks 'mouse-leave-buffer-hook) ;turn off temporary modes - (if org-velocity-use-search-ring - (add-to-history 'search-ring ,org-velocity-search search-ring-max)) - (if org-velocity-edit-indirectly - (org-velocity-edit-entry ',heading) - (progn - (message "%s" ,(org-velocity-heading-name heading)) - (org-pop-to-buffer-same-window (marker-buffer - ,(org-velocity-heading-marker heading))) - (goto-char (marker-position - ,(org-velocity-heading-marker heading))))))) +(defsubst org-velocity-match-buffer () + "Return the proper buffer for Org-Velocity to display in." + (get-buffer-create org-velocity-match-buffer-name)) + +(defun org-velocity-beginning-of-headings () + "Goto the start of the first heading." + (goto-char (point-min)) + ;; If we are before the first heading we could still be at the + ;; first heading. + (or (looking-at org-velocity-heading-regexp) + (re-search-forward org-velocity-heading-regexp))) (defun org-velocity-make-indirect-buffer (heading) "Make or switch to an indirect buffer visiting HEADING." - (let* ((bucket (marker-buffer (org-velocity-heading-marker heading))) + + (let* ((bucket (org-velocity-heading-buffer heading)) (name (org-velocity-heading-name heading)) (existing (get-buffer name))) (if (and existing (buffer-base-buffer existing) @@ -296,144 +282,168 @@ bucket (generate-new-buffer-name (org-velocity-heading-name heading)))))) +(defun org-velocity-capture () + "Record a note with `org-capture'." + (let ((org-capture-templates + org-velocity-capture-templates)) + (org-capture nil + ;; This is no longer automatically selected. + (when (org-velocity-singlep org-capture-templates) + (caar org-capture-templates))) + (if org-capture-mode (rename-buffer org-velocity-search t)))) + +(defvar org-velocity-saved-winconf nil) +(make-variable-buffer-local 'org-velocity-saved-winconf) + (defun org-velocity-edit-entry (heading) "Edit entry at HEADING in an indirect buffer." - (let ((buffer (org-velocity-make-indirect-buffer heading))) - (with-current-buffer buffer - (let ((org-inhibit-startup t)) - (org-mode)) - (goto-char (marker-position (org-velocity-heading-marker heading))) - (narrow-to-region (point) - (save-excursion - (org-end-of-subtree t) - (point))) - (goto-char (point-min)) - (add-hook 'org-ctrl-c-ctrl-c-hook 'org-velocity-dismiss nil t)) - (pop-to-buffer buffer) - (set (make-local-variable 'header-line-format) - (format "%s Use C-c C-c to finish." - (abbreviate-file-name - (buffer-file-name - (marker-buffer - (org-velocity-heading-marker heading)))))))) + (let ((winconf (current-window-configuration))) + (let ((buffer (org-velocity-make-indirect-buffer heading))) + (with-current-buffer buffer + (let ((org-inhibit-startup t)) + (org-mode)) + (setq org-velocity-saved-winconf winconf) + (goto-char (org-velocity-heading-position heading)) + (narrow-to-region (point) + (save-excursion + (org-end-of-subtree t) + (point))) + (goto-char (point-min)) + (add-hook 'org-ctrl-c-ctrl-c-hook 'org-velocity-dismiss nil t)) + (pop-to-buffer buffer) + (set (make-local-variable 'header-line-format) + (format "%s Use C-c C-c to finish." + (abbreviate-file-name + (buffer-file-name + (org-velocity-heading-buffer heading)))))))) (defun org-velocity-dismiss () "Save current entry and close indirect buffer." - (progn - (save-buffer) - (kill-buffer))) + (let ((winconf org-velocity-saved-winconf)) + (prog1 t ;Tell hook we're done. + (save-buffer) + (kill-buffer) + (when (window-configuration-p winconf) + (set-window-configuration winconf))))) + +(defun org-velocity-visit-button (button) + (run-hooks 'mouse-leave-buffer-hook) + (if org-velocity-use-search-ring + (add-to-history 'search-ring + (button-get button 'search) + search-ring-max)) + (org-velocity-edit-entry (button-get button 'match))) -(defun org-velocity-buttonize-no-hints (heading) - "Insert HEADING as a text button with no hints." - (let ((action (org-velocity-make-button-action heading))) - (insert-text-button - (org-velocity-heading-name heading) - 'action action)) - (newline)) - -(defun org-velocity-buttonize (heading) - "Insert HEADING as a text button with an hint." - (insert (format "#%c " (nth (1- (line-number-at-pos)) - org-velocity-index))) - (org-velocity-buttonize-no-hints heading)) - -(defun org-velocity-remember () - "Use `org-remember' to record a note." - (let ((org-remember-templates - org-velocity-remember-templates)) - (call-interactively 'org-remember) - (when org-remember-mode - (set (make-local-variable 'remember-buffer) - (rename-buffer org-velocity-search t))))) +(define-button-type 'org-velocity-button + 'action #'org-velocity-visit-button) -(defun org-velocity-capture () - "Use `org-capture' to record a note." - (let ((org-capture-templates - org-velocity-capture-templates)) - (when (fboundp 'org-capture) ;; quiet compiler - (call-interactively 'org-capture) - (if org-capture-mode (rename-buffer org-velocity-search t))))) - -(defun org-velocity-insert-heading (&optional heading) - "Add a new heading named HEADING and go to it." - (let ((heading (or heading org-velocity-search))) - (pop-to-buffer (org-velocity-bucket-buffer)) - (goto-char (point-max)) - (let ((inhibit-quit t)) - (newline) - (org-insert-heading t t) (insert heading) - (newline) - (goto-char (point-max))))) - -(defun org-velocity-generic-search (search) - "Return entries containing SEARCH." - (save-excursion - (loop initially (goto-char (point-min)) - while (re-search-forward search (point-max) t) - if (org-velocity-nearest-heading (match-beginning 0)) - collect it - do (outline-next-heading)))) - -(defsubst org-velocity-phrase-search (search) - "Return entries containing SEARCH as a phrase." - (org-velocity-generic-search (regexp-quote search))) - -(defsubst org-velocity-any-search (search) - "Return entries containing any word in SEARCH." - (org-velocity-generic-search (regexp-opt (split-string search)))) - -(defsubst org-velocity-regexp-search (search) - (condition-case lossage - (org-velocity-generic-search search) - (invalid-regexp (minibuffer-message "%s" lossage)))) - -(defun org-velocity-all-search (search) - "Return entries containing all words in SEARCH." - (save-excursion - (let ((keywords (mapcar 'regexp-quote (split-string search)))) - (delq nil - (org-map-entries - (lambda () - ;; Only search the subtree once. - (setq org-map-continue-from - (save-excursion (org-end-of-subtree t) (point))) - (if (loop for word in keywords - always (save-excursion - (re-search-forward - word org-map-continue-from t))) - (org-velocity-nearest-heading (point))))))))) - -(defun org-velocity-present (headings &optional no-hints search) - "Buttonize HEADINGS in `org-velocity-display-buffer'. -If NO-HINTS is non-nil, display entries without indices. -SEARCH binds `org-velocity-search'." - (and (listp headings) (delete-dups headings)) - (let ((cdr (nthcdr - (1- (length org-velocity-index)) - headings))) - (and (consp cdr) (setcdr cdr nil))) - (let ((org-velocity-search search)) - (with-current-buffer (org-velocity-display-buffer) - (mapc - (if no-hints 'org-velocity-buttonize-no-hints - 'org-velocity-buttonize) - headings) - (goto-char (point-min))))) - -(defun org-velocity-create-1 () - "Create a new heading. -The possible methods are `org-velocity-capture', -`org-velocity-remember', or `org-velocity-create', in -that order. Which is preferred is determined by -`org-velocity-create-method'." - (funcall - (ecase org-velocity-create-method - (capture (or (and (featurep 'org-capture) 'org-velocity-capture) - (and (featurep 'org-remember) 'org-velocity-remember) - 'org-velocity-insert-heading)) - (remember (or (and (featurep 'org-remember) 'org-velocity-remember) - 'org-velocity-insert-heading)) - (buffer 'org-velocity-insert-heading)))) +(defsubst org-velocity-buttonize (heading) + "Insert HEADING as a text button with no hints." + (insert-text-button + (propertize (org-velocity-heading-name heading) 'face 'link) + :type 'org-velocity-button + 'match heading + 'search org-velocity-search)) + +(defsubst org-velocity-insert-preview (heading) + (when org-velocity-show-previews + (insert-char ?\ 1) + (insert + (propertize + (org-velocity-heading-preview heading) + 'face 'shadow)))) + +(defsubst* org-velocity-present-match (&key hint match) + (with-current-buffer (org-velocity-match-buffer) + (when hint (insert "#" hint " ")) + (org-velocity-buttonize match) + (org-velocity-insert-preview match) + (newline))) + +(defun org-velocity-generic-search (search &optional hide-hints) + "Display any entry containing SEARCH." + (let ((hints org-velocity-index) matches) + (block nil + (while (and hints (re-search-forward search nil t)) + (let ((match (org-velocity-nearest-heading (point)))) + (org-velocity-present-match + :hint (unless hide-hints (car hints)) + :match match) + (push match matches)) + (setq hints (cdr hints)) + (unless (re-search-forward org-velocity-heading-regexp nil t) + (return)))) + (nreverse matches))) + +(defun* org-velocity-all-search (search &optional hide-hints max) + "Display only entries containing every word in SEARCH." + (let ((keywords (mapcar 'regexp-quote (split-string search))) + (hints org-velocity-index) + matches) + (org-map-entries + (lambda () + ;; Return if we've run out of hints. + (when (null hints) + (return-from org-velocity-all-search (nreverse matches))) + ;; Only search the subtree once. + (setq org-map-continue-from + (save-excursion + (goto-char (line-end-position)) + (if (re-search-forward org-velocity-heading-regexp nil t) + (line-end-position) + (point-max)))) + (when (loop for word in keywords + always (save-excursion + (re-search-forward + (concat "\\<" word "\\>") + org-map-continue-from t))) + (let ((match (org-velocity-nearest-heading (match-end 0)))) + (org-velocity-present-match + :hint (unless hide-hints (car hints)) + :match match) + (push match matches) + (setq hints (cdr hints)))))) + (nreverse matches))) + +(defun* org-velocity-present (search &key hide-hints) + "Buttonize matches for SEARCH in `org-velocity-match-buffer'. +If HIDE-HINTS is non-nil, display entries without indices. SEARCH +binds `org-velocity-search'. + +Return matches." + (if (and (stringp search) (not (string= "" search))) + ;; Fold case when the search string is all lowercase. + (let ((case-fold-search (equal search (downcase search))) + (truncate-partial-width-windows t)) + (with-current-buffer (org-velocity-match-buffer) + (erase-buffer) + ;; Permanent locals. + (setq cursor-type nil + truncate-lines t)) + (prog1 + (with-current-buffer (org-velocity-bucket-buffer) + (let ((inhibit-point-motion-hooks t) + (inhibit-field-text-motion t)) + (save-excursion + (org-velocity-beginning-of-headings) + (case org-velocity-search-method + (all (org-velocity-all-search search hide-hints)) + (phrase (org-velocity-generic-search + (concat "\\<" (regexp-quote search)) + hide-hints)) + (any (org-velocity-generic-search + (concat "\\<" + (regexp-opt (split-string search))) + hide-hints)) + (regexp (condition-case lossage + (org-velocity-generic-search + search hide-hints) + (invalid-regexp + (minibuffer-message "%s" lossage)))))))) + (with-current-buffer (org-velocity-match-buffer) + (goto-char (point-min))))) + (with-current-buffer (org-velocity-match-buffer) + (erase-buffer)))) (defun org-velocity-store-link () "Function for `org-store-link-functions'." @@ -443,72 +453,53 @@ (add-hook 'org-store-link-functions 'org-velocity-store-link) -(defun org-velocity-create (search &optional ask) +(defun* org-velocity-create (search &key ask) "Create new heading named SEARCH. If ASK is non-nil, ask first." (when (or (null ask) (y-or-n-p "No match found, create? ")) (let ((org-velocity-search search) - (org-default-notes-file (org-velocity-use-file)) + (org-default-notes-file (org-velocity-bucket-file)) ;; save a stored link org-store-link-plist) - (org-velocity-create-1)) + (org-velocity-capture)) search)) -(defun org-velocity-get-matches (search) - "Return matches for SEARCH in current bucket. -Use method specified by `org-velocity-search-method'." - (when (and search (not (string-equal "" search))) - (with-current-buffer (org-velocity-bucket-buffer) - ;; Fold case if the search string is lowercase. - (let ((case-fold-search (equal search (downcase search)))) - (case org-velocity-search-method - ('phrase (org-velocity-phrase-search search)) - ('any (org-velocity-any-search search)) - ('all (org-velocity-all-search search)) - ('regexp (org-velocity-regexp-search search))))))) - (defun org-velocity-engine (search) "Display a list of headings where SEARCH occurs." - (with-current-buffer (org-velocity-display-buffer) - (erase-buffer) - (setq cursor-type nil)) - (unless (or - (not (stringp search)) - (string-equal "" search)) ;exit on empty string - (case - (if (and org-velocity-force-new (eq last-command-event ?\C-j)) - 'force - (with-current-buffer (org-velocity-bucket-buffer) - (save-excursion - (let ((matches (org-velocity-get-matches search))) - (org-velocity-present matches nil search) - (cond ((zerop (length matches)) 'new) - ((= (length matches) 1) 'follow) - ((> (length matches) 1) 'prompt)))))) - ('prompt (progn - (Electric-pop-up-window (org-velocity-display-buffer)) - (let ((hint (org-velocity-electric-follow-hint))) - (if hint - (case hint - (edit (org-velocity-read nil search)) - (force (org-velocity-create search)) - (otherwise (org-velocity-activate-button hint))))))) - ('new (unless (org-velocity-create search t) - (org-velocity-read nil search))) - ('force (org-velocity-create search)) - ('follow (if (y-or-n-p "One match, follow? ") - (progn - (set-buffer (org-velocity-display-buffer)) - (goto-char (point-min)) - (button-activate (next-button (point)))) - (org-velocity-read nil search)))))) + (let ((org-velocity-search search)) + (unless (or + (not (stringp search)) + (string= "" search)) ;exit on empty string + (case + (if (and org-velocity-force-new (eq last-command-event ?\C-j)) + :force + (let ((matches (org-velocity-present search))) + (cond ((null matches) :new) + ((org-velocity-singlep matches) :follow) + (t :prompt)))) + (:prompt (progn + (pop-to-buffer (org-velocity-match-buffer)) + (let ((hint (org-velocity-electric-read-hint))) + (when hint (case hint + (:edit (org-velocity-read nil search)) + (:force (org-velocity-create search)) + (otherwise (org-velocity-activate-button hint))))))) + (:new (unless (org-velocity-create search :ask t) + (org-velocity-read nil search))) + (:force (org-velocity-create search)) + (:follow (if (y-or-n-p "One match, follow? ") + (progn + (set-buffer (org-velocity-match-buffer)) + (goto-char (point-min)) + (button-activate (next-button (point)))) + (org-velocity-read nil search))))))) (defun org-velocity-position (item list) "Return first position of ITEM in LIST." (loop for elt in list - for i from 0 - if (equal elt item) - return i)) + for i from 0 + when (equal elt item) + return i)) (defun org-velocity-activate-button (char) "Go to button on line number associated with CHAR in `org-velocity-index'." @@ -525,7 +516,11 @@ (interactive) (message "%s" (substitute-command-keys - "\\[org-velocity-electric-new] for new entry, \\[org-velocity-electric-edit] to edit search, \\[scroll-up] to scroll.")) + "\\[org-velocity-electric-new] for new entry, +\\[org-velocity-electric-edit] to edit search, +\\[scroll-up] to scroll up, +\\[scroll-down] to scroll down, +\\[keyboard-quit] to quit.")) (sit-for 4)) (defun org-velocity-electric-follow (ev) @@ -548,12 +543,12 @@ (defun org-velocity-electric-edit () "Edit the search string." (interactive) - (throw 'org-velocity-select 'edit)) + (throw 'org-velocity-select :edit)) (defun org-velocity-electric-new () "Force a new entry." (interactive) - (throw 'org-velocity-select 'force)) + (throw 'org-velocity-select :force)) (defvar org-velocity-electric-map (let ((map (make-sparse-keymap))) @@ -561,26 +556,28 @@ (loop for c in org-velocity-index do (define-key map (char-to-string c) 'org-velocity-electric-follow)) (define-key map "0" 'org-velocity-electric-new) - (define-key map [tab] 'scroll-up) - (define-key map [return] 'org-velocity-electric-edit) + (define-key map "\C-v" 'scroll-up) + (define-key map "\M-v" 'scroll-down) + (define-key map (kbd "RET") 'org-velocity-electric-edit) (define-key map [mouse-1] 'org-velocity-electric-click) (define-key map [mouse-2] 'org-velocity-electric-click) - (define-key map [escape escape escape] 'keyboard-quit) + (define-key map [escape] 'keyboard-quit) (define-key map "\C-h" 'help-command) map)) -(defun org-velocity-electric-follow-hint () +(defun org-velocity-electric-read-hint () "Read index of button electrically." - (with-current-buffer (org-velocity-display-buffer) + (with-current-buffer (org-velocity-match-buffer) (use-local-map org-velocity-electric-map) (catch 'org-velocity-select - (Electric-command-loop 'org-velocity-select - "Follow: ")))) + (Electric-command-loop 'org-velocity-select "Follow: ")))) (defvar org-velocity-incremental-keymap (let ((map (make-sparse-keymap))) (define-key map [mouse-1] 'org-velocity-click-for-incremental) (define-key map [mouse-2] 'org-velocity-click-for-incremental) + (define-key map "\C-v" 'scroll-up) + (define-key map "\M-v" 'scroll-down) map)) (defun org-velocity-click-for-incremental () @@ -601,30 +598,24 @@ (eq (buffer-local-value 'major-mode (window-buffer w)) 'completion-list-mode)))) -(defun org-velocity-display-for-incremental () - "Display results of search without hinting." - (when (and (sit-for idle-update-delay) - (not (org-velocity-displaying-completions-p))) +(defun org-velocity-update () + "Display results of search without hinting. +Stop searching once there are more matches than can be displayed." + (unless (org-velocity-displaying-completions-p) (let* ((search (org-velocity-minibuffer-contents)) - (matches (org-velocity-get-matches search))) - (if (zerop (length matches)) - (progn - (when (get-buffer-window (org-velocity-display-buffer)) - (delete-window - (get-buffer-window (org-velocity-display-buffer))) - (select-window (active-minibuffer-window))) - (unless (string-equal search "") - (minibuffer-message "No match; RET to create"))) - (if (and org-velocity-exit-on-match - (= (length matches) 1)) - (throw 'click search)) - (with-current-buffer (org-velocity-display-buffer) - (use-local-map org-velocity-incremental-keymap) - (erase-buffer) - (setq cursor-type nil)) - (with-current-buffer (org-velocity-bucket-buffer) - (org-velocity-present matches t search)) - (display-buffer (org-velocity-display-buffer)))))) + (matches (org-velocity-present search :hide-hints t))) + (cond ((null matches) + (select-window (active-minibuffer-window)) + (unless (or (null search) (string= "" search)) + (minibuffer-message "No match; RET to create"))) + ((and (org-velocity-singlep matches) + org-velocity-exit-on-match) + (throw 'click search)) + (t + (with-current-buffer (org-velocity-match-buffer) + (use-local-map org-velocity-incremental-keymap))))))) + +(defvar dabbrev--last-abbrev) (defun org-velocity-dabbrev-completion-list (abbrev) "Return all dabbrev completions for ABBREV." @@ -633,17 +624,25 @@ (setq dabbrev--last-abbrev abbrev) (dabbrev--find-all-expansions abbrev case-fold-search)) +(defvar org-velocity-local-completion-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map minibuffer-local-completion-map) + (define-key map " " 'self-insert-command) + (define-key map [remap minibuffer-complete] 'minibuffer-complete-word) + map) + "Keymap for completion with `completing-read'.") + (defun org-velocity-read-with-completion (prompt) "Completing read with PROMPT." (let ((minibuffer-local-completion-map - minibuffer-local-filename-completion-map) + org-velocity-local-completion-map) (completion-no-auto-exit t) (crm-separator " ")) (funcall (case org-velocity-search-method - (phrase 'completing-read) - (any 'completing-read-multiple) - (all 'completing-read-multiple)) + (phrase #'completing-read) + (any #'completing-read-multiple) + (all #'completing-read-multiple)) prompt (completion-table-dynamic 'org-velocity-dabbrev-completion-list)))) @@ -660,30 +659,36 @@ (goto-char (point-max)))) (if (eq org-velocity-search-method 'regexp) (read-regexp prompt) - (if (and org-velocity-use-completion - ;; map-entries complains for nonexistent files - (file-exists-p (org-velocity-use-file))) + (if org-velocity-use-completion (org-velocity-read-with-completion prompt) (read-string prompt))))) -(defun org-velocity-read-incrementally (prompt) +(defun org-velocity-incremental-read (prompt) "Read string with PROMPT and display results incrementally." (let ((res (unwind-protect - (catch 'click - (add-hook 'post-command-hook - 'org-velocity-display-for-incremental) - (if (eq org-velocity-search-method 'regexp) - (read-regexp prompt) - (if (and org-velocity-use-completion - (file-exists-p (org-velocity-use-file))) - (org-velocity-read-with-completion prompt) - (read-string prompt)))) - (remove-hook 'post-command-hook - 'org-velocity-display-for-incremental)))) + (let* ((match-window (display-buffer (org-velocity-match-buffer))) + (org-velocity-index + ;; Truncate the index to the size of the buffer to be + ;; displayed. + (with-selected-window match-window + (if (> (window-height) (length org-velocity-index)) + ;; (subseq org-velocity-index 0 (window-height)) + (let ((hints (copy-sequence org-velocity-index))) + (setcdr (nthcdr (window-height) hints) nil) + hints) + org-velocity-index)))) + (catch 'click + (add-hook 'post-command-hook 'org-velocity-update) + (if (eq org-velocity-search-method 'regexp) + (read-regexp prompt) + (if org-velocity-use-completion + (org-velocity-read-with-completion prompt) + (read-string prompt))))) + (remove-hook 'post-command-hook 'org-velocity-update)))) (if (bufferp res) (org-pop-to-buffer-same-window res) res))) -(defun org-velocity-read (arg &optional search) +(defun org-velocity (arg &optional search) "Read a search string SEARCH for Org-Velocity interface. This means that a buffer will display all headings where SEARCH occurs, where one can be selected by a mouse click or by typing @@ -693,22 +698,27 @@ If `org-velocity-bucket' is defined and `org-velocity-always-use-bucket' is non-nil, then the bucket file will be used; otherwise, this will work when called in any Org -file. Calling with ARG forces current file." +file. Calling with ARG forces current file." (interactive "P") (let ((org-velocity-always-use-bucket (if arg nil org-velocity-always-use-bucket))) ;; complain if inappropriate - (assert (org-velocity-use-file)) - (unwind-protect - (let ((dabbrev-search-these-buffers-only - (list (org-velocity-bucket-buffer)))) - (org-velocity-engine - (if org-velocity-search-is-incremental - (org-velocity-read-incrementally "Velocity search: ") - (org-velocity-read-string "Velocity search: " search)))) - (progn - (kill-buffer (org-velocity-display-buffer)) - (delete-other-windows))))) + (assert (org-velocity-bucket-file)) + (let ((org-velocity-bucket-buffer + (find-file-noselect (org-velocity-bucket-file)))) + (unwind-protect + (let ((dabbrev-search-these-buffers-only + (list (org-velocity-bucket-buffer)))) + (org-velocity-engine + (if org-velocity-search-is-incremental + (org-velocity-incremental-read "Velocity search: ") + (org-velocity-read-string "Velocity search: " search)))) + (progn + (kill-buffer (org-velocity-match-buffer)) + (delete-other-windows)))))) + +(defalias 'org-velocity-read 'org-velocity) (provide 'org-velocity) + ;;; org-velocity.el ends here diff -Nru org-mode-7.7/contrib/lisp/org-wikinodes.el org-mode-7.8.02/contrib/lisp/org-wikinodes.el --- org-mode-7.7/contrib/lisp/org-wikinodes.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/contrib/lisp/org-wikinodes.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,6 +1,6 @@ ;;; org-wikinodes.el --- Wiki-like CamelCase links to outline nodes -;; Copyright (C) 2010 Free Software Foundation, Inc. +;; Copyright (C) 2010-2011 Free Software Foundation, Inc. ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp @@ -334,6 +334,4 @@ (provide 'org-wikinodes) -;; arch-tag: e3b56e38-a2be-478c-b56c-68a913ec54ec - ;;; org-wikinodes.el ends here diff -Nru org-mode-7.7/contrib/lisp/org-xhtml.el org-mode-7.8.02/contrib/lisp/org-xhtml.el --- org-mode-7.7/contrib/lisp/org-xhtml.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/contrib/lisp/org-xhtml.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,16 +1,14 @@ ;;; org-xhtml.el --- XHTML export for Org-mode (uses org-lparse) -;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 -;; Free Software Foundation, Inc. +;; Copyright (C) 2004-2011 Free Software Foundation, Inc. ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 0.8 - +;; ;; This file is not (yet) part of GNU Emacs. ;; However, it is distributed under the same license. - +;; ;; GNU Emacs is free software: you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or @@ -30,14 +28,15 @@ ;;; Code: (require 'org-exp) +(require 'org-html) ; FIXME; remove during merge (require 'format-spec) - (require 'org-lparse) - (eval-when-compile (require 'cl) (require 'table) (require 'browse-url)) (declare-function org-id-find-id-file "org-id" (id)) (declare-function htmlize-region "ext:htmlize" (beg end)) +(declare-function org-pop-to-buffer-same-window + "org-compat" (&optional buffer-or-name norecord label)) (defgroup org-export-xhtml nil "Options specific for HTML export of Org-mode files." @@ -166,6 +165,12 @@ dt { font-weight: bold; } div.figure { padding: 0.5em; } div.figure p { text-align: center; } + div.inlinetask { + padding:10px; + border:2px solid gray; + margin:10px; + background: #ffffcc; + } textarea { overflow-x: auto; } .linenr { font-size:smaller } .code-highlighted {background-color:#ffff00;} @@ -377,11 +382,13 @@ (string :tag "Custom formatting string") (function :tag "Function (must return a string)"))) -(defcustom org-export-xhtml-preamble-format - '(("en" "

    %t

    ")) +(defcustom org-export-xhtml-preamble-format '(("en" "")) "The format for the HTML preamble. %t stands for the title. +%a stands for the author's name. +%e stands for the author's email. +%d stands for the date. If you need to use a \"%\" character, you need to escape it like that: \"%%\"." @@ -417,10 +424,10 @@ ")) "The format for the HTML postamble. -%a stands for the author. -%e stands for the email(s). +%a stands for the author's name. +%e stands for the author's email. %d stands for the date. -%c will be replaced by information about Org/Emacs. +%c will be replaced by information about Org/Emacs versions. %v will be replaced by `org-export-xhtml-validation-link'. If you need to use a \"%\" character, you need to escape it @@ -556,25 +563,22 @@ :group 'org-export-xhtml :type 'string) -(defcustom org-export-xhtml-with-timestamp nil - "If non-nil, write timestamp into the exported HTML text. -If non-nil, write `org-export-xhtml-html-helper-timestamp' into the -exported HTML text. Otherwise, the buffer will just be saved to -a file." - :group 'org-export-xhtml - :type 'boolean) - -(defcustom org-export-xhtml-html-helper-timestamp - "


    \n" - "The HTML tag used as timestamp delimiter for HTML-helper-mode." - :group 'org-export-xhtml - :type 'string) +;; FIXME Obsolete since Org 7.7 +;; Use the :timestamp option or `org-export-time-stamp-file' instead +(defvar org-export-xhtml-with-timestamp nil + "If non-nil, write container for HTML-helper-mode timestamp.") + +;; FIXME Obsolete since Org 7.7 +(defvar org-export-xhtml-html-helper-timestamp + "\n



    \n

    \n" + "The HTML tag used as timestamp delimiter for HTML-helper-mode.") (defcustom org-export-xhtml-protect-char-alist '(("&" . "&") ("<" . "<") (">" . ">")) "Alist of characters to be converted by `org-html-protect'." + :group 'org-export-xhtml :type '(repeat (cons (string :tag "Character") (string :tag "HTML equivalent")))) @@ -621,6 +625,26 @@ (const :tag "Keep internal css" nil) (string :tag "URL or local href"))) +;; FIXME: The following variable is obsolete since Org 7.7 but is +;; still declared and checked within code for compatibility reasons. +;; Use the custom variables `org-export-xhtml-divs' instead. +(defvar org-export-xhtml-content-div "content" + "The name of the container DIV that holds all the page contents. + +This variable is obsolete since Org version 7.7. +Please set `org-export-xhtml-divs' instead.") + +(defcustom org-export-xhtml-divs '("preamble" "content" "postamble") + "The name of the main divs for HTML export. +This is a list of three strings, the first one for the preamble +DIV, the second one for the content DIV and the third one for the +postamble DIV." + :group 'org-export-xhtml + :type '(list + (string :tag " Div for the preamble:") + (string :tag " Div for the content:") + (string :tag "Div for the postamble:"))) + ;;; Hooks (defvar org-export-xhtml-after-blockquotes-hook nil @@ -629,24 +653,30 @@ (defvar org-export-xhtml-final-hook nil "Hook run at the end of HTML export, in the new buffer.") -;;; HTML export +(defun org-export-xhtml-preprocess-latex-fragments () + (when (equal org-lparse-backend 'xhtml) + (org-export-xhtml-do-preprocess-latex-fragments))) -(defun org-export-xhtml-preprocess (parameters) +(defvar org-lparse-opt-plist) ; bound during org-do-lparse +(defun org-export-xhtml-do-preprocess-latex-fragments () "Convert LaTeX fragments to images." - (when (and org-current-export-file - (plist-get parameters :LaTeX-fragments)) - (org-format-latex - (concat "ltxpng/" (file-name-sans-extension - (file-name-nondirectory - org-current-export-file))) - org-current-export-dir nil "Creating LaTeX image %s" - nil nil - (cond - ((eq (plist-get parameters :LaTeX-fragments) 'verbatim) 'verbatim) - ((eq (plist-get parameters :LaTeX-fragments) 'mathjax ) 'mathjax) - ((eq (plist-get parameters :LaTeX-fragments) t ) 'mathjax) - ((eq (plist-get parameters :LaTeX-fragments) 'dvipng ) 'dvipng) - (t nil)))) + (let* ((latex-frag-opt (plist-get org-lparse-opt-plist :LaTeX-fragments)) + (latex-frag-opt-1 ; massage the options + (cond + ((eq latex-frag-opt 'verbatim) 'verbatim) + ((eq latex-frag-opt 'mathjax ) 'mathjax) + ((eq latex-frag-opt t ) 'mathjax) + ((eq latex-frag-opt 'dvipng ) 'dvipng) + (t nil)))) + (when (and org-current-export-file latex-frag-opt) + (org-format-latex + (concat "ltxpng/" (file-name-sans-extension + (file-name-nondirectory + org-current-export-file))) + org-current-export-dir nil "Creating LaTeX image %s" + nil nil latex-frag-opt-1)))) + +(defun org-export-xhtml-preprocess-label-references () (goto-char (point-min)) (let (label l1) (while (re-search-forward "\\\\ref{\\([^{}\n]+\\)}" nil t) @@ -658,6 +688,19 @@ (setq l1 label))) (replace-match (format "[[#%s][%s]]" label l1) t t))))) +(defun org-export-xhtml-preprocess (parameters) + (org-export-xhtml-preprocess-label-references)) + +;; Process latex fragments as part of +;; `org-export-preprocess-after-blockquote-hook'. Note that this hook +;; is the one that is closest and well before the call to +;; `org-export-attach-captions-and-attributes' in +;; `org-export-preprocess-stirng'. The above arrangement permits +;; captions, labels and attributes to be attached to png images +;; generated out of latex equations. +(add-hook 'org-export-preprocess-after-blockquote-hook + 'org-export-xhtml-preprocess-latex-fragments) + (defvar html-table-tag nil) ; dynamically scoped into this. @@ -690,23 +733,24 @@ "." (plist-get opt-plist :html-extension))))))) -;;; org-xhtml-format-org-link (defun org-xhtml-format-org-link (opt-plist type-1 path fragment desc attr - descp) + descp) "Make an HTML link. OPT-PLIST is an options list. -TYPE is the device-type of the link (THIS://foo.html) -PATH is the path of the link (http://THIS#locationx) -FRAGMENT is the fragment part of the link, if any (foo.html#THIS) +TYPE is the device-type of the link (THIS://foo.html). +PATH is the path of the link (http://THIS#location). +FRAGMENT is the fragment part of the link, if any (foo.html#THIS). DESC is the link description, if any. -ATTR is a string of other attributes of the a element. -MAY-INLINE-P allows inlining it as an image." +ATTR is a string of other attributes of the \"a\" element." (declare (special org-lparse-par-open)) - (when (string= type-1 "coderef") - (setq attr - (format "class=\"coderef\" onmouseover=\"CodeHighlightOn(this, '%s');\" onmouseout=\"CodeHighlightOff(this, '%s');\"" - fragment fragment))) (save-match-data + (when (string= type-1 "coderef") + (let ((ref fragment)) + (setq desc (format (org-export-get-coderef-format ref (and descp desc)) + (cdr (assoc ref org-export-code-refs))) + fragment (concat "coderef-" ref) + attr (format "class=\"coderef\" onmouseover=\"CodeHighlightOn(this, '%s');\" onmouseout=\"CodeHighlightOff(this, '%s');\"" + fragment fragment)))) (let* ((may-inline-p (and (member type-1 '("http" "https" "file")) (org-lparse-should-inline-p path descp) @@ -772,8 +816,8 @@ (defun org-xhtml-format-inline-image (desc) ;; FIXME: alt text missing here? - (org-xhtml-format-tags "\"\"/" "" desc)) - + (org-xhtml-format-tags + "\"%s\"/" "" desc (file-name-nondirectory desc))) ;; FIXME: the org-lparse defvar belongs to org-lparse.el (defvar org-lparse-link-description-is-image) @@ -781,34 +825,34 @@ (defun org-xhtml-format-image (src) "Create image tag with source and attributes." (save-match-data - (if (string-match "^ltxpng/" src) - (format "\"%s\"/" - src (org-find-text-property-in-string 'org-latex-src src)) - (let* ((caption (org-find-text-property-in-string 'org-caption src)) - (attr (org-find-text-property-in-string 'org-attributes src)) - (label (org-find-text-property-in-string 'org-label src)) - (caption (and caption (org-xml-encode-org-text caption))) - (img (format "" - src - (if (string-match "\\" . "\n") - (concat - (org-lparse-format '("\n

    " . "

    ") img) - (org-lparse-format '("\n

    " . "

    ") caption)) - extra))) - (buffer-string)) - img))))) + (let* ((caption (org-find-text-property-in-string 'org-caption src)) + (attr (org-find-text-property-in-string 'org-attributes src)) + (label (org-find-text-property-in-string 'org-label src)) + (caption (and caption (org-xml-encode-org-text caption))) + (img-extras (if (string-match "^ltxpng/" src) + (format " alt=\"%s\"" + (org-find-text-property-in-string + 'org-latex-src src)) + (if (string-match "\\" src img-extras)) + (extra (concat + (and label + (format "id=\"%s\" " (org-solidify-link-text label))) + "class=\"figure\""))) + (if caption + (with-temp-buffer + (with-org-lparse-preserve-paragraph-state + (insert + (org-lparse-format + '("
    " . "\n
    ") + (concat + (org-lparse-format '("\n

    " . "

    ") img) + (org-lparse-format '("\n

    " . "

    ") caption)) + extra))) + (buffer-string)) + img)))) (defun org-export-xhtml-get-bibliography () "Find bibliography, cut it out and return it." @@ -960,7 +1004,6 @@ ;; FIXME: the org-lparse defvar belongs to org-lparse.el (defvar org-lparse-toc) -(defvar org-lparse-footnote-buffer) (defvar org-lparse-footnote-definitions) (defvar org-lparse-dyn-first-heading-pos) @@ -992,10 +1035,6 @@ ;; Remove display properties (remove-text-properties (point-min) (point-max) '(display t)) - ;; kill temporary buffers - (when org-lparse-footnote-buffer - (kill-buffer org-lparse-footnote-buffer)) - ;; Run the hook (run-hooks 'org-export-xhtml-final-hook)) @@ -1016,32 +1055,32 @@ (when (> level org-last-level) (let ((cnt (- level org-last-level))) (while (>= (setq cnt (1- cnt)) 0) - (org-lparse-begin 'LIST 'unordered) - (org-lparse-begin 'LIST-ITEM 'unordered)))) + (org-lparse-begin-list 'unordered) + (org-lparse-begin-list-item 'unordered)))) (when (< level org-last-level) (let ((cnt (- org-last-level level))) (while (>= (setq cnt (1- cnt)) 0) - (org-lparse-end-list-item) - (org-lparse-end 'LIST 'unordered)))) + (org-lparse-end-list-item-1) + (org-lparse-end-list 'unordered)))) - (org-lparse-end-list-item) - (org-lparse-begin 'LIST-ITEM 'unordered) + (org-lparse-end-list-item-1) + (org-lparse-begin-list-item 'unordered) (insert toc-entry)) -(defun org-xhtml-begin-toc (lang-specific-heading) +(defun org-xhtml-begin-toc (lang-specific-heading max-level) (org-lparse-insert-tag "
    ") (insert (org-lparse-format 'HEADING lang-specific-heading (or (org-lparse-get 'TOPLEVEL-HLEVEL) 1))) (org-lparse-insert-tag "
    ") - (org-lparse-begin 'LIST 'unordered) - (org-lparse-begin 'LIST-ITEM 'unordered)) + (org-lparse-begin-list 'unordered) + (org-lparse-begin-list-item 'unordered)) (defun org-xhtml-end-toc () (while (> org-last-level (1- org-min-level)) (setq org-last-level (1- org-last-level)) - (org-lparse-end-list-item) - (org-lparse-end 'LIST 'unordered)) + (org-lparse-end-list-item-1) + (org-lparse-end-list 'unordered)) (org-lparse-insert-tag "
    ") (org-lparse-insert-tag "
    ") @@ -1197,6 +1236,12 @@ ;; register the xhtml exporter with org-lparse library (org-lparse-register-backend 'xhtml) +(defun org-xhtml-unload-function () + (org-lparse-unregister-backend 'xhtml) + (remove-hook 'org-export-preprocess-after-blockquote-hook + 'org-export-xhtml-preprocess-latex-fragments) + nil) + (defun org-xhtml-begin-document-body (opt-plist) (let ((link-up (and (plist-get opt-plist :link-up) (string-match "\\S-" (plist-get opt-plist :link-up)) @@ -1205,19 +1250,24 @@ (string-match "\\S-" (plist-get opt-plist :link-home)) (plist-get opt-plist :link-home)))) (insert "\n") - (org-lparse-insert-tag "
    ") (insert "\n" (or (and (or link-up link-home) (format org-export-xhtml-home/up-format (or link-up link-home) (or link-home link-up))) "") "\n")) - (org-xhtml-insert-preamble opt-plist)) + (org-xhtml-insert-preamble opt-plist) + + (org-lparse-insert-tag + "
    " (or org-export-xhtml-content-div + (nth 1 org-export-xhtml-divs))) + + (org-lparse-insert-tag "\n

    %s

    \n" + (plist-get opt-plist :title))) (defun org-xhtml-end-document-body (opt-plist) (org-xhtml-insert-postamble opt-plist) (unless body-only - (org-lparse-insert-tag "
    ") (insert "\n"))) (defun org-xhtml-begin-document-content (opt-plist) @@ -1247,11 +1297,11 @@ "%s - + %s + @@ -1273,6 +1323,7 @@ language language (plist-get opt-plist :title) charset + (plist-get opt-plist :title) (plist-get opt-plist :effective-date) (plist-get opt-plist :author) (plist-get opt-plist :description) @@ -1376,18 +1427,18 @@ (END (org-lparse-begin-paragraph)))) (t (error "Unknown environment %s" style)))) -(defun org-xhtml-begin-environment (style) +(defun org-xhtml-begin-environment (style env-options-plist) (org-xhtml-format-environment style 'BEGIN)) -(defun org-xhtml-end-environment (style) +(defun org-xhtml-end-environment (style env-options-plist) (org-xhtml-format-environment style 'END)) -(defun org-xhtml-begin-list (ltype &optional arg1) +(defun org-xhtml-begin-list (ltype) (setq ltype (or (org-lparse-html-list-type-to-canonical-list-type ltype) ltype)) - (case ltype - (ordered (let ((extra (if arg1 (format " start=\"%d\"" arg1) ""))) + (ordered (let* ((arg1 nil) + (extra (if arg1 (format " start=\"%d\"" arg1) ""))) (org-lparse-insert-tag "" extra))) (unordered (org-lparse-insert-tag "
      ")) (description (org-lparse-insert-tag "
      ")) @@ -1500,7 +1551,8 @@ "") (let* ((align (aref org-lparse-table-colalign-vector c)) - (alignspec (if org-xhtml-format-table-no-css + (alignspec (if (and (boundp 'org-xhtml-format-table-no-css) + org-xhtml-format-table-no-css) " align=\"%s\"" " class=\"%s\"")) (extra (format alignspec align))) (format "" extra)) @@ -1517,8 +1569,9 @@ (let ((c (string-to-number (match-string 1)))) (replace-match (if org-export-xhtml-table-align-individual-fields - (format (if org-xhtml-format-table-no-css " align=\"%s\"" - " class=\"%s\"") + (format (if (and (boundp 'org-xhtml-format-table-no-css) + org-xhtml-format-table-no-css) + " align=\"%s\"" " class=\"%s\"") (or (aref org-lparse-table-colalign-vector c) "left")) "") t t))) (goto-char (point-max))) @@ -1529,7 +1582,7 @@ (cons (eval (car org-export-table-row-tags)) (eval (cdr org-export-table-row-tags))) row)) -(defun org-xhtml-format-table-cell (text r c) +(defun org-xhtml-format-table-cell (text r c horiz-span) (let ((cell-style-cookie (or (and org-lparse-table-is-styled (format "@@class%03d@@" c)) ""))) (cond @@ -1654,10 +1707,17 @@ (INIT-METHOD nil) (SAVE-METHOD nil) (CLEANUP-METHOD nil) - (OTHER-BACKENDS - '("xhtml" "etext" "html" "html10" "mediawiki" "pdf" "sdw" "sdw3" "sdw4" - "text" "text10" "odt" "vor" "vor4")) - (CONVERT-METHOD org-lparse-convert-process) + ;; (OTHER-BACKENDS + ;; ;; There is a provision to register a per-backend converter and + ;; ;; output formats. Refer `org-lparse-get-converter' and + ;; ;; `org-lparse-get-other-backends'. + + ;; ;; The default behaviour is to use `org-lparse-convert-process' + ;; ;; and `org-lparse-convert-capabilities'. + ;; ) + ;; (CONVERT-METHOD + ;; ;; See note above + ;; ) (EXPORT-DIR (org-export-directory :html opt-plist)) (FILE-NAME-EXTENSION (plist-get opt-plist :html-extension)) (EXPORT-BUFFER-NAME "*Org HTML Export*") @@ -1709,21 +1769,31 @@ (date (plist-get opt-plist :effective-date)) (author (plist-get opt-plist :author)) (lang-words (plist-get opt-plist :lang-words)) - (email (plist-get opt-plist :email))) + (email (plist-get opt-plist :email)) + html-pre-real-contents) (cond ((stringp html-pre) - (insert - (format-spec html-pre `((?t . ,title) (?a . ,author) - (?d . ,date) (?e . ,email))))) + (setq html-pre-real-contents + (format-spec html-pre `((?t . ,title) (?a . ,author) + (?d . ,date) (?e . ,email))))) ((functionp html-pre) - (funcall html-pre opt-plist)) + (insert "
      \n") + (funcall html-pre) + (insert "\n
      \n")) (t - (insert - (format-spec - (or (cadr (assoc (nth 0 lang-words) - org-export-xhtml-preamble-format)) - (cadr (assoc "en" org-export-xhtml-preamble-format))) - `((?t . ,title) (?a . ,author) - (?d . ,date) (?e . ,email))))))))) + (setq html-pre-real-contents + (format-spec + (or (cadr (assoc (nth 0 lang-words) + org-export-xhtml-preamble-format)) + (cadr (assoc "en" org-export-xhtml-preamble-format))) + `((?t . ,title) (?a . ,author) + (?d . ,date) (?e . ,email)))))) + + ;; don't output an empty preamble DIV + (unless (and (functionp html-pre) + (equal html-pre-real-contents "")) + (insert "
      \n") + (insert html-pre-real-contents) + (insert "\n
      \n"))))) (defun org-xhtml-insert-postamble (opt-plist) (when org-lparse-footnote-definitions @@ -1736,6 +1806,9 @@ (when bib (insert "\n" bib "\n"))) + (unless body-only + (org-lparse-insert-tag "
    ")) + ;; export html postamble (unless body-only (let* ((html-post (plist-get opt-plist :html-postamble)) @@ -1753,18 +1826,16 @@ (concat "Org version " org-version " with Emacs version " (number-to-string emacs-major-version)))) (when (plist-get opt-plist :html-postamble) + (insert "\n
    \n") (cond ((stringp html-post) - (insert "
    \n") (insert (format-spec html-post `((?a . ,author) (?e . ,email) (?d . ,date) (?c . ,creator-info) - (?v . ,html-validation-link)))) - (insert "
    ")) + (?v . ,html-validation-link))))) ((functionp html-post) - (funcall html-post opt-plist)) + (funcall html-post)) ((eq html-post 'auto) ;; fall back on default postamble - (insert "
    \n") (when (plist-get opt-plist :time-stamp-file) (insert "

    " (nth 2 lang-words) ": " date "

    \n")) (when (and (plist-get opt-plist :author-info) author) @@ -1775,20 +1846,21 @@ (insert "

    " (concat "Org version " org-version " with Emacs version " (number-to-string emacs-major-version) "

    \n"))) - (insert html-validation-link "\n
    ")) + (insert html-validation-link "\n")) (t - (insert "
    \n") (insert (format-spec (or (cadr (assoc (nth 0 lang-words) org-export-xhtml-postamble-format)) (cadr (assoc "en" org-export-xhtml-postamble-format))) `((?a . ,author) (?e . ,email) (?d . ,date) (?c . ,creator-info) - (?v . ,html-validation-link)))) - (insert "
    ")))))) + (?v . ,html-validation-link)))))) + (insert "
    ")))) - (if org-export-xhtml-with-timestamp - (insert org-export-xhtml-html-helper-timestamp))) + ;; FIXME `org-export-xhtml-with-timestamp' has been declared + ;; obsolete since Org 7.7 -- don't forget to remove this. + (when org-export-xhtml-with-timestamp + (insert org-export-xhtml-html-helper-timestamp))) ;; There are references to org-html-expand, org-html-protect and ;; org-html-do-expand outside of org-html.el. For now provide a @@ -1816,5 +1888,4 @@ (provide 'org-xhtml) -;; arch-tag: 8109d84d-eb8f-460b-b1a8-f45f3a6c7ea1 ;;; org-xhtml.el ends here diff -Nru org-mode-7.7/contrib/odt/etc/schema/od-schema-v1.1.rnc org-mode-7.8.02/contrib/odt/etc/schema/od-schema-v1.1.rnc --- org-mode-7.7/contrib/odt/etc/schema/od-schema-v1.1.rnc 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/contrib/odt/etc/schema/od-schema-v1.1.rnc 1970-01-01 00:00:00.000000000 +0000 @@ -1,6444 +0,0 @@ -# OASIS OpenDocument v1.1 -# OASIS Standard, 1 Feb 2007 -# Relax-NG Schema -# -# $Id$ -# -# © 2002-2007 OASIS Open -# © 1999-2007 Sun Microsystems, Inc. - -namespace a = "http://relaxng.org/ns/compatibility/annotations/1.0" -namespace anim = "urn:oasis:names:tc:opendocument:xmlns:animation:1.0" -namespace chart = "urn:oasis:names:tc:opendocument:xmlns:chart:1.0" -namespace config = "urn:oasis:names:tc:opendocument:xmlns:config:1.0" -namespace dc = "http://purl.org/dc/elements/1.1/" -namespace dr3d = "urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" -namespace draw = "urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" -namespace fo = - "urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" -namespace form = "urn:oasis:names:tc:opendocument:xmlns:form:1.0" -namespace math = "http://www.w3.org/1998/Math/MathML" -namespace meta = "urn:oasis:names:tc:opendocument:xmlns:meta:1.0" -namespace number = "urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" -namespace office = "urn:oasis:names:tc:opendocument:xmlns:office:1.0" -namespace presentation = - "urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" -namespace script = "urn:oasis:names:tc:opendocument:xmlns:script:1.0" -namespace smil = - "urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0" -namespace style = "urn:oasis:names:tc:opendocument:xmlns:style:1.0" -namespace svg = - "urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" -namespace table = "urn:oasis:names:tc:opendocument:xmlns:table:1.0" -namespace text = "urn:oasis:names:tc:opendocument:xmlns:text:1.0" -namespace xforms = "http://www.w3.org/2002/xforms" -namespace xlink = "http://www.w3.org/1999/xlink" - -office-process-content = - [ a:defaultValue = "true" ] - attribute office:process-content { boolean }? -start = - office-document - | office-document-content - | office-document-styles - | office-document-meta - | office-document-settings -office-document = - element office:document { - office-document-attrs, - office-document-common-attrs, - office-meta, - office-settings, - office-scripts, - office-font-face-decls, - office-styles, - office-automatic-styles, - office-master-styles, - office-body - } -office-document-content = - element office:document-content { - office-document-common-attrs, - office-scripts, - office-font-face-decls, - office-automatic-styles, - office-body - } -office-document-styles = - element office:document-styles { - office-document-common-attrs, - office-font-face-decls, - office-styles, - office-automatic-styles, - office-master-styles - } -office-document-meta = - element office:document-meta { - office-document-common-attrs, office-meta - } -office-document-settings = - element office:document-settings { - office-document-common-attrs, office-settings - } -office-document-common-attrs &= attribute office:version { \string }? -office-document-attrs &= attribute office:mimetype { \string } -office-meta = element office:meta { office-meta-content }? -office-meta-content = anyElements -office-meta-content-strict = office-meta-data* -office-body = element office:body { office-body-content } -office-body-content |= - element office:text { - office-text-attlist, - office-text-content-prelude, - office-text-content-main*, - office-text-content-epilogue - } -office-text-content-prelude = - office-forms, text-tracked-changes, text-decls, table-decls -office-text-content-main = - text-content* - | (text-page-sequence, (draw-a | shape)*) -text-content = - text-h - | text-p - | text-list - | text-numbered-paragraph - | table-table - | draw-a - | text-section - | text-soft-page-break - | text-table-of-content - | text-illustration-index - | text-table-index - | text-object-index - | text-user-index - | text-alphabetical-index - | text-bibliography - | shape - | change-marks -office-text-content-epilogue = table-functions -office-text-attlist &= - [ a:defaultValue = "false" ] attribute text:global { boolean }? -office-text-attlist &= - [ a:defaultValue = "false" ] - attribute text:use-soft-page-breaks { boolean }? -office-body-content |= - element office:drawing { - office-drawing-attlist, - office-drawing-content-prelude, - office-drawing-content-main, - office-drawing-content-epilogue - } -office-drawing-attlist = empty -office-drawing-content-prelude = text-decls, table-decls -office-drawing-content-main = draw-page* -office-drawing-content-epilogue = table-functions -office-body-content |= - element office:presentation { - office-presentation-attlist, - office-presentation-content-prelude, - office-presentation-content-main, - office-presentation-content-epilogue - } -office-presentation-attlist = empty -office-presentation-content-prelude = - text-decls, table-decls, presentation-decls -office-presentation-content-main = draw-page* -office-presentation-content-epilogue = - presentation-settings, table-functions -office-body-content |= - element office:spreadsheet { - office-spreadsheet-attlist, - office-spreadsheet-content-prelude, - office-spreadsheet-content-main, - office-spreadsheet-content-epilogue - } -office-spreadsheet-content-prelude = - table-tracked-changes?, text-decls, table-decls -table-decls = - table-calculation-settings?, - table-content-validations?, - table-label-ranges? -office-spreadsheet-content-main = table-table* -office-spreadsheet-content-epilogue = table-functions -table-functions = - table-named-expressions?, - table-database-ranges?, - table-data-pilot-tables?, - table-consolidation?, - table-dde-links? -office-body-content |= - element office:chart { - office-chart-attlist, - office-chart-content-prelude, - office-chart-content-main, - office-chart-content-epilogue - } -office-chart-attlist = empty -office-chart-content-prelude = text-decls, table-decls -office-chart-content-main = chart-chart -office-chart-content-epilogue = table-functions -office-body-content |= - element office:image { - office-image-attlist, - office-image-content-prelude, - office-image-content-main, - office-image-content-epilogue - } -office-image-attlist = empty -office-image-content-prelude = empty -office-image-content-main = draw-frame -office-image-content-epilogue = empty -office-settings = element office:settings { config-config-item-set+ }? -config-config-item-set = - element config:config-item-set { - config-config-item-set-attlist, config-items - } -config-items = - (config-config-item - | config-config-item-set - | config-config-item-map-named - | config-config-item-map-indexed)+ -config-config-item-set-attlist &= attribute config:name { \string } -config-config-item = - element config:config-item { config-config-item-attlist, text } -config-config-item-attlist &= attribute config:name { \string } -config-config-item-attlist &= - attribute config:type { - "boolean" - | "short" - | "int" - | "long" - | "double" - | "string" - | "datetime" - | "base64Binary" - } -config-config-item-map-indexed = - element config:config-item-map-indexed { - config-config-item-map-indexed-attlist, - config-config-item-map-entry+ - } -config-config-item-map-indexed-attlist &= - attribute config:name { \string } -config-config-item-map-entry = - element config:config-item-map-entry { - config-config-item-map-entry-attlist, config-items - } -config-config-item-map-entry-attlist &= - attribute config:name { \string }? -config-config-item-map-named = - element config:config-item-map-named { - config-config-item-map-named-attlist, config-config-item-map-entry+ - } -config-config-item-map-named-attlist &= - attribute config:name { \string } -office-scripts = - element office:scripts { office-script*, office-event-listeners? }? -office-script = - element office:script { - office-script-attlist, - mixed { anyElements } - } -office-script-attlist = attribute script:language { \string } -office-font-face-decls = - element office:font-face-decls { style-font-face* }? -office-styles = - element office:styles { - styles - & style-default-style* - & text-outline-style? - & text-notes-configuration* - & text-bibliography-configuration? - & text-linenumbering-configuration? - & draw-gradient* - & svg-linearGradient* - & svg-radialGradient* - & draw-hatch* - & draw-fill-image* - & draw-marker* - & draw-stroke-dash* - & draw-opacity* - & style-presentation-page-layout* - }? -office-automatic-styles = - element office:automatic-styles { styles & style-page-layout* }? -office-master-styles = - element office:master-styles { - style-master-page* & style-handout-master? & draw-layer-set? - }? -styles = - style-style* - & text-list-style* - & number-number-style* - & number-currency-style* - & number-percentage-style* - & number-date-style* - & number-time-style* - & number-boolean-style* - & number-text-style* -office-meta-data |= element meta:generator { \string } -office-meta-data |= element dc:title { \string } -office-meta-data |= element dc:description { \string } -office-meta-data |= element dc:subject { \string } -office-meta-data |= element meta:keyword { \string } -office-meta-data |= element meta:initial-creator { \string } -office-meta-data |= dc-creator -dc-creator = element dc:creator { \string } -office-meta-data |= element meta:printed-by { \string } -office-meta-data |= element meta:creation-date { dateTime } -office-meta-data |= dc-date -dc-date = element dc:date { dateTime } -office-meta-data |= element meta:print-date { dateTime } -office-meta-data |= - element meta:template { - attribute xlink:href { anyURI }, - [ a:defaultValue = "simple" ] attribute xlink:type { "simple" }?, - [ a:defaultValue = "onRequest" ] - attribute xlink:actuate { "onRequest" }?, - attribute xlink:title { \string }?, - attribute meta:date { dateTime }? - } -office-meta-data |= - element meta:auto-reload { - [ a:defaultValue = "simple" ] attribute xlink:type { "simple" }?, - [ a:defaultValue = "replace" ] attribute xlink:show { "replace" }?, - [ a:defaultValue = "onLoad" ] attribute xlink:actuate { "onLoad" }?, - attribute xlink:href { anyURI }?, - attribute meta:delay { duration }? - } -office-meta-data |= - element meta:hyperlink-behaviour { - attribute office:target-frame-name { targetFrameName }?, - attribute xlink:show { "new" | "replace" }? - } -office-meta-data |= element dc:language { language } -office-meta-data |= element meta:editing-cycles { nonNegativeInteger } -office-meta-data |= element meta:editing-duration { duration } -office-meta-data |= - element meta:document-statistic { - attribute meta:page-count { nonNegativeInteger }?, - attribute meta:table-count { nonNegativeInteger }?, - attribute meta:draw-count { nonNegativeInteger }?, - attribute meta:image-count { nonNegativeInteger }?, - attribute meta:ole-object-count { nonNegativeInteger }?, - attribute meta:object-count { nonNegativeInteger }?, - attribute meta:paragraph-count { nonNegativeInteger }?, - attribute meta:word-count { nonNegativeInteger }?, - attribute meta:character-count { nonNegativeInteger }?, - attribute frame-count { nonNegativeInteger }?, - attribute sentence-count { nonNegativeInteger }?, - attribute syllable-count { nonNegativeInteger }?, - attribute non-whitespace-character-count { nonNegativeInteger }?, - attribute meta:row-count { nonNegativeInteger }?, - attribute meta:cell-count { nonNegativeInteger }? - } -office-meta-data |= - element meta:user-defined { - attribute meta:name { \string }, - ((attribute meta:value-type { "float" }, - double) - | (attribute meta:value-type { "date" }, - dateOrDateTime) - | (attribute meta:value-type { "time" }, - duration) - | (attribute meta:value-type { "boolean" }, - boolean) - | (attribute meta:value-type { "string" }, - \string) - | text) - } -text-h = - element text:h { - heading-attrs, paragraph-attrs, text-number?, paragraph-content* - } -heading-attrs &= attribute text:outline-level { positiveInteger } -heading-attrs &= - [ a:defaultValue = "false" ] - attribute text:restart-numbering { boolean }? -heading-attrs &= attribute text:start-value { nonNegativeInteger }? -heading-attrs &= - [ a:defaultValue = "false" ] - attribute text:is-list-header { boolean }? -text-number = element text:number { \string } -text-p = element text:p { paragraph-attrs, paragraph-content* } -paragraph-attrs = - attribute text:style-name { styleNameRef }?, - attribute text:class-names { styleNameRefs }?, - attribute text:cond-style-name { styleNameRef }? -paragraph-attrs &= text-id? -text-page-sequence = element text:page-sequence { text-page+ } -text-page = element text:page { text-page-attlist, empty } -text-page-attlist = attribute text:master-page-name { styleNameRef } -text-list = - element text:list { - text-list-attr, text-list-header?, text-list-item* - } -text-list-attr &= attribute text:style-name { styleNameRef }? -text-list-attr &= attribute text:continue-numbering { boolean }? -text-list-item = - element text:list-item { text-list-item-attr, text-list-item-content } -text-list-item-content = - text-number?, (text-p | text-h | text-list | text-soft-page-break)* -text-list-item-attr &= - attribute text:start-value { nonNegativeInteger }? -text-list-header = element text:list-header { text-list-item-content } -text-numbered-paragraph = - element text:numbered-paragraph { - text-numbered-paragraph-attr, text-number?, (text-p | text-h) - } -text-numbered-paragraph-attr &= - [ a:defaultValue = "1" ] attribute text:level { positiveInteger }? -text-numbered-paragraph-attr &= text-list-attr -text-numbered-paragraph-attr &= text-list-item-attr -text-section = - element text:section { - text-section-attr, - (text-section-source | text-section-source-dde | empty), - text-content* - } -text-section-attr &= sectionAttr -sectionAttr &= attribute text:style-name { styleNameRef }? -sectionAttr &= attribute text:name { \string } -sectionAttr &= attribute text:protected { boolean }? -sectionAttr &= attribute text:protection-key { \string }? -text-section-attr &= - attribute text:display { "true" | "none" } - | (attribute text:display { "condition" }, - attribute text:condition { \string }) - | empty -text-section-source = - element text:section-source { text-section-source-attr } -text-section-source-attr &= - (attribute xlink:href { anyURI }, - [ a:defaultValue = "simple" ] attribute xlink:type { "simple" }?, - [ a:defaultValue = "embed" ] attribute xlink:show { "embed" }?)? -text-section-source-attr &= attribute text:section-name { \string }? -text-section-source-attr &= attribute text:filter-name { \string }? -text-section-source-dde = office-dde-source -text-tracked-changes = - element text:tracked-changes { - text-tracked-changes-attr, text-changed-region* - }? -text-tracked-changes-attr &= - [ a:defaultValue = "true" ] attribute text:track-changes { boolean }? -text-changed-region = - element text:changed-region { - text-changed-region-attr, text-changed-region-content - } -text-changed-region-attr &= attribute text:id { ID } -text-changed-region-content |= - element text:insertion { office-change-info } -text-changed-region-content |= - element text:deletion { office-change-info, text-content* } -text-changed-region-content |= - element text:format-change { office-change-info } -change-marks = - element text:change { change-mark-attr } - | element text:change-start { change-mark-attr } - | element text:change-end { change-mark-attr } -change-mark-attr = attribute text:change-id { IDREF } -text-soft-page-break = element text:soft-page-break { empty } -text-decls = - element text:variable-decls { text-variable-decl* }?, - element text:sequence-decls { text-sequence-decl* }?, - element text:user-field-decls { text-user-field-decl* }?, - element text:dde-connection-decls { text-dde-connection-decl* }?, - text-alphabetical-index-auto-mark-file? -paragraph-content |= text -paragraph-content |= - element text:s { - attribute text:c { nonNegativeInteger }? - } -paragraph-content |= element text:tab { text-tab-attr } -text-tab-attr = attribute text:tab-ref { nonNegativeInteger }? -paragraph-content |= element text:line-break { empty } -paragraph-content |= text-soft-page-break -paragraph-content |= - element text:span { - attribute text:style-name { styleNameRef }?, - attribute text:class-names { styleNameRefs }?, - paragraph-content* - } -paragraph-content |= - element text:a { - text-a-attlist, office-event-listeners?, paragraph-content* - } -text-a-attlist &= attribute office:name { \string }? -text-a-attlist &= attribute office:title { \string }? -text-a-attlist &= - attribute xlink:href { anyURI }, - [ a:defaultValue = "simple" ] attribute xlink:type { "simple" }?, - [ a:defaultValue = "onRequest" ] - attribute xlink:actuate { "onRequest" }? -text-a-attlist &= - attribute office:target-frame-name { targetFrameName }?, - attribute xlink:show { "new" | "replace" }? -text-a-attlist &= - attribute text:style-name { styleNameRef }?, - attribute text:visited-style-name { styleNameRef }? -paragraph-content |= - element text:bookmark { - attribute text:name { \string } - } - | element text:bookmark-start { - attribute text:name { \string } - } - | element text:bookmark-end { - attribute text:name { \string } - } -paragraph-content |= - element text:reference-mark { - attribute text:name { \string } - } -paragraph-content |= - element text:reference-mark-start { - attribute text:name { \string } - } - | element text:reference-mark-end { - attribute text:name { \string } - } -paragraph-content |= - element text:note { - text-note-class, - attribute text:id { \string }?, - element text:note-citation { - attribute text:label { \string }?, - text - }, - element text:note-body { text-content* } - } -text-note-class = attribute text:note-class { "footnote" | "endnote" } -paragraph-content |= - element text:ruby { - attribute text:style-name { styleNameRef }?, - element text:ruby-base { paragraph-content }, - element text:ruby-text { - attribute text:style-name { styleNameRef }?, - text - } - } -paragraph-content |= office-annotation -paragraph-content |= change-marks -paragraph-content |= shape | draw-a -paragraph-content |= element text:date { text-date-attlist, text } -text-date-attlist &= - common-field-fixed-attlist & common-field-data-style-name-attlist -text-date-attlist &= attribute text:date-value { dateOrDateTime }? -text-date-attlist &= attribute text:date-adjust { duration }? -paragraph-content |= element text:time { text-time-attlist, text } -text-time-attlist &= - common-field-fixed-attlist & common-field-data-style-name-attlist -text-time-attlist &= attribute text:time-value { timeOrDateTime }? -text-time-attlist &= attribute text:time-adjust { duration }? -paragraph-content |= - element text:page-number { text-page-number-attlist, text } -text-page-number-attlist &= - common-field-num-format-attlist & common-field-fixed-attlist -text-page-number-attlist &= attribute text:page-adjust { integer }? -text-page-number-attlist &= - attribute text:select-page { "previous" | "current" | "next" }? -paragraph-content |= - element text:page-continuation { - text-page-continuation-attlist, text - } -text-page-continuation-attlist &= - attribute text:select-page { "previous" | "next" } -text-page-continuation-attlist &= - attribute text:string-value { \string }? -paragraph-content |= - element text:sender-firstname { common-field-fixed-attlist, text } -paragraph-content |= - element text:sender-lastname { common-field-fixed-attlist, text } -paragraph-content |= - element text:sender-initials { common-field-fixed-attlist, text } -paragraph-content |= - element text:sender-title { common-field-fixed-attlist, text } -paragraph-content |= - element text:sender-position { common-field-fixed-attlist, text } -paragraph-content |= - element text:sender-email { common-field-fixed-attlist, text } -paragraph-content |= - element text:sender-phone-private { common-field-fixed-attlist, text } -paragraph-content |= - element text:sender-fax { common-field-fixed-attlist, text } -paragraph-content |= - element text:sender-company { common-field-fixed-attlist, text } -paragraph-content |= - element text:sender-phone-work { common-field-fixed-attlist, text } -paragraph-content |= - element text:sender-street { common-field-fixed-attlist, text } -paragraph-content |= - element text:sender-city { common-field-fixed-attlist, text } -paragraph-content |= - element text:sender-postal-code { common-field-fixed-attlist, text } -paragraph-content |= - element text:sender-country { common-field-fixed-attlist, text } -paragraph-content |= - element text:sender-state-or-province { - common-field-fixed-attlist, text - } -paragraph-content |= - element text:author-name { common-field-fixed-attlist, text } -paragraph-content |= - element text:author-initials { common-field-fixed-attlist, text } -paragraph-content |= element text:chapter { text-chapter-attlist, text } -text-chapter-attlist &= - attribute text:display { - "name" - | "number" - | "number-and-name" - | "plain-number-and-name" - | "plain-number" - } -text-chapter-attlist &= - attribute text:outline-level { nonNegativeInteger } -paragraph-content |= - element text:file-name { text-file-name-attlist, text } -text-file-name-attlist &= - attribute text:display { - "full" | "path" | "name" | "name-and-extension" - }? -text-file-name-attlist &= common-field-fixed-attlist -paragraph-content |= - element text:template-name { text-template-name-attlist, text } -text-template-name-attlist = - attribute text:display { - "full" | "path" | "name" | "name-and-extension" | "area" | "title" - }? -paragraph-content |= element text:sheet-name { text } -text-variable-decl = - element text:variable-decl { - common-field-name-attlist, common-value-type-attlist - } -paragraph-content |= - element text:variable-set { - (common-field-name-attlist - & common-field-formula-attlist - & common-value-and-type-attlist - & common-field-display-value-none-attlist - & common-field-data-style-name-attlist), - text - } -paragraph-content |= - element text:variable-get { - (common-field-name-attlist - & common-field-display-value-formula-attlist - & common-field-data-style-name-attlist), - text - } -paragraph-content |= - element text:variable-input { - (common-field-name-attlist - & common-field-description-attlist - & common-value-type-attlist - & common-field-display-value-none-attlist - & common-field-data-style-name-attlist), - text - } -text-user-field-decl = - element text:user-field-decl { - common-field-name-attlist, - common-field-formula-attlist?, - common-value-and-type-attlist - } -paragraph-content |= - element text:user-field-get { - (common-field-name-attlist - & common-field-display-value-formula-none-attlist - & common-field-data-style-name-attlist), - text - } -paragraph-content |= - element text:user-field-input { - (common-field-name-attlist - & common-field-description-attlist - & common-field-data-style-name-attlist), - text - } -text-sequence-decl = - element text:sequence-decl { text-sequence-decl-attlist } -text-sequence-decl-attlist &= common-field-name-attlist -text-sequence-decl-attlist &= - attribute text:display-outline-level { nonNegativeInteger } -text-sequence-decl-attlist &= - attribute text:separation-character { character }? -paragraph-content |= - element text:sequence { - (common-field-name-attlist - & common-field-formula-attlist - & common-field-num-format-attlist - & text-sequence-ref-name), - text - } -text-sequence-ref-name = attribute text:ref-name { \string }? -paragraph-content |= - element text:expression { - (common-field-formula-attlist - & common-value-and-type-attlist? - & common-field-display-value-formula-attlist - & common-field-data-style-name-attlist), - text - } -paragraph-content |= - element text:text-input { common-field-description-attlist, text } -paragraph-content |= - element text:initial-creator { common-field-fixed-attlist, text } -paragraph-content |= - element text:creation-date { - (common-field-fixed-attlist - & common-field-data-style-name-attlist - & attribute text:date-value { dateOrDateTime }?), - text - } -paragraph-content |= - element text:creation-time { - (common-field-fixed-attlist - & common-field-data-style-name-attlist - & attribute text:time-value { timeOrDateTime }?), - text - } -paragraph-content |= - element text:description { common-field-fixed-attlist, text } -paragraph-content |= - element text:user-defined { - (common-field-fixed-attlist - & attribute text:name { \string } - & common-field-data-style-name-attlist - & attribute office:value { double }? - & attribute office:date-value { dateOrDateTime }? - & attribute office:time-value { duration }? - & attribute office:boolean-value { boolean }? - & attribute office:string-value { \string }?), - text - } -paragraph-content |= - element text:print-time { - (common-field-fixed-attlist - & common-field-data-style-name-attlist - & attribute text:time-value { time }?), - text - } -paragraph-content |= - element text:print-date { - (common-field-fixed-attlist - & common-field-data-style-name-attlist - & attribute text:date-value { date }?), - text - } -paragraph-content |= - element text:printed-by { common-field-fixed-attlist, text } -paragraph-content |= - element text:title { common-field-fixed-attlist, text } -paragraph-content |= - element text:subject { common-field-fixed-attlist, text } -paragraph-content |= - element text:keywords { common-field-fixed-attlist, text } -paragraph-content |= - element text:editing-cycles { common-field-fixed-attlist, text } -paragraph-content |= - element text:editing-duration { - (common-field-fixed-attlist - & common-field-data-style-name-attlist - & attribute text:duration { duration }?), - text - } -paragraph-content |= - element text:modification-time { - (common-field-fixed-attlist - & common-field-data-style-name-attlist - & attribute text:time-value { time }?), - text - } -paragraph-content |= - element text:modification-date { - (common-field-fixed-attlist - & common-field-data-style-name-attlist - & attribute text:date-value { date }?), - text - } -paragraph-content |= - element text:creator { common-field-fixed-attlist, text } -paragraph-content |= - element text:page-count - | text:paragraph-count - | text:word-count - | text:character-count - | text:table-count - | text:image-count - | text:object-count { common-field-num-format-attlist, text } -common-field-database-table = - common-field-database-table-attlist, common-field-database-name -common-field-database-name |= attribute text:database-name { \string }? -common-field-database-name |= form-connection-resource -common-field-database-table-attlist &= - attribute text:table-name { \string } -common-field-database-table-attlist &= - attribute text:table-type { "table" | "query" | "command" }? -paragraph-content |= - element text:database-display { text-database-display-attlist, text } -text-database-display-attlist &= common-field-database-table -text-database-display-attlist &= common-field-data-style-name-attlist -text-database-display-attlist &= attribute text:column-name { \string } -paragraph-content |= - element text:database-next { text-database-next-attlist } -text-database-next-attlist &= common-field-database-table -text-database-next-attlist &= attribute text:condition { formula }? -paragraph-content |= - element text:database-row-select { text-database-row-select-attlist } -text-database-row-select-attlist &= common-field-database-table -text-database-row-select-attlist &= - attribute text:condition { formula }? -text-database-row-select-attlist &= - attribute text:row-number { nonNegativeInteger }? -paragraph-content |= - element text:database-row-number { - (common-field-database-table - & common-field-num-format-attlist - & attribute text:value { nonNegativeInteger }?), - text - } -paragraph-content |= - element text:database-name { common-field-database-table, text } -paragraph-content |= - element text:page-variable-set { - text-set-page-variable-attlist, text - } -text-set-page-variable-attlist &= attribute text:active { boolean }? -text-set-page-variable-attlist &= - attribute text:page-adjust { integer }? -paragraph-content |= - element text:page-variable-get { - text-get-page-variable-attlist, text - } -text-get-page-variable-attlist &= common-field-num-format-attlist -paragraph-content |= - element text:placeholder { text-placeholder-attlist, text } -text-placeholder-attlist &= - attribute text:placeholder-type { - "text" | "table" | "text-box" | "image" | "object" - } -text-placeholder-attlist &= common-field-description-attlist -paragraph-content |= - element text:conditional-text { text-conditional-text-attlist, text } -text-conditional-text-attlist &= attribute text:condition { formula } -text-conditional-text-attlist &= - attribute text:string-value-if-true { \string } -text-conditional-text-attlist &= - attribute text:string-value-if-false { \string } -text-conditional-text-attlist &= - attribute text:current-value { boolean }? -paragraph-content |= - element text:hidden-text { text-hidden-text-attlist, text } -text-hidden-text-attlist &= attribute text:condition { formula } -text-hidden-text-attlist &= attribute text:string-value { \string } -text-hidden-text-attlist &= attribute text:is-hidden { boolean }? -paragraph-content |= - element text:reference-ref | text:bookmark-ref { - text-common-ref-content & text-ref-content - } -paragraph-content |= - element text:note-ref { - text-common-ref-content & text-note-ref-content & text-ref-content - } -paragraph-content |= - element text:sequence-ref { - text-common-ref-content & text-sequence-ref-content - } -text-common-ref-content &= text -text-common-ref-content &= attribute text:ref-name { \string }? -text-note-ref-content &= text-note-class -text-ref-content &= - attribute text:reference-format { - "page" | "chapter" | "direction" | "text" - }? -text-sequence-ref-content &= - attribute text:reference-format { - "page" - | "chapter" - | "direction" - | "text" - | "category-and-value" - | "caption" - | "value" - }? -paragraph-content |= - element text:script { - ((attribute xlink:href { anyURI }, - [ a:defaultValue = "simple" ] attribute xlink:type { "simple" }?) - | text) - & attribute script:language { \string }? - } -paragraph-content |= - element text:execute-macro { - attribute text:name { \string }?, - office-event-listeners?, - text - } -paragraph-content |= - element text:hidden-paragraph { text-hidden-paragraph-attlist, text } -text-hidden-paragraph-attlist &= attribute text:condition { formula } -text-hidden-paragraph-attlist &= attribute text:is-hidden { boolean }? -paragraph-content |= - element text:dde-connection { - attribute text:connection-name { \string }, - text - } -paragraph-content |= - element text:measure { - attribute text:kind { "value" | "unit" | "gap" }, - text - } -paragraph-content |= - element text:table-formula { - (common-field-formula-attlist - & common-field-display-value-formula-attlist - & common-field-data-style-name-attlist), - text - } -common-value-type-attlist = attribute office:value-type { valueType } -common-value-and-type-attlist = - (attribute office:value-type { "float" }, - attribute office:value { double }) - | (attribute office:value-type { "percentage" }, - attribute office:value { double }) - | (attribute office:value-type { "currency" }, - attribute office:value { double }, - attribute office:currency { \string }?) - | (attribute office:value-type { "date" }, - attribute office:date-value { dateOrDateTime }) - | (attribute office:value-type { "time" }, - attribute office:time-value { duration }) - | (attribute office:value-type { "boolean" }, - attribute office:boolean-value { boolean }) - | (attribute office:value-type { "string" }, - attribute office:string-value { \string }?) -common-field-fixed-attlist = attribute text:fixed { boolean }? -common-field-name-attlist = attribute text:name { variableName } -common-field-description-attlist = attribute text:description { text }? -common-field-display-value-none-attlist = - attribute text:display { "value" | "none" }? -common-field-display-value-formula-none-attlist = - attribute text:display { "value" | "formula" | "none" }? -common-field-display-value-formula-attlist = - attribute text:display { "value" | "formula" }? -common-field-formula-attlist = attribute text:formula { formula }? -common-field-data-style-name-attlist = - attribute style:data-style-name { styleNameRef }? -common-field-num-format-attlist = common-num-format-attlist? -paragraph-content |= - element text:toc-mark-start { text-toc-mark-start-attrs } -text-toc-mark-start-attrs = text-id, text-outline-level -text-outline-level = attribute text:outline-level { positiveInteger }? -text-id = attribute text:id { \string } -paragraph-content |= element text:toc-mark-end { text-id } -paragraph-content |= - element text:toc-mark { - attribute text:string-value { \string }, - text-outline-level - } -paragraph-content |= - element text:user-index-mark-start { - text-id, text-outline-level, text-index-name - } -paragraph-content |= - element text:user-index-mark-end { text-id, text-outline-level } -paragraph-content |= - element text:user-index-mark { - attribute text:string-value { \string }, - text-outline-level, - text-index-name - } -text-index-name = attribute text:index-name { \string } -paragraph-content |= - element text:alphabetical-index-mark-start { - text-id, text-alphabetical-index-mark-attrs - } -paragraph-content |= - element text:alphabetical-index-mark-end { text-id } -paragraph-content |= - element text:alphabetical-index-mark { - attribute text:string-value { \string }, - text-alphabetical-index-mark-attrs - } -text-alphabetical-index-mark-attrs &= - attribute text:key1 { \string }?, - attribute text:key2 { \string }? -text-alphabetical-index-mark-attrs &= - attribute text:string-value-phonetic { \string }?, - attribute text:key1-phonetic { \string }?, - attribute text:key2-phonetic { \string }? -text-alphabetical-index-mark-attrs &= - [ a:defaultValue = "false" ] attribute text:main-entry { boolean }? -paragraph-content |= - element text:bibliography-mark { - attribute text:bibliography-type { text-bibliography-types }, - attribute text:identifier - | text:address - | text:annote - | text:author - | text:booktitle - | text:chapter - | text:edition - | text:editor - | text:howpublished - | text:institution - | text:journal - | text:month - | text:note - | text:number - | text:organizations - | text:pages - | text:publisher - | text:school - | text:series - | text:title - | text:report-type - | text:volume - | text:year - | text:url - | text:custom1 - | text:custom2 - | text:custom3 - | text:custom4 - | text:custom5 - | text:isbn - | text:issn { \string }*, - text - } -text-bibliography-types = - "article" - | "book" - | "booklet" - | "conference" - | "custom1" - | "custom2" - | "custom3" - | "custom4" - | "custom5" - | "email" - | "inbook" - | "incollection" - | "inproceedings" - | "journal" - | "manual" - | "mastersthesis" - | "misc" - | "phdthesis" - | "proceedings" - | "techreport" - | "unpublished" - | "www" -text-index-body = element text:index-body { index-content-main* } -index-content-main = text-content | text-index-title -text-index-title = - element text:index-title { sectionAttr, index-content-main* } -text-table-of-content = - element text:table-of-content { - sectionAttr, text-table-of-content-source, text-index-body - } -text-table-of-content-source = - element text:table-of-content-source { - text-table-of-content-source-attlist, - text-index-title-template?, - text-table-of-content-entry-template*, - text-index-source-styles* - } -text-table-of-content-source-attlist &= - attribute text:outline-level { positiveInteger }? -text-table-of-content-source-attlist &= - [ a:defaultValue = "true" ] - attribute text:use-outline-level { boolean }? -text-table-of-content-source-attlist &= - attribute text:use-index-marks { boolean }? -text-table-of-content-source-attlist &= - attribute text:use-index-source-styles { boolean }? -text-table-of-content-source-attlist &= - attribute text:index-scope { "document" | "chapter" }? -text-table-of-content-source-attlist &= - attribute text:relative-tab-stop-position { boolean }? -text-table-of-content-entry-template = - element text:table-of-content-entry-template { - text-table-of-content-entry-template-attlist, - text-table-of-content-children* - } -text-table-of-content-children = - text-index-entry-chapter - | text-index-entry-page-number - | text-index-entry-text - | text-index-entry-span - | text-index-entry-tab-stop - | text-index-entry-link-start - | text-index-entry-link-end -text-table-of-content-entry-template-attlist &= - attribute text:outline-level { positiveInteger } -text-table-of-content-entry-template-attlist &= - attribute text:style-name { styleNameRef } -text-illustration-index = - element text:illustration-index { - sectionAttr, text-illustration-index-source, text-index-body - } -text-illustration-index-source = - element text:illustration-index-source { - text-illustration-index-source-attrs, - text-index-title-template?, - text-illustration-index-entry-template? - } -text-illustration-index-source-attrs &= text-index-scope-attr -text-index-scope-attr = - [ a:defaultValue = "document" ] - attribute text:index-scope { "document" | "chapter" }? -text-illustration-index-source-attrs &= - text-relative-tab-stop-position-attr -text-relative-tab-stop-position-attr = - [ a:defaultValue = "true" ] - attribute text:relative-tab-stop-position { boolean }? -text-illustration-index-source-attrs &= - [ a:defaultValue = "true" ] attribute text:use-caption { boolean }? -text-illustration-index-source-attrs &= - attribute text:caption-sequence-name { \string }? -text-illustration-index-source-attrs &= - attribute text:caption-sequence-format { - "text" | "category-and-value" | "caption" - }? -text-illustration-index-entry-template = - element text:illustration-index-entry-template { - text-illustration-index-entry-content - } -text-illustration-index-entry-content = - text-illustration-index-entry-template-attrs, - (text-index-entry-page-number - | text-index-entry-text - | text-index-entry-span - | text-index-entry-tab-stop)* -text-illustration-index-entry-template-attrs = - attribute text:style-name { styleNameRef } -text-table-index = - element text:table-index { - sectionAttr, text-table-index-source, text-index-body - } -text-table-index-source = - element text:table-index-source { - text-illustration-index-source-attrs, - text-index-title-template?, - text-table-index-entry-template? - } -text-table-index-entry-template = - element text:table-index-entry-template { - text-illustration-index-entry-content - } -text-object-index = - element text:object-index { - sectionAttr, text-object-index-source, text-index-body - } -text-object-index-source = - element text:object-index-source { - text-object-index-source-attrs, - text-index-title-template?, - text-object-index-entry-template? - } -text-object-index-source-attrs &= text-index-scope-attr -text-object-index-source-attrs &= text-relative-tab-stop-position-attr -text-object-index-source-attrs &= - [ a:defaultValue = "false" ] - attribute text:use-spreadsheet-objects { boolean }? -text-object-index-source-attrs &= - [ a:defaultValue = "false" ] - attribute text:use-math-objects { boolean }? -text-object-index-source-attrs &= - [ a:defaultValue = "false" ] - attribute text:use-draw-objects { boolean }? -text-object-index-source-attrs &= - [ a:defaultValue = "false" ] - attribute text:use-chart-objects { boolean }? -text-object-index-source-attrs &= - [ a:defaultValue = "false" ] - attribute text:use-other-objects { boolean }? -text-object-index-entry-template = - element text:object-index-entry-template { - text-illustration-index-entry-content - } -text-user-index = - element text:user-index { - sectionAttr, text-user-index-source, text-index-body - } -text-user-index-source = - element text:user-index-source { - text-user-index-source-attr, - text-index-title-template?, - text-user-index-entry-template*, - text-index-source-styles* - } -text-user-index-source-attr &= - text-index-scope-attr, - text-relative-tab-stop-position-attr, - attribute text:index-name { \string } -text-user-index-source-attr &= - [ a:defaultValue = "false" ] - attribute text:use-index-marks { boolean }?, - [ a:defaultValue = "false" ] attribute text:use-graphics { boolean }?, - [ a:defaultValue = "false" ] attribute text:use-tables { boolean }?, - [ a:defaultValue = "false" ] - attribute text:use-floating-frames { boolean }?, - [ a:defaultValue = "false" ] attribute text:use-objects { boolean }? -text-user-index-source-attr &= - [ a:defaultValue = "false" ] - attribute text:copy-outline-levels { boolean }? -text-user-index-entry-template = - element text:user-index-entry-template { - text-user-index-entry-template-attrs, - (text-index-entry-chapter - | text-index-entry-page-number - | text-index-entry-text - | text-index-entry-span - | text-index-entry-tab-stop)* - } -text-user-index-entry-template-attrs &= - attribute text:outline-level { positiveInteger } -text-user-index-entry-template-attrs &= - attribute text:style-name { styleNameRef } -text-alphabetical-index = - element text:alphabetical-index { - sectionAttr, text-alphabetical-index-source, text-index-body - } -text-alphabetical-index-source = - element text:alphabetical-index-source { - text-alphabetical-index-source-attrs, - text-index-title-template?, - text-alphabetical-index-entry-template* - } -text-alphabetical-index-source-attrs &= - text-index-scope-attr, text-relative-tab-stop-position-attr -text-alphabetical-index-source-attrs &= - [ a:defaultValue = "false" ] attribute text:ignore-case { boolean }? -text-alphabetical-index-source-attrs &= - attribute text:main-entry-style-name { styleNameRef }? -text-alphabetical-index-source-attrs &= - [ a:defaultValue = "false" ] - attribute text:alphabetical-separators { boolean }? -text-alphabetical-index-source-attrs &= - [ a:defaultValue = "true" ] - attribute text:combine-entries { boolean }?, - [ a:defaultValue = "false" ] - attribute text:combine-entries-with-dash { boolean }?, - [ a:defaultValue = "true" ] - attribute text:combine-entries-with-pp { boolean }? -text-alphabetical-index-source-attrs &= - [ a:defaultValue = "false" ] - attribute text:use-keys-as-entries { boolean }? -text-alphabetical-index-source-attrs &= - [ a:defaultValue = "false" ] - attribute text:capitalize-entries { boolean }? -text-alphabetical-index-source-attrs &= - [ a:defaultValue = "false" ] - attribute text:comma-separated { boolean }? -text-alphabetical-index-source-attrs &= - attribute fo:language { languageCode }? -text-alphabetical-index-source-attrs &= - attribute fo:country { countryCode }? -text-alphabetical-index-source-attrs &= - attribute text:sort-algorithm { \string }? -text-alphabetical-index-auto-mark-file = - element text:alphabetical-index-auto-mark-file { - attribute xlink:href { anyURI }, - [ a:defaultValue = "simple" ] attribute xlink:type { "simple" }? - } -text-alphabetical-index-entry-template = - element text:alphabetical-index-entry-template { - text-alphabetical-index-entry-template-attrs, - (text-index-entry-chapter - | text-index-entry-page-number - | text-index-entry-text - | text-index-entry-span - | text-index-entry-tab-stop)* - } -text-alphabetical-index-entry-template-attrs &= - attribute text:outline-level { "1" | "2" | "3" | "separator" } -text-alphabetical-index-entry-template-attrs &= - attribute text:style-name { styleNameRef } -text-bibliography = - element text:bibliography { - sectionAttr, text-bibliography-source, text-index-body - } -text-bibliography-source = - element text:bibliography-source { - text-index-title-template?, text-bibliography-entry-template* - } -text-bibliography-entry-template = - element text:bibliography-entry-template { - text-bibliography-entry-template-attrs, - (text-index-entry-span - | text-index-entry-tab-stop - | text-index-entry-bibliography)* - } -text-bibliography-entry-template-attrs &= - attribute text:bibliography-type { text-bibliography-types } -text-bibliography-entry-template-attrs &= - attribute text:style-name { styleNameRef } -text-index-source-styles = - element text:index-source-styles { - attribute text:outline-level { positiveInteger }, - text-index-source-style* - } -text-index-source-style = - element text:index-source-style { - attribute text:style-name { styleName }, - empty - } -text-index-title-template = - element text:index-title-template { - attribute text:style-name { styleNameRef }?, - text - } -text-index-entry-chapter = - element text:index-entry-chapter { - attribute text:style-name { styleNameRef }?, - text-index-entry-chapter-attrs - } -text-index-entry-chapter-attrs = - [ a:defaultValue = "number" ] - attribute text:display { "name" | "number" | "number-and-name" }? -text-index-entry-text = - element text:index-entry-text { - attribute text:style-name { styleNameRef }? - } -text-index-entry-page-number = - element text:index-entry-page-number { - attribute text:style-name { styleNameRef }? - } -text-index-entry-span = - element text:index-entry-span { - attribute text:style-name { styleNameRef }?, - text - } -text-index-entry-bibliography = - element text:index-entry-bibliography { - text-index-entry-bibliography-attrs - } -text-index-entry-bibliography-attrs &= - attribute text:style-name { styleNameRef }? -text-index-entry-bibliography-attrs &= - attribute text:bibliography-data-field { - "address" - | "annote" - | "author" - | "bibliography-type" - | "booktitle" - | "chapter" - | "custom1" - | "custom2" - | "custom3" - | "custom4" - | "custom5" - | "edition" - | "editor" - | "howpublished" - | "identifier" - | "institution" - | "isbn" - | "issn" - | "journal" - | "month" - | "note" - | "number" - | "organizations" - | "pages" - | "publisher" - | "report-type" - | "school" - | "series" - | "title" - | "url" - | "volume" - | "year" - } -text-index-entry-tab-stop = - element text:index-entry-tab-stop { - attribute text:style-name { styleNameRef }?, - text-index-entry-tab-stop-attrs - } -text-index-entry-tab-stop-attrs &= - attribute style:leader-char { character }? -text-index-entry-tab-stop-attrs &= - attribute style:type { "right" } - | (attribute style:type { "left" }, - attribute style:position { length }) -text-index-entry-link-start = - element text:index-entry-link-start { - attribute text:style-name { styleNameRef }? - } -text-index-entry-link-end = - element text:index-entry-link-end { - attribute text:style-name { styleNameRef }? - } -table-table = - element table:table { - table-table-attlist, - table-table-source?, - office-dde-source?, - table-scenario?, - office-forms?, - table-shapes?, - table-columns-and-groups, - table-rows-and-groups - } -table-columns-and-groups = - (table-table-column-group | table-columns-no-group)+ -table-columns-no-group = - (table-columns, (table-table-header-columns, table-columns?)?) - | (table-table-header-columns, table-columns?) -table-columns = table-table-columns | table-table-column+ -table-rows-and-groups = (table-table-row-group | table-rows-no-group)+ -table-rows-no-group = - (table-rows, (table-table-header-rows, table-rows?)?) - | (table-table-header-rows, table-rows?) -table-rows = - table-table-rows | (text-soft-page-break?, table-table-row)+ -table-table-attlist &= attribute table:name { \string }? -table-table-attlist &= attribute table:style-name { styleNameRef }? -table-table-attlist &= - [ a:defaultValue = "false" ] attribute table:protected { boolean }?, - attribute table:protection-key { text }? -table-table-attlist &= - [ a:defaultValue = "true" ] attribute table:print { boolean }? -table-table-attlist &= - attribute table:print-ranges { cellRangeAddressList }? -table-table-row = - element table:table-row { - table-table-row-attlist, - (table-table-cell | table-covered-table-cell)+ - } -table-table-row-attlist &= - [ a:defaultValue = "1" ] - attribute table:number-rows-repeated { positiveInteger }? -table-table-row-attlist &= attribute table:style-name { styleNameRef }? -table-table-row-attlist &= - attribute table:default-cell-style-name { styleNameRef }? -table-table-row-attlist &= - [ a:defaultValue = "visible" ] - attribute table:visibility { table-visibility-value }? -table-visibility-value = "visible" | "collapse" | "filter" -table-table-cell = - element table:table-cell { - table-table-cell-attlist, - table-table-cell-attlist-extra, - table-table-cell-content - } -table-covered-table-cell = - element table:covered-table-cell { - table-table-cell-attlist, table-table-cell-content - } -table-table-cell-content = - table-cell-range-source?, - office-annotation?, - table-detective?, - text-content* -table-table-cell-attlist &= - [ a:defaultValue = "1" ] - attribute table:number-columns-repeated { positiveInteger }? -table-table-cell-attlist-extra &= - [ a:defaultValue = "1" ] - attribute table:number-columns-spanned { positiveInteger }?, - [ a:defaultValue = "1" ] - attribute table:number-rows-spanned { positiveInteger }? -table-table-cell-attlist &= attribute table:style-name { styleNameRef }? -table-table-cell-attlist &= - attribute table:content-validation-name { \string }? -table-table-cell-attlist &= attribute table:formula { \string }? -table-table-cell-attlist-extra &= - attribute table:number-matrix-columns-spanned { positiveInteger }?, - attribute table:number-matrix-rows-spanned { positiveInteger }? -table-table-cell-attlist &= common-value-and-type-attlist? -table-table-cell-attlist &= - [ a:defaultValue = "false" ] attribute table:protect { boolean }? -table-table-column = - element table:table-column { table-table-column-attlist, empty } -table-table-column-attlist &= - [ a:defaultValue = "1" ] - attribute table:number-columns-repeated { positiveInteger }? -table-table-column-attlist &= - attribute table:style-name { styleNameRef }? -table-table-column-attlist &= - [ a:defaultValue = "visible" ] - attribute table:visibility { table-visibility-value }? -table-table-column-attlist &= - attribute table:default-cell-style-name { styleNameRef }? -table-table-header-columns = - element table:table-header-columns { table-table-column+ } -table-table-columns = - element table:table-columns { table-table-column+ } -table-table-column-group = - element table:table-column-group { - table-table-column-group-attlist, table-columns-and-groups - } -table-table-column-group-attlist &= - [ a:defaultValue = "true" ] attribute table:display { boolean }? -table-table-header-rows = - element table:table-header-rows { - (text-soft-page-break?, table-table-row)+ - } -table-table-rows = - element table:table-rows { (text-soft-page-break?, table-table-row)+ } -table-table-row-group = - element table:table-row-group { - table-table-row-group-attlist, table-rows-and-groups - } -table-table-row-group-attlist &= - [ a:defaultValue = "true" ] attribute table:display { boolean }? -table-table-attlist &= - [ a:defaultValue = "false" ] attribute table:is-sub-table { boolean }? -cellAddress = - xsd:string { - pattern = "($?([^\. ']+|'([^']|'')+'))?\.$?[A-Z]+$?[0-9]+" - } -cellRangeAddress = - xsd:string { - pattern = - "($?([^\. ']+|'([^']|'')+'))?\.$?[A-Z]+$?[0-9]+(:($?([^\. ']+|'([^']|'')+'))?\.$?[A-Z]+$?[0-9]+)?" - } -cellRangeAddressList = - # Value is a space separated list of "cellRangeAddress" patterns - xsd:string -table-table-source = - element table:table-source { - table-table-source-attlist, table-linked-source-attlist, empty - } -table-table-source-attlist &= - [ a:defaultValue = "copy-all" ] - attribute table:mode { "copy-all" | "copy-results-only" }? -table-table-source-attlist &= attribute table:table-name { \string }? -table-linked-source-attlist &= - [ a:defaultValue = "simple" ] attribute xlink:type { "simple" }?, - [ a:defaultValue = "onRequest" ] - attribute xlink:actuate { "onRequest" }?, - attribute xlink:href { anyURI } -table-linked-source-attlist &= attribute table:filter-name { \string }? -table-linked-source-attlist &= - attribute table:filter-options { \string }? -table-linked-source-attlist &= - attribute table:refresh-delay { duration }? -table-scenario = - element table:scenario { table-scenario-attlist, empty } -table-scenario-attlist &= - attribute table:scenario-ranges { cellRangeAddressList } -table-scenario-attlist &= attribute table:is-active { boolean } -table-scenario-attlist &= - [ a:defaultValue = "true" ] - attribute table:display-border { boolean }? -table-scenario-attlist &= attribute table:border-color { color }? -table-scenario-attlist &= - [ a:defaultValue = "true" ] attribute table:copy-back { boolean }? -table-scenario-attlist &= - [ a:defaultValue = "true" ] attribute table:copy-styles { boolean }? -table-scenario-attlist &= - [ a:defaultValue = "true" ] attribute table:copy-formulas { boolean }? -table-scenario-attlist &= attribute table:comment { \string }? -table-scenario-attlist &= attribute table:protected { boolean }? -table-shapes = element table:shapes { shape+ } -table-cell-range-source = - element table:cell-range-source { - table-table-cell-range-source-attlist, - table-linked-source-attlist, - empty - } -table-table-cell-range-source-attlist &= - attribute table:name { \string } -table-table-cell-range-source-attlist &= - attribute table:last-column-spanned { positiveInteger }, - attribute table:last-row-spanned { positiveInteger } -table-detective = - element table:detective { table-highlighted-range*, table-operation* } -table-operation = - element table:operation { table-operation-attlist, empty } -table-operation-attlist &= - attribute table:name { - "trace-dependents" - | "remove-dependents" - | "trace-precedents" - | "remove-precedents" - | "trace-errors" - } -table-operation-attlist &= attribute table:index { nonNegativeInteger } -table-highlighted-range = - element table:highlighted-range { - (table-highlighted-range-attlist - | table-highlighted-range-attlist-invalid), - empty - } -table-highlighted-range-attlist &= - attribute table:cell-range-address { cellRangeAddress }? -table-highlighted-range-attlist &= - attribute table:direction { - "from-another-table" | "to-another-table" | "from-same-table" - } -table-highlighted-range-attlist &= - [ a:defaultValue = "false" ] - attribute table:contains-error { boolean }? -table-highlighted-range-attlist-invalid &= - attribute table:marked-invalid { boolean } -office-spreadsheet-attlist &= - [ a:defaultValue = "false" ] - attribute table:structure-protected { boolean }?, - attribute table:protection-key { \string }? -table-calculation-settings = - element table:calculation-settings { - table-calculation-setting-attlist, - table-null-date?, - table-iteration? - } -table-calculation-setting-attlist &= - [ a:defaultValue = "true" ] - attribute table:case-sensitive { boolean }? -table-calculation-setting-attlist &= - [ a:defaultValue = "false" ] - attribute table:precision-as-shown { boolean }? -table-calculation-setting-attlist &= - [ a:defaultValue = "true" ] - attribute table:search-criteria-must-apply-to-whole-cell { boolean }? -table-calculation-setting-attlist &= - [ a:defaultValue = "true" ] - attribute table:automatic-find-labels { boolean }? -table-calculation-setting-attlist &= - [ a:defaultValue = "true" ] - attribute table:use-regular-expressions { boolean }? -table-calculation-setting-attlist &= - [ a:defaultValue = "1930" ] - attribute table:null-year { positiveInteger }? -table-null-date = - element table:null-date { - [ a:defaultValue = "date" ] - attribute table:value-type { valueType }?, - [ a:defaultValue = "1899-12-30" ] - attribute table:date-value { date }?, - empty - } -table-iteration = - element table:iteration { - [ a:defaultValue = "disable" ] - attribute table:status { "enable" | "disable" }?, - [ a:defaultValue = "100" ] - attribute table:steps { positiveInteger }?, - [ a:defaultValue = "0.001" ] - attribute table:maximum-difference { double }?, - empty - } -table-content-validations = - element table:content-validations { table-content-validation+ } -table-content-validation = - element table:content-validation { - table-validation-attlist, - table-help-message?, - (table-error-message - | (table-error-macro, office-event-listeners?))? - } -table-validation-attlist &= attribute table:name { \string } -table-validation-attlist &= attribute table:condition { \string }? -table-validation-attlist &= - attribute table:base-cell-address { cellAddress }? -table-validation-attlist &= - [ a:defaultValue = "true" ] - attribute table:allow-empty-cell { boolean }? -table-validation-attlist &= - [ a:defaultValue = "unsorted" ] - attribute table:display-list { - "none" | "unsorted" | "sort-ascending" - }? -table-help-message = - element table:help-message { - attribute table:title { \string }?, - [ a:defaultValue = "false" ] attribute table:display { boolean }?, - text-p* - } -table-error-message = - element table:error-message { - attribute table:title { \string }?, - [ a:defaultValue = "false" ] attribute table:display { boolean }?, - [ a:defaultValue = "stop" ] - attribute table:message-type { - "stop" | "warning" | "information" - }?, - text-p* - } -table-error-macro = - element table:error-macro { - [ a:defaultValue = "true" ] attribute table:execute { boolean }? - } -table-label-ranges = element table:label-ranges { table-label-range* } -table-label-range = - element table:label-range { table-label-range-attlist, empty } -table-label-range-attlist &= - attribute table:label-cell-range-address { cellRangeAddress } -table-label-range-attlist &= - attribute table:data-cell-range-address { cellRangeAddress } -table-label-range-attlist &= - attribute table:orientation { "column" | "row" } -table-named-expressions = - element table:named-expressions { - (table-named-range | table-named-expression)* - } -table-named-range = - element table:named-range { table-named-range-attlist, empty } -table-named-range-attlist &= - attribute table:name { \string }, - attribute table:cell-range-address { cellRangeAddress }, - attribute table:base-cell-address { cellAddress }?, - [ a:defaultValue = "none" ] - attribute table:range-usable-as { - "none" - | list { - ("print-range" | "filter" | "repeat-row" | "repeat-column")+ - } - }? -table-named-expression = - element table:named-expression { - table-named-expression-attlist, empty - } -table-named-expression-attlist &= - attribute table:name { \string }, - attribute table:expression { \string }, - attribute table:base-cell-address { cellAddress }? -table-database-ranges = - element table:database-ranges { table-database-range* } -table-database-range = - element table:database-range { - table-database-range-attlist, - (table-database-source-sql - | table-database-source-table - | table-database-source-query)?, - table-filter?, - table-sort?, - table-subtotal-rules? - } -table-database-range-attlist &= attribute table:name { \string }? -table-database-range-attlist &= - [ a:defaultValue = "false" ] attribute table:is-selection { boolean }? -table-database-range-attlist &= - [ a:defaultValue = "false" ] - attribute table:on-update-keep-styles { boolean }? -table-database-range-attlist &= - [ a:defaultValue = "true" ] - attribute table:on-update-keep-size { boolean }? -table-database-range-attlist &= - [ a:defaultValue = "true" ] - attribute table:has-persistent-data { boolean }? -table-database-range-attlist &= - [ a:defaultValue = "row" ] - attribute table:orientation { "column" | "row" }? -table-database-range-attlist &= - [ a:defaultValue = "true" ] - attribute table:contains-header { boolean }? -table-database-range-attlist &= - [ a:defaultValue = "false" ] - attribute table:display-filter-buttons { boolean }? -table-database-range-attlist &= - attribute table:target-range-address { cellRangeAddress } -table-database-range-attlist &= - attribute table:refresh-delay { boolean }? -table-database-source-sql = - element table:database-source-sql { - table-database-source-sql-attlist, empty - } -table-database-source-sql-attlist &= - attribute table:database-name { \string } -table-database-source-sql-attlist &= - attribute table:sql-statement { \string } -table-database-source-sql-attlist &= - [ a:defaultValue = "false" ] - attribute table:parse-sql-statement { boolean }? -table-database-source-query = - element table:database-source-table { - table-database-source-table-attlist, empty - } -table-database-source-table-attlist &= - attribute table:database-name { \string } -table-database-source-table-attlist &= - attribute table:database-table-name { \string } -table-database-source-table = - element table:database-source-query { - table-database-source-query-attlist, empty - } -table-database-source-query-attlist &= - attribute table:database-name { \string } -table-database-source-query-attlist &= - attribute table:query-name { \string } -table-sort = element table:sort { table-sort-attlist, table-sort-by+ } -table-sort-attlist &= - [ a:defaultValue = "true" ] - attribute table:bind-styles-to-content { boolean }? -table-sort-attlist &= - attribute table:target-range-address { cellRangeAddress }? -table-sort-attlist &= - [ a:defaultValue = "false" ] - attribute table:case-sensitive { boolean }? -table-sort-attlist &= attribute table:language { languageCode }? -table-sort-attlist &= attribute table:country { countryCode }? -table-sort-attlist &= attribute table:algorithm { \string }? -table-sort-by = element table:sort-by { table-sort-by-attlist, empty } -table-sort-by-attlist &= - attribute table:field-number { nonNegativeInteger } -table-sort-by-attlist &= - [ a:defaultValue = "automatic" ] - attribute table:data-type { - "text" | "number" | "automatic" | \string - }? -table-sort-by-attlist &= - [ a:defaultValue = "ascending" ] - attribute table:order { "ascending" | "descending" }? -table-subtotal-rules = - element table:subtotal-rules { - table-subtotal-rules-attlist, - table-sort-groups?, - table-subtotal-rule* - } -table-subtotal-rules-attlist &= - [ a:defaultValue = "true" ] - attribute table:bind-styles-to-content { boolean }? -table-subtotal-rules-attlist &= - [ a:defaultValue = "false" ] - attribute table:case-sensitive { boolean }? -table-subtotal-rules-attlist &= - [ a:defaultValue = "false" ] - attribute table:page-breaks-on-group-change { boolean }? -table-sort-groups = - element table:sort-groups { table-sort-groups-attlist, empty } -table-sort-groups-attlist &= - [ a:defaultValue = "automatic" ] - attribute table:data-type { - "text" | "number" | "automatic" | \string - }? -table-sort-groups-attlist &= - [ a:defaultValue = "ascending" ] - attribute table:order { "ascending" | "descending" }? -table-subtotal-rule = - element table:subtotal-rule { - table-subtotal-rule-attlist, table-subtotal-field* - } -table-subtotal-rule-attlist &= - attribute table:group-by-field-number { nonNegativeInteger } -table-subtotal-field = - element table:subtotal-field { table-subtotal-field-attlist, empty } -table-subtotal-field-attlist &= - attribute table:field-number { nonNegativeInteger } -table-subtotal-field-attlist &= - attribute table:function { - "auto" - | "average" - | "count" - | "countnums" - | "max" - | "min" - | "product" - | "stdev" - | "stdevp" - | "sum" - | "var" - | "varp" - | \string - } -table-filter = - element table:filter { - table-filter-attlist, - (table-filter-condition | table-filter-and | table-filter-or) - } -table-filter-attlist &= - attribute table:target-range-address { cellRangeAddress }? -table-filter-attlist &= - [ a:defaultValue = "self" ] - attribute table:condition-source { "self" | "cell-range" }? -table-filter-attlist &= - attribute table:condition-source-range-address { cellRangeAddress }? -table-filter-attlist &= - [ a:defaultValue = "true" ] - attribute table:display-duplicates { boolean }? -table-filter-and = - element table:filter-and { - (table-filter-or | table-filter-condition)+ - } -table-filter-or = - element table:filter-or { - (table-filter-and | table-filter-condition)+ - } -table-filter-condition = - element table:filter-condition { - table-filter-condition-attlist, empty - } -table-filter-condition-attlist &= - attribute table:field-number { nonNegativeInteger } -table-filter-condition-attlist &= attribute table:value { \string } -table-filter-condition-attlist &= attribute table:operator { \string } -table-filter-condition-attlist &= - [ a:defaultValue = "false" ] - attribute table:case-sensitive { \string }? -table-filter-condition-attlist &= - [ a:defaultValue = "text" ] - attribute table:data-type { "text" | "number" }? -table-data-pilot-tables = - element table:data-pilot-tables { table-data-pilot-table* } -table-data-pilot-table = - element table:data-pilot-table { - table-data-pilot-table-attlist, - (table-database-source-sql - | table-database-source-table - | table-database-source-query - | table-source-service - | table-source-cell-range)?, - table-data-pilot-field+ - } -table-data-pilot-table-attlist &= attribute table:name { \string } -table-data-pilot-table-attlist &= - attribute table:application-data { \string }? -table-data-pilot-table-attlist &= - [ a:defaultValue = "both" ] - attribute table:grand-total { "none" | "row" | "column" | "both" }? -table-data-pilot-table-attlist &= - [ a:defaultValue = "false" ] - attribute table:ignore-empty-rows { boolean }? -table-data-pilot-table-attlist &= - [ a:defaultValue = "false" ] - attribute table:identify-categories { boolean }? -table-data-pilot-table-attlist &= - attribute table:target-range-address { cellRangeAddress } -table-data-pilot-table-attlist &= - attribute table:buttons { cellRangeAddressList }? -table-data-pilot-table-attlist &= - [ a:defaultValue = "true" ] - attribute table:show-filter-button { boolean }? -table-data-pilot-table-attlist &= - [ a:defaultValue = "true" ] - attribute table:drill-down-on-double-click { boolean }? -table-source-cell-range = - element table:source-cell-range { - table-source-cell-range-attlist, table-filter? - } -table-source-cell-range-attlist &= - attribute table:cell-range-address { cellRangeAddress } -table-source-service = - element table:source-service { table-source-service-attlist, empty } -table-source-service-attlist &= attribute table:name { \string } -table-source-service-attlist &= attribute table:source-name { \string } -table-source-service-attlist &= attribute table:object-name { \string } -table-source-service-attlist &= attribute table:user-name { \string }? -table-source-service-attlist &= attribute table:password { \string }? -table-data-pilot-field = - element table:data-pilot-field { - table-data-pilot-field-attlist, - table-data-pilot-level?, - table-data-pilot-field-reference?, - table-data-pilot-groups? - } -table-data-pilot-field-attlist &= - attribute table:source-field-name { \string } -table-data-pilot-field-attlist &= - attribute table:orientation { "row" | "column" | "data" | "hidden" } - | (attribute table:orientation { "page" }, - attribute table:selected-page { \string }) -table-data-pilot-field-attlist &= - [ a:defaultValue = "false" ] - attribute table:is-data-layout-field { \string }? -table-data-pilot-field-attlist &= - attribute table:function { - "auto" - | "average" - | "count" - | "countnums" - | "max" - | "min" - | "product" - | "stdev" - | "stdevp" - | "sum" - | "var" - | "varp" - | \string - }? -table-data-pilot-field-attlist &= - [ a:defaultValue = "-1" ] attribute table:used-hierarchy { integer }? -table-data-pilot-level = - element table:data-pilot-level { - table-data-pilot-level-attlist, - table-data-pilot-subtotals?, - table-data-pilot-members?, - table-data-pilot-display-info?, - table-data-pilot-sort-info?, - table-data-pilot-layout-info? - } -table-data-pilot-level-attlist &= - attribute table:show-empty { boolean }? -table-data-pilot-subtotals = - element table:data-pilot-subtotals { table-data-pilot-subtotal* } -table-data-pilot-subtotal = - element table:data-pilot-subtotal { - table-data-pilot-subtotal-attlist, empty - } -table-data-pilot-subtotal-attlist &= - attribute table:function { - "auto" - | "average" - | "count" - | "countnums" - | "max" - | "min" - | "product" - | "stdev" - | "stdevp" - | "sum" - | "var" - | "varp" - | \string - } -table-data-pilot-members = - element table:data-pilot-members { table-data-pilot-member* } -table-data-pilot-member = - element table:data-pilot-member { - table-data-pilot-member-attlist, empty - } -table-data-pilot-member-attlist &= attribute table:name { \string } -table-data-pilot-member-attlist &= attribute table:display { boolean }? -table-data-pilot-member-attlist &= - attribute table:show-details { boolean }? -table-data-pilot-display-info = - element table:data-pilot-display-info { - table-data-pilot-display-info-attlist, empty - } -table-data-pilot-display-info-attlist &= - attribute table:enabled { boolean } -table-data-pilot-display-info-attlist &= - attribute table:data-field { \string } -table-data-pilot-display-info-attlist &= - attribute table:member-count { nonNegativeInteger } -table-data-pilot-display-info-attlist &= - attribute table:display-member-mode { "from-top" | "from-bottom" } -table-data-pilot-sort-info = - element table:data-pilot-sort-info { - table-data-pilot-sort-info-attlist, empty - } -table-data-pilot-sort-info-attlist &= - (attribute table:sort-mode { "data" }, - attribute table:data-field { \string }) - | attribute table:sort-mode { "none" | "manual" | "name" } -table-data-pilot-sort-info-attlist &= - attribute table:order { "ascending" | "descending" } -table-data-pilot-layout-info = - element table:data-pilot-layout-info { - table-data-pilot-layout-info-attlist, empty - } -table-data-pilot-layout-info-attlist &= - attribute table:layout-mode { - "tabular-layout" - | "outline-subtotals-top" - | "outline-subtotals-bottom" - } -table-data-pilot-layout-info-attlist &= - attribute table:add-empty-lines { boolean } -table-data-pilot-field-reference = - element table:data-pilot-field-reference { - table-data-pilot-field-reference-attlist - } -table-data-pilot-field-reference-attlist &= - attribute table:field-name { \string } -table-data-pilot-field-reference-attlist &= - (attribute table:member-type { "named" }, - attribute table:member-name { \string }) - | attribute table:member-type { "previous" | "next" } -table-data-pilot-field-reference-attlist &= - attribute table:type { - "none" - | "member-difference" - | "member-percentage" - | "member-percentage-difference" - | "running-total" - | "row-percentage" - | "column-percentage" - | "total-percentage" - | "index" - } -table-data-pilot-groups = - element table:data-pilot-groups { - table-data-pilot-groups-attlist, table-data-pilot-group+ - } -table-data-pilot-groups-attlist &= - attribute table:source-field-name { \string } -table-data-pilot-groups-attlist &= - attribute table:date-start { dateOrDateTime | "auto" } - | attribute table:start { double | "auto" } -table-data-pilot-groups-attlist &= - attribute table:date-end { dateOrDateTime | "auto" } - | attribute table:end { double | "auto" } -table-data-pilot-groups-attlist &= attribute table:step { double } -table-data-pilot-groups-attlist &= - attribute table:grouped-by { - "seconds" - | "minutes" - | "hours" - | "days" - | "months" - | "quarters" - | "years" - } -table-data-pilot-group = - element table:data-pilot-group { - table-data-pilot-group-attlist, table-data-pilot-group-member+ - } -table-data-pilot-group-attlist &= attribute table:name { \string } -table-data-pilot-group-member = - element table:data-pilot-group-member { - table-data-pilot-group-member-attlist - } -table-data-pilot-group-member-attlist &= - attribute table:name { \string } -table-consolidation = - element table:consolidation { table-consolidation-attlist, empty } -table-consolidation-attlist &= - attribute table:function { - "auto" - | "average" - | "count" - | "countnums" - | "max" - | "min" - | "product" - | "stdev" - | "stdevp" - | "sum" - | "var" - | "varp" - | \string - } -table-consolidation-attlist &= - attribute table:source-cell-range-addresses { cellRangeAddressList } -table-consolidation-attlist &= - attribute table:target-cell-address { cellAddress } -table-consolidation-attlist &= - [ a:defaultValue = "none" ] - attribute table:use-labels { "none" | "row" | "column" | "both" }? -table-consolidation-attlist &= - [ a:defaultValue = "false" ] - attribute table:link-to-source-data { boolean }? -table-dde-links = element table:dde-links { table-dde-link+ } -table-tracked-changes = - element table:tracked-changes { - table-tracked-changes-attlist, - (table-cell-content-change - | table-insertion - | table-deletion - | table-movement)* - } -table-tracked-changes-attlist &= - [ a:defaultValue = "false" ] - attribute table:track-changes { boolean }? -table-insertion = - element table:insertion { - table-insertion-attlist, - common-table-change-attlist, - office-change-info, - table-dependencies?, - table-deletions? - } -table-insertion-attlist &= - attribute table:type { "row" | "column" | "table" } -table-insertion-attlist &= attribute table:position { integer } -table-insertion-attlist &= - [ a:defaultValue = "1" ] attribute table:count { positiveInteger }? -table-insertion-attlist &= attribute table:table { integer }? -table-dependencies = element table:dependencies { table-dependency+ } -table-dependency = - element table:dependency { - attribute table:id { \string }, - empty - } -table-deletions = - element table:deletions { - (table-cell-content-deletion | table-change-deletion)+ - } -table-cell-content-deletion = - element table:cell-content-deletion { - attribute table:id { \string }?, - table-cell-address?, - table-change-track-table-cell? - } -table-change-deletion = - element table:change-deletion { - attribute table:id { \string }?, - empty - } -table-deletion = - element table:deletion { - table-deletion-attlist, - common-table-change-attlist, - office-change-info, - table-dependencies?, - table-deletions?, - table-cut-offs? - } -table-deletion-attlist &= - attribute table:type { "row" | "column" | "table" } -table-deletion-attlist &= attribute table:position { integer } -table-deletion-attlist &= attribute table:table { integer }? -table-deletion-attlist &= - attribute table:multi-deletion-spanned { integer }? -table-cut-offs = - element table:cut-offs { - table-movement-cut-off+ - | (table-insertion-cut-off, table-movement-cut-off*) - } -table-insertion-cut-off = - element table:insertion-cut-off { - table-insertion-cut-off-attlist, empty - } -table-insertion-cut-off-attlist &= attribute table:id { \string } -table-insertion-cut-off-attlist &= attribute table:position { integer } -table-movement-cut-off = - element table:movement-cut-off { - table-movement-cut-off-attlist, empty - } -table-movement-cut-off-attlist &= - attribute table:position { integer } - | (attribute table:start-position { integer }, - attribute table:end-position { integer }) -table-movement = - element table:movement { - common-table-change-attlist, - table-source-range-address, - table-target-range-address, - office-change-info, - table-dependencies?, - table-deletions? - } -table-source-range-address = - element table:source-range-address { - common-table-range-attlist, empty - } -table-target-range-address = - element table:target-range-address { - common-table-range-attlist, empty - } -common-table-range-attlist &= - common-table-cell-address-attlist - | common-table-cell-range-address-attlist -common-table-cell-address-attlist &= - attribute table:column { integer }, - attribute table:row { integer }, - attribute table:table { integer } -common-table-cell-range-address-attlist &= - attribute table:start-column { integer }, - attribute table:start-row { integer }, - attribute table:start-table { integer }, - attribute table:end-column { integer }, - attribute table:end-row { integer }, - attribute table:end-table { integer } -table-change-track-table-cell &= - element table:change-track-table-cell { - table-change-track-table-cell-attlist, text-p* - } -table-change-track-table-cell-attlist &= - attribute table:cell-address { cellAddress }? -table-change-track-table-cell-attlist &= - [ a:defaultValue = "false" ] - attribute table:matrix-covered { boolean }? -table-change-track-table-cell-attlist &= - attribute table:formula { \string }?, - attribute table:number-matrix-columns-spanned { positiveInteger }?, - attribute table:number-matrix-rows-spanned { positiveInteger }?, - common-value-and-type-attlist? -table-cell-content-change = - element table:cell-content-change { - common-table-change-attlist, - table-cell-address, - office-change-info, - table-dependencies?, - table-deletions?, - table-previous - } -table-cell-address = - element table:cell-address { - common-table-cell-address-attlist, empty - } -table-previous = - element table:previous { - attribute table:id { \string }?, - table-change-track-table-cell - } -common-table-change-attlist &= attribute table:id { \string } -common-table-change-attlist &= - [ a:defaultValue = "pending" ] - attribute table:acceptance-state { - "accepted" | "rejected" | "pending" - }? -common-table-change-attlist &= - attribute table:rejecting-change-id { \string }? -style-handout-master = - element style:handout-master { - common-presentation-header-footer-attlist, - style-handout-master-attlist, - shape* - } -style-handout-master-attlist &= - attribute presentation:presentation-page-layout-name { styleNameRef }? -style-handout-master-attlist &= - attribute style:page-layout-name { styleNameRef } -style-handout-master-attlist &= - attribute draw:style-name { styleNameRef }? -draw-layer-set = element draw:layer-set { draw-layer* } -draw-layer = - element draw:layer { draw-layer-attlist, svg-title?, svg-desc? } -draw-layer-attlist &= attribute draw:name { \string } -draw-layer-attlist &= - [ a:defaultValue = "false" ] attribute draw:protected { boolean }? -draw-layer-attlist &= - [ a:defaultValue = "always" ] - attribute draw:display { "always" | "screen" | "printer" | "none" }? -draw-page = - element draw:page { - common-presentation-header-footer-attlist, - draw-page-attlist, - office-forms?, - shape*, - (presentation-animations | animation-element)?, - presentation-notes? - } -draw-page-attlist &= attribute draw:name { \string }? -draw-page-attlist &= attribute draw:style-name { styleNameRef }? -draw-page-attlist &= attribute draw:master-page-name { styleNameRef } -draw-page-attlist &= - attribute presentation:presentation-page-layout-name { styleNameRef }? -common-presentation-header-footer-attlist &= - attribute presentation:use-header-name { \string }? -common-presentation-header-footer-attlist &= - attribute presentation:use-footer-name { \string }? -common-presentation-header-footer-attlist &= - attribute presentation:use-date-time-name { \string }? -draw-page-attlist &= attribute draw:id { ID }? -draw-page-attlist &= attribute draw:nav-order { IDREFS }? -shape = - draw-rect - | draw-line - | draw-polyline - | draw-polygon - | draw-regular-polygon - | draw-path - | draw-circle - | draw-ellipse - | draw-g - | draw-page-thumbnail - | draw-frame - | draw-measure - | draw-caption - | draw-connector - | draw-control - | dr3d-scene - | draw-custom-shape -draw-rect = - element draw:rect { - draw-rect-attlist, - common-draw-position-attlist, - common-draw-size-attlist, - common-draw-shape-with-text-and-styles-attlist, - common-draw-caption-id-attlist, - svg-title?, - svg-desc?, - office-event-listeners?, - draw-glue-point*, - draw-text - } -draw-rect-attlist &= attribute draw:corner-radius { nonNegativeLength }? -draw-line = - element draw:line { - draw-line-attlist, - common-draw-shape-with-text-and-styles-attlist, - common-draw-caption-id-attlist, - svg-title?, - svg-desc?, - office-event-listeners?, - draw-glue-point*, - draw-text - } -draw-line-attlist &= - attribute svg:x1 { coordinate }, - attribute svg:y1 { coordinate } -draw-line-attlist &= - attribute svg:x2 { coordinate }, - attribute svg:y2 { coordinate } -draw-polyline = - element draw:polyline { - common-draw-points-attlist, - common-draw-position-attlist, - common-draw-size-attlist, - common-draw-viewbox-attlist, - common-draw-shape-with-text-and-styles-attlist, - common-draw-caption-id-attlist, - svg-title?, - svg-desc?, - office-event-listeners?, - draw-glue-point*, - draw-text - } -common-draw-points-attlist = attribute draw:points { points } -draw-polygon = - element draw:polygon { - common-draw-points-attlist, - common-draw-position-attlist, - common-draw-size-attlist, - common-draw-viewbox-attlist, - common-draw-shape-with-text-and-styles-attlist, - common-draw-caption-id-attlist, - svg-title?, - svg-desc?, - office-event-listeners?, - draw-glue-point*, - draw-text - } -draw-regular-polygon = - element draw:regular-polygon { - draw-regular-polygon-attlist, - common-draw-position-attlist, - common-draw-size-attlist, - common-draw-shape-with-text-and-styles-attlist, - common-draw-caption-id-attlist, - svg-title?, - svg-desc?, - office-event-listeners?, - draw-glue-point*, - draw-text - } -draw-regular-polygon-attlist &= - attribute draw:concave { "false" } - | (attribute draw:concave { "true" }, - draw-regular-polygon-sharpness-attlist) -draw-regular-polygon-attlist &= - attribute draw:corners { positiveInteger } -draw-regular-polygon-sharpness-attlist = - attribute draw:sharpness { percent } -draw-path = - element draw:path { - common-draw-path-data-attlist, - common-draw-position-attlist, - common-draw-size-attlist, - common-draw-viewbox-attlist, - common-draw-shape-with-text-and-styles-attlist, - common-draw-caption-id-attlist, - svg-title?, - svg-desc?, - office-event-listeners?, - draw-glue-point*, - draw-text - } -common-draw-path-data-attlist = attribute svg:d { pathData } -draw-circle = - element draw:circle { - draw-circle-attlist, - common-draw-circle-ellipse-attlist, - common-draw-position-attlist, - common-draw-size-attlist, - common-draw-shape-with-text-and-styles-attlist, - common-draw-caption-id-attlist, - svg-title?, - svg-desc?, - office-event-listeners?, - draw-glue-point*, - draw-text - } -common-draw-circle-ellipse-attlist &= - (attribute svg:cx { coordinate }, - attribute svg:cy { coordinate })? -draw-circle-attlist &= attribute svg:r { length }? -common-draw-circle-ellipse-attlist &= - [ a:defaultValue = "full" ] - attribute draw:kind { "full" | "section" | "cut" | "arc" }? -common-draw-circle-ellipse-attlist &= - attribute draw:start-angle { double }? -common-draw-circle-ellipse-attlist &= - attribute draw:end-angle { double }? -draw-ellipse = - element draw:ellipse { - common-draw-circle-ellipse-attlist, - draw-ellipse-attlist, - common-draw-position-attlist, - common-draw-size-attlist, - common-draw-shape-with-text-and-styles-attlist, - common-draw-caption-id-attlist, - svg-title?, - svg-desc?, - office-event-listeners?, - draw-glue-point*, - draw-text - } -draw-ellipse-attlist &= - (attribute svg:rx { length }, - attribute svg:ry { length })? -draw-connector = - element draw:connector { - draw-connector-attlist, - common-draw-shape-with-text-and-styles-attlist, - common-draw-caption-id-attlist, - svg-title?, - svg-desc?, - office-event-listeners?, - draw-glue-point*, - draw-text - } -draw-connector-attlist &= - [ a:defaultValue = "standard" ] - attribute draw:type { "standard" | "lines" | "line" | "curve" }? -draw-connector-attlist &= - (attribute svg:x1 { coordinate }, - attribute svg:y1 { coordinate })? -draw-connector-attlist &= attribute draw:start-shape { IDREF }? -draw-connector-attlist &= - attribute draw:start-glue-point { nonNegativeInteger }? -draw-connector-attlist &= - (attribute svg:x2 { coordinate }, - attribute svg:y2 { coordinate })? -draw-connector-attlist &= attribute draw:end-shape { IDREF }? -draw-connector-attlist &= - attribute draw:end-glue-point { nonNegativeInteger }? -draw-connector-attlist &= - attribute draw:line-skew { - list { length, (length, length?)? } - }? -draw-caption = - element draw:caption { - draw-caption-attlist, - common-draw-position-attlist, - common-draw-size-attlist, - common-draw-shape-with-text-and-styles-attlist, - common-draw-caption-id-attlist, - svg-title?, - svg-desc?, - office-event-listeners?, - draw-glue-point*, - draw-text - } -draw-caption-attlist &= - (attribute draw:caption-point-x { coordinate }, - attribute draw:caption-point-y { coordinate })? -draw-caption-attlist &= - attribute draw:corner-radius { nonNegativeLength }? -draw-measure = - element draw:measure { - draw-measure-attlist, - common-draw-shape-with-text-and-styles-attlist, - common-draw-caption-id-attlist, - svg-title?, - svg-desc?, - office-event-listeners?, - draw-glue-point*, - draw-text - } -draw-measure-attlist &= - attribute svg:x1 { coordinate }, - attribute svg:y1 { coordinate } -draw-measure-attlist &= - attribute svg:x2 { coordinate }, - attribute svg:y2 { coordinate } -draw-control = - element draw:control { - draw-control-attlist, - common-draw-position-attlist, - common-draw-size-attlist, - common-draw-shape-with-text-and-styles-attlist, - common-draw-caption-id-attlist, - svg-title?, - svg-desc?, - draw-glue-point* - } -draw-control-attlist &= attribute draw:control { IDREF } -draw-page-thumbnail = - element draw:page-thumbnail { - draw-page-thumbnail-attlist, - common-draw-position-attlist, - common-draw-size-attlist, - presentation-shape-attlist, - common-draw-shape-with-styles-attlist, - common-draw-caption-id-attlist, - svg-title?, - svg-desc? - } -draw-page-thumbnail-attlist = - attribute draw:page-number { positiveInteger }? -draw-g = - element draw:g { - draw-g-attlist, - common-draw-z-index-attlist, - common-draw-name-attlist, - common-draw-id-attlist, - common-draw-style-name-attlist, - common-text-spreadsheet-shape-attlist, - common-draw-caption-id-attlist, - svg-title?, - svg-desc?, - office-event-listeners?, - draw-glue-point*, - shape* - } -draw-g-attlist &= attribute svg:y { coordinate }? -common-draw-name-attlist &= attribute draw:name { \string }? -common-draw-caption-id-attlist &= attribute draw:caption-id { IDREF }? -common-draw-position-attlist = - attribute svg:x { coordinate }?, - attribute svg:y { coordinate }? -common-draw-size-attlist = - attribute svg:width { length }?, - attribute svg:height { length }? -common-draw-transform-attlist = attribute draw:transform { \string }? -common-draw-viewbox-attlist = - attribute svg:viewBox { - list { integer, integer, integer, integer } - } -common-draw-style-name-attlist = - (attribute draw:style-name { styleNameRef }?, - attribute draw:class-names { styleNameRefs }?) - | (attribute presentation:style-name { styleNameRef }?, - attribute presentation:class-names { styleNameRefs }?) -common-draw-text-style-name-attlist = - attribute draw:text-style-name { styleNameRef }? -common-draw-layer-name-attlist = attribute draw:layer { xsd:string }? -common-draw-id-attlist = attribute draw:id { ID }? -common-draw-z-index-attlist = - attribute draw:z-index { nonNegativeInteger }? -common-text-spreadsheet-shape-attlist &= - attribute table:end-cell-address { cellAddress }?, - attribute table:end-x { coordinate }?, - attribute table:end-y { coordinate }? -common-text-spreadsheet-shape-attlist &= - attribute table:table-background { boolean }? -common-text-spreadsheet-shape-attlist &= common-text-anchor-attlist -common-text-anchor-attlist &= - attribute text:anchor-type { - "page" | "frame" | "paragraph" | "char" | "as-char" - }? -common-text-anchor-attlist &= - attribute text:anchor-page-number { positiveInteger }? -draw-text = (text-p | text-list)* -common-draw-shape-with-styles-attlist = - common-draw-z-index-attlist, - common-draw-id-attlist, - common-draw-layer-name-attlist, - common-draw-style-name-attlist, - common-draw-transform-attlist, - common-draw-name-attlist, - common-text-spreadsheet-shape-attlist -common-draw-shape-with-text-and-styles-attlist = - common-draw-shape-with-styles-attlist, - common-draw-text-style-name-attlist -draw-glue-point = - element draw:glue-point { draw-glue-point-attlist, empty } -draw-glue-point-attlist &= attribute draw:id { nonNegativeInteger } -draw-glue-point-attlist &= - attribute svg:x { distance | percent }, - attribute svg:y { distance | percent } -draw-glue-point-attlist &= - attribute draw:align { - "top-left" - | "top" - | "top-right" - | "left" - | "center" - | "right" - | "bottom-left" - | "bottom-right" - }? -draw-glue-points-attlist &= - attribute draw:escape-direction { - "auto" - | "left" - | "right" - | "up" - | "down" - | "horizontal" - | "vertical" - } -svg-title = element svg:title { text } -svg-desc = element svg:desc { text } -draw-frame = - element draw:frame { - common-draw-shape-with-text-and-styles-attlist, - common-draw-position-attlist, - common-draw-rel-size-attlist, - common-draw-caption-id-attlist, - presentation-shape-attlist, - draw-frame-attlist, - (draw-text-box - | draw-image - | draw-object - | draw-object-ole - | draw-applet - | draw-floating-frame - | draw-plugin)*, - office-event-listeners?, - draw-glue-point*, - draw-image-map?, - svg-title?, - svg-desc?, - (draw-contour-polygon | draw-contour-path)? - } -common-draw-rel-size-attlist = - common-draw-size-attlist, - attribute style:rel-width { percent | "scale" | "scale-min" }?, - attribute style:rel-height { percent | "scale" | "scale-min" }? -draw-frame-attlist &= attribute draw:copy-of { \string }? -draw-text-box = - element draw:text-box { draw-text-box-attlist, text-content* } -draw-text-box-attlist &= attribute draw:chain-next-name { \string }? -draw-text-box-attlist &= - attribute draw:corner-radius { nonNegativeLength }? -draw-text-box-attlist &= - attribute fo:min-height { length | percent }?, - attribute fo:min-width { length | percent }? -draw-text-box-attlist &= - attribute fo:max-height { length | percent }?, - attribute fo:max-width { length | percent }? -draw-text-box-attlist &= text-id? -draw-image = - element draw:image { - draw-image-attlist, - (common-draw-data-attlist | office-binary-data), - draw-text - } -common-draw-data-attlist &= - attribute xlink:href { anyURI }, - [ a:defaultValue = "simple" ] attribute xlink:type { "simple" }?, - [ a:defaultValue = "embed" ] attribute xlink:show { "embed" }?, - [ a:defaultValue = "onLoad" ] attribute xlink:actuate { "onLoad" }? -office-binary-data = element office:binary-data { base64Binary } -draw-image-attlist &= attribute draw:filter-name { \string }? -draw-object = - element draw:object { - draw-object-attlist, - (common-draw-data-attlist | office-document | math-math) - } -draw-object-ole = - element draw:object-ole { - draw-object-ole-attlist, - (common-draw-data-attlist | office-binary-data) - } -draw-object-attlist &= - attribute draw:notify-on-update-of-ranges { \string }? -draw-object-ole-attlist &= attribute draw:class-id { text }? -draw-applet = - element draw:applet { - draw-applet-attlist, common-draw-data-attlist?, draw-param* - } -draw-applet-attlist &= attribute draw:code { text }? -draw-applet-attlist &= attribute draw:object { text }? -draw-applet-attlist &= attribute draw:archive { text }? -draw-applet-attlist &= - [ a:defaultValue = "false" ] attribute draw:may-script { boolean }? -draw-plugin = - element draw:plugin { - draw-plugin-attlist, common-draw-data-attlist, draw-param* - } -draw-plugin-attlist &= attribute draw:mime-type { text }? -draw-param = element draw:param { draw-param-attlist, empty } -draw-param-attlist &= attribute draw:name { text }? -draw-param-attlist &= attribute draw:value { text }? -draw-floating-frame = - element draw:floating-frame { - draw-floating-frame-attlist, common-draw-data-attlist - } -draw-floating-frame-attlist &= attribute draw:frame-name { \string }? -draw-contour-polygon = - element draw:contour-polygon { - common-contour-attlist, - common-draw-size-attlist, - common-draw-viewbox-attlist, - common-draw-points-attlist, - empty - } -draw-contour-path = - element draw:contour-path { - common-contour-attlist, - common-draw-size-attlist, - common-draw-viewbox-attlist, - common-draw-path-data-attlist, - empty - } -common-contour-attlist &= attribute draw:recreate-on-edit { boolean } -draw-a = element draw:a { draw-a-attlist, draw-frame } -draw-a-attlist &= - attribute xlink:href { anyURI }, - [ a:defaultValue = "simple" ] attribute xlink:type { "simple" }?, - [ a:defaultValue = "onRequest" ] - attribute xlink:actuate { "onRequest" }? -draw-a-attlist &= - attribute office:target-frame-name { targetFrameName }?, - attribute xlink:show { "new" | "replace" }? -draw-a-attlist &= attribute office:name { \string }? -draw-a-attlist &= attribute office:title { \string }? -draw-a-attlist &= - [ a:defaultValue = "false" ] attribute office:server-map { boolean }? -draw-image-map = - element draw:image-map { - (draw-area-rectangle | draw-area-circle | draw-area-polygon)* - } -draw-area-rectangle = - element draw:area-rectangle { - common-draw-area-attlist, - attribute svg:x { coordinate }, - attribute svg:y { coordinate }, - attribute svg:width { length }, - attribute svg:height { length }, - svg-title?, - svg-desc?, - office-event-listeners? - } -draw-area-circle = - element draw:area-circle { - common-draw-area-attlist, - attribute svg:cx { coordinate }, - attribute svg:cy { coordinate }, - attribute svg:r { length }, - svg-title?, - svg-desc?, - office-event-listeners? - } -draw-area-polygon = - element draw:area-polygon { - common-draw-area-attlist, - attribute svg:x { coordinate }, - attribute svg:y { coordinate }, - attribute svg:width { length }, - attribute svg:height { length }, - common-draw-viewbox-attlist, - common-draw-points-attlist, - svg-title?, - svg-desc?, - office-event-listeners? - } -common-draw-area-attlist &= - attribute xlink:href { anyURI }?, - [ a:defaultValue = "simple" ] attribute xlink:type { "simple" }?, - attribute office:target-frame-name { targetFrameName }?, - attribute xlink:show { "new" | "replace" }? -common-draw-area-attlist &= attribute office:name { \string }? -common-draw-area-attlist &= attribute draw:nohref { "nohref" }? -dr3d-scene = - element dr3d:scene { - dr3d-scene-attlist, - common-draw-position-attlist, - common-draw-size-attlist, - common-draw-style-name-attlist, - common-draw-z-index-attlist, - common-draw-id-attlist, - common-draw-layer-name-attlist, - common-text-spreadsheet-shape-attlist, - common-dr3d-transform-attlist, - common-draw-caption-id-attlist, - svg-title?, - svg-desc?, - dr3d-light*, - shapes3d* - } -shapes3d = - dr3d-scene | dr3d-extrude | dr3d-sphere | dr3d-rotate | dr3d-cube -dr3d-scene-attlist &= - attribute dr3d:vrp { vector3D }?, - attribute dr3d:vpn { vector3D }?, - attribute dr3d:vup { vector3D }? -dr3d-scene-attlist &= - attribute dr3d:projection { "parallel" | "perspective" }? -dr3d-scene-attlist &= attribute dr3d:distance { length }? -dr3d-scene-attlist &= attribute dr3d:focal-length { length }? -dr3d-scene-attlist &= - attribute dr3d:shadow-slant { nonNegativeInteger }? -dr3d-scene-attlist &= - attribute dr3d:shade-mode { "flat" | "phong" | "gouraud" | "draft" }? -dr3d-scene-attlist &= attribute dr3d:ambient-color { color }? -dr3d-scene-attlist &= attribute dr3d:lighting-mode { boolean }? -common-dr3d-transform-attlist = attribute dr3d:transform { text }? -dr3d-light = element dr3d:light { dr3d-light-attlist, empty } -dr3d-light-attlist &= attribute dr3d:diffuse-color { color }? -dr3d-light-attlist &= attribute dr3d:direction { vector3D } -dr3d-light-attlist &= attribute dr3d:enabled { boolean }? -dr3d-light-attlist &= attribute dr3d:specular { boolean }? -dr3d-cube = - element dr3d:cube { - dr3d-cube-attlist, - common-draw-z-index-attlist, - common-draw-id-attlist, - common-draw-layer-name-attlist, - common-draw-style-name-attlist, - common-dr3d-transform-attlist, - empty - } -dr3d-cube-attlist &= - attribute dr3d:min-edge { vector3D }?, - attribute dr3d:max-edge { vector3D }? -dr3d-sphere = - element dr3d:sphere { - dr3d-sphere-attlist, - common-draw-z-index-attlist, - common-draw-id-attlist, - common-draw-layer-name-attlist, - common-draw-style-name-attlist, - common-dr3d-transform-attlist, - empty - } -dr3d-sphere-attlist &= attribute dr3d:center { vector3D }? -dr3d-sphere-attlist &= attribute dr3d:size { vector3D }? -dr3d-extrude = - element dr3d:extrude { - common-draw-path-data-attlist, - common-draw-viewbox-attlist, - common-draw-id-attlist, - common-draw-z-index-attlist, - common-draw-layer-name-attlist, - common-draw-style-name-attlist, - common-dr3d-transform-attlist, - empty - } -dr3d-rotate = - element dr3d:rotate { - common-draw-viewbox-attlist, - common-draw-path-data-attlist, - common-draw-z-index-attlist, - common-draw-id-attlist, - common-draw-layer-name-attlist, - common-draw-style-name-attlist, - common-dr3d-transform-attlist, - empty - } -draw-custom-shape = - element draw:custom-shape { - draw-custom-shape-attlist, - common-draw-position-attlist, - common-draw-size-attlist, - common-draw-shape-with-text-and-styles-attlist, - common-draw-caption-id-attlist, - svg-title?, - svg-desc?, - office-event-listeners?, - draw-glue-point*, - draw-text, - draw-enhanced-geometry? - } -draw-custom-shape-attlist &= attribute draw:engine { namespacedToken }? -draw-custom-shape-attlist &= attribute draw:data { \string }? -draw-enhanced-geometry = - element draw:enhanced-geometry { - draw-enhanced-geometry-attlist, draw-equation*, draw-handle* - } -draw-enhanced-geometry-attlist &= - [ a:defaultValue = "non-primitive" ] - attribute draw:type { custom-shape-type }? -custom-shape-type = "non-primitive" | \string -draw-enhanced-geometry-attlist &= - attribute svg:viewBox { - list { integer, integer, integer, integer } - }? -draw-enhanced-geometry-attlist &= - [ a:defaultValue = "false" ] - attribute draw:mirror-vertical { boolean }?, - [ a:defaultValue = "false" ] - attribute draw:mirror-horizontal { boolean }? -draw-enhanced-geometry-attlist &= - [ a:defaultValue = "0" ] attribute draw:text-rotate-angle { double }? -draw-enhanced-geometry-attlist &= - [ a:defaultValue = "false" ] - attribute draw:extrusion-allowed { boolean }? -draw-enhanced-geometry-attlist &= - [ a:defaultValue = "false" ] - attribute draw:text-path-allowed { boolean }? -draw-enhanced-geometry-attlist &= - [ a:defaultValue = "false" ] - attribute draw:concentric-gradient-fill-allowed { boolean }? -draw-enhanced-geometry-attlist &= - [ a:defaultValue = "false" ] attribute draw:extrusion { boolean }? -draw-enhanced-geometry-attlist &= - [ a:defaultValue = "33%" ] - attribute draw:extrusion-brightness { percent }? -draw-enhanced-geometry-attlist &= - [ a:defaultValue = "36pt 0" ] - attribute draw:extrusion-depth { - list { length, double } - }? -draw-enhanced-geometry-attlist &= - [ a:defaultValue = "0%" ] - attribute draw:extrusion-diffusion { percent }? -draw-enhanced-geometry-attlist &= - [ a:defaultValue = "30" ] - attribute draw:extrusion-number-of-line-segments { integer }? -draw-enhanced-geometry-attlist &= - [ a:defaultValue = "true" ] - attribute draw:extrusion-light-face { boolean }? -draw-enhanced-geometry-attlist &= - [ a:defaultValue = "true" ] - attribute draw:extrusion-first-light-harsh { boolean }? -draw-enhanced-geometry-attlist &= - [ a:defaultValue = "true" ] - attribute draw:extrusion-second-light-harsh { boolean }? -draw-enhanced-geometry-attlist &= - [ a:defaultValue = "66%" ] - attribute draw:extrusion-first-light-level { percent }? -draw-enhanced-geometry-attlist &= - [ a:defaultValue = "66%" ] - attribute draw:extrusion-second-light-level { percent }? -draw-enhanced-geometry-attlist &= - [ a:defaultValue = "(5 0 1)" ] - attribute draw:extrusion-first-light-direction { vector3D }? -draw-enhanced-geometry-attlist &= - [ a:defaultValue = "(-5 0 1)" ] - attribute draw:extrusion-second-light-direction { vector3D }? -draw-enhanced-geometry-attlist &= - [ a:defaultValue = "false" ] - attribute draw:extrusion-metal { boolean }? -draw-enhanced-geometry-attlist &= - [ a:defaultValue = "flat" ] - attribute dr3d:shade-mode { "flat" | "phong" | "gouraud" | "draft" }? -draw-enhanced-geometry-attlist &= - [ a:defaultValue = "0 0" ] - attribute draw:extrusion-rotation-angle { - list { double, double } - }? -draw-enhanced-geometry-attlist &= - attribute draw:extrusion-rotation-center { vector3D }? -draw-enhanced-geometry-attlist &= - [ a:defaultValue = "50%" ] - attribute draw:extrusion-shininess { percent }? -draw-enhanced-geometry-attlist &= - [ a:defaultValue = "50 45" ] - attribute draw:extrusion-skew { - list { double, double } - }? -draw-enhanced-geometry-attlist &= - [ a:defaultValue = "0%" ] - attribute draw:extrusion-specularity { percent }? -draw-enhanced-geometry-attlist &= - [ a:defaultValue = "parallel" ] - attribute dr3d:projection { "parallel" | "perspective" }? -draw-enhanced-geometry-attlist &= - [ a:defaultValue = "3.5cm -3.5cm 25cm" ] - attribute draw:extrusion-viewpoint { point3D }? -point3D = xsd:string -draw-enhanced-geometry-attlist &= - [ a:defaultValue = "0.5 -0.5" ] - attribute draw:extrusion-origin { - list { double, double } - }? -draw-enhanced-geometry-attlist &= - [ a:defaultValue = "false" ] - attribute draw:extrusion-color { boolean }? -draw-enhanced-geometry-attlist &= - attribute draw:enhanced-path { \string }? -draw-enhanced-geometry-attlist &= - [ a:defaultValue = "0" ] - attribute draw:path-stretchpoint-x { double }?, - [ a:defaultValue = "0" ] - attribute draw:path-stretchpoint-y { double }? -draw-enhanced-geometry-attlist &= attribute draw:text-areas { \string }? -draw-enhanced-geometry-attlist &= - attribute draw:glue-points { \string }? -draw-enhanced-geometry-attlist &= - [ a:defaultValue = "none" ] - attribute draw:glue-point-type { "none" | "segments" | "rectangle" }? -draw-enhanced-geometry-attlist &= - attribute draw:glue-point-leaving-directions { text }? -draw-enhanced-geometry-attlist &= - [ a:defaultValue = "false" ] attribute draw:text-path { boolean }? -draw-enhanced-geometry-attlist &= - [ a:defaultValue = "normal" ] - attribute draw:text-path-mode { "normal" | "path" | "shape" }? -draw-enhanced-geometry-attlist &= - [ a:defaultValue = "path" ] - attribute draw:text-path-scale { "path" | "shape" }? -draw-enhanced-geometry-attlist &= - [ a:defaultValue = "false" ] - attribute draw:text-path-same-letter-heights { boolean }? -draw-enhanced-geometry-attlist &= attribute draw:modifiers { \string }? -draw-equation = element draw:equation { draw-equation-attlist, empty } -draw-equation-attlist &= attribute draw:name { \string }? -draw-equation-attlist &= attribute draw:formula { \string }? -draw-handle = element draw:handle { draw-handle-attlist, empty } -draw-handle-attlist &= - [ a:defaultValue = "false" ] - attribute draw:handle-mirror-vertical { boolean }? -draw-handle-attlist &= - [ a:defaultValue = "false" ] - attribute draw:handle-mirror-horizontal { boolean }? -draw-handle-attlist &= - [ a:defaultValue = "false" ] - attribute draw:handle-switched { boolean }? -draw-handle-attlist &= attribute draw:handle-position { \string } -draw-handle-attlist &= - attribute draw:handle-range-x-minimum { \string }? -draw-handle-attlist &= - attribute draw:handle-range-x-maximum { \string }? -draw-handle-attlist &= - attribute draw:handle-range-y-minimum { \string }? -draw-handle-attlist &= - attribute draw:handle-range-y-maximum { \string }? -draw-handle-attlist &= attribute draw:handle-polar { \string }? -draw-handle-attlist &= - attribute draw:handle-radius-range-minimum { \string }? -draw-handle-attlist &= - attribute draw:handle-radius-range-maximum { \string }? -presentation-shape-attlist &= - attribute presentation:class { presentation-classes }? -presentation-classes = - "title" - | "outline" - | "subtitle" - | "text" - | "graphic" - | "object" - | "chart" - | "table" - | "orgchart" - | "page" - | "notes" - | "handout" - | "header" - | "footer" - | "date-time" - | "page-number" -presentation-shape-attlist &= - attribute presentation:placeholder { boolean }? -presentation-shape-attlist &= - attribute presentation:user-transformed { boolean }? -presentation-animations = - element presentation:animations { - (presentation-animation-elements | presentation-animation-group)* - } -presentation-animation-elements = - presentation-show-shape - | presentation-show-text - | presentation-hide-shape - | presentation-hide-text - | presentation-dim - | presentation-play -presentation-sound = - element presentation:sound { - presentation-sound-attlist, - attribute xlink:href { anyURI }, - [ a:defaultValue = "simple" ] attribute xlink:type { "simple" }?, - [ a:defaultValue = "onRequest" ] - attribute xlink:actuate { "onRequest" }?, - attribute xlink:show { "new" | "replace" }?, - empty - } -presentation-sound-attlist &= - attribute presentation:play-full { boolean }? -presentation-show-shape = - element presentation:show-shape { - common-presentation-effect-attlist, presentation-sound? - } -common-presentation-effect-attlist &= attribute draw:shape-id { IDREF } -common-presentation-effect-attlist &= - [ a:defaultValue = "none" ] - attribute presentation:effect { presentationEffects }? -presentationEffects = - "none" - | "fade" - | "move" - | "stripes" - | "open" - | "close" - | "dissolve" - | "wavyline" - | "random" - | "lines" - | "laser" - | "appear" - | "hide" - | "move-short" - | "checkerboard" - | "rotate" - | "stretch" -common-presentation-effect-attlist &= - [ a:defaultValue = "none" ] - attribute presentation:direction { presentationEffectDirections }? -presentationEffectDirections = - "none" - | "from-left" - | "from-top" - | "from-right" - | "from-bottom" - | "from-center" - | "from-upper-left" - | "from-upper-right" - | "from-lower-left" - | "from-lower-right" - | "to-left" - | "to-top" - | "to-right" - | "to-bottom" - | "to-upper-left" - | "to-upper-right" - | "to-lower-right" - | "to-lower-left" - | "path" - | "spiral-inward-left" - | "spiral-inward-right" - | "spiral-outward-left" - | "spiral-outward-right" - | "vertical" - | "horizontal" - | "to-center" - | "clockwise" - | "counter-clockwise" -common-presentation-effect-attlist &= - [ a:defaultValue = "medium" ] - attribute presentation:speed { presentationSpeeds }? -presentationSpeeds = "slow" | "medium" | "fast" -common-presentation-effect-attlist &= - attribute presentation:delay { duration }? -common-presentation-effect-attlist &= - [ a:defaultValue = "100%" ] - attribute presentation:start-scale { percent }? -common-presentation-effect-attlist &= - attribute presentation:path-id { text }? -presentation-show-text = - element presentation:show-text { - common-presentation-effect-attlist, presentation-sound? - } -presentation-hide-shape = - element presentation:hide-shape { - common-presentation-effect-attlist, presentation-sound? - } -presentation-hide-text = - element presentation:hide-text { - common-presentation-effect-attlist, presentation-sound? - } -presentation-dim = - element presentation:dim { - presentation-dim-attlist, presentation-sound? - } -presentation-dim-attlist &= attribute draw:shape-id { IDREF } -presentation-dim-attlist &= attribute draw:color { color } -presentation-play = - element presentation:play { presentation-play-attlist, empty } -presentation-play-attlist &= - attribute draw:shape-id { IDREF }, - [ a:defaultValue = "medium" ] - attribute presentation:speed { presentationSpeeds }? -presentation-animation-group = - element presentation:animation-group { - presentation-animation-elements* - } -common-anim-attlist &= - [ a:defaultValue = "default" ] - attribute presentation:node-type { - "default" - | "on-click" - | "with-previous" - | "after-previous" - | "timing-root" - | "main-sequence" - | "interactive-sequence" - }? -common-anim-attlist &= attribute presentation:preset-id { \string }? -common-anim-attlist &= - attribute presentation:preset-sub-type { \string }? -common-anim-attlist &= - [ a:defaultValue = "custom" ] - attribute presentation:preset-class { - "custom" - | "entrance" - | "exit" - | "emphasis" - | "motion-path" - | "ole-action" - | "media-call" - }? -common-anim-attlist &= attribute presentation:master-element { IDREF }? -common-anim-attlist &= attribute presentation:group-id { \string }? -presentation-event-listener = - element presentation:event-listener { - presentation-event-listener-attlist, presentation-sound? - } -presentation-event-listener-attlist &= - attribute script:event-name { \string } -presentation-event-listener-attlist &= - attribute presentation:action { - "none" - | "previous-page" - | "next-page" - | "first-page" - | "last-page" - | "hide" - | "stop" - | "execute" - | "show" - | "verb" - | "fade-out" - | "sound" - } -presentation-event-listener-attlist &= - [ a:defaultValue = "none" ] - attribute presentation:effect { presentationEffects }? -presentation-event-listener-attlist &= - [ a:defaultValue = "none" ] - attribute presentation:direction { presentationEffectDirections }? -presentation-event-listener-attlist &= - [ a:defaultValue = "medium" ] - attribute presentation:speed { presentationSpeeds }? -presentation-event-listener-attlist &= - [ a:defaultValue = "100%" ] - attribute presentation:start-scale { percent }? -presentation-event-listener-attlist &= - attribute xlink:href { anyURI }?, - [ a:defaultValue = "simple" ] attribute xlink:type { "simple" }?, - [ a:defaultValue = "embed" ] attribute xlink:show { "embed" }?, - [ a:defaultValue = "onRequest" ] - attribute xlink:actuate { "onRequest" }? -presentation-event-listener-attlist &= - attribute presentation:verb { nonNegativeInteger }? -paragraph-content |= element presentation:header { empty } -paragraph-content |= element presentation:footer { empty } -paragraph-content |= element presentation:date-time { empty } -presentation-decls = presentation-decl* -presentation-decl |= - element presentation:header-decl { - presentation-header-decl-attlist, text - } -presentation-header-decl-attlist &= - attribute presentation:name { \string } -presentation-decl |= - element presentation:footer-decl { - presentation-footer-decl-attlist, text - } -presentation-footer-decl-attlist &= - attribute presentation:name { \string } -presentation-decl |= - element presentation:date-time-decl { - presentation-date-time-decl-attlist, text - } -presentation-date-time-decl-attlist &= - attribute presentation:name { \string } -presentation-date-time-decl-attlist &= - attribute presentation:source { "fixed" | "current-date" } -presentation-date-time-decl-attlist &= - attribute style:data-style-name { styleNameRef }? -presentation-settings = - element presentation:settings { - presentation-settings-attlist, presentation-show* - }? -presentation-settings-attlist &= - attribute presentation:start-page { \string }? -presentation-settings-attlist &= - attribute presentation:show { \string }? -presentation-settings-attlist &= - [ a:defaultValue = "true" ] - attribute presentation:full-screen { boolean }? -presentation-settings-attlist &= - [ a:defaultValue = "false" ] - attribute presentation:endless { boolean }? -presentation-settings-attlist &= - attribute presentation:pause { duration }? -presentation-settings-attlist &= - [ a:defaultValue = "false" ] - attribute presentation:show-logo { boolean }? -presentation-settings-attlist &= - [ a:defaultValue = "false" ] - attribute presentation:force-manual { boolean }? -presentation-settings-attlist &= - [ a:defaultValue = "true" ] - attribute presentation:mouse-visible { boolean }? -presentation-settings-attlist &= - [ a:defaultValue = "false" ] - attribute presentation:mouse-as-pen { boolean }? -presentation-settings-attlist &= - [ a:defaultValue = "false" ] - attribute presentation:start-with-navigator { boolean }? -presentation-settings-attlist &= - [ a:defaultValue = "enabled" ] - attribute presentation:animations { "enabled" | "disabled" }? -presentation-settings-attlist &= - [ a:defaultValue = "enabled" ] - attribute presentation:transition-on-click { "enabled" | "disabled" }? -presentation-settings-attlist &= - [ a:defaultValue = "false" ] - attribute presentation:stay-on-top { boolean }? -presentation-settings-attlist &= - [ a:defaultValue = "true" ] - attribute presentation:show-end-of-presentation-slide { boolean }? -presentation-show = - element presentation:show { presentation-show-attlist, empty } -presentation-show-attlist &= attribute presentation:name { \string } -presentation-show-attlist &= attribute presentation:pages { text } -chart-chart = - element chart:chart { - chart-chart-attlist, - chart-title?, - chart-subtitle?, - chart-footer?, - chart-legend?, - chart-plot-area, - table-table? - } -chart-chart-attlist &= attribute chart:class { namespacedToken } -chart-chart-attlist &= common-draw-size-attlist -chart-chart-attlist &= attribute chart:column-mapping { \string }? -chart-chart-attlist &= attribute chart:row-mapping { \string }? -chart-chart-attlist &= attribute chart:style-name { styleNameRef }? -chart-title = element chart:title { chart-title-attlist, text-p? } -chart-title-attlist &= attribute table:cell-range { cellAddress }? -chart-title-attlist &= common-draw-position-attlist -chart-title-attlist &= attribute chart:style-name { styleNameRef }? -chart-subtitle = element chart:subtitle { chart-title-attlist, text-p? } -chart-footer = element chart:footer { chart-title-attlist, text-p? } -chart-legend = element chart:legend { chart-legend-attlist, empty } -chart-legend-attlist &= - (attribute chart:legend-position { - "start" | "end" | "top" | "bottom" - }, - attribute chart:legend-align { "start" | "center" | "end" }?) - | attribute chart:legend-position { - "top-start" | "bottom-start" | "top-end" | "bottom-end" - } - | empty -chart-legend-attlist &= common-draw-position-attlist -chart-legend-attlist &= - attribute style:legend-expansion { "wide" | "high" | "balanced" } - | (attribute style:legend-expansion { "custom" }, - attribute style:legend-expansion-aspect-ratio { double }) - | empty -chart-legend-attlist &= attribute chart:style-name { styleNameRef }? -chart-plot-area = - element chart:plot-area { - chart-plot-area-attlist, - dr3d-light*, - chart-axis*, - chart-series*, - chart-stock-gain-marker?, - chart-stock-loss-marker?, - chart-stock-range-line?, - chart-wall?, - chart-floor? - } -chart-plot-area-attlist &= - common-draw-position-attlist, common-draw-size-attlist -chart-plot-area-attlist &= attribute chart:style-name { styleNameRef }? -chart-plot-area-attlist &= - attribute table:cell-range-address { cellRangeAddress }? -chart-plot-area-attlist &= - [ a:defaultValue = "none" ] - attribute chart:data-source-has-labels { - "none" | "row" | "column" | "both" - }? -chart-plot-area-attlist &= - dr3d-scene-attlist, common-dr3d-transform-attlist -chart-wall = element chart:wall { chart-wall-attlist, empty } -chart-wall-attlist &= attribute svg:width { length }? -chart-wall-attlist &= attribute chart:style-name { styleNameRef }? -chart-floor = element chart:floor { chart-floor-attlist, empty } -chart-floor-attlist &= attribute svg:width { length }? -chart-floor-attlist &= attribute chart:style-name { styleNameRef }? -chart-axis = - element chart:axis { - chart-axis-attlist, chart-title?, chart-categories?, chart-grid* - } -chart-axis-attlist &= attribute chart:dimension { "x" | "y" | "z" } -chart-axis-attlist &= attribute chart:name { \string }? -chart-axis-attlist &= attribute chart:style-name { styleNameRef }? -chart-grid = element chart:grid { chart-grid-attlist } -chart-grid-attlist &= - [ a:defaultValue = "major" ] - attribute chart:class { "major" | "minor" }? -chart-grid-attlist &= attribute chart:style-name { styleNameRef }? -chart-series = - element chart:series { - chart-series-attlist, - chart-domain*, - chart-mean-value?, - chart-regression-curve?, - chart-error-indicator?, - chart-data-point* - } -chart-series-attlist &= - attribute chart:values-cell-range-address { cellRangeAddress }? -chart-series-attlist &= - attribute chart:label-cell-address { cellAddress }? -chart-series-attlist &= attribute chart:class { namespacedToken }? -chart-series-attlist &= attribute chart:attached-axis { \string }? -chart-series-attlist &= attribute chart:style-name { styleNameRef }? -chart-domain = - element chart:domain { - attribute table:cell-range-address { cellRangeAddress }? - } -chart-categories = - element chart:categories { - attribute table:cell-range-address { cellRangeAddress }? - } -chart-data-point = - element chart:data-point { chart-data-point-attlist, empty } -chart-data-point-attlist &= - attribute chart:repeated { nonNegativeInteger }? -chart-data-point-attlist &= attribute chart:style-name { styleNameRef }? -chart-mean-value = - element chart:mean-value { chart-mean-value-attlist, empty } -chart-mean-value-attlist &= attribute chart:style-name { styleNameRef }? -chart-error-indicator = - element chart:error-indicator { chart-error-indicator-attlist, empty } -chart-error-indicator-attlist &= - attribute chart:style-name { styleNameRef }? -chart-regression-curve = - element chart:regression-curve { - chart-regression-curve-attlist, empty - } -chart-regression-curve-attlist &= - attribute chart:style-name { styleNameRef }? -chart-stock-gain-marker = - element chart:stock-gain-marker { common-stock-marker-attlist } -chart-stock-loss-marker = - element chart:stock-loss-marker { common-stock-marker-attlist } -chart-stock-range-line = - element chart:stock-range-line { common-stock-marker-attlist } -common-stock-marker-attlist = - attribute chart:style-name { styleNameRef }? -office-forms = - element office:forms { - office-forms-attlist, (form-form | xforms-model)* - }? -office-forms-attlist &= - [ a:defaultValue = "false" ] - attribute form:automatic-focus { boolean }? -office-forms-attlist &= - [ a:defaultValue = "true" ] - attribute form:apply-design-mode { boolean }? -form-form = - element form:form { - common-form-control-attlist, - form-form-attlist, - form-properties?, - office-event-listeners?, - (controls | form-form)*, - form-connection-resource? - } -form-form-attlist &= - (attribute xlink:href { anyURI }, - [ a:defaultValue = "simple" ] attribute xlink:type { "simple" }?, - [ a:defaultValue = "onRequest" ] - attribute xlink:actuate { "onRequest" }?)? -form-form-attlist &= - [ a:defaultValue = "_blank" ] - attribute office:target-frame { targetFrameName }? -form-form-attlist &= - [ a:defaultValue = "get" ] - attribute form:method { "get" | "post" | \string }? -form-form-attlist &= - [ a:defaultValue = "application/x-www-form-urlencoded" ] - attribute form:enctype { \string }? -form-form-attlist &= - [ a:defaultValue = "true" ] attribute form:allow-deletes { boolean }? -form-form-attlist &= - [ a:defaultValue = "true" ] attribute form:allow-inserts { boolean }? -form-form-attlist &= - [ a:defaultValue = "true" ] attribute form:allow-updates { boolean }? -form-form-attlist &= - [ a:defaultValue = "false" ] attribute form:apply-filter { boolean }? -form-form-attlist &= - [ a:defaultValue = "command" ] - attribute form:command-type { "table" | "query" | "command" }? -form-form-attlist &= attribute form:command { text }? -form-form-attlist &= attribute form:datasource { anyURI | \string }? -form-form-attlist &= attribute form:master-fields { \string }? -form-form-attlist &= attribute form:detail-fields { \string }? -form-form-attlist &= - [ a:defaultValue = "true" ] - attribute form:escape-processing { boolean }? -form-form-attlist &= attribute form:filter { \string }? -form-form-attlist &= - [ a:defaultValue = "false" ] attribute form:ignore-result { boolean }? -form-form-attlist &= attribute form:navigation-mode { navigation }? -navigation = "none" | "current" | "parent" -form-form-attlist &= attribute form:order { \string }? -form-form-attlist &= attribute form:tab-cycle { tab-cycles }? -tab-cycles = "records" | "current" | "page" -form-connection-resource = - element form:connection-resource { - attribute xlink:href { anyURI }, - empty - } -xforms-model = element xforms:model { anyAttListOrElements } -column-controls |= - element form:text { form-text-attlist, common-form-control-content } -controls |= column-controls -form-text-attlist = - form-control-attlist, - common-current-value-attlist, - common-disabled-attlist, - common-maxlength-attlist, - common-printable-attlist, - common-readonly-attlist, - common-tab-attlist, - common-title-attlist, - common-value-attlist, - common-convert-empty-attlist, - common-data-field-attlist -form-control-attlist = - common-form-control-attlist, - common-control-id-attlist, - xforms-bind-attlist -common-form-control-content = form-properties?, office-event-listeners? -column-controls |= - element form:textarea { - form-textarea-attlist, common-form-control-content, text-p* - } -form-textarea-attlist = - form-control-attlist, - common-current-value-attlist, - common-disabled-attlist, - common-maxlength-attlist, - common-printable-attlist, - common-readonly-attlist, - common-tab-attlist, - common-title-attlist, - common-value-attlist, - common-convert-empty-attlist, - common-data-field-attlist -controls |= - element form:password { - form-password-attlist, common-form-control-content - } -form-password-attlist &= - form-control-attlist, - common-disabled-attlist, - common-maxlength-attlist, - common-printable-attlist, - common-tab-attlist, - common-title-attlist, - common-value-attlist, - common-convert-empty-attlist -form-password-attlist &= - [ a:defaultValue = "*" ] attribute form:echo-char { character }? -controls |= - element form:file { form-file-attlist, common-form-control-content } -form-file-attlist &= - form-control-attlist, - common-current-value-attlist, - common-disabled-attlist, - common-maxlength-attlist, - common-printable-attlist, - common-readonly-attlist, - common-tab-attlist, - common-title-attlist, - common-value-attlist -column-controls |= - element form:formatted-text { - form-formatted-text-attlist, common-form-control-content - } -form-formatted-text-attlist &= - form-control-attlist, - common-current-value-attlist, - common-disabled-attlist, - common-maxlength-attlist, - common-printable-attlist, - common-readonly-attlist, - common-tab-attlist, - common-title-attlist, - common-value-attlist, - common-convert-empty-attlist, - common-data-field-attlist -form-formatted-text-attlist &= attribute form:max-value { \string }? -form-formatted-text-attlist &= attribute form:min-value { \string }? -form-formatted-text-attlist &= - [ a:defaultValue = "false" ] attribute form:validation { boolean }? -column-controls |= - element form:number { - form-number-attlist, - common-numeric-control-attlist, - common-form-control-content - } -common-numeric-control-attlist = - form-control-attlist, - common-disabled-attlist, - common-maxlength-attlist, - common-printable-attlist, - common-readonly-attlist, - common-tab-attlist, - common-title-attlist, - common-convert-empty-attlist, - common-data-field-attlist -form-number-attlist &= attribute form:value { double }? -form-number-attlist &= attribute form:current-value { double }? -form-number-attlist &= attribute form:min-value { double }? -form-number-attlist &= attribute form:max-value { double }? -column-controls |= - element form:date { - form-date-attlist, - common-numeric-control-attlist, - common-form-control-content - } -controls |= - element form:time { - form-time-attlist, - common-numeric-control-attlist, - common-form-control-content - } -form-date-attlist &= attribute form:value { date }? -form-time-attlist &= attribute form:value { time }? -form-date-attlist &= attribute form:current-value { date }? -form-time-attlist &= attribute form:current-value { time }? -form-date-attlist &= attribute form:min-value { date }? -form-time-attlist &= attribute form:min-value { time }? -form-date-attlist &= attribute form:max-value { date }? -form-time-attlist &= attribute form:max-value { time }? -controls |= - element form:fixed-text { - form-fixed-text-attlist, common-form-control-content - } -form-fixed-text-attlist &= - form-control-attlist, - for, - common-disabled-attlist, - label, - common-printable-attlist, - common-title-attlist -form-fixed-text-attlist &= - [ a:defaultValue = "false" ] attribute form:multi-line { boolean }? -column-controls |= - element form:combobox { - form-combobox-attlist, common-form-control-content, form-item* - } -form-combobox-attlist &= - form-control-attlist, - common-current-value-attlist, - common-disabled-attlist, - dropdown, - common-maxlength-attlist, - common-printable-attlist, - common-readonly-attlist, - size, - common-tab-attlist, - common-title-attlist, - common-value-attlist, - common-convert-empty-attlist, - common-data-field-attlist, - list-source, - list-source-type -form-combobox-attlist &= attribute form:auto-complete { boolean }? -form-item = element form:item { form-item-attlist, text } -form-item-attlist &= label -column-controls |= - element form:listbox { - form-listbox-attlist, common-form-control-content, form-option* - } -form-listbox-attlist &= - form-control-attlist, - common-disabled-attlist, - dropdown, - common-printable-attlist, - size, - common-tab-attlist, - common-title-attlist, - bound-column, - common-data-field-attlist, - list-source, - list-source-type -form-listbox-attlist &= - [ a:defaultValue = "false" ] attribute form:multiple { boolean }? -form-listbox-attlist &= attribute form:xforms-list-source { \string }? -form-option = element form:option { form-option-attlist, text } -form-option-attlist &= - current-selected, selected, label, common-value-attlist -controls |= - element form:button { - form-button-attlist, common-form-control-content - } -form-button-attlist &= - form-control-attlist, - button-type, - common-disabled-attlist, - label, - image-data, - common-printable-attlist, - common-tab-attlist, - target-frame, - target-location, - common-title-attlist, - common-value-attlist, - common-form-relative-image-position-attlist -form-button-attlist &= - [ a:defaultValue = "false" ] - attribute form:default-button { boolean }? -form-button-attlist &= - [ a:default-value = "false" ] attribute form:toggle { boolean }? -form-button-attlist &= attribute form:focus-on-click { boolean }? -form-button-attlist &= attribute form:xforms-submission { \string }? -controls |= - element form:image { form-image-attlist, common-form-control-content } -form-image-attlist &= - form-control-attlist, - button-type, - common-disabled-attlist, - image-data, - common-printable-attlist, - common-tab-attlist, - target-frame, - target-location, - common-title-attlist, - common-value-attlist -column-controls |= - element form:checkbox { - form-checkbox-attlist, common-form-control-content - } -form-checkbox-attlist &= - form-control-attlist, - common-disabled-attlist, - label, - common-printable-attlist, - common-tab-attlist, - common-title-attlist, - common-value-attlist, - common-data-field-attlist, - common-form-visual-effect-attlist, - common-form-relative-image-position-attlist -states = "unchecked" | "checked" | "unknown" -form-checkbox-attlist &= attribute form:current-state { states }? -form-checkbox-attlist &= - [ a:defaultValue = "false" ] attribute form:is-tristate { boolean }? -form-checkbox-attlist &= - [ a:defaultValue = "unchecked" ] attribute form:state { states }? -controls |= - element form:radio { form-radio-attlist, common-form-control-content } -form-radio-attlist &= - form-control-attlist, - current-selected, - common-disabled-attlist, - label, - common-printable-attlist, - selected, - common-tab-attlist, - common-title-attlist, - common-value-attlist, - common-data-field-attlist, - common-form-visual-effect-attlist, - common-form-relative-image-position-attlist -controls |= - element form:frame { form-frame-attlist, common-form-control-content } -form-frame-attlist &= - form-control-attlist, - common-disabled-attlist, - for, - label, - common-printable-attlist, - common-title-attlist -controls |= - element form:image-frame { - form-image-frame-attlist, common-form-control-content - } -form-image-frame-attlist &= - form-control-attlist, - common-disabled-attlist, - image-data, - common-printable-attlist, - common-readonly-attlist, - common-title-attlist, - common-data-field-attlist -controls |= - element form:hidden { - form-hidden-attlist, common-form-control-content - } -form-hidden-attlist &= form-control-attlist, common-value-attlist -controls |= - element form:grid { - form-grid-attlist, common-form-control-content, form-column* - } -form-grid-attlist &= - form-control-attlist, - common-disabled-attlist, - common-printable-attlist, - common-tab-attlist, - common-title-attlist -form-column = - element form:column { form-column-attlist, column-controls+ } -form-column-attlist &= - common-form-control-attlist, label, text-style-name -text-style-name = attribute form:text-style-name { styleNameRef }? -controls |= - element form:value-range { - form-value-range-attlist, common-form-control-content - } -form-value-range-attlist &= - form-control-attlist, - common-disabled-attlist, - common-printable-attlist, - common-tab-attlist, - common-title-attlist, - common-value-attlist -form-value-range-attlist &= attribute form:max-value { \string }? -form-value-range-attlist &= attribute form:min-value { \string }? -form-value-range-attlist &= - [ a:defaultName = "1" ] attribute form:step-size { positiveInteger }? -form-value-range-attlist &= - attribute form:page-step-size { positiveInteger }? -form-value-range-attlist &= - attribute form:delay-for-repeat { duration }? -form-value-range-attlist &= - attribute form:orientation { "horizontal" | "vertical" }? -controls |= - element form:generic-control { - form-generic-control-attlist, common-form-control-content - } -form-generic-control-attlist &= form-control-attlist -common-form-control-attlist &= attribute form:name { \string }? -common-form-control-attlist &= - attribute form:control-implementation { namespacedToken }? -xforms-bind-attlist = attribute xforms:bind { \string }? -types = "submit" | "reset" | "push" | "url" -button-type = - [ a:defaultValue = "push" ] attribute form:button-type { types }? -common-control-id-attlist = attribute form:id { ID } -current-selected = - [ a:defaultValue = "false" ] - attribute form:current-selected { boolean }? -common-value-attlist = attribute form:value { \string }? -common-current-value-attlist = attribute form:current-value { \string }? -common-disabled-attlist = - [ a:defaultValue = "false" ] attribute form:disabled { boolean }? -dropdown = - [ a:defaultValue = "false" ] attribute form:dropdown { boolean }? -for = attribute form:for { \string }? -image-data = attribute form:image-data { anyURI }? -label = attribute form:label { \string }? -common-maxlength-attlist = - attribute form:max-length { nonNegativeInteger }? -common-printable-attlist = - [ a:defaultValue = "true" ] attribute form:printable { boolean }? -common-readonly-attlist = - [ a:defaultValue = "false" ] attribute form:readonly { boolean }? -selected = - [ a:defaultValue = "false" ] attribute form:selected { boolean }? -size = attribute form:size { nonNegativeInteger }? -common-tab-attlist &= - [ a:defaultValue = "0" ] - attribute form:tab-index { nonNegativeInteger }? -common-tab-attlist &= - [ a:defaultValue = "true" ] attribute form:tab-stop { boolean }? -target-frame = - [ a:defaultValue = "_blank" ] - attribute office:target-frame { targetFrameName }? -target-location = attribute xlink:href { anyURI }? -common-title-attlist = attribute form:title { text }? -common-form-visual-effect-attlist &= - attribute form:visual-effect { "flat" | "3d" }? -common-form-relative-image-position-attlist &= - [ a:defaultValue = "center" ] - attribute form:image-position { "center" }? - | (attribute form:image-position { - "start" | "end" | "top" | "bottom" - }, - [ a:defaultValue = "center" ] - attribute form:image-align { "start" | "center" | "end" }?) -bound-column = attribute form:bound-column { \string }? -common-convert-empty-attlist = - [ a:defaultValue = "false" ] - attribute form:convert-empty-to-null { boolean }? -common-data-field-attlist = attribute form:data-field { \string }? -list-source = attribute form:list-source { \string }? -list-source-type = - attribute form:list-source-type { - "table" - | "query" - | "sql" - | "sql-pass-through" - | "value-list" - | "table-fields" - }? -form-properties = element form:properties { form-property+ } -form-property |= - element form:property { - form-property-name, form-property-value-and-type-attlist - } -form-property-name &= attribute form:property-name { \string } -form-property-value-and-type-attlist &= - common-value-and-type-attlist - | attribute office:value-type { "void" } -form-property |= - element form:list-property { - form-property-name, form-property-type-and-value-list - } -form-property-type-and-value-list = - (attribute office:value-type { "float" }, - element form:list-value { - attribute office:value { double } - }*) - | (attribute office:value-type { "percentage" }, - element form:list-value { - attribute office:value { double } - }*) - | (attribute office:value-type { "currency" }, - element form:list-value { - attribute office:value { double }, - attribute office:currency { \string }? - }*) - | (attribute office:value-type { "date" }, - element form:list-value { - attribute office:date-value { dateOrDateTime } - }*) - | (attribute office:value-type { "time" }, - element form:list-value { - attribute office:time-value { duration } - }*) - | (attribute office:value-type { "boolean" }, - element form:list-value { - attribute office:boolean-value { boolean } - }*) - | (attribute office:value-type { "string" }, - element form:list-value { - attribute office:string-value { \string } - }*) - | attribute office:value-type { "void" } -office-annotation = - element office:annotation { - office-annotation-attlist, - draw-caption-attlist, - common-draw-position-attlist, - common-draw-size-attlist, - common-draw-shape-with-text-and-styles-attlist, - dc-creator?, - dc-date?, - meta-date-string?, - (text-p | text-list)* - } -office-annotation-attlist &= attribute office:display { boolean }? -meta-date-string = element meta:date-string { \string } -common-num-format-prefix-suffix-attlist &= - attribute style:num-prefix { \string }?, - attribute style:num-suffix { \string }? -common-num-format-attlist &= - attribute style:num-format { "1" | "i" | "I" | \string | empty } - | (attribute style:num-format { "a" | "A" }, - style-num-letter-sync-attlist) - | empty -style-num-letter-sync-attlist &= - attribute style:num-letter-sync { boolean }? -office-change-info = - element office:change-info { dc-creator, dc-date, text-p* } -office-event-listeners = - element office:event-listeners { - (script-event-listener | presentation-event-listener)* - } -script-event-listener &= - element script:event-listener { script-event-listener-attlist, empty } -script-event-listener-attlist &= attribute script:event-name { \string } -script-event-listener-attlist &= attribute script:language { \string } -script-event-listener-attlist &= - attribute script:macro-name { \string } - | (attribute xlink:href { anyURI }, - [ a:defaultValue = "simple" ] attribute xlink:type { "simple" }?, - [ a:defaultValue = "onRequest" ] - attribute xlink:actuate { "onRequest" }?) -math-math = element math:math { mathMarkup } -# To avoid inclusion of the complete MathML schema, anything - -# is allowed within a math:math top-level element -mathMarkup = - (attribute * { text } - | text - | element * { mathMarkup })* -text-dde-connection-decl = - element text:dde-connection-decl { - text-dde-connection-decl-attlist, common-dde-connection-decl-attlist - } -text-dde-connection-decl-attlist &= attribute office:name { \string } -common-dde-connection-decl-attlist &= - attribute office:dde-application { \string } -common-dde-connection-decl-attlist &= - attribute office:dde-topic { \string } -common-dde-connection-decl-attlist &= - attribute office:dde-item { \string } -common-dde-connection-decl-attlist &= - [ a:defaultValue = "true" ] - attribute office:automatic-update { boolean }? -table-dde-link = - element table:dde-link { office-dde-source, table-table } -office-dde-source = - element office:dde-source { - office-dde-source-attlist, common-dde-connection-decl-attlist - } -office-dde-source-attlist &= attribute office:name { \string }? -office-dde-source-attlist &= - [ a:defaultValue = "into-default-style-data-style" ] - attribute office:conversion-mode { - "into-default-style-data-style" - | "into-english-number" - | "keep-text" - }? -animation-element |= - element anim:animate { - common-anim-target-attlist, - common-anim-named-target-attlist, - common-anim-values-attlist, - common-anim-spline-mode-attlist, - common-spline-anim-value-attlist, - common-timing-attlist, - common-anim-add-accum-attlist - } -animation-element |= - element anim:set { - common-anim-target-attlist, - common-anim-named-target-attlist, - common-anim-set-values-attlist, - common-timing-attlist, - common-anim-add-accum-attlist - } -animation-element |= - element anim:animateMotion { - anim-animate-motion-attlist, - common-anim-target-attlist, - common-anim-named-target-attlist, - common-anim-add-accum-attlist, - common-anim-values-attlist, - common-timing-attlist, - common-spline-anim-value-attlist - } -anim-animate-motion-attlist &= attribute svg:path { pathData }? -anim-animate-motion-attlist &= attribute svg:origin { \string }? -anim-animate-motion-attlist &= - [ a:defaultValue = "paced" ] - attribute smil:calcMode { - "discrete" | "linear" | "paced" | "spline" - }? -animation-element |= - element anim:animateColor { - common-anim-target-attlist, - common-anim-named-target-attlist, - common-anim-add-accum-attlist, - common-anim-values-attlist, - common-anim-spline-mode-attlist, - common-spline-anim-value-attlist, - anim-animate-color-attlist, - common-timing-attlist - } -anim-animate-color-attlist &= - [ a:defaultValue = "rgb" ] - attribute anim:color-interpolation { "rgb" | "hsl" }? -anim-animate-color-attlist &= - [ a:defaultValue = "clockwise" ] - attribute anim:color-interpolation-direction { - "clockwise" | "counter-clockwise" - }? -animation-element |= - element anim:animateTransform { - common-anim-target-attlist, - common-anim-named-target-attlist, - common-anim-add-accum-attlist, - common-anim-values-attlist, - anim-animate-transform-attlist, - common-timing-attlist - } -anim-animate-transform-attlist &= - attribute svg:type { - "translate" | "scale" | "rotate" | "skewX" | "skewY" - } -animation-element |= - element anim:transitionFilter { - common-anim-target-attlist, - common-anim-add-accum-attlist, - common-anim-values-attlist, - common-anim-spline-mode-attlist, - anim-transition-filter-attlist, - common-timing-attlist - } -anim-transition-filter-attlist &= attribute smil:type { \string } -anim-transition-filter-attlist &= attribute smil:subtype { \string }? -anim-transition-filter-attlist &= - [ a:defaultValue = "forward" ] - attribute smil:direction { "forward" | "reverse" }? -anim-transition-filter-attlist &= - attribute smil:fadeColor { "forward" | "reverse" }? -anim-transition-filter-attlist &= - [ a:defaultValue = "in" ] attribute smil:mode { "in" | "out" }? -common-anim-attlist &= attribute anim:id { ID }? -common-anim-target-attlist &= attribute smil:targetElement { IDREF }? -common-anim-named-target-attlist &= - attribute smil:attributeName { \string } -common-anim-target-attlist &= attribute anim:sub-item { \string }? -common-anim-values-attlist &= attribute smil:values { \string }? -common-anim-spline-mode-attlist &= - [ a:defaultValue = "discrete" ] - attribute smil:calcMode { - "discrete" | "linear" | "paced" | "spline" - }? -common-spline-anim-value-attlist &= attribute smil:keyTimes { \string }? -common-spline-anim-value-attlist &= - attribute smil:keySplines { \string }? -common-anim-add-accum-attlist &= - attribute smil:accumulate { "none" | "sum" }? -common-anim-add-accum-attlist &= - attribute smil:additive { "replace" | "sum" }? -common-anim-values-attlist &= attribute anim:formula { \string }? -common-anim-set-values-attlist &= attribute smil:to { \string }? -common-anim-values-attlist &= - common-anim-set-values-attlist, - attribute smil:from { \string }?, - attribute smil:by { \string }? -common-begin-end-timing-attlist &= attribute smil:begin { \string }? -common-begin-end-timing-attlist &= attribute smil:end { \string }? -common-dur-timing-attlist &= attribute smil:dur { \string }? -common-endsync-timing-attlist &= - attribute smil:endsync { "first" | "last" | "all" | "media" }? -common-repeat-timing-attlist &= - attribute smil:repeatDur { \string }?, - attribute smil:repeatCount { nonNegativeInteger | "indefinite" }? -common-fill-timing-attlist &= - attribute smil:fill { - "remove" | "freeze" | "hold" | "auto" | "default" | "transition" - }? -common-fill-default-attlist &= - attribute smil:fillDefault { - "remove" | "freeze" | "hold" | "transition" | "auto" | "inherit" - }? -common-restart-timing-attlist &= - [ a:defaultValue = "default" ] - attribute smil:restart { - "never" | "always" | "whenNotActive" | "default" - }? -common-restart-default-attlist &= - [ a:defaultValue = "inherit" ] - attribute smil:restartDefault { - "never" | "always" | "whenNotActive" | "inherit" - }? -common-time-manip-attlist &= - [ a:defaultValue = "0.0" ] attribute smil:accelerate { double }? -common-time-manip-attlist &= - [ a:defaultValue = "0.0" ] attribute smil:decelerate { double }? -common-time-manip-attlist &= - [ a:defaultValue = "false" ] attribute smil:autoReverse { boolean }? -animation-element |= - element anim:par { - common-anim-attlist, - common-timing-attlist, - common-endsync-timing-attlist, - animation-element* - } -common-basic-timing-attlist &= - common-begin-end-timing-attlist, - common-dur-timing-attlist, - common-repeat-timing-attlist -common-timing-attlist &= - common-basic-timing-attlist, - common-restart-timing-attlist, - common-restart-default-attlist, - common-fill-timing-attlist, - common-fill-default-attlist, - common-time-manip-attlist -animation-element |= - element anim:seq { - common-anim-attlist, - common-endsync-timing-attlist, - common-timing-attlist, - animation-element* - } -animation-element |= - element anim:iterate { - common-anim-attlist, - anim-iterate-attlist, - common-timing-attlist, - common-endsync-timing-attlist, - animation-element* - } -anim-iterate-attlist &= common-anim-target-attlist -anim-iterate-attlist &= attribute anim:iterate-type { \string }? -anim-iterate-attlist &= attribute anim:iterate-interval { duration }? -animation-element |= - element anim:audio { - common-anim-attlist, anim-audio-attlist, common-basic-timing-attlist - } -anim-audio-attlist &= attribute xlink:href { anyURI }? -anim-audio-attlist &= attribute anim:audio-level { double }? -animation-element |= - element anim:command { - common-anim-attlist, - anim-command-attlist, - common-begin-end-timing-attlist, - common-anim-target-attlist, - element anim:param { - attribute anim:name { text }, - attribute anim:value { text } - }* - } -anim-command-attlist &= attribute anim:command { \string } -style-style = - element style:style { - style-style-attlist, style-style-content, style-map* - } -style-style-attlist &= attribute style:name { styleName } -style-style-attlist &= attribute style:display-name { \string }? -style-style-attlist &= - attribute style:parent-style-name { styleNameRef }? -style-style-attlist &= attribute style:next-style-name { styleNameRef }? -style-style-attlist &= - attribute style:list-style-name { styleName | empty }? -style-style-attlist &= - attribute style:master-page-name { styleNameRef }? -style-style-attlist &= - [ a:defaultValue = "false" ] attribute style:auto-update { boolean }? -style-style-attlist &= attribute style:data-style-name { styleNameRef }? -style-style-attlist &= attribute style:class { \string }? -style-style-attlist &= - attribute style:default-outline-level { positiveInteger }? -style-map = element style:map { style-map-attlist, empty } -style-map-attlist &= attribute style:condition { \string } -style-map-attlist &= attribute style:apply-style-name { styleNameRef } -style-map-attlist &= attribute style:base-cell-address { cellAddress }? -style-default-style = - element style:default-style { style-style-content } -style-page-layout = - element style:page-layout { - style-page-layout-attlist, - style-page-layout-properties?, - style-header-style?, - style-footer-style? - } -style-page-layout-attlist &= attribute style:name { styleName } -style-page-layout-attlist &= - [ a:defaultValue = "all" ] - attribute style:page-usage { "all" | "left" | "right" | "mirrored" }? -style-header-style = - element style:header-style { style-header-footer-properties? } -style-footer-style = - element style:footer-style { style-header-footer-properties? } -style-master-page = - element style:master-page { - style-master-page-attlist, - (style-header, style-header-left?)?, - (style-footer, style-footer-left?)?, - office-forms?, - style-style*, - shape*, - presentation-notes? - } -style-master-page-attlist &= attribute style:name { styleName } -style-master-page-attlist &= attribute style:display-name { \string }? -style-master-page-attlist &= - attribute style:page-layout-name { styleNameRef } -style-master-page-attlist &= attribute draw:style-name { styleNameRef }? -style-master-page-attlist &= - attribute style:next-style-name { styleNameRef }? -style-header = - element style:header { - common-style-header-footer-attlist, header-footer-content - } -style-footer = - element style:footer { - common-style-header-footer-attlist, header-footer-content - } -style-header-left = - element style:header-left { - common-style-header-footer-attlist, header-footer-content - } -style-footer-left = - element style:footer-left { - common-style-header-footer-attlist, header-footer-content - } -header-footer-content = - (text-tracked-changes, - text-decls, - (text-h - | text-p - | text-list - | table-table - | text-section - | text-table-of-content - | text-illustration-index - | text-table-index - | text-object-index - | text-user-index - | text-alphabetical-index - | text-bibliography - | text-index-title - | change-marks)*) - | (style-region-left?, style-region-center?, style-region-right?) -common-style-header-footer-attlist &= - [ a:defaultValue = "true" ] attribute style:display { boolean }? -style-region-left = element style:region-left { region-content } -style-region-center = element style:region-center { region-content } -style-region-right = element style:region-right { region-content } -region-content = text-p* -presentation-notes = - element presentation:notes { - common-presentation-header-footer-attlist, - presentation-notes-attlist, - office-forms, - shape* - } -presentation-notes-attlist &= - attribute style:page-layout-name { styleNameRef }? -presentation-notes-attlist &= - attribute draw:style-name { styleNameRef }? -table-table-template = - element table:table-template { - table-table-template-attlist, - table-first-row?, - table-last-row?, - table-first-column?, - table-last-column?, - (table-body - | (table-even-rows, table-odd-rows) - | (table-even-columns, table-odd-columns)) - } -table-table-template-attlist &= attribute text:name { \string } -table-table-template-attlist &= - attribute text:first-row-start-column { rowOrCol } -table-table-template-attlist &= - attribute text:first-row-end-column { rowOrCol } -table-table-template-attlist &= - attribute text:last-row-start-column { rowOrCol } -table-table-template-attlist &= - attribute text:last-row-end-column { rowOrCol } -rowOrCol = "row" | "column" -table-first-row = - element table:first-row { common-table-template-attlist, empty } -table-last-row = - element table:last-row { common-table-template-attlist, empty } -table-first-column = - element table:first-column { common-table-template-attlist, empty } -table-last-column = - element table:last-column { common-table-template-attlist, empty } -table-body = element table:body { common-table-template-attlist, empty } -table-even-rows = - element table:even-rows { common-table-template-attlist, empty } -table-odd-rows = - element table:odd-rows { common-table-template-attlist, empty } -table-even-columns = - element table:even-columns { common-table-template-attlist, empty } -table-odd-columns = - element table:odd-columns { common-table-template-attlist, empty } -common-table-template-attlist &= - attribute text:style-name { styleNameRef }, - attribute text:paragraph-style-name { styleNameRef? } -style-font-face = - element style:font-face { - style-font-face-attlist, svg-font-face-src?, svg-definition-src? - } -style-font-face-attlist &= - attribute svg:font-family { \string }?, - attribute svg:font-style { fontStyle }?, - attribute svg:font-variant { fontVariant }?, - attribute svg:font-weight { fontWeight }?, - attribute svg:font-stretch { - "normal" - | "ultra-condensed" - | "extra-condensed" - | "condensed" - | "semi-condensed" - | "semi-expanded" - | "expanded" - | "extra-expanded" - | "ultra-expanded" - }?, - attribute svg:font-size { positiveLength }?, - attribute svg:unicode-range { text }?, - attribute svg:units-per-em { integer }?, - attribute svg:panose-1 { text }?, - attribute svg:stemv { integer }?, - attribute svg:stemh { integer }?, - attribute svg:slope { integer }?, - attribute svg:cap-height { integer }?, - attribute svg:x-height { integer }?, - attribute svg:accent-height { integer }?, - attribute svg:ascent { integer }?, - attribute svg:descent { integer }?, - attribute svg:widths { text }?, - attribute svg:bbox { text }?, - attribute svg:ideographic { integer }?, - attribute svg:alphabetic { integer }?, - attribute svg:mathematical { integer }?, - attribute svg:hanging { integer }?, - attribute svg:v-ideographic { integer }?, - attribute svg:v-alphabetic { integer }?, - attribute svg:v-mathematical { integer }?, - attribute svg:v-hanging { integer }?, - attribute svg:underline-position { integer }?, - attribute svg:underline-thickness { integer }?, - attribute svg:strikethrough-position { integer }?, - attribute svg:strikethrough-thickness { integer }?, - attribute svg:overline-position { integer }?, - attribute svg:overline-thickness { integer }? -svg-font-face-src = - element svg:font-face-src { - (svg-font-face-uri | svg-font-face-name)+ - } -svg-font-face-uri = - element svg:font-face-uri { - common-svg-font-face-xlink-attlist, svg-font-face-format* - } -svg-font-face-format = - element svg:font-face-format { - attribute svg:string { text }?, - empty - } -svg-font-face-name = - element svg:font-face-name { - attribute svg:name { text }?, - empty - } -svg-definition-src = - element svg:definition-src { - common-svg-font-face-xlink-attlist, empty - } -common-svg-font-face-xlink-attlist &= - attribute xlink:href { anyURI }, - [ a:defaultValue = "simple" ] attribute xlink:type { "simple" }?, - [ a:defaultValue = "onRequest" ] - attribute xlink:actuate { "onRequest" }? -style-font-face-attlist &= attribute style:name { \string } -style-font-face-attlist &= attribute style:font-adornments { \string }? -style-font-face-attlist &= - attribute style:font-family-generic { fontFamilyGeneric }? -style-font-face-attlist &= attribute style:font-pitch { fontPitch }? -style-font-face-attlist &= - attribute style:font-charset { textEncoding }? -number-number-style = - element number:number-style { - common-data-style-attlist, - style-text-properties?, - number-text?, - (any-number, number-text?)?, - style-map* - } -any-number = number-number | number-scientific-number | number-fraction -number-number = - element number:number { - number-number-attlist, - common-decimal-places-attlist, - common-number-attlist, - number-embedded-text* - } -number-number-attlist &= attribute number:decimal-replacement { text }? -number-number-attlist &= - [ a:defaultValue = "1" ] attribute number:display-factor { double }? -number-embedded-text = - element number:embedded-text { number-embedded-text-attlist, text } -number-embedded-text-attlist &= attribute number:position { integer } -number-scientific-number = - element number:scientific-number { - number-scientific-number-attlist, - common-decimal-places-attlist, - common-number-attlist, - empty - } -number-scientific-number-attlist &= - attribute number:min-exponent-digits { integer }? -number-fraction = - element number:fraction { - number-fraction-attlist, common-number-attlist, empty - } -number-fraction-attlist &= - attribute number:min-numerator-digits { integer }? -number-fraction-attlist &= - attribute number:min-denominator-digits { integer }? -number-fraction-attlist &= - attribute number:denominator-value { integer }? -number-currency-style = - element number:currency-style { - common-data-style-attlist, - common-auto-reorder-attlist, - style-text-properties?, - number-text?, - ((number-and-text, currency-symbol-and-text?) - | (currency-symbol-and-text, number-and-text?))?, - style-map* - } -currency-symbol-and-text = number-currency-symbol, number-text? -number-and-text = number-number, number-text? -number-currency-symbol = - element number:currency-symbol { - number-currency-symbol-attlist, text - } -number-currency-symbol-attlist &= - attribute number:language { languageCode }?, - attribute number:country { countryCode }? -number-percentage-style = - element number:percentage-style { - common-data-style-attlist, - style-text-properties?, - number-text?, - number-and-text?, - style-map* - } -number-date-style = - element number:date-style { - common-data-style-attlist, - common-auto-reorder-attlist, - common-format-source-attlist, - style-text-properties?, - # This DTD does not reflect the fact that some elements must not - - # occur more than once. - number-text?, - (any-date, number-text?)+, - style-map* - } -any-date = - number-day - | number-month - | number-year - | number-era - | number-day-of-week - | number-week-of-year - | number-quarter - | number-hours - | number-am-pm - | number-minutes - | number-seconds -number-day = - element number:day { - number-day-attlist, common-calendar-attlist, empty - } -number-day-attlist &= - [ a:defaultValue = "short" ] - attribute number:style { "short" | "long" }? -number-month = - element number:month { - number-month-attlist, common-calendar-attlist, empty - } -number-month-attlist &= - [ a:defaultValue = "false" ] attribute number:textual { boolean }? -number-month-attlist &= - [ a:defaultValue = "false" ] - attribute number:possessive-form { boolean }? -number-month-attlist &= - [ a:defaultValue = "short" ] - attribute number:style { "short" | "long" }? -number-year = - element number:year { - number-year-attlist, common-calendar-attlist, empty - } -number-year-attlist &= - [ a:defaultValue = "short" ] - attribute number:style { "short" | "long" }? -number-era = - element number:era { - number-era-attlist, common-calendar-attlist, empty - } -number-era-attlist &= - [ a:defaultValue = "short" ] - attribute number:style { "short" | "long" }? -number-day-of-week = - element number:day-of-week { - number-day-of-week-attlist, common-calendar-attlist, empty - } -number-day-of-week-attlist &= - [ a:defaultValue = "short" ] - attribute number:style { "short" | "long" }? -number-week-of-year = - element number:week-of-year { common-calendar-attlist, empty } -number-quarter = - element number:quarter { - number-quarter-attlist, common-calendar-attlist, empty - } -number-quarter-attlist &= - [ a:defaultValue = "short" ] - attribute number:style { "short" | "long" }? -number-time-style = - element number:time-style { - number-time-style-attlist, - common-data-style-attlist, - common-format-source-attlist, - style-text-properties?, - # This DTD does not reflect the fact that some elements must not - - # occur more than once. - number-text?, - (any-time, number-text?)+, - style-map* - } -any-time = number-hours | number-am-pm | number-minutes | number-seconds -number-time-style-attlist &= - [ a:defaultValue = "true" ] - attribute number:truncate-on-overflow { boolean }? -number-hours = element number:hours { number-hours-attlist, empty } -number-hours-attlist &= - [ a:defaultValue = "short" ] - attribute number:style { "short" | "long" }? -number-minutes = - element number:minutes { number-minutes-attlist, empty } -number-minutes-attlist &= - [ a:defaultValue = "short" ] - attribute number:style { "short" | "long" }? -number-seconds = - element number:seconds { number-seconds-attlist, empty } -number-seconds-attlist &= - [ a:defaultValue = "short" ] - attribute number:style { "short" | "long" }? -number-seconds-attlist &= - [ a:defaultValue = "0" ] attribute number:decimal-places { integer }? -number-am-pm = element number:am-pm { empty } -number-boolean-style = - element number:boolean-style { - common-data-style-attlist, - style-text-properties?, - number-text?, - (number-boolean, number-text?)?, - style-map* - } -number-boolean = element number:boolean { empty } -number-text-style = - element number:text-style { - common-data-style-attlist, - style-text-properties?, - number-text?, - (number-text-content, number-text?)*, - style-map* - } -number-text = element number:text { text } -number-text-content = element number:text-content { empty } -common-data-style-attlist &= attribute style:name { styleName } -style-data-style-attlist &= attribute style:display-name { \string }? -common-data-style-attlist &= attribute number:language { languageCode }? -common-data-style-attlist &= attribute number:country { countryCode }? -common-data-style-attlist &= attribute number:title { text }? -common-data-style-attlist &= attribute style:volatile { boolean }? -common-auto-reorder-attlist &= - [ a:defaultValue = "false" ] - attribute number:automatic-order { boolean }? -common-format-source-attlist = - [ a:defaultValue = "fixed" ] - attribute number:format-source { "fixed" | "language" }? -common-data-style-attlist &= - [ a:defaultValue = "1" ] - attribute number:transliteration-format { \string }? -common-data-style-attlist &= - attribute number:transliteration-language { countryCode }? -common-data-style-attlist &= - attribute number:transliteration-country { countryCode }? -common-data-style-attlist &= - [ a:defaultValue = "short" ] - attribute number:transliteration-style { - "short" | "medium" | "long" - }? -common-decimal-places-attlist = - attribute number:decimal-places { integer }? -common-number-attlist &= - attribute number:min-integer-digits { integer }? -common-number-attlist &= - [ a:defaultValue = "false" ] attribute number:grouping { boolean }? -common-calendar-attlist &= - attribute number:calendar { - "gregorian" - | "gengou" - | "ROC" - | "hanja_yoil" - | "hanja" - | "hijri" - | "jewish" - | "buddhist" - | \string - }? -style-style-content |= - attribute style:family { "text" }, - style-text-properties? -style-style-content |= - attribute style:family { "paragraph" }, - style-paragraph-properties?, - style-text-properties? -style-style-content |= - attribute style:family { "section" }, - style-section-properties? -style-style-content |= - attribute style:family { "ruby" }, - style-ruby-properties? -text-linenumbering-configuration = - element text:linenumbering-configuration { - text-linenumbering-configuration-attlist, - text-linenumbering-separator? - } -text-linenumbering-configuration-attlist &= - [ a:defaultValue = "true" ] attribute text:number-lines { boolean }? -text-linenumbering-configuration-attlist &= common-num-format-attlist? -text-linenumbering-configuration-attlist &= - attribute text:style-name { styleNameRef }? -text-linenumbering-configuration-attlist &= - attribute text:increment { nonNegativeInteger }? -text-linenumbering-configuration-attlist &= - [ a:defaultValue = "left" ] - attribute text:number-position { - "left" | "right" | "inner" | "outer" - }? -text-linenumbering-configuration-attlist &= - attribute text:offset { nonNegativeLength }? -text-linenumbering-configuration-attlist &= - [ a:defaultValue = "true" ] - attribute text:count-empty-lines { boolean }? -text-linenumbering-configuration-attlist &= - [ a:defaultValue = "false" ] - attribute text:count-in-text-boxes { boolean }? -text-linenumbering-configuration-attlist &= - [ a:defaultValue = "false" ] - attribute text:restart-on-page { boolean }? -text-linenumbering-separator = - element text:linenumbering-separator { - attribute text:increment { nonNegativeInteger }?, - text - } -text-notes-configuration = - element text:notes-configuration { text-notes-configuration-content } -text-notes-configuration-content &= text-note-class -text-notes-configuration-content &= - attribute text:citation-style-name { styleNameRef }? -text-notes-configuration-content &= - attribute text:citation-body-style-name { styleNameRef }? -text-notes-configuration-content &= - attribute text:default-style-name { styleNameRef }? -text-notes-configuration-content &= - attribute text:master-page-name { styleNameRef }? -text-notes-configuration-content &= - attribute text:start-value { nonNegativeInteger }? -text-notes-configuration-content &= - common-num-format-prefix-suffix-attlist, common-num-format-attlist? -text-notes-configuration-content &= - attribute text:start-numbering-at { "document" | "chapter" | "page" }? -text-notes-configuration-content &= - attribute text:footnotes-position { - "text" | "page" | "section" | "document" - }? -text-notes-configuration-content &= - element text:note-continuation-notice-forward { text }? -text-notes-configuration-content &= - element text:note-continuation-notice-backward { text }? -text-bibliography-configuration = - element text:bibliography-configuration { - text-bibliography-configuration-attlist, text-sort-key* - } -text-bibliography-configuration-attlist &= - attribute text:prefix { \string }?, - attribute text:suffix { \string }? -text-bibliography-configuration-attlist &= - [ a:defaultValue = "false" ] - attribute text:numbered-entries { boolean }? -text-bibliography-configuration-attlist &= - [ a:defaultValue = "true" ] - attribute text:sort-by-position { boolean }?, - attribute fo:language { languageCode }?, - attribute fo:country { countryCode }?, - attribute text:sort-algorithm { \string }? -text-sort-key = element text:sort-key { text-sort-key-attlist, empty } -text-sort-key-attlist &= - attribute text:key { - "address" - | "annote" - | "author" - | "bibliography-type" - | "booktitle" - | "chapter" - | "custom1" - | "custom2" - | "custom3" - | "custom4" - | "custom5" - | "edition" - | "editor" - | "howpublished" - | "identifier" - | "institution" - | "isbn" - | "issn" - | "journal" - | "month" - | "note" - | "number" - | "organizations" - | "pages" - | "publisher" - | "report-type" - | "school" - | "series" - | "title" - | "url" - | "volume" - | "year" - }, - [ a:defaultValue = "true" ] attribute text:sort-ascending { boolean }? -text-list-style = - element text:list-style { - text-list-style-attr, text-list-style-content* - } -text-list-style-attr &= attribute style:name { styleName } -text-list-style-attr &= attribute style:display-name { \string }? -text-list-style-attr &= - [ a:defaultValue = "false" ] - attribute text:consecutive-numbering { boolean }? -text-list-level-style-attr = attribute text:level { positiveInteger } -text-list-style-content |= - element text:list-level-style-number { - text-list-level-style-attr, - text-list-level-style-number-attr, - style-list-level-properties?, - style-text-properties? - } -text-list-level-style-number-attr &= - attribute text:style-name { styleNameRef }? -text-list-level-style-number-attr &= - common-num-format-attlist, common-num-format-prefix-suffix-attlist -text-list-level-style-number-attr &= - [ a:defaultValue = "1" ] - attribute text:display-levels { positiveInteger }? -text-list-level-style-number-attr &= - [ a:defaultValue = "1" ] - attribute text:start-value { positiveInteger }? -text-list-style-content |= - element text:list-level-style-bullet { - text-list-level-style-attr, - text-list-level-style-bullet-attr, - style-list-level-properties?, - style-text-properties? - } -text-list-level-style-bullet-attr &= - attribute text:style-name { styleNameRef }? -text-list-level-style-bullet-attr &= - attribute text:bullet-char { character } -text-list-level-style-bullet-attr &= - common-num-format-prefix-suffix-attlist -text-list-level-style-bullet-attr &= - attribute text:bullet-relative-size { percent }? -text-list-style-content |= - element text:list-level-style-image { - text-list-level-style-attr, - text-list-level-style-image-attr, - style-list-level-properties? - } -text-list-level-style-image-attr &= - common-draw-data-attlist | office-binary-data -text-outline-style = - element text:outline-style { text-outline-level-style+ } -text-outline-level-style = - element text:outline-level-style { - text-outline-level-style-attlist, - style-list-level-properties?, - style-text-properties? - } -text-outline-level-style-attlist &= - attribute text:level { positiveInteger } -text-outline-level-style-attlist &= - attribute text:style-name { styleNameRef }? -text-outline-level-style-attlist &= - common-num-format-attlist, common-num-format-prefix-suffix-attlist -text-outline-level-style-attlist &= - [ a:defaultValue = "1" ] - attribute text:display-levels { positiveInteger }? -text-outline-level-style-attlist &= - [ a:defaultValue = "1" ] - attribute text:start-value { positiveInteger }? -style-style-content |= - attribute style:family { "table" }, - style-table-properties? -style-style-content |= - attribute style:family { "table-column" }, - style-table-column-properties? -style-style-content |= - attribute style:family { "table-row" }, - style-table-row-properties? -style-style-content |= - attribute style:family { "table-cell" }, - style-table-cell-properties?, - style-paragraph-properties?, - style-text-properties? -style-style-content |= - attribute style:family { "graphic" | "presentation" }, - style-graphic-properties?, - style-paragraph-properties?, - style-text-properties? -style-graphic-properties = - element style:graphic-properties { style-graphic-properties-content } -style-graphic-properties-content = style-properties-content -style-graphic-properties-content-strict = - style-graphic-properties-attlist, - style-graphic-fill-properties-attlist, - style-graphic-properties-elements -style-graphic-properties-elements = empty -style-style-content |= - attribute style:family { "drawing-page" }, - style-drawing-page-properties? -style-drawing-page-properties = - element style:drawing-page-properties { - style-drawing-page-properties-content - } -style-drawing-page-properties-content = style-properties-content -style-drawing-page-properties-content-strict = - style-graphic-fill-properties-attlist, - style-drawing-page-properties-attlist, - style-drawing-page-properties-elements -draw-gradient = - element draw:gradient { - common-draw-gradient-attlist, draw-gradient-attlist, empty - } -common-draw-gradient-attlist &= attribute draw:name { styleName }? -common-draw-gradient-attlist &= attribute draw:display-name { \string }? -common-draw-gradient-attlist &= attribute draw:style { gradient-style } -gradient-style = - "linear" | "axial" | "radial" | "ellipsoid" | "square" | "rectangular" -common-draw-gradient-attlist &= - attribute draw:cx { percent }?, - attribute draw:cy { percent }? -draw-gradient-attlist &= - attribute draw:start-color { color }?, - attribute draw:end-color { color }? -draw-gradient-attlist &= - attribute draw:start-intensity { percent }?, - attribute draw:end-intensity { percent }? -common-draw-gradient-attlist &= attribute draw:angle { integer }? -common-draw-gradient-attlist &= attribute draw:border { percent }? -svg-linearGradient = - element svg:linearGradient { - common-svg-gradient-attlist, - [ a:defaultValue = "0%" ] - attribute svg:x1 { coordinate | percent }?, - [ a:defaultValue = "0%" ] - attribute svg:y1 { coordinate | percent }?, - [ a:defaultValue = "100%" ] - attribute svg:x2 { coordinate | percent }?, - [ a:defaultValue = "100%" ] - attribute svg:y2 { coordinate | percent }?, - svg-stop* - } -svg-radialGradient = - element svg:radialGradient { - common-svg-gradient-attlist, - [ a:defaultValue = "50%" ] - attribute svg:cx { coordinate | percent }?, - [ a:defaultValue = "50%" ] - attribute svg:cy { coordinate | percent }?, - [ a:defaultValue = "50%" ] - attribute svg:r { coordinate | percent }?, - attribute svg:fx { coordinate | percent }?, - attribute svg:fy { coordinate | percent }?, - svg-stop* - } -svg-stop = - element svg:stop { - attribute svg:offset { double | percent }, - attribute svg:stop-color { color }?, - attribute svg:stop-opacity { double }? - } -common-svg-gradient-attlist &= - [ a:defaultValue = "objectBoundingBox" ] - attribute svg:gradientUnits { "objectBoundingBox" }?, - attribute svg:gradientTransform { \string }?, - [ a:defaultValue = "pad" ] - attribute svg:spreadMethod { "pad" | "reflect" | "repeat" }? -common-svg-gradient-attlist &= attribute draw:name { styleName } -common-svg-gradient-attlist &= attribute draw:display-name { \string }? -draw-hatch = element draw:hatch { draw-hatch-attlist, empty } -draw-hatch-attlist &= attribute draw:name { styleName } -draw-hatch-attlist &= attribute draw:display-name { \string }? -draw-hatch-attlist &= - attribute draw:style { "single" | "double" | "triple" } -draw-hatch-attlist &= attribute draw:color { color }? -draw-hatch-attlist &= attribute draw:distance { length }? -draw-hatch-attlist &= attribute draw:rotation { integer }? -draw-fill-image = - element draw:fill-image { - draw-fill-image-attlist, - attribute xlink:href { anyURI }, - [ a:defaultValue = "simple" ] attribute xlink:type { "simple" }?, - [ a:defaultValue = "embed" ] attribute xlink:show { "embed" }?, - [ a:defaultValue = "onLoad" ] attribute xlink:actuate { "onLoad" }?, - empty - } -draw-fill-image-attlist &= attribute draw:name { styleName } -draw-fill-image-attlist &= attribute draw:display-name { \string }? -draw-fill-image-attlist &= - attribute svg:width { length }?, - attribute svg:height { length }? -draw-opacity = - element draw:opacity { - common-draw-gradient-attlist, draw-opacity-attlist, empty - } -draw-opacity-attlist &= - attribute draw:start { percent }?, - attribute draw:end { percent }? -draw-marker = - element draw:marker { - draw-marker-attlist, - common-draw-viewbox-attlist, - common-draw-path-data-attlist, - empty - } -draw-marker-attlist &= attribute draw:name { styleName } -draw-marker-attlist &= attribute draw:display-name { \string }? -draw-stroke-dash = - element draw:stroke-dash { draw-stroke-dash-attlist, empty } -draw-stroke-dash-attlist &= attribute draw:name { styleName } -draw-stroke-dash-attlist &= attribute draw:display-name { \string }? -draw-stroke-dash-attlist &= attribute draw:style { "rect" | "round" }? -draw-stroke-dash-attlist &= - attribute draw:dots1 { integer }?, - attribute draw:dots1-length { length }?, - attribute draw:dots2 { integer }?, - attribute draw:dots2-length { length }? -draw-stroke-dash-attlist &= attribute draw:distance { length }? -style-presentation-page-layout = - element style:presentation-page-layout { - attribute style:name { styleName }, - attribute style:display-name { \string }?, - presentation-placeholder* - } -presentation-placeholder = - element presentation:placeholder { - attribute presentation:object { presentation-classes }, - attribute svg:x { coordinate | percent }, - attribute svg:y { coordinate | percent }, - attribute svg:width { length | percent }, - attribute svg:height { length | percent }, - empty - } -style-style-content |= - attribute style:family { "chart" }, - style-chart-properties?, - style-graphic-properties?, - style-paragraph-properties?, - style-text-properties? -style-properties-content = anyAttListOrElements -style-page-layout-properties = - element style:page-layout-properties { - style-page-layout-properties-content - } -style-page-layout-properties-content = style-properties-content -style-page-layout-properties-content-strict = - style-page-layout-properties-attlist, - style-page-layout-properties-elements -style-page-layout-properties-attlist &= - attribute fo:page-width { length }?, - attribute fo:page-height { length }? -style-page-layout-properties-attlist &= - common-num-format-attlist?, common-num-format-prefix-suffix-attlist -style-page-layout-properties-attlist &= - attribute style:paper-tray-name { "default" | \string }? -style-page-layout-properties-attlist &= - attribute style:print-orientation { "portrait" | "landscape" }? -style-page-layout-properties-attlist &= - common-horizontal-margin-attlist, - common-vertical-margin-attlist, - common-margin-attlist -style-page-layout-properties-attlist &= common-border-attlist -style-page-layout-properties-attlist &= common-border-line-width-attlist -style-page-layout-properties-attlist &= common-padding-attlist -style-page-layout-properties-attlist &= common-shadow-attlist -style-page-layout-properties-attlist &= common-background-color-attlist -style-page-layout-properties-elements &= style-background-image -style-page-layout-properties-elements &= style-columns -style-page-layout-properties-attlist &= - attribute style:register-truth-ref-style-name { styleNameRef }? -style-page-layout-properties-attlist &= - attribute style:print { - list { - ("headers" - | "grid" - | "annotations" - | "objects" - | "charts" - | "drawings" - | "formulas" - | "zero-values")* - } - }? -style-page-layout-properties-attlist &= - attribute style:print-page-order { "ttb" | "ltr" }? -style-page-layout-properties-attlist &= - attribute style:first-page-number { positiveInteger | "continue" }? -style-page-layout-properties-attlist &= - attribute style:scale-to { percent }?, - attribute style:scale-to-pages { positiveInteger }? -style-page-layout-properties-attlist &= - attribute style:table-centering { - "horizontal" | "vertical" | "both" | "none" - }? -style-page-layout-properties-attlist &= - attribute style:footnote-max-height { length }? -style-page-layout-properties-attlist &= common-writing-mode-attlist -style-page-layout-properties-elements &= style-footnote-sep -style-footnote-sep = - element style:footnote-sep { style-footnote-sep-attlist, empty }? -style-footnote-sep-attlist &= - attribute style:width { length }?, - attribute style:rel-width { percent }?, - attribute style:color { color }?, - attribute style:line-style { lineStyle }?, - [ a:defaultValue = "left" ] - attribute style:adjustment { "left" | "center" | "right" }?, - attribute style:distance-before-sep { length }?, - attribute style:distance-after-sep { length }? -style-page-layout-properties-attlist &= - attribute style:layout-grid-mode { "none" | "line" | "both" }? -style-page-layout-properties-attlist &= - attribute style:layout-grid-base-height { length }? -style-page-layout-properties-attlist &= - attribute style:layout-grid-ruby-height { length }? -style-page-layout-properties-attlist &= - attribute style:layout-grid-lines { positiveInteger }? -style-page-layout-properties-attlist &= - attribute style:layout-grid-color { color }? -style-page-layout-properties-attlist &= - attribute style:layout-grid-ruby-below { boolean }? -style-page-layout-properties-attlist &= - attribute style:layout-grid-print { boolean }? -style-page-layout-properties-attlist &= - attribute style:layout-grid-display { boolean }? -style-header-footer-properties = - element style:header-footer-properties { - style-header-footer-properties-content - } -style-header-footer-properties-content = style-properties-content -style-header-footer-properties-content-strict = - style-header-footer-properties-attlist, - style-header-footer-properties-elements -style-header-footer-properties-attlist &= - attribute svg:height { length }?, - attribute fo:min-height { length }? -style-header-footer-properties-attlist &= - common-horizontal-margin-attlist, - common-vertical-margin-attlist, - common-margin-attlist -style-header-footer-properties-attlist &= common-border-attlist -style-header-footer-properties-attlist &= - common-border-line-width-attlist -style-header-footer-properties-attlist &= common-padding-attlist -style-header-footer-properties-attlist &= - common-background-color-attlist -style-header-footer-properties-elements &= style-background-image -style-header-footer-properties-attlist &= common-shadow-attlist -style-header-footer-properties-attlist &= - attribute style:dynamic-spacing { boolean }? -style-text-properties = - element style:text-properties { style-text-properties-content } -style-text-properties-content = style-properties-content -style-text-properties-content-strict = - style-text-properties-attlist, style-text-properties-elements -style-text-properties-elements = empty -style-text-properties-attlist &= - attribute fo:font-variant { fontVariant }? -fontVariant = "normal" | "small-caps" -style-text-properties-attlist &= - attribute fo:text-transform { - "none" | "lowercase" | "uppercase" | "capitalize" - }? -style-text-properties-attlist &= attribute fo:color { color }? -style-text-properties-attlist &= - attribute style:use-window-font-color { boolean }? -style-text-properties-attlist &= - attribute style:text-outline { boolean }? -style-text-properties-attlist &= - attribute style:text-line-through-type { lineType }? -style-text-properties-attlist &= - attribute style:text-line-through-style { lineStyle }? -style-text-properties-attlist &= - attribute style:text-line-through-width { lineWidth }? -style-text-properties-attlist &= - attribute style:text-line-through-color { "font-color" | color }? -style-text-properties-attlist &= - attribute style:text-line-through-text { \string }? -style-text-properties-attlist &= - attribute style:text-line-through-text-style { styleNameRef }? -style-text-properties-attlist &= - attribute style:text-position { - list { (percent | "super" | "sub"), percent? } - }? -style-text-properties-attlist &= - attribute style:font-name { \string }?, - attribute style:font-name-asian { \string }?, - attribute style:font-name-complex { \string }? -style-text-properties-attlist &= - attribute fo:font-family { \string }?, - attribute style:font-family-asian { \string }?, - attribute style:font-family-complex { \string }? -style-text-properties-attlist &= - attribute style:font-family-generic { fontFamilyGeneric }?, - attribute style:font-family-generic-asian { fontFamilyGeneric }?, - attribute style:font-family-generic-complex { fontFamilyGeneric }? -fontFamilyGeneric = - "roman" | "swiss" | "modern" | "decorative" | "script" | "system" -style-text-properties-attlist &= - attribute style:font-style-name { \string }?, - attribute style:font-style-name-asian { \string }?, - attribute style:font-style-name-complex { \string }? -style-text-properties-attlist &= - attribute style:font-pitch { fontPitch }?, - attribute style:font-pitch-asian { fontPitch }?, - attribute style:font-pitch-complex { fontPitch }? -fontPitch = "fixed" | "variable" -style-text-properties-attlist &= - attribute style:font-charset { textEncoding }?, - attribute style:font-charset-asian { textEncoding }?, - attribute style:font-charset-complex { textEncoding }? -textEncoding = xsd:string { pattern = "[A-Za-z][A-Za-z0-9._\-]*" } -style-text-properties-attlist &= - attribute fo:font-size { positiveLength | percent }?, - attribute style:font-size-asian { positiveLength | percent }?, - attribute style:font-size-complex { positiveLength | percent }? -style-text-properties-attlist &= - attribute style:font-size-rel { length }?, - attribute style:font-size-rel-asian { length }?, - attribute style:font-size-rel-complex { length }? -style-text-properties-attlist &= - attribute style:script-type { - "latin" | "asian" | "complex" | "ignore" - }? -style-text-properties-attlist &= - attribute fo:letter-spacing { length | "normal" }? -style-text-properties-attlist &= - attribute fo:language { languageCode }?, - attribute style:language-asian { languageCode }?, - attribute style:language-complex { languageCode }? -style-text-properties-attlist &= - attribute fo:country { countryCode }?, - attribute style:country-asian { countryCode }?, - attribute style:country-complex { countryCode }? -style-text-properties-attlist &= - attribute fo:font-style { fontStyle }?, - attribute style:font-style-asian { fontStyle }?, - attribute style:font-style-complex { fontStyle }? -fontStyle = "normal" | "italic" | "oblique" -style-text-properties-attlist &= - attribute style:font-relief { "none" | "embossed" | "engraved" }? -style-text-properties-attlist &= - attribute fo:text-shadow { shadowType }? -shadowType = - "none" - | # The following string must match an XSL shadow decl - \string -style-text-properties-attlist &= - attribute style:text-underline-type { lineType }? -lineType = "none" | "single" | "double" -style-text-properties-attlist &= - attribute style:text-underline-style { lineStyle }? -lineStyle = - "none" - | "solid" - | "dotted" - | "dash" - | "long-dash" - | "dot-dash" - | "dot-dot-dash" - | "wave" -style-text-properties-attlist &= - attribute style:text-underline-width { lineWidth }? -lineWidth = - "auto" - | "normal" - | "bold" - | "thin" - | "dash" - | "medium" - | "thick" - | positiveInteger - | percent - | positiveLength -style-text-properties-attlist &= - attribute style:text-underline-color { "font-color" | color }? -style-text-properties-attlist &= - attribute fo:font-weight { fontWeight }?, - attribute style:font-weight-asian { fontWeight }?, - attribute style:font-weight-complex { fontWeight }? -fontWeight = - "normal" - | "bold" - | "100" - | "200" - | "300" - | "400" - | "500" - | "600" - | "700" - | "800" - | "900" -style-text-properties-attlist &= - attribute style:text-underline-mode { lineMode }? -lineMode = "continuous" | "skip-white-space" -style-text-properties-attlist &= - attribute style:text-line-through-mode { lineMode }? -style-text-properties-attlist &= - attribute style:letter-kerning { boolean }? -style-text-properties-attlist &= - attribute style:text-blinking { boolean }? -style-text-properties-attlist &= common-background-color-attlist -style-text-properties-attlist &= - attribute style:text-combine { "none" | "letters" | "lines" }? -style-text-properties-attlist &= - attribute style:text-combine-start-char { character }?, - attribute style:text-combine-end-char { character }? -style-text-properties-attlist &= - attribute style:text-emphasize { - "none" - | list { - ("none" | "accent" | "dot" | "circle" | "disc"), - ("above" | "below") - } - }? -style-text-properties-attlist &= attribute style:text-scale { percent }? -style-text-properties-attlist &= - attribute style:text-rotation-angle { integer }? -style-text-properties-attlist &= - attribute style:text-rotation-scale { "fixed" | "line-height" }? -style-text-properties-attlist &= attribute fo:hyphenate { boolean }? -style-text-properties-attlist &= - attribute fo:hyphenation-remain-char-count { positiveInteger }? -style-text-properties-attlist &= - attribute fo:hyphenation-push-char-count { positiveInteger }? -style-text-properties-attlist &= - attribute text:display { "true" } - | attribute text:display { "none" } - | (attribute text:display { "condition" }, - attribute text:condition { "none" }) - | empty -style-paragraph-properties = - element style:paragraph-properties { - style-paragraph-properties-content - } -style-paragraph-properties-content = style-properties-content -style-paragraph-properties-content-strict = - style-paragraph-properties-attlist, - style-paragraph-properties-elements -style-paragraph-properties-attlist &= - attribute fo:line-height { "normal" | nonNegativeLength | percent }? -style-paragraph-properties-attlist &= - attribute style:line-height-at-least { nonNegativeLength }? -style-paragraph-properties-attlist &= - attribute style:line-spacing { length }? -style-paragraph-properties-attlist &= - attribute style:font-independent-line-spacing { boolean }? -style-paragraph-properties-attlist &= common-text-align -common-text-align = - attribute fo:text-align { - "start" | "end" | "left" | "right" | "center" | "justify" - }? -style-paragraph-properties-attlist &= - attribute fo:text-align-last { "start" | "center" | "justify" }? -style-paragraph-properties-attlist &= - attribute style:justify-single-word { boolean }? -style-paragraph-properties-attlist &= - attribute fo:keep-together { "auto" | "always" }? -style-paragraph-properties-attlist &= - attribute fo:widows { nonNegativeInteger }? -style-paragraph-properties-attlist &= - attribute fo:orphans { nonNegativeInteger }? -style-paragraph-properties-elements &= style-tab-stops -style-tab-stops = element style:tab-stops { style-tab-stop* }? -style-tab-stop = - element style:tab-stop { style-tab-stop-attlist, empty } -style-tab-stop-attlist &= attribute style:position { nonNegativeLength } -style-tab-stop-attlist &= - [ a:defaultValue = "left" ] - attribute style:type { "left" | "center" | "right" }? - | (attribute style:type { "char" }, - style-tab-stop-char-attlist) -style-tab-stop-char-attlist &= attribute style:char { character } -style-tab-stop-attlist &= attribute style:leader-type { lineType }? -style-tab-stop-attlist &= attribute style:leader-style { lineStyle }? -style-tab-stop-attlist &= attribute style:leader-width { lineWidth }? -style-tab-stop-attlist &= - attribute style:leader-color { "font-color" | color }? -style-tab-stop-attlist &= - [ a:defaultValue = " " ] attribute style:leader-text { \string }? -style-tab-stop-attlist &= - attribute style:leader-text-style { styleNameRef }? -style-paragraph-properties-attlist &= - attribute style:tab-stop-distance { nonNegativeLength }? -style-paragraph-properties-attlist &= - attribute fo:hyphenation-keep { "auto" | "page" }? -style-paragraph-properties-attlist &= - attribute fo:hyphenation-ladder-count { - "no-limit" | positiveInteger - }? -style-paragraph-properties-elements &= style-drop-cap -style-drop-cap = - element style:drop-cap { style-drop-cap-attlist, empty }? -style-drop-cap-attlist &= - [ a:defaultValue = "1" ] - attribute style:length { "word" | positiveInteger }? -style-drop-cap-attlist &= - [ a:defaultValue = "1" ] attribute style:lines { positiveInteger }? -style-drop-cap-attlist &= - [ a:defaultValue = "0cm" ] attribute style:distance { length }? -style-drop-cap-attlist &= attribute style:style-name { styleNameRef }? -style-paragraph-properties-attlist &= - attribute style:register-true { boolean }? -style-paragraph-properties-attlist &= common-horizontal-margin-attlist -common-horizontal-margin-attlist = - attribute fo:margin-left { length | percent }?, - attribute fo:margin-right { length | percent }? -style-paragraph-properties-attlist &= - attribute fo:text-indent { length | percent }? -style-paragraph-properties-attlist &= - attribute style:auto-text-indent { boolean }? -style-paragraph-properties-attlist &= common-vertical-margin-attlist -common-vertical-margin-attlist = - attribute fo:margin-top { nonNegativeLength | percent }?, - attribute fo:margin-bottom { nonNegativeLength | percent }? -style-paragraph-properties-attlist &= common-margin-attlist -common-margin-attlist = - attribute fo:margin { nonNegativeLength | percent }? -style-paragraph-properties-attlist &= common-break-attlist -common-break-attlist = - attribute fo:break-before { "auto" | "column" | "page" }?, - attribute fo:break-after { "auto" | "column" | "page" }? -style-paragraph-properties-attlist &= common-background-color-attlist -common-background-color-attlist = - attribute fo:background-color { "transparent" | color }? -style-paragraph-properties-elements &= style-background-image -style-background-image = - element style:background-image { - style-background-image-attlist, - (common-draw-data-attlist | office-binary-data | empty) - }? -style-background-image-attlist &= - [ a:defaultValue = "repeat" ] - attribute style:repeat { "no-repeat" | "repeat" | "stretch" }? -style-background-image-attlist &= - [ a:defaultValue = "center" ] - attribute style:position { - "left" - | "center" - | "right" - | "top" - | "bottom" - | list { horiBackPos, vertBackPos } - | list { vertBackPos, horiBackPos } - }? -horiBackPos = "left" | "center" | "right" -vertBackPos = "top" | "center" | "bottom" -style-background-image-attlist &= - attribute style:filter-name { \string }? -style-background-image-attlist &= attribute draw:opacity { percent }? -style-paragraph-properties-attlist &= common-border-attlist -common-border-attlist = - attribute fo:border { \string }?, - attribute fo:border-top { \string }?, - attribute fo:border-bottom { \string }?, - attribute fo:border-left { \string }?, - attribute fo:border-right { \string }? -style-paragraph-properties-attlist &= common-border-line-width-attlist -common-border-line-width-attlist = - attribute style:border-line-width { borderWidths }?, - attribute style:border-line-width-top { borderWidths }?, - attribute style:border-line-width-bottom { borderWidths }?, - attribute style:border-line-width-left { borderWidths }?, - attribute style:border-line-width-right { borderWidths }? -borderWidths = list { positiveLength, positiveLength, positiveLength } -style-paragraph-properties-attlist &= common-padding-attlist -common-padding-attlist = - attribute fo:padding { nonNegativeLength }?, - attribute fo:padding-top { nonNegativeLength }?, - attribute fo:padding-bottom { nonNegativeLength }?, - attribute fo:padding-left { nonNegativeLength }?, - attribute fo:padding-right { nonNegativeLength }? -style-paragraph-properties-attlist &= common-shadow-attlist -common-shadow-attlist = attribute style:shadow { shadowType }? -style-paragraph-properties-attlist &= common-keep-with-next-attlist -common-keep-with-next-attlist = - attribute fo:keep-with-next { "auto" | "always" }? -style-paragraph-properties-attlist &= - [ a:defaultValue = "false" ] attribute text:number-lines { boolean }? -style-paragraph-properties-attlist &= - attribute text:line-number { nonNegativeInteger }? -style-paragraph-properties-attlist &= - attribute style:text-autospace { "none" | "ideograph-alpha" }? -style-paragraph-properties-attlist &= - attribute style:punctuation-wrap { "simple" | "hanging" }? -style-paragraph-properties-attlist &= - attribute style:line-break { "normal" | "strict" }? -style-paragraph-properties-attlist &= - [ a:defaultValue = "auto" ] - attribute style:vertical-align { - "top" | "middle" | "bottom" | "auto" | "baseline" - }? -style-paragraph-properties-attlist &= common-writing-mode-attlist -common-writing-mode-attlist = - attribute style:writing-mode { - "lr-tb" | "rl-tb" | "tb-rl" | "tb-lr" | "lr" | "rl" | "tb" | "page" - }? -style-paragraph-properties-attlist &= - attribute style:writing-mode-automatic { boolean }? -style-paragraph-properties-attlist &= - attribute style:snap-to-layout-grid { boolean }? -style-paragraph-properties-attlist &= common-page-number-attlist -common-page-number-attlist = - attribute style:page-number { positiveInteger | "auto" }? -style-paragraph-properties-attlist &= - attribute style:background-transparency { percent }? -style-ruby-properties = - element style:ruby-properties { style-ruby-properties-content } -style-ruby-properties-content = style-properties-content -style-ruby-properties-content-strict = - style-ruby-properties-attlist, style-ruby-properties-elements -style-ruby-properties-elements = empty -style-ruby-properties-attlist &= - attribute style:ruby-position { "above" | "below" }? -style-ruby-properties-attlist &= - attribute style:ruby-align { - "left" - | "center" - | "right" - | "distribute-letter" - | "distribute-space" - }? -style-section-properties = - element style:section-properties { style-section-properties-content } -style-section-properties-content = style-properties-content -style-section-properties-content-strict = - style-section-properties-attlist, style-section-properties-elements -style-section-properties-attlist &= common-background-color-attlist -style-section-properties-elements &= style-background-image -style-section-properties-attlist &= common-horizontal-margin-attlist -style-section-properties-elements &= style-columns -style-columns = - element style:columns { - style-columns-attlist, style-column-sep?, style-column* - }? -style-columns-attlist &= attribute fo:column-count { positiveInteger } -style-columns-attlist &= attribute fo:column-gap { length }? -style-column = element style:column { style-column-attlist } -style-column-attlist &= attribute style:rel-width { relativeLength } -style-column-attlist &= - [ a:defaultValue = "0cm" ] attribute fo:start-indent { length }? -style-column-attlist &= - [ a:defaultValue = "0cm" ] attribute fo:end-indent { length }? -style-column-attlist &= - [ a:defaultValue = "0cm" ] attribute fo:space-before { length }? -style-column-attlist &= - [ a:defaultValue = "0cm" ] attribute fo:space-after { length }? -style-column-sep = element style:column-sep { style-column-sep-attlist } -style-column-sep-attlist &= - [ a:defaultValue = "solid" ] - attribute style:style { - "none" | "solid" | "dotted" | "dashed" | "dot-dashed" - }? -style-column-sep-attlist &= attribute style:width { length } -style-column-sep-attlist &= - [ a:defaultValue = "100%" ] attribute style:height { percent }? -style-column-sep-attlist &= - [ a:defaultValue = "top" ] - attribute style:vertical-align { "top" | "middle" | "bottom" }? -style-column-sep-attlist &= - [ a:defaultValue = "#000000" ] attribute style:color { color }? -style-section-properties-attlist &= - [ a:defaultValue = "false" ] attribute style:protect { boolean }? -style-section-properties-attlist &= - attribute text:dont-balance-text-columns { boolean }? -style-section-properties-attlist &= common-writing-mode-attlist -style-section-properties-elements &= text-notes-configuration* -style-table-properties = - element style:table-properties { style-table-properties-content } -style-table-properties-content = style-properties-content -style-table-properties-content-strict = - style-table-properties-attlist, style-table-properties-elements -style-table-properties-attlist &= - attribute style:width { positiveLength }?, - attribute style:rel-width { percent }? -style-table-properties-attlist &= - attribute table:align { "left" | "center" | "right" | "margins" }? -style-table-properties-attlist &= common-horizontal-margin-attlist -style-table-properties-attlist &= common-vertical-margin-attlist -style-table-properties-attlist &= common-margin-attlist -style-table-properties-attlist &= common-page-number-attlist -style-table-properties-attlist &= common-break-attlist -style-table-properties-attlist &= common-background-color-attlist -style-table-properties-elements &= style-background-image -style-table-properties-attlist &= common-shadow-attlist -style-table-properties-attlist &= common-keep-with-next-attlist -style-table-properties-attlist &= - attribute style:may-break-between-rows { boolean }? -style-table-properties-attlist &= - attribute table:border-model { "collapsing" | "separating" }? -style-table-properties-attlist &= common-writing-mode-attlist -style-table-properties-attlist &= attribute table:display { boolean }? -style-table-column-properties = - element style:table-column-properties { - style-table-column-properties-content - } -style-table-column-properties-content = style-properties-content -style-table-column-properties-content-strict = - style-table-column-properties-attlist, - style-table-column-properties-elements -style-table-column-properties-elements = empty -style-table-column-properties-attlist &= - attribute style:column-width { positiveLength }?, - attribute style:rel-column-width { relativeLength }? -style-table-column-properties-attlist &= - attribute style:use-optimal-column-width { boolean }? -style-table-column-properties-attlist &= common-break-attlist -style-table-row-properties = - element style:table-row-properties { - style-table-row-properties-content - } -style-table-row-properties-content = style-properties-content -style-table-row-properties-content-strict = - style-table-row-properties-attlist, - style-table-row-properties-elements -style-table-row-properties-attlist &= - attribute style:row-height { positiveLength }?, - attribute style:min-row-height { nonNegativeLength }? -style-table-row-properties-attlist &= - attribute style:use-optimal-row-height { boolean }? -style-table-row-properties-attlist &= common-background-color-attlist -style-table-row-properties-elements &= style-background-image -style-table-row-properties-attlist &= common-break-attlist -style-table-row-properties-attlist &= - attribute fo:keep-together { "auto" | "always" }? -style-table-cell-properties = - element style:table-cell-properties { - style-table-cell-properties-content - } -style-table-cell-properties-content = style-properties-content -style-table-cell-properties-content-strict = - style-table-cell-properties-attlist, - style-table-cell-properties-elements -style-table-cell-properties-attlist &= - attribute style:vertical-align { - "top" | "middle" | "bottom" | "automatic" - }? -style-table-cell-properties-attlist &= - attribute style:text-align-source { "fix" | "value-type" }? -style-table-cell-properties-attlist &= common-style-direction-attlist -common-style-direction-attlist = - attribute style:direction { "ltr" | "ttb" }? -style-table-cell-properties-attlist &= - attribute style:glyph-orientation-vertical { "auto" | "0" }? -style-table-cell-properties-attlist &= common-shadow-attlist -style-table-cell-properties-attlist &= common-background-color-attlist -style-table-cell-properties-elements &= style-background-image -style-table-cell-properties-attlist &= common-border-attlist -style-table-cell-properties-attlist &= - attribute style:diagonal-tl-br { \string }?, - attribute style:diagonal-tl-br-widths { borderWidths }?, - attribute style:diagonal-bl-tr { \string }?, - attribute style:diagonal-bl-tr-widths { borderWidths }? -style-table-cell-properties-attlist &= common-border-line-width-attlist -style-table-cell-properties-attlist &= common-padding-attlist -style-table-cell-properties-attlist &= - attribute fo:wrap-option { "no-wrap" | "wrap" }? -style-table-cell-properties-attlist &= common-rotation-angle-attlist -common-rotation-angle-attlist = - attribute style:rotation-angle { nonNegativeInteger }? -style-table-cell-properties-attlist &= - attribute style:rotation-align { - "none" | "bottom" | "top" | "center" - }? -style-table-cell-properties-attlist &= - attribute style:cell-protect { - "none" - | "hidden-and-protected" - | list { ("protected" | "formula-hidden")+ } - }? -style-table-cell-properties-attlist &= - attribute style:print-content { boolean }? -style-table-cell-properties-attlist &= - attribute style:decimal-places { nonNegativeInteger }? -style-table-cell-properties-attlist &= - attribute style:repeat-content { boolean }? -style-table-cell-properties-attlist &= - attribute style:shrink-to-fit { boolean }? -style-list-level-properties = - element style:list-level-properties { - style-list-level-properties-content - } -style-list-level-properties-content = style-properties-content -style-list-level-properties-content-strict = - style-list-level-properties-attlist, - style-list-level-properties-elements -style-list-level-properties-elements = empty -style-list-level-properties-attlist &= common-text-align -style-list-level-properties-attlist &= - attribute text:space-before { nonNegativeLength }? -style-list-level-properties-attlist &= - attribute text:min-label-width { nonNegativeLength }? -style-list-level-properties-attlist &= - attribute text:min-label-distance { nonNegativeLength }? -style-list-level-properties-attlist &= - attribute style:font-name { \string }? -style-list-level-properties-attlist &= - attribute fo:width { positiveLength }?, - attribute fo:height { positiveLength }? -style-list-level-properties-attlist &= - common-vertical-rel-attlist, common-vertical-pos-attlist -style-graphic-properties-attlist &= - attribute draw:stroke { "none" | "dash" | "solid" }? -style-graphic-properties-attlist &= - attribute draw:stroke-dash { styleNameRef }? -style-graphic-properties-attlist &= - attribute draw:stroke-dash-names { styleNameRefs }? -style-graphic-properties-attlist &= - attribute svg:stroke-width { length }? -style-graphic-properties-attlist &= - attribute svg:stroke-color { color }? -style-graphic-properties-attlist &= - attribute draw:marker-start { styleNameRef }? -style-graphic-properties-attlist &= - attribute draw:marker-end { styleNameRef }? -style-graphic-properties-attlist &= - attribute draw:marker-start-width { length }? -style-graphic-properties-attlist &= - attribute draw:marker-end-width { length }? -style-graphic-properties-attlist &= - attribute draw:marker-start-center { boolean }? -style-graphic-properties-attlist &= - attribute draw:marker-end-center { boolean }? -style-graphic-properties-attlist &= - attribute svg:stroke-opacity { - xsd:double { minInclusive = "0" maxInclusive = "1" } - | percent - }? -style-graphic-properties-attlist &= - attribute draw:stroke-linejoin { - "miter" | "round" | "bevel" | "middle" | "none" | "inherit" - }? -style-graphic-fill-properties-attlist &= - attribute draw:fill { - "none" | "solid" | "bitmap" | "gradient" | "hatch" - }? -style-graphic-fill-properties-attlist &= - attribute draw:fill-color { color }? -style-graphic-fill-properties-attlist &= - attribute draw:secondary-fill-color { color }? -style-graphic-fill-properties-attlist &= - attribute draw:fill-gradient-name { styleNameRef }? -style-graphic-fill-properties-attlist &= - attribute draw:gradient-step-count { nonNegativeInteger }? -style-graphic-fill-properties-attlist &= - attribute draw:fill-hatch-name { styleNameRef }? -style-graphic-fill-properties-attlist &= - attribute draw:fill-hatch-solid { boolean }? -style-graphic-fill-properties-attlist &= - attribute draw:fill-image-name { styleNameRef }? -style-graphic-fill-properties-attlist &= - attribute style:repeat { "no-repeat" | "repeat" | "stretch" }? -style-graphic-fill-properties-attlist &= - attribute draw:fill-image-width { length | percent }?, - attribute draw:fill-image-height { length | percent }? -style-graphic-fill-properties-attlist &= - attribute draw:fill-image-ref-point-x { percent }?, - attribute draw:fill-image-ref-point-y { percent }?, - attribute draw:fill-image-ref-point { - "top-left" - | "top" - | "top-right" - | "left" - | "center" - | "right" - | "bottom-left" - | "bottom" - | "bottom-right" - }? -style-graphic-fill-properties-attlist &= - attribute draw:tile-repeat-offset { text }? -style-graphic-fill-properties-attlist &= - attribute draw:opacity { percent }? -style-graphic-fill-properties-attlist &= - attribute draw:opacity-name { styleNameRef }? -style-graphic-fill-properties-attlist &= - attribute svg:fill-rule { "nonzero" | "evenodd" }? -style-graphic-properties-attlist &= - attribute draw:symbol-color { color }? -style-graphic-properties-attlist &= - attribute text:animation { - "none" | "scroll" | "alternate" | "slide" - }? -style-graphic-properties-attlist &= - attribute text:animation-direction { - "left" | "right" | "up" | "down" - }? -style-graphic-properties-attlist &= - attribute text:animation-start-inside { boolean }? -style-graphic-properties-attlist &= - attribute text:animation-stop-inside { boolean }? -style-graphic-properties-attlist &= - attribute text:animation-repeat { nonNegativeInteger }? -style-graphic-properties-attlist &= - attribute text:animation-delay { duration }? -style-graphic-properties-attlist &= - attribute text:animation-steps { length }? -style-graphic-properties-attlist &= - attribute draw:auto-grow-width { boolean }?, - attribute draw:auto-grow-height { boolean }? -style-graphic-properties-attlist &= - attribute draw:fit-to-size { boolean }? -style-graphic-properties-attlist &= - attribute draw:fit-to-contour { boolean }? -style-graphic-properties-attlist &= - attribute draw:textarea-vertical-align { - "top" | "middle" | "bottom" | "justify" - }? -style-graphic-properties-attlist &= - attribute draw:textarea-horizontal-align { - "left" | "center" | "right" | "justify" - }? -style-graphic-properties-attlist &= - attribute fo:wrap-option { "no-wrap" | "wrap" }? -style-graphic-properties-elements &= text-list-style? -style-graphic-properties-attlist &= - attribute draw:color-mode { - "greyscale" | "mono" | "watermark" | "standard" - }? -style-graphic-properties-attlist &= - attribute draw:color-inversion { boolean }? -style-graphic-properties-attlist &= - attribute draw:luminance { percent }? -style-graphic-properties-attlist &= attribute draw:contrast { percent }? -style-graphic-properties-attlist &= attribute draw:gamma { percent }? -style-graphic-properties-attlist &= attribute draw:red { percent }? -style-graphic-properties-attlist &= attribute draw:green { percent }? -style-graphic-properties-attlist &= attribute draw:blue { percent }? -style-graphic-properties-attlist &= - attribute draw:image-opacity { percent }? -style-graphic-properties-attlist &= - attribute draw:shadow { "visible" | "hidden" }? -style-graphic-properties-attlist &= - attribute draw:shadow-offset-x { length }?, - attribute draw:shadow-offset-y { length }? -style-graphic-properties-attlist &= - attribute draw:shadow-color { color }? -style-graphic-properties-attlist &= - attribute draw:shadow-opacity { percent }? -style-graphic-properties-attlist &= - attribute draw:start-line-spacing-horizontal { distance }?, - attribute draw:start-line-spacing-vertical { distance }? -style-graphic-properties-attlist &= - attribute draw:end-line-spacing-horizontal { distance }?, - attribute draw:end-line-spacing-vertical { distance }? -style-graphic-properties-attlist &= - attribute draw:line-distance { distance }? -style-graphic-properties-attlist &= - attribute draw:guide-overhang { length }? -style-graphic-properties-attlist &= - attribute draw:guide-distance { distance }? -style-graphic-properties-attlist &= - attribute draw:start-guide { length }? -style-graphic-properties-attlist &= attribute draw:end-guide { length }? -style-graphic-properties-attlist &= - attribute draw:placing { "below" | "above" }? -style-graphic-properties-attlist &= attribute draw:parallel { boolean }? -style-graphic-properties-attlist &= - attribute draw:measure-align { - "automatic" | "left-outside" | "inside" | "right-outside" - }?, - attribute draw:measure-vertical-align { - "automatic" | "above" | "below" | "center" - }? -style-graphic-properties-attlist &= - attribute draw:unit { - "automatic" - | "mm" - | "cm" - | "m" - | "km" - | "pt" - | "pc" - | "inch" - | "ft" - | "mi" - }? -style-graphic-properties-attlist &= - attribute draw:show-unit { boolean }? -style-graphic-properties-attlist &= - attribute draw:decimal-places { nonNegativeInteger }? -style-graphic-properties-attlist &= - attribute draw:caption-type { - "straight-line" | "angled-line" | "angled-connector-line" - }? -style-graphic-properties-attlist &= - attribute draw:caption-angle-type { "fixed" | "free" }? -style-graphic-properties-attlist &= - attribute draw:caption-angle { nonNegativeInteger }? -style-graphic-properties-attlist &= - attribute draw:caption-gap { distance }? -style-graphic-properties-attlist &= - attribute draw:caption-escape-direction { - "horizontal" | "vertical" | "auto" - }? -style-graphic-properties-attlist &= - attribute draw:caption-escape { length | percent }? -style-graphic-properties-attlist &= - attribute draw:caption-line-length { length }? -style-graphic-properties-attlist &= - attribute draw:caption-fit-line-length { boolean }? -style-graphic-properties-attlist &= - attribute dr3d:horizontal-segments { nonNegativeInteger }? -style-graphic-properties-attlist &= - attribute dr3d:vertical-segments { nonNegativeInteger }? -style-graphic-properties-attlist &= - attribute dr3d:edge-rounding { percent }? -style-graphic-properties-attlist &= - attribute dr3d:edge-rounding-mode { "correct" | "attractive" }? -style-graphic-properties-attlist &= - attribute dr3d:back-scale { percent }? -style-graphic-properties-attlist &= attribute dr3d:depth { length }? -style-graphic-properties-attlist &= - attribute dr3d:backface-culling { "enabled" | "disabled" }? -style-graphic-properties-attlist &= - attribute dr3d:end-angle { nonNegativeInteger }? -style-graphic-properties-attlist &= - attribute dr3d:close-front { boolean }? -style-graphic-properties-attlist &= - attribute dr3d:close-back { boolean }? -style-graphic-properties-attlist &= - attribute dr3d:lighting-mode { "standard" | "double-sided" }? -style-graphic-properties-attlist &= - attribute dr3d:normals-kind { "object" | "flat" | "sphere" }? -style-graphic-properties-attlist &= - attribute dr3d:normals-direction { "normal" | "inverse" }? -style-graphic-properties-attlist &= - attribute dr3d:texture-generation-mode-x { - "object" | "parallel" | "sphere" - }?, - attribute dr3d:texture-generation-mode-y { - "object" | "parallel" | "sphere" - }? -style-graphic-properties-attlist &= - attribute dr3d:texture-kind { "luminance" | "intensity" | "color" }? -style-graphic-properties-attlist &= - attribute dr3d:texture-filter { "enabled" | "disabled" }? -style-graphic-properties-attlist &= - attribute dr3d:texture-mode { "replace" | "modulate" | "blend" }? -style-graphic-properties-attlist &= - attribute dr3d:ambient-color { color }?, - attribute dr3d:emissive-color { color }?, - attribute dr3d:specular-color { color }?, - attribute dr3d:diffuse-color { color }? -style-graphic-properties-attlist &= - attribute dr3d:shininess { percent }? -style-graphic-properties-attlist &= - attribute dr3d:shadow { "visible" | "hidden" }? -style-graphic-properties-attlist &= - common-draw-rel-size-attlist, - attribute fo:min-width { length | percent }? -style-graphic-properties-attlist &= - attribute fo:min-height { length | percent }? -style-graphic-properties-attlist &= - attribute fo:max-height { length | percent }?, - attribute fo:max-width { length | percent }? -style-graphic-properties-attlist &= common-horizontal-margin-attlist -style-graphic-properties-attlist &= common-vertical-margin-attlist -style-graphic-properties-attlist &= common-margin-attlist -style-graphic-properties-attlist &= - attribute style:print-content { boolean }? -style-graphic-properties-attlist &= - attribute style:protect { - "none" - | list { ("content" | "position" | "size")+ } - }? -style-graphic-properties-attlist &= - attribute style:horizontal-pos { - "left" - | "center" - | "right" - | "from-left" - | "inside" - | "outside" - | "from-inside" - }?, - attribute svg:x { coordinate }? -style-graphic-properties-attlist &= - attribute style:horizontal-rel { - "page" - | "page-content" - | "page-start-margin" - | "page-end-margin" - | "frame" - | "frame-content" - | "frame-start-margin" - | "frame-end-margin" - | "paragraph" - | "paragraph-content" - | "paragraph-start-margin" - | "paragraph-end-margin" - | "char" - }? -style-graphic-properties-attlist &= common-vertical-pos-attlist -common-vertical-pos-attlist = - attribute style:vertical-pos { - "top" | "middle" | "bottom" | "from-top" | "below" - }?, - attribute svg:y { coordinate }? -style-graphic-properties-attlist &= common-vertical-rel-attlist -common-vertical-rel-attlist = - attribute style:vertical-rel { - "page" - | "page-content" - | "frame" - | "frame-content" - | "paragraph" - | "paragraph-content" - | "char" - | "line" - | "baseline" - | "text" - }? -style-graphic-properties-attlist &= common-text-anchor-attlist -style-graphic-properties-attlist &= common-border-attlist -style-graphic-properties-attlist &= common-border-line-width-attlist -style-graphic-properties-attlist &= common-padding-attlist -style-graphic-properties-attlist &= common-shadow-attlist -style-graphic-properties-attlist &= common-background-color-attlist -style-graphic-properties-elements &= style-background-image -style-graphic-properties-elements &= style-columns -style-graphic-properties-attlist &= - attribute style:editable { boolean }? -style-graphic-properties-attlist &= - attribute style:wrap { - "none" - | "left" - | "right" - | "parallel" - | "dynamic" - | "run-through" - | "biggest" - }? -style-graphic-properties-attlist &= - attribute style:wrap-dynamic-threshold { nonNegativeLength }? -style-graphic-properties-attlist &= - attribute style:number-wrapped-paragraphs { - "no-limit" | positiveInteger - }? -style-graphic-properties-attlist &= - attribute style:wrap-contour { boolean }? -style-graphic-properties-attlist &= - attribute style:wrap-contour-mode { "full" | "outside" }? -style-graphic-properties-attlist &= - attribute style:run-through { "foreground" | "background" }? -style-graphic-properties-attlist &= - attribute style:flow-with-text { boolean }? -style-graphic-properties-attlist &= - attribute style:overflow-behavior { - "clip" | "auto-create-new-frame" - }? -style-graphic-properties-attlist &= - attribute style:mirror { - "none" - | "vertical" - | horizontal-mirror - | list { "vertical", horizontal-mirror } - | list { horizontal-mirror, "vertical" } - }? -horizontal-mirror = - "horizontal" | "horizontal-on-odd" | "horizontal-on-even" -style-graphic-properties-attlist &= - attribute fo:clip { - # The attribute value must match the one XSL's clip - \string - }? -style-graphic-properties-attlist &= - [ a:defaultValue = "iterative" ] - attribute draw:wrap-influence-on-position { - "iterative" | "once-concurrent" | "once-successive" - }? -style-graphic-properties-attlist &= common-writing-mode-attlist -style-graphic-properties-attlist &= - attribute draw:frame-display-scrollbar { boolean }? -style-graphic-properties-attlist &= - attribute draw:frame-display-border { boolean }? -style-graphic-properties-attlist &= - attribute draw:frame-margin-horizontal { nonNegativePixelLength }?, - attribute draw:frame-margin-vertical { nonNegativePixelLength }? -nonNegativePixelLength = - xsd:string { pattern = "([0-9]+(\.[0-9]*)?|\.[0-9]+)(px)" } -style-graphic-properties-attlist &= - attribute draw:visible-area-left { nonNegativeLength }?, - attribute draw:visible-area-top { nonNegativeLength }?, - attribute draw:visible-area-width { positiveLength }?, - attribute draw:visible-area-height { positiveLength }? -style-graphic-properties-attlist &= - attribute draw:ole-draw-aspect { nonNegativeInteger }? -style-chart-properties = - element style:chart-properties { style-chart-properties-content } -style-chart-properties-content = style-properties-content -style-chart-properties-content-strict = - style-chart-properties-attlist, style-chart-properties-elements -style-chart-properties-elements = empty -style-chart-properties-attlist &= - [ a:defaultValue = "true" ] attribute chart:scale-text { boolean }? -style-chart-properties-attlist &= - attribute chart:three-dimensional { boolean }? -style-chart-properties-attlist &= attribute chart:deep { boolean }? -style-chart-properties-attlist &= - attribute chart:symbol-type { "none" } - | attribute chart:symbol-type { "automatic" } - | (attribute chart:symbol-type { "named-symbol" }, - attribute chart:symbol-name { - "square" - | "diamond" - | "arrow-down" - | "arrow-up" - | "arrow-right" - | "arrow-left" - | "bow-tie" - | "hourglass" - | "circle" - | "star" - | "x" - | "plus" - | "asterisk" - | "horizontal-bar" - | "vertical-bar" - }) - | (attribute chart:symbol-type { "image" }, - element chart:symbol-image { - attribute xlink:href { anyURI } - }) - | empty -style-chart-properties-attlist &= - attribute chart:symbol-width { nonNegativeLength }?, - attribute chart:symbol-height { nonNegativeLength }? -style-chart-properties-attlist &= - [ a:defaultValue = "false" ] attribute chart:vertical { boolean }? -style-chart-properties-attlist &= - [ a:defaultValue = "false" ] attribute chart:connect-bars { boolean }? -style-chart-properties-attlist &= - attribute chart:gap-width { integer }?, - attribute chart:overlap { integer }? -style-chart-properties-attlist &= - [ a:defaultValue = "false" ] - attribute chart:japanese-candle-stick { boolean }? -style-chart-properties-attlist &= - [ a:defaultValue = "none" ] - attribute chart:interpolation { - "none" | "cubic-spline" | "b-spline" - }?, - [ a:defaultValue = "2" ] - attribute chart:spline-order { positiveInteger }?, - [ a:defaultValue = "20" ] - attribute chart:spline-resolution { positiveInteger }? -style-chart-properties-attlist &= - [ a:defaultValue = "0" ] - attribute chart:pie-offset { nonNegativeInteger }? -style-chart-properties-attlist &= - [ a:defaultValue = "false" ] attribute chart:lines { boolean }? -style-chart-properties-attlist &= - [ a:defaultValue = "cuboid" ] - attribute chart:solid-type { - "cuboid" | "cylinder" | "cone" | "pyramid" - }? -style-chart-properties-attlist &= - [ a:defaultValue = "false" ] attribute chart:stacked { boolean }?, - [ a:defaultValue = "false" ] attribute chart:percentage { boolean }? -style-chart-properties-attlist &= - attribute chart:link-data-style-to-source { boolean }? -style-chart-properties-attlist &= attribute chart:visible { boolean }? -style-chart-properties-attlist &= - attribute chart:logarithmic { boolean }? -style-chart-properties-attlist &= - attribute chart:maximum { double }?, - attribute chart:minimum { double }?, - attribute chart:origin { double }?, - attribute chart:interval-major { double }?, - attribute chart:interval-minor-divisor { positiveInteger }? -style-chart-properties-attlist &= - attribute chart:tick-marks-major-inner { boolean }?, - attribute chart:tick-marks-major-outer { boolean }?, - attribute chart:tick-marks-minor-inner { boolean }?, - attribute chart:tick-marks-minor-outer { boolean }? -style-chart-properties-attlist &= - attribute chart:display-label { boolean }?, - attribute chart:text-overlap { boolean }?, - attribute text:line-break { boolean }?, - [ a:defaultValue = "side-by-side" ] - attribute chart:label-arrangement { - "side-by-side" | "stagger-even" | "stagger-odd" - }? -style-chart-properties-attlist &= common-style-direction-attlist -style-chart-properties-attlist &= common-rotation-angle-attlist -style-chart-properties-attlist &= - attribute chart:data-label-number { "none" | "value" | "percentage" }? -style-chart-properties-attlist &= - attribute chart:data-label-text { boolean }? -style-chart-properties-attlist &= - attribute chart:data-label-symbol { boolean }? -style-chart-properties-attlist &= - attribute chart:mean-value { boolean }? -style-chart-properties-attlist &= - [ a:defaultValue = "none" ] - attribute chart:error-category { - "none" - | "variance" - | "standard-deviation" - | "percentage" - | "error-margin" - | "constant" - }? -style-chart-properties-attlist &= - attribute chart:error-percentage { double }? -style-chart-properties-attlist &= - attribute chart:error-margin { double }? -style-chart-properties-attlist &= - attribute chart:error-lower-limit { double }?, - attribute chart:error-upper-limit { double }? -style-chart-properties-attlist &= - attribute chart:error-upper-indicator { boolean }?, - attribute chart:error-lower-indicator { boolean }? -style-chart-properties-attlist &= - [ a:defaultValue = "columns" ] - attribute chart:series-source { "columns" | "rows" }? -style-chart-properties-attlist &= - [ a:defaultValue = "none" ] - attribute chart:regression-type { - "none" | "linear" | "logarithmic" | "exponential" | "power" - }? -style-drawing-page-properties-attlist &= - attribute presentation:transition-type { - "manual" | "automatic" | "semi-automatic" - }? -style-drawing-page-properties-attlist &= - attribute presentation:transition-style { - "none" - | "fade-from-left" - | "fade-from-top" - | "fade-from-right" - | "fade-from-bottom" - | "fade-from-upperleft" - | "fade-from-upperright" - | "fade-from-lowerleft" - | "fade-from-lowerright" - | "move-from-left" - | "move-from-top" - | "move-from-right" - | "move-from-bottom" - | "move-from-upperleft" - | "move-from-upperright" - | "move-from-lowerleft" - | "move-from-lowerright" - | "uncover-to-left" - | "uncover-to-top" - | "uncover-to-right" - | "uncover-to-bottom" - | "uncover-to-upperleft" - | "uncover-to-upperright" - | "uncover-to-lowerleft" - | "uncover-to-lowerright" - | "fade-to-center" - | "fade-from-center" - | "vertical-stripes" - | "horizontal-stripes" - | "clockwise" - | "counterclockwise" - | "open-vertical" - | "open-horizontal" - | "close-vertical" - | "close-horizontal" - | "wavyline-from-left" - | "wavyline-from-top" - | "wavyline-from-right" - | "wavyline-from-bottom" - | "spiralin-left" - | "spiralin-right" - | "spiralout-left" - | "spiralout-right" - | "roll-from-top" - | "roll-from-left" - | "roll-from-right" - | "roll-from-bottom" - | "stretch-from-left" - | "stretch-from-top" - | "stretch-from-right" - | "stretch-from-bottom" - | "vertical-lines" - | "horizontal-lines" - | "dissolve" - | "random" - | "vertical-checkerboard" - | "horizontal-checkerboard" - | "interlocking-horizontal-left" - | "interlocking-horizontal-right" - | "interlocking-vertical-top" - | "interlocking-vertical-bottom" - | "fly-away" - | "open" - | "close" - | "melt" - }? -style-drawing-page-properties-attlist &= - attribute presentation:transition-speed { presentationSpeeds }? -style-drawing-page-properties-attlist &= - attribute smil:type { \string }? -style-drawing-page-properties-attlist &= - attribute smil:subtype { \string }? -style-drawing-page-properties-attlist &= - [ a:defaultValue = "forward" ] - attribute smil:direction { "forward" | "reverse" }? -style-drawing-page-properties-attlist &= - attribute smil:fadeColor { color }? -style-drawing-page-properties-attlist &= - attribute presentation:duration { duration }? -style-drawing-page-properties-attlist &= - attribute presentation:visibility { "visible" | "hidden" }? -style-drawing-page-properties-elements &= presentation-sound? -style-drawing-page-properties-attlist &= - attribute draw:background-size { "full" | "border" }? -style-drawing-page-properties-attlist &= - attribute presentation:background-objects-visible { boolean }? -style-drawing-page-properties-attlist &= - attribute presentation:background-visible { boolean }? -style-drawing-page-properties-attlist &= - attribute presentation:display-header { boolean }? -style-drawing-page-properties-attlist &= - attribute presentation:display-footer { boolean }? -style-drawing-page-properties-attlist &= - attribute presentation:display-page-number { boolean }? -style-drawing-page-properties-attlist &= - attribute presentation:display-date-time { boolean }? -\string = xsd:string -date = xsd:date -time = xsd:time -dateTime = xsd:dateTime -duration = xsd:duration -integer = xsd:integer -nonNegativeInteger = xsd:nonNegativeInteger -positiveInteger = xsd:positiveInteger -double = xsd:double -anyURI = xsd:anyURI -base64Binary = xsd:base64Binary -ID = xsd:ID -IDREF = xsd:IDREF -IDREFS = xsd:IDREFS -boolean = "true" | "false" -dateOrDateTime = xsd:date | xsd:dateTime -timeOrDateTime = xsd:time | xsd:dateTime -language = xsd:language -countryCode = xsd:token { pattern = "[A-Za-z0-9]{1,8}" } -languageCode = xsd:token { pattern = "[A-Za-z]{1,8}" } -character = xsd:string { length = "1" } -length = - xsd:string { - pattern = - "-?([0-9]+(\.[0-9]*)?|\.[0-9]+)((cm)|(mm)|(in)|(pt)|(pc)|(px))" - } -nonNegativeLength = - xsd:string { - pattern = - "([0-9]+(\.[0-9]*)?|\.[0-9]+)((cm)|(mm)|(in)|(pt)|(pc)|(px))" - } -positiveLength = - xsd:string { - pattern = - "([0-9]*[1-9][0-9]*(\.[0-9]*)?|0+\.[0-9]*[1-9][0-9]*|\.[0-9]*[1-9][0-9]*)((cm)|(mm)|(in)|(pt)|(pc)|(px))" - } -percent = xsd:string { pattern = "-?([0-9]+(\.[0-9]*)?|\.[0-9]+)%" } -relativeLength = xsd:string { pattern = "[0-9]+\*" } -coordinate = length -distance = length -color = xsd:string { pattern = "#[0-9a-fA-F]{6}" } -styleName = xsd:NCName -styleNameRef = xsd:NCName | empty -styleNameRefs = list { xsd:NCName* } -variableName = xsd:string -formula = - # A formula should start with a namespace prefix, - - # but has no restrictions - xsd:string -targetFrameName = "_self" | "_blank" | "_parent" | "_top" | \string -valueType = - "float" - | "time" - | "date" - | "percentage" - | "currency" - | "boolean" - | "string" -points = - xsd:string { pattern = "-?[0-9]+,-?[0-9]+([ ]+-?[0-9]+,-?[0-9]+)*" } -pathData = xsd:string -vector3D = - xsd:string { - pattern = - "\([ ]*-?([0-9]+(\.[0-9]*)?|\.[0-9]+)([ ]+-?([0-9]+(\.[0-9]*)?|\.[0-9]+)){2}[ ]*\)" - } -namespacedToken = - xsd:string { pattern = "[0-9a-zA-Z_]+:[0-9a-zA-Z._\-]+" } -anyAttListOrElements = - attribute * { text }*, - anyElements -anyElements = - element * { - mixed { anyAttListOrElements } - }* diff -Nru org-mode-7.7/contrib/odt/OASIS/OpenDocument-schema-v1.1.rng org-mode-7.8.02/contrib/odt/OASIS/OpenDocument-schema-v1.1.rng --- org-mode-7.7/contrib/odt/OASIS/OpenDocument-schema-v1.1.rng 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/contrib/odt/OASIS/OpenDocument-schema-v1.1.rng 1970-01-01 00:00:00.000000000 +0000 @@ -1,17891 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - boolean - short - int - long - double - string - datetime - base64Binary - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - simple - - - - - onRequest - - - - - - - - - - - - - - - - - - - simple - - - - - replace - - - - - onLoad - - - - - - - - - - - - - - - - - - - - - - - - - new - replace - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - float - - - - - - date - - - - - - time - - - - - - boolean - - - - - - string - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - true - none - - - - - condition - - - - - - - - - - - - - - - - - - - - - simple - - - - - embed - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - simple - - - - - onRequest - - - - - - - - - - - - - new - replace - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - footnote - endnote - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - previous - current - next - - - - - - - - - - - - - - previous - next - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - name - number - number-and-name - plain-number-and-name - plain-number - - - - - - - - - - - - - - - - - - - full - path - name - name-and-extension - - - - - - - - - - - - - - - - - - full - path - name - name-and-extension - area - title - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text:page-count - text:paragraph-count - text:word-count - text:character-count - text:table-count - text:image-count - text:object-count - - - - - - - - - - - - - - - - - - - - - - - - - - - - - table - query - command - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text - table - text-box - image - object - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text:reference-ref - text:bookmark-ref - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - page - chapter - direction - text - - - - - - - - - page - chapter - direction - text - category-and-value - caption - value - - - - - - - - - - - - - - - simple - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - value - unit - gap - - - - - - - - - - - - - - - - - - - - - - - - - float - - - - - - - - percentage - - - - - - - - currency - - - - - - - - - - - - - date - - - - - - - - time - - - - - - - - boolean - - - - - - - - string - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - value - none - - - - - - - - - value - formula - none - - - - - - - - - value - formula - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text:identifier - text:address - text:annote - text:author - text:booktitle - text:chapter - text:edition - text:editor - text:howpublished - text:institution - text:journal - text:month - text:note - text:number - text:organizations - text:pages - text:publisher - text:school - text:series - text:title - text:report-type - text:volume - text:year - text:url - text:custom1 - text:custom2 - text:custom3 - text:custom4 - text:custom5 - text:isbn - text:issn - - - - - - - - - - article - book - booklet - conference - custom1 - custom2 - custom3 - custom4 - custom5 - email - inbook - incollection - inproceedings - journal - manual - mastersthesis - misc - phdthesis - proceedings - techreport - unpublished - www - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - document - chapter - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - document - chapter - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text - category-and-value - caption - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - simple - - - - - - - - - - - - - - - - - - - - - - 1 - 2 - 3 - separator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - name - number - number-and-name - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - address - annote - author - bibliography-type - booktitle - chapter - custom1 - custom2 - custom3 - custom4 - custom5 - edition - editor - howpublished - identifier - institution - isbn - issn - journal - month - note - number - organizations - pages - publisher - report-type - school - series - title - url - volume - year - - - - - - - - - - - - - - - - - - - - - - - - right - - - - left - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - visible - collapse - filter - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ($?([^\. ']+|'([^']|'')+'))?\.$?[A-Z]+$?[0-9]+ - - - - - - ($?([^\. ']+|'([^']|'')+'))?\.$?[A-Z]+$?[0-9]+(:($?([^\. ']+|'([^']|'')+'))?\.$?[A-Z]+$?[0-9]+)? - - - - - - - - - - - - - - - - - - - copy-all - copy-results-only - - - - - - - - - - - - - - - simple - - - - - onRequest - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - trace-dependents - remove-dependents - trace-precedents - remove-precedents - trace-errors - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - from-another-table - to-another-table - from-same-table - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - enable - disable - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - none - unsorted - sort-ascending - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - stop - warning - information - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - column - row - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - none - - - - print-range - filter - repeat-row - repeat-column - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - column - row - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text - number - automatic - - - - - - - - - - ascending - descending - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text - number - automatic - - - - - - - - - - ascending - descending - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - auto - average - count - countnums - max - min - product - stdev - stdevp - sum - var - varp - - - - - - - - - - - - - - - - - - - - - - - - - - self - cell-range - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text - number - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - none - row - column - both - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - row - column - data - hidden - - - - - page - - - - - - - - - - - - - - - - - - - auto - average - count - countnums - max - min - product - stdev - stdevp - sum - var - varp - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - auto - average - count - countnums - max - min - product - stdev - stdevp - sum - var - varp - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - from-top - from-bottom - - - - - - - - - - - - - - data - - - - - - - - none - manual - name - - - - - - - - ascending - descending - - - - - - - - - - - - - tabular-layout - outline-subtotals-top - outline-subtotals-bottom - - - - - - - - - - - - - - - - - - - - - - - named - - - - - - - - previous - next - - - - - - - - none - member-difference - member-percentage - member-percentage-difference - running-total - row-percentage - column-percentage - total-percentage - index - - - - - - - - - - - - - - - - - - - - - - auto - - - - - - auto - - - - - - - - - - auto - - - - - - auto - - - - - - - - - - - - - seconds - minutes - hours - days - months - quarters - years - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - auto - average - count - countnums - max - min - product - stdev - stdevp - sum - var - varp - - - - - - - - - - - - - - - - - - - none - row - column - both - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - row - column - table - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - row - column - table - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - accepted - rejected - pending - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - always - screen - printer - none - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - false - - - - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - full - section - cut - arc - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - standard - lines - line - curve - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - page - frame - paragraph - char - as-char - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - top-left - top - top-right - left - center - right - bottom-left - bottom-right - - - - - - - - auto - left - right - up - down - horizontal - vertical - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - scale - scale-min - - - - - - - - scale - scale-min - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - simple - - - - - - - embed - - - - - - - onLoad - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - simple - - - - - - onRequest - - - - - - - - - - - - - - new - replace - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - simple - - - - - - - - - - - - new - replace - - - - - - - - - - - - - - - - nohref - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - parallel - perspective - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - flat - phong - gouraud - draft - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - non-primitive - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - flat - phong - gouraud - draft - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - parallel - perspective - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - none - segments - rectangle - - - - - - - - - - - - - - - - - - - - - normal - path - shape - - - - - - - - - path - shape - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - title - outline - subtitle - text - graphic - object - chart - table - orgchart - page - notes - handout - header - footer - date-time - page-number - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - simple - - - - - - - onRequest - - - - - - - new - replace - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - none - fade - move - stripes - open - close - dissolve - wavyline - random - lines - laser - appear - hide - move-short - checkerboard - rotate - stretch - - - - - - - - - - - - none - from-left - from-top - from-right - from-bottom - from-center - from-upper-left - from-upper-right - from-lower-left - from-lower-right - to-left - to-top - to-right - to-bottom - to-upper-left - to-upper-right - to-lower-right - to-lower-left - path - spiral-inward-left - spiral-inward-right - spiral-outward-left - spiral-outward-right - vertical - horizontal - to-center - clockwise - counter-clockwise - - - - - - - - - - - - slow - medium - fast - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - default - on-click - with-previous - after-previous - timing-root - main-sequence - interactive-sequence - - - - - - - - - - - - - - - - - - - - - - - custom - entrance - exit - emphasis - motion-path - ole-action - media-call - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - none - previous-page - next-page - first-page - last-page - hide - stop - execute - show - verb - fade-out - sound - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - simple - - - - - - - embed - - - - - - - onRequest - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - fixed - current-date - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - enabled - disabled - - - - - - - - - enabled - disabled - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - start - end - top - bottom - - - - - - start - center - end - - - - - - - top-start - bottom-start - top-end - bottom-end - - - - - - - - - - - - - wide - high - balanced - - - - - custom - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - none - row - column - both - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - x - y - z - - - - - - - - - - - - - - - - - - - - - - - - - - - major - minor - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - simple - - - - - onRequest - - - - - - - - - - - - - - - - get - post - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - table - query - command - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - none - current - parent - - - - - - - - - - - - - - - - - - - records - current - page - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - unchecked - checked - unknown - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - horizontal - vertical - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - submit - reset - push - url - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - flat - 3d - - - - - - - - - center - - - - - - start - end - top - bottom - - - - - - start - center - end - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - table - query - sql - sql-pass-through - value-list - table-fields - - - - - - - - - - - - - - - - - - - - - - - - - - - void - - - - - - - - - - - - - - float - - - - - - - - - - - - percentage - - - - - - - - - - - - currency - - - - - - - - - - - - - - - - - date - - - - - - - - - - - - time - - - - - - - - - - - - boolean - - - - - - - - - - - - string - - - - - - - - - - - void - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1 - i - I - - - - - - - - a - A - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - simple - - - - - onRequest - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - into-default-style-data-style - into-english-number - keep-text - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - discrete - linear - paced - spline - - - - - - - - - - - - - - - - - - - - - rgb - hsl - - - - - - - - - clockwise - counter-clockwise - - - - - - - - - - - - - - - - - - translate - scale - rotate - skewX - skewY - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - forward - reverse - - - - - - - - - forward - reverse - - - - - - - - - in - out - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - discrete - linear - paced - spline - - - - - - - - - - - - - - - - - - - - - - - none - sum - - - - - - - - - replace - sum - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - first - last - all - media - - - - - - - - - - - - - - - indefinite - - - - - - - - - remove - freeze - hold - auto - default - transition - - - - - - - - - remove - freeze - hold - transition - auto - inherit - - - - - - - - - never - always - whenNotActive - default - - - - - - - - - never - always - whenNotActive - inherit - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - all - left - right - mirrored - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - row - column - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - normal - ultra-condensed - extra-condensed - condensed - semi-condensed - semi-expanded - expanded - extra-expanded - ultra-expanded - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - simple - - - - - onRequest - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - short - long - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - short - long - - - - - - - - - - - - - - - - short - long - - - - - - - - - - - - - - - - short - long - - - - - - - - - - - - - - - - short - long - - - - - - - - - - - - - - - - - - - - - - short - long - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - short - long - - - - - - - - - - - - - - - short - long - - - - - - - - - - - - - - - short - long - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - fixed - language - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - short - medium - long - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - gregorian - gengou - ROC - hanja_yoil - hanja - hijri - jewish - buddhist - - - - - - - - - text - - - - - - - - - - paragraph - - - - - - - - - - - - - section - - - - - - - - - - ruby - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - left - right - inner - outer - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - document - chapter - page - - - - - - - - - text - page - section - document - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - address - annote - author - bibliography-type - booktitle - chapter - custom1 - custom2 - custom3 - custom4 - custom5 - edition - editor - howpublished - identifier - institution - isbn - issn - journal - month - note - number - organizations - pages - publisher - report-type - school - series - title - url - volume - year - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - table - - - - - - - - - - table-column - - - - - - - - - - table-row - - - - - - - - - - table-cell - - - - - - - - - - - - - - - - - graphic - presentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - drawing-page - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - linear - axial - radial - ellipsoid - square - rectangular - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - objectBoundingBox - - - - - - - - - - - pad - reflect - repeat - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - single - double - triple - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - simple - - - - - - - embed - - - - - - - onLoad - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - rect - round - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - chart - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - default - - - - - - - - - - portrait - landscape - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - headers - grid - annotations - objects - charts - drawings - formulas - zero-values - - - - - - - - - - - ttb - ltr - - - - - - - - - - continue - - - - - - - - - - - - - - - - - - - - - horizontal - vertical - both - none - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - left - center - right - - - - - - - - - - - - - - - - - - - none - line - both - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - normal - small-caps - - - - - - - none - lowercase - uppercase - capitalize - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - font-color - - - - - - - - - - - - - - - - - - - - - - - - - - super - sub - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - roman - swiss - modern - decorative - script - system - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - fixed - variable - - - - - - - - - - - - - - - - - - - - - - - [A-Za-z][A-Za-z0-9._\-]* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - latin - asian - complex - ignore - - - - - - - - - - normal - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - normal - italic - oblique - - - - - - - none - embossed - engraved - - - - - - - - - - - - - - - none - - - - - - - - - - - - - - - none - single - double - - - - - - - - - - - - - none - solid - dotted - dash - long-dash - dot-dash - dot-dot-dash - wave - - - - - - - - - - - - - auto - normal - bold - thin - dash - medium - thick - - - - - - - - - - font-color - - - - - - - - - - - - - - - - - - - - - - - - - - normal - bold - 100 - 200 - 300 - 400 - 500 - 600 - 700 - 800 - 900 - - - - - - - - - - - - - continuous - skip-white-space - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - none - letters - lines - - - - - - - - - - - - - - - - - - - - - none - - - none - accent - dot - circle - disc - - - above - below - - - - - - - - - - - - - - - - - - - - - - - - - fixed - line-height - - - - - - - - - - - - - - - - - - - - - - - - - - - - - true - - - none - - - - condition - - - none - - - - - - - - - - - - - - - - - - - - - - - - normal - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - start - end - left - right - center - justify - - - - - - - - - start - center - justify - - - - - - - - - - - - - - - - auto - always - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - left - center - right - - - - - - char - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - font-color - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - auto - page - - - - - - - - - no-limit - - - - - - - - - - - - - - - - - - - - - - word - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - auto - column - page - - - - - - - auto - column - page - - - - - - - - - - - - - transparent - - - - - - - - - - - - - - - - - - - - - - - - - - no-repeat - repeat - stretch - - - - - - - - - left - center - right - top - bottom - - - - - - - - - - - - - - - - left - center - right - - - - - top - center - bottom - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - auto - always - - - - - - - - - - - - - - - - - - - - - - - none - ideograph-alpha - - - - - - - - - simple - hanging - - - - - - - - - normal - strict - - - - - - - - - top - middle - bottom - auto - baseline - - - - - - - - - - - - - lr-tb - rl-tb - tb-rl - tb-lr - lr - rl - tb - page - - - - - - - - - - - - - - - - - - - - - - - - - - auto - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - above - below - - - - - - - - - left - center - right - distribute-letter - distribute-space - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - none - solid - dotted - dashed - dot-dashed - - - - - - - - - - - - - - - - - - - - - top - middle - bottom - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - left - center - right - margins - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - collapsing - separating - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - auto - always - - - - - - - - - - - - - - - - - - - - - - - top - middle - bottom - automatic - - - - - - - - - fix - value-type - - - - - - - - - - - - - ltr - ttb - - - - - - - - - auto - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - no-wrap - wrap - - - - - - - - - - - - - - - - - - - - none - bottom - top - center - - - - - - - - - none - hidden-and-protected - - - - protected - formula-hidden - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - none - dash - solid - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 0 - 1 - - - - - - - - - - - miter - round - bevel - middle - none - inherit - - - - - - - - - none - solid - bitmap - gradient - hatch - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - no-repeat - repeat - stretch - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - top-left - top - top-right - left - center - right - bottom-left - bottom - bottom-right - - - - - - - - - - - - - - - - - - - - - - - - - - - - nonzero - evenodd - - - - - - - - - - - - - - - - none - scroll - alternate - slide - - - - - - - - - left - right - up - down - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - top - middle - bottom - justify - - - - - - - - - left - center - right - justify - - - - - - - - - no-wrap - wrap - - - - - - - - - - - - - - greyscale - mono - watermark - standard - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - visible - hidden - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - below - above - - - - - - - - - - - - - - - - automatic - left-outside - inside - right-outside - - - - - - - automatic - above - below - center - - - - - - - - - automatic - mm - cm - m - km - pt - pc - inch - ft - mi - - - - - - - - - - - - - - - - - - - - - - - straight-line - angled-line - angled-connector-line - - - - - - - - - fixed - free - - - - - - - - - - - - - - - - - - - - - - - horizontal - vertical - auto - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - correct - attractive - - - - - - - - - - - - - - - - - - - - - - - enabled - disabled - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - standard - double-sided - - - - - - - - - object - flat - sphere - - - - - - - - - normal - inverse - - - - - - - - - object - parallel - sphere - - - - - - - object - parallel - sphere - - - - - - - - - luminance - intensity - color - - - - - - - - - enabled - disabled - - - - - - - - - replace - modulate - blend - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - visible - hidden - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - none - - - - content - position - size - - - - - - - - - - - - left - center - right - from-left - inside - outside - from-inside - - - - - - - - - - - - - - page - page-content - page-start-margin - page-end-margin - frame - frame-content - frame-start-margin - frame-end-margin - paragraph - paragraph-content - paragraph-start-margin - paragraph-end-margin - char - - - - - - - - - - - - - top - middle - bottom - from-top - below - - - - - - - - - - - - - - - - - - page - page-content - frame - frame-content - paragraph - paragraph-content - char - line - baseline - text - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - none - left - right - parallel - dynamic - run-through - biggest - - - - - - - - - - - - - - - - no-limit - - - - - - - - - - - - - - - - - full - outside - - - - - - - - - foreground - background - - - - - - - - - - - - - - - - clip - auto-create-new-frame - - - - - - - - - none - vertical - - - vertical - - - - - vertical - - - - - - - - - horizontal - horizontal-on-odd - horizontal-on-even - - - - - - - - - - - - - - - iterative - once-concurrent - once-successive - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ([0-9]+(\.[0-9]*)?|\.[0-9]+)(px) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - none - - - automatic - - - - named-symbol - - - - square - diamond - arrow-down - arrow-up - arrow-right - arrow-left - bow-tie - hourglass - circle - star - x - plus - asterisk - horizontal-bar - vertical-bar - - - - - - image - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - none - cubic-spline - b-spline - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - cuboid - cylinder - cone - pyramid - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - side-by-side - stagger-even - stagger-odd - - - - - - - - - - - - - - - none - value - percentage - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - none - variance - standard-deviation - percentage - error-margin - constant - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - columns - rows - - - - - - - - - none - linear - logarithmic - exponential - power - - - - - - - - - manual - automatic - semi-automatic - - - - - - - - - none - fade-from-left - fade-from-top - fade-from-right - fade-from-bottom - fade-from-upperleft - fade-from-upperright - fade-from-lowerleft - fade-from-lowerright - move-from-left - move-from-top - move-from-right - move-from-bottom - move-from-upperleft - move-from-upperright - move-from-lowerleft - move-from-lowerright - uncover-to-left - uncover-to-top - uncover-to-right - uncover-to-bottom - uncover-to-upperleft - uncover-to-upperright - uncover-to-lowerleft - uncover-to-lowerright - fade-to-center - fade-from-center - vertical-stripes - horizontal-stripes - clockwise - counterclockwise - open-vertical - open-horizontal - close-vertical - close-horizontal - wavyline-from-left - wavyline-from-top - wavyline-from-right - wavyline-from-bottom - spiralin-left - spiralin-right - spiralout-left - spiralout-right - roll-from-top - roll-from-left - roll-from-right - roll-from-bottom - stretch-from-left - stretch-from-top - stretch-from-right - stretch-from-bottom - - vertical-lines - horizontal-lines - dissolve - random - vertical-checkerboard - horizontal-checkerboard - interlocking-horizontal-left - interlocking-horizontal-right - interlocking-vertical-top - interlocking-vertical-bottom - fly-away - open - close - melt - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - forward - reverse - - - - - - - - - - - - - - - - - - - - - - - visible - hidden - - - - - - - - - - - - - - full - border - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - true - false - - - - - - - - - - - - - - - - - - - - [A-Za-z0-9]{1,8} - - - - - [A-Za-z]{1,8} - - - - - 1 - - - - - -?([0-9]+(\.[0-9]*)?|\.[0-9]+)((cm)|(mm)|(in)|(pt)|(pc)|(px)) - - - - - - ([0-9]+(\.[0-9]*)?|\.[0-9]+)((cm)|(mm)|(in)|(pt)|(pc)|(px)) - - - - - - ([0-9]*[1-9][0-9]*(\.[0-9]*)?|0+\.[0-9]*[1-9][0-9]*|\.[0-9]*[1-9][0-9]*)((cm)|(mm)|(in)|(pt)|(pc)|(px)) - - - - - - -?([0-9]+(\.[0-9]*)?|\.[0-9]+)% - - - - - [0-9]+\* - - - - - - - - - - - #[0-9a-fA-F]{6} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - _self - _blank - _parent - _top - - - - - - - float - time - date - percentage - currency - boolean - string - - - - - - -?[0-9]+,-?[0-9]+([ ]+-?[0-9]+,-?[0-9]+)* - - - - - - - - - \([ ]*-?([0-9]+(\.[0-9]*)?|\.[0-9]+)([ ]+-?([0-9]+(\.[0-9]*)?|\.[0-9]+)){2}[ ]*\) - - - - - - - [0-9a-zA-Z_]+:[0-9a-zA-Z._\-]+ - - - - - - - - - - - - - - - - - - - - - - diff -Nru org-mode-7.7/contrib/odt/OASIS/OpenDocument-v1.2-cs01-manifest-schema.rng org-mode-7.8.02/contrib/odt/OASIS/OpenDocument-v1.2-cs01-manifest-schema.rng --- org-mode-7.7/contrib/odt/OASIS/OpenDocument-v1.2-cs01-manifest-schema.rng 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/contrib/odt/OASIS/OpenDocument-v1.2-cs01-manifest-schema.rng 1970-01-01 00:00:00.000000000 +0000 @@ -1,224 +0,0 @@ - - - - - - - - - - - - - - - - - - - 1.2 - - - - - - - - - - - - - - - - - - - - - - - - - - - edit - presentation-slide-show - read-only - - - - - - - - - - - - - - - - - - - - - - - - - - - SHA1/1K - - - - - - - - - - - - - - - - - - - Blowfish CFB - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - PBKDF2 - - - - - - - - - - - - - - - - - - - - - - - - - - - SHA1 - - - - - - - - - - - - - - - - [^:]+:[^:]+ - - - - - - - - - - - - diff -Nru org-mode-7.7/contrib/odt/OASIS/OpenDocument-v1.2-cs01-schema.rng org-mode-7.8.02/contrib/odt/OASIS/OpenDocument-v1.2-cs01-schema.rng --- org-mode-7.7/contrib/odt/OASIS/OpenDocument-v1.2-cs01-schema.rng 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/contrib/odt/OASIS/OpenDocument-v1.2-cs01-schema.rng 1970-01-01 00:00:00.000000000 +0000 @@ -1,18127 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1.2 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - boolean - short - int - long - double - string - datetime - base64Binary - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - simple - - - - - - - onRequest - - - - - - - - - - - - - - - - - simple - - - - - - - replace - - - - - onLoad - - - - - - - - - - - - - - - - - - - new - replace - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - float - - - - - - date - - - - - - time - - - - - - boolean - - - - - - string - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - true - none - - - - - condition - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - simple - - - - - - - embed - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text:page-count - text:paragraph-count - text:word-count - text:character-count - text:table-count - text:image-count - text:object-count - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text:reference-ref - text:bookmark-ref - - - - - - - - - - - - - - - - - - - - - - - - simple - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - value - unit - gap - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text:identifier - text:address - text:annote - text:author - text:booktitle - text:chapter - text:edition - text:editor - text:howpublished - text:institution - text:journal - text:month - text:note - text:number - text:organizations - text:pages - text:publisher - text:school - text:series - text:title - text:report-type - text:volume - text:year - text:url - text:custom1 - text:custom2 - text:custom3 - text:custom4 - text:custom5 - text:isbn - text:issn - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - simple - - - - - - - onRequest - - - - - - - - - - - new - replace - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - footnote - endnote - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - previous - current - next - - - - - - - - - - previous - next - - - - - - - - - - - - - - name - number - number-and-name - plain-number-and-name - plain-number - - - - - - - - - - - - - full - path - name - name-and-extension - - - - - - - - - - - full - path - name - name-and-extension - area - title - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - table - query - command - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text - table - text-box - image - object - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - number-no-superior - number-all-superior - number - - - - - - - - - - - - - - - - - - - - - - category-and-value - caption - value - - - - - - - page - chapter - direction - text - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - float - - - - - - - - percentage - - - - - - - - currency - - - - - - - - - - - - - date - - - - - - - - time - - - - - - - - boolean - - - - - - - - string - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - value - none - - - - - - - - - value - formula - none - - - - - - - - - value - formula - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - article - book - booklet - conference - custom1 - custom2 - custom3 - custom4 - custom5 - email - inbook - incollection - inproceedings - journal - manual - mastersthesis - misc - phdthesis - proceedings - techreport - unpublished - www - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - document - chapter - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text - category-and-value - caption - - - - - - - - - - document - chapter - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - simple - - - - - - - - - - - - - - - - - - - - - - - - - 1 - 2 - 3 - separator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - name - number - number-and-name - plain-number - plain-number-and-name - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - address - annote - author - bibliography-type - booktitle - chapter - custom1 - custom2 - custom3 - custom4 - custom5 - edition - editor - howpublished - identifier - institution - isbn - issn - journal - month - note - number - organizations - pages - publisher - report-type - school - series - title - url - volume - year - - - - - - - - - - - - - - - - - - - - - - - - right - - - - left - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - visible - collapse - filter - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ($?([^\. ']+|'([^']|'')+'))?\.$?[A-Z]+$?[0-9]+ - - - - - - ($?([^\. ']+|'([^']|'')+'))?\.$?[A-Z]+$?[0-9]+(:($?([^\. ']+|'([^']|'')+'))?\.$?[A-Z]+$?[0-9]+)? - - - ($?([^\. ']+|'([^']|'')+'))?\.$?[0-9]+:($?([^\. ']+|'([^']|'')+'))?\.$?[0-9]+ - - - ($?([^\. ']+|'([^']|'')+'))?\.$?[A-Z]+:($?([^\. ']+|'([^']|'')+'))?\.$?[A-Z]+ - - - - - - Value is a space separated list of "cellRangeAddress" patterns - - - - - - - - - - - - - - copy-all - copy-results-only - - - - - - - - - - - - - - simple - - - - - - - onRequest - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - trace-dependents - remove-dependents - trace-precedents - remove-precedents - trace-errors - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - from-another-table - to-another-table - from-same-table - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - date - - - - - - - - - - - - - - - - enable - disable - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - none - unsorted - sort-ascending - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - stop - warning - information - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - column - row - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - none - - - - print-range - filter - repeat-row - repeat-column - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - column - row - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - alpha-numeric - integer - double - - - - - - - - - - - - - - - - - - - - text - number - automatic - - - - - - - - ascending - descending - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text - number - automatic - - - - - - - - ascending - descending - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - average - count - countnums - max - min - product - stdev - stdevp - sum - var - varp - - - - - - - - - - - - - - - - - - - - - - - - - - self - cell-range - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text - number - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - none - row - column - both - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - row - column - data - hidden - - - - - page - - - - - - - - - - - - - - - auto - average - count - countnums - max - min - product - stdev - stdevp - sum - var - varp - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - auto - average - count - countnums - max - min - product - stdev - stdevp - sum - var - varp - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - from-top - from-bottom - - - - - - - - - - - - - - - - data - - - - - - - - none - manual - name - - - - - - ascending - descending - - - - - - - - - - - - - - - tabular-layout - outline-subtotals-top - outline-subtotals-bottom - - - - - - - - - - - - - - - - - - - - - named - - - - - - - - previous - next - - - - - - none - member-difference - member-percentage - member-percentage-difference - running-total - row-percentage - column-percentage - total-percentage - index - - - - - - - - - - - - - - - - - - - - - - auto - - - - - - auto - - - - - - - - auto - - - - - - auto - - - - - - - - - seconds - minutes - hours - days - months - quarters - years - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - average - count - countnums - max - min - product - stdev - stdevp - sum - var - varp - - - - - - - - - - - - - none - row - column - both - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - row - column - table - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - row - column - table - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - accepted - rejected - pending - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - always - screen - printer - none - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - false - - - - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - full - section - cut - arc - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - standard - lines - line - curve - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - page - frame - paragraph - char - as-char - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - top-left - top - top-right - left - center - right - bottom-left - bottom-right - - - - - - auto - left - right - up - down - horizontal - vertical - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - scale - scale-min - - - - - - - - scale - scale-min - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - simple - - - - - - - embed - - - - - onLoad - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - simple - - - - - - - onRequest - - - - - - - - - - - new - replace - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - simple - - - - - - - - - - - - - new - replace - - - - - - - - - - - - nohref - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - parallel - perspective - - - - - - - - - - - - - - - - - - - - - - flat - phong - gouraud - draft - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - flat - phong - gouraud - draft - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - parallel - perspective - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - none - segments - rectangle - - - - - - - - - - - - - - - - - normal - path - shape - - - - - - - path - shape - - - - - - - - - - - - - - - - - - non-primitive - - - - - - \([ ]*-?([0-9]+(\.[0-9]*)?|\.[0-9]+)((cm)|(mm)|(in)|(pt)|(pc))([ ]+-?([0-9]+(\.[0-9]*)?|\.[0-9]+)((cm)|(mm)|(in)|(pt)|(pc))){2}[ ]*\) - - - - - -0.5 - 0.5 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - title - outline - subtitle - text - graphic - object - chart - table - orgchart - page - notes - handout - header - footer - date-time - page-number - - - - - - - - - - - - - - - - - - - - - - - - - - - simple - - - - - - - onRequest - - - - - - new - replace - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - none - fade - move - stripes - open - close - dissolve - wavyline - random - lines - laser - appear - hide - move-short - checkerboard - rotate - stretch - - - - - none - from-left - from-top - from-right - from-bottom - from-center - from-upper-left - from-upper-right - from-lower-left - from-lower-right - to-left - to-top - to-right - to-bottom - to-upper-left - to-upper-right - to-lower-right - to-lower-left - path - spiral-inward-left - spiral-inward-right - spiral-outward-left - spiral-outward-right - vertical - horizontal - to-center - clockwise - counter-clockwise - - - - - slow - medium - fast - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - default - on-click - with-previous - after-previous - timing-root - main-sequence - interactive-sequence - - - - - - - - - - - - - - - - - custom - entrance - exit - emphasis - motion-path - ole-action - media-call - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - none - previous-page - next-page - first-page - last-page - hide - stop - execute - show - verb - fade-out - sound - last-visited-page - - - - - - - - - - - - - - - - - - - - - - - - - simple - - - - - - - embed - - - - - onRequest - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - fixed - current-date - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - enabled - disabled - - - - - - - enabled - disabled - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - simple - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - start - end - top - bottom - - - - - - start - center - end - - - - - - - top-start - bottom-start - top-end - bottom-end - - - - - - - - - wide - high - balanced - - - - - custom - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - none - row - column - both - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - x - y - z - - - - - - - - - - - - - - - - - - - - - - major - minor - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - simple - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - simple - - - - - - - none - - - - - onRequest - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - equal-integer - is-boolean - equal-boolean - equal-use-only-zero - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - boolean - short - int - long - double - string - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - simple - - - - - - - none - - - - - onRequest - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - no-nulls - nullable - - - - - - - - - - - - - - - - - - - - bit - boolean - tinyint - smallint - integer - bigint - float - real - double - numeric - decimal - char - varchar - longvarchar - date - time - timestmp - binary - varbinary - longvarbinary - sqlnull - other - object - distinct - struct - array - blob - clob - ref - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - primary - unique - foreign - - - - - - - - - - - - - cascade - restrict - set-null - no-action - set-default - - - - - - - - cascade - restrict - set-null - no-action - set-default - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - simple - - - - - - - onRequest - - - - - - - - - - - - get - post - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - table - query - command - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - none - current - parent - - - - - records - current - page - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - selection - selection-indices - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - unchecked - checked - unknown - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - horizontal - vertical - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - submit - reset - push - url - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - flat - 3d - - - - - - - - - center - - - - - - start - end - top - bottom - - - - - - start - center - end - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - table - query - sql - sql-pass-through - value-list - table-fields - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void - - - - - - - - float - - - - - - - - - - - - percentage - - - - - - - - - - - - currency - - - - - - - - - - - - - - - - - date - - - - - - - - - - - - time - - - - - - - - - - - - boolean - - - - - - - - - - - - string - - - - - - - - - - - void - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1 - i - I - - - - - - - - a - A - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - simple - - - - - - - onRequest - - - - - - - - - - - - - To avoid inclusion of the complete MathML schema, anything is allowed within a math:math top-level element - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - into-default-style-data-style - into-english-number - keep-text - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - discrete - linear - paced - spline - - - - - - - - - - - rgb - hsl - - - - - - - clockwise - counter-clockwise - - - - - - - - - translate - scale - rotate - skewX - skewY - - - - - - - - - - - - - - - - - forward - reverse - - - - - - - - - - - - in - out - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - discrete - linear - paced - spline - - - - - - - - - - - - - - - - - - - - - - - - none - sum - - - - - - - replace - sum - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - first - last - all - media - - - - - - - - - - - - - - - - indefinite - - - - - - - 0.0 - - - - - - - remove - freeze - hold - auto - default - transition - - - - - - - - - remove - freeze - hold - transition - auto - inherit - - - - - - - - - never - always - whenNotActive - default - - - - - - - - - never - always - whenNotActive - inherit - - - - - - - - - - - - - - - - - - - - - - - - - - 0 - 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - all - left - right - mirrored - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - row - column - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - normal - ultra-condensed - extra-condensed - condensed - semi-condensed - semi-expanded - expanded - extra-expanded - ultra-expanded - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - simple - - - - - - - onRequest - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - short - long - - - - - - - - - - - - - - - - - - - - - - - - - - - short - long - - - - - - - - - - - - - - - - - short - long - - - - - - - - - - - - - - - - short - long - - - - - - - - - - - - - - - - short - long - - - - - - - - - - - - - - - - - - - - - - short - long - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - short - long - - - - - - - - - - - - - - - short - long - - - - - - - - - - - - - - - - short - long - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - short - medium - long - - - - - - - - - - - - - - - - - fixed - language - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - gregorian - gengou - ROC - hanja_yoil - hanja - hijri - jewish - buddhist - - - - - - - - - - text - - - - - - - - paragraph - - - - - - - - - - - section - - - - - - - - ruby - - - - - - - - table - - - - - - - - table-column - - - - - - - - table-row - - - - - - - - table-cell - - - - - - - - - - - - - - - graphic - presentation - - - - - - - - - - - - - - - drawing-page - - - - - - - - chart - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - left - right - inner - outer - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - document - chapter - page - - - - - - - text - page - section - document - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - address - annote - author - bibliography-type - booktitle - chapter - custom1 - custom2 - custom3 - custom4 - custom5 - edition - editor - howpublished - identifier - institution - isbn - issn - journal - month - note - number - organizations - pages - publisher - report-type - school - series - title - url - volume - year - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - linear - axial - radial - ellipsoid - square - rectangular - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - objectBoundingBox - - - - - - - - - - - pad - reflect - repeat - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - single - double - triple - - - - - - - - - - - - - - - - - - - - - - - - simple - - - - - - - embed - - - - - onLoad - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - rect - round - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - default - - - - - - - - portrait - landscape - - - - - - - - - - - - - - - - - - - - - - headers - grid - annotations - objects - charts - drawings - formulas - zero-values - - - - - - - - - ttb - ltr - - - - - - - - continue - - - - - - - - - - - - - - - - - horizontal - vertical - both - none - - - - - - - - - - - - - none - line - both - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - left - center - right - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - none - lowercase - uppercase - capitalize - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - font-color - - - - - - - - - - - - - - - - - - - - super - sub - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - latin - asian - complex - ignore - - - - - - - - normal - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - none - embossed - engraved - - - - - - - - - - - - - - - - - - - - - - - - - - - font-color - - - - - - - - - - - - - - - - - - - - - - - font-color - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - none - letters - lines - - - - - - - - - - - - - - - - - none - - - none - accent - dot - circle - disc - - - above - below - - - - - - - - - - - - - - - - - - - fixed - line-height - - - - - - - - - - - - - - - - - - - - - true - - - none - - - - condition - - - none - - - - - - - - - normal - small-caps - - - - - roman - swiss - modern - decorative - script - system - - - - - fixed - variable - - - - - [A-Za-z][A-Za-z0-9._\-]* - - - - - normal - italic - oblique - - - - - none - - - - - - none - single - double - - - - - none - solid - dotted - dash - long-dash - dot-dash - dot-dot-dash - wave - - - - - auto - normal - bold - thin - medium - thick - - - - - - - - normal - bold - 100 - 200 - 300 - 400 - 500 - 600 - 700 - 800 - 900 - - - - - continuous - skip-white-space - - - - - - - - - - - - - - - - - normal - - - - - - - - - - - - - - - - - - - - - - - - - start - center - justify - - - - - - - - - - - - auto - always - - - - - - - - - - - - - - - - - - - - - - auto - page - - - - - - - no-limit - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - none - ideograph-alpha - - - - - - - simple - hanging - - - - - - - normal - strict - - - - - - - top - middle - bottom - auto - baseline - - - - - - - - - - - - - - - - - - - - - - - start - end - left - right - center - justify - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - left - center - right - - - - - - char - - - - - - - - - - - - - - - - - - - - - - - font-color - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - word - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - auto - column - page - - - - - - - auto - column - page - - - - - - - - - transparent - - - - - - - - - - - - - - - - - - - - - - - no-repeat - repeat - stretch - - - - - - - left - center - right - top - bottom - - - - - - - - - - - - - - - - - - - - - - - - - - left - center - right - - - - - top - center - bottom - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - auto - always - - - - - - - - - lr-tb - rl-tb - tb-rl - tb-lr - lr - rl - tb - page - - - - - - - - - - auto - - - - - - - - - - - - - - - - - - - - - - - - - - - - - above - below - - - - - - - left - center - right - distribute-letter - distribute-space - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - none - solid - dotted - dashed - dot-dashed - - - - - - - - - - - - - - - top - middle - bottom - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - left - center - right - margins - - - - - - - - - - - - - - - - - - - - collapsing - separating - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - auto - always - - - - - - - - - - - - - - - - - - - - - - - top - middle - bottom - automatic - - - - - - - fix - value-type - - - - - - - - auto - 0 - 0deg - 0rad - 0grad - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - no-wrap - wrap - - - - - - - - none - bottom - top - center - - - - - - - none - hidden-and-protected - - - - protected - formula-hidden - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ltr - ttb - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - label-width-and-position - label-alignment - - - - - - - - - - - - - - - - - - - - - listtab - space - nothing - - - - - - - - - - - - - - - - - - - - - - - - - none - dash - solid - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 0 - 1 - - - - - - - - - miter - round - bevel - middle - none - - - - - - - butt - square - round - - - - - - - - - - - - none - scroll - alternate - slide - - - - - - - left - right - up - down - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - top - middle - bottom - justify - - - - - - - left - center - right - justify - - - - - - - no-wrap - wrap - - - - - - - - - - - - greyscale - mono - watermark - standard - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - visible - hidden - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - below - above - - - - - - - - - - - - automatic - left-outside - inside - right-outside - - - - - - - automatic - above - below - center - - - - - - - automatic - mm - cm - m - km - pt - pc - inch - ft - mi - - - - - - - - - - - - - - - - - straight-line - angled-line - angled-connector-line - - - - - - - fixed - free - - - - - - - - - - - - - - - - - horizontal - vertical - auto - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - correct - attractive - - - - - - - - - - - - - - - - - enabled - disabled - - - - - - - - - - - - - - - - - - - - - - standard - double-sided - - - - - - - object - flat - sphere - - - - - - - normal - inverse - - - - - - - object - parallel - sphere - - - - - - - object - parallel - sphere - - - - - - - luminance - intensity - color - - - - - - - enabled - disabled - - - - - - - replace - modulate - blend - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - visible - hidden - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - none - - - - content - position - size - - - - - - - - - - left - center - right - from-left - inside - outside - from-inside - - - - - - - - - - - - page - page-content - page-start-margin - page-end-margin - frame - frame-content - frame-start-margin - frame-end-margin - paragraph - paragraph-content - paragraph-start-margin - paragraph-end-margin - char - - - - - - - - - - - - - - - - - none - left - right - parallel - dynamic - run-through - biggest - - - - - - - - - - - - no-limit - - - - - - - - - - - - - full - outside - - - - - - - foreground - background - - - - - - - - - - - - clip - auto-create-new-frame - - - - - - - none - vertical - - - vertical - - - - - vertical - - - - - - - - auto - - - - - - - - iterative - once-concurrent - once-successive - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - content - thumbnail - icon - print-view - - - - - - - - - - - - - - - - none - solid - bitmap - gradient - hatch - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - no-repeat - repeat - stretch - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - top-left - top - top-right - left - center - right - bottom-left - bottom - bottom-right - - - - - - - - - horizontal - vertical - - - - - - - - - - - - - - - - - - nonzero - evenodd - - - - - - - - - - - - - - - - - - - top - middle - bottom - from-top - below - - - - - - - - - - - - - - page - page-content - frame - frame-content - paragraph - paragraph-content - char - line - baseline - text - - - - - - - - - - - - - - horizontal - horizontal-on-odd - horizontal-on-even - - - - - rect\([ ]*((-?([0-9]+(\.[0-9]*)?|\.[0-9]+)((cm)|(mm)|(in)|(pt)|(pc)))|(auto))([ ]*,[ ]*((-?([0-9]+(\.[0-9]*)?|\.[0-9]+)((cm)|(mm)|(in)|(pt)|(pc))))|(auto)){3}[ ]*\) - - - - - ([0-9]+(\.[0-9]*)?|\.[0-9]+)(px) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - none - - - automatic - - - - named-symbol - - - - square - diamond - arrow-down - arrow-up - arrow-right - arrow-left - bow-tie - hourglass - circle - star - x - plus - asterisk - horizontal-bar - vertical-bar - - - - - - image - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - none - cubic-spline - b-spline - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - cuboid - cylinder - cone - pyramid - - - - - - - - - - - - - - - - - use-zero - leave-gap - ignore - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - side-by-side - stagger-even - stagger-odd - - - - - - - - - none - value - percentage - value-and-percentage - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - none - variance - standard-deviation - percentage - error-margin - constant - standard-error - cell-range - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - columns - rows - - - - - - - none - linear - logarithmic - exponential - power - - - - - - - start - end - - - - - - - - near-axis - near-axis-other-side - outside-start - outside-end - - - - - - - at-labels - at-axis - at-labels-and-axis - - - - - - - - - - - - - avoid-overlap - center - top - top-right - right - bottom-right - bottom - bottom-left - left - top-left - inside - outside - near-origin - - - - - - - - manual - automatic - semi-automatic - - - - - - - none - fade-from-left - fade-from-top - fade-from-right - fade-from-bottom - fade-from-upperleft - fade-from-upperright - fade-from-lowerleft - fade-from-lowerright - move-from-left - move-from-top - move-from-right - move-from-bottom - move-from-upperleft - move-from-upperright - move-from-lowerleft - move-from-lowerright - uncover-to-left - uncover-to-top - uncover-to-right - uncover-to-bottom - uncover-to-upperleft - uncover-to-upperright - uncover-to-lowerleft - uncover-to-lowerright - fade-to-center - fade-from-center - vertical-stripes - horizontal-stripes - clockwise - counterclockwise - open-vertical - open-horizontal - close-vertical - close-horizontal - wavyline-from-left - wavyline-from-top - wavyline-from-right - wavyline-from-bottom - spiralin-left - spiralin-right - spiralout-left - spiralout-right - roll-from-top - roll-from-left - roll-from-right - roll-from-bottom - stretch-from-left - stretch-from-top - stretch-from-right - stretch-from-bottom - vertical-lines - horizontal-lines - dissolve - random - vertical-checkerboard - horizontal-checkerboard - interlocking-horizontal-left - interlocking-horizontal-right - interlocking-vertical-top - interlocking-vertical-bottom - fly-away - open - close - melt - - - - - - - - - - - - - - - - - - - - - - forward - reverse - - - - - - - - - - - - - - - - - visible - hidden - - - - - - - full - border - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - true - false - - - - - - - - - - - - - - - - - - - - [A-Za-z0-9]{1,8} - - - - - [A-Za-z]{1,8} - - - - - [A-Za-z0-9]{1,8} - - - - - 1 - - - - - -?([0-9]+(\.[0-9]*)?|\.[0-9]+)((cm)|(mm)|(in)|(pt)|(pc)|(px)) - - - - - ([0-9]+(\.[0-9]*)?|\.[0-9]+)((cm)|(mm)|(in)|(pt)|(pc)|(px)) - - - - - ([0-9]*[1-9][0-9]*(\.[0-9]*)?|0+\.[0-9]*[1-9][0-9]*|\.[0-9]*[1-9][0-9]*)((cm)|(mm)|(in)|(pt)|(pc)|(px)) - - - - - -?([0-9]+(\.[0-9]*)?|\.[0-9]+)% - - - - - ([0-9]?[0-9](\.[0-9]*)?|100(\.0*)?|\.[0-9]+)% - - - - - -?([0-9]?[0-9](\.[0-9]*)?|100(\.0*)?|\.[0-9]+)% - - - - - [0-9]+\* - - - - - - - - - - - #[0-9a-fA-F]{6} - - - - - - - - (([\i-[:]][\c-[:]]*)?:)?.+ - 1 - - - - - - - - - - - - \[(([\i-[:]][\c-[:]]*)?:)?.+\] - 3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - _self - _blank - _parent - _top - - - - - - float - time - date - percentage - currency - boolean - string - - - - - -?[0-9]+,-?[0-9]+([ ]+-?[0-9]+,-?[0-9]+)* - - - - - - - - \([ ]*-?([0-9]+(\.[0-9]*)?|\.[0-9]+)([ ]+-?([0-9]+(\.[0-9]*)?|\.[0-9]+)){2}[ ]*\) - - - - - [^:]+:[^:]+ - - - - - An IRI-reference as defined in [RFC3987]. See ODF 1.2 Part 1 section 18.3. - - - - - - - - - - - - - - - - - - - - - diff -Nru org-mode-7.7/contrib/odt/styles/OrgOdtAutomaticStyles.xml org-mode-7.8.02/contrib/odt/styles/OrgOdtAutomaticStyles.xml --- org-mode-7.7/contrib/odt/styles/OrgOdtAutomaticStyles.xml 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/contrib/odt/styles/OrgOdtAutomaticStyles.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,152 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -Nru org-mode-7.7/contrib/odt/styles/OrgOdtStyles.xml org-mode-7.8.02/contrib/odt/styles/OrgOdtStyles.xml --- org-mode-7.7/contrib/odt/styles/OrgOdtStyles.xml 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/contrib/odt/styles/OrgOdtStyles.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,668 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -Nru org-mode-7.7/contrib/README org-mode-7.8.02/contrib/README --- org-mode-7.7/contrib/README 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/contrib/README 2011-12-13 00:34:24.000000000 +0000 @@ -46,6 +46,7 @@ org-screen.el --- Visit screen sessions through Org-mode links org-secretary.el --- Team management with org-mode org-special-blocks.el --- Turn blocks into LaTeX envs and HTML divs +org-sudoku.el --- Create and solve SUDOKU puzzles in Org tables orgtbl-sqlinsert.el --- Convert Org-mode tables to SQL insertions org-toc.el --- Table of contents for Org-mode buffer org-track.el --- Keep up with Org development diff -Nru org-mode-7.7/debian/changelog org-mode-7.8.02/debian/changelog --- org-mode-7.7/debian/changelog 2011-11-11 14:09:35.000000000 +0000 +++ org-mode-7.8.02/debian/changelog 2011-12-13 15:59:28.000000000 +0000 @@ -1,3 +1,10 @@ +org-mode (7.8.02-1) unstable; urgency=low + + * New upstream release + * Updated debian/watch file + + -- Sebastien Delafond Tue, 13 Dec 2011 16:58:49 +0100 + org-mode (7.7-3) unstable; urgency=low * More conventional debian/rules, not requiring root; thanks Colin diff -Nru org-mode-7.7/doc/org org-mode-7.8.02/doc/org --- org-mode-7.7/doc/org 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/doc/org 2011-12-13 00:34:24.000000000 +0000 @@ -1,9 +1,8 @@ This is org, produced by makeinfo version 4.11 from org.texi. -This manual is for Org version 7.7. +This manual is for Org version 7.8.02. - Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free -Software Foundation, Inc. + Copyright (C) 2004-2011 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, @@ -34,10 +33,9 @@ Org Mode Manual *************** -This manual is for Org version 7.7. +This manual is for Org version 7.8.02. - Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free -Software Foundation, Inc. + Copyright (C) 2004-2011 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, @@ -125,7 +123,7 @@ * Column formulas:: Formulas valid for an entire column * Editing and debugging formulas:: Fixing formulas * Updating the table:: Recomputing all dependent fields -* Advanced features:: Field names, parameters and automatic recalc +* Advanced features:: Field and column names, parameters and automatic recalc Hyperlinks @@ -316,7 +314,7 @@ * HTML export:: Exporting to HTML * LaTeX and PDF export:: Exporting to LaTeX, and processing to PDF * DocBook export:: Exporting to DocBook -* OpenDocumentText export:: Exporting to OpenDocumentText +* OpenDocument Text export:: Exporting to OpenDocument Text * TaskJuggler export:: Exporting to TaskJuggler * Freemind export:: Exporting to Freemind mind maps * XOXO export:: Exporting to XOXO @@ -353,15 +351,30 @@ * Images in DocBook export:: How to insert figures into DocBook output * Special characters:: How to handle special characters -OpenDocument export +OpenDocument Text export -* OpenDocumentText export commands:: How to invoke OpenDocumentText export -* Applying Custom Styles:: How to apply custom styles to the output -* Converting to Other formats:: How to convert to formats like doc, docx etc -* Links in OpenDocumentText export:: How links will be interpreted and formatted -* Tables in OpenDocumentText export:: How Tables are handled -* Images in OpenDocumentText export:: How to insert figures -* Additional Documentation:: How to handle special characters +* Pre-requisites for ODT export:: What packages ODT exporter relies on +* ODT export commands:: How to invoke ODT export +* Applying custom styles:: How to apply custom styles to the output +* Links in ODT export:: How links will be interpreted and formatted +* Tables in ODT export:: How Tables are exported +* Images in ODT export:: How to insert images +* Math formatting in ODT export:: How LaTeX fragments are formatted +* Literal examples in ODT export:: How source and example blocks are formatted +* Advanced topics in ODT export:: Read this if you are a power user + +Math formatting in ODT export + +* Working with LaTeX math snippets:: How to embed LaTeX math fragments +* Working with MathML or OpenDocument formula files:: How to embed equations in native format + +Advanced topics in ODT export + +* Exporting and converting to other formats:: How to produce `pdf' and other formats +* Working with OpenDocument style files:: Explore the internals +* Creating one-off styles:: How to produce custom highlighting etc +* Customizing tables in ODT export:: How to define and use Table templates +* Validating OpenDocument XML:: How to debug corrupt OpenDocument files Publishing @@ -698,6 +711,34 @@ Email from within Emacs, please copy and paste the content into your Email program. + Sometimes you might face a problem due to an error in your Emacs or +Org-mode setup. Before reporting a bug, it is very helpful to start +Emacs with minimal customisations and reproduce the problem. Doing so +often helps you determine if the problem is with your customisation or +with Org-mode itself. You can start a typical minimal session with a +command like the example below. + + $ emacs -Q -l /path/to/minimal-org.el + + However if you are using Org-mode as distributed with Emacs, a +minimal setup is not necessary. In that case it is sufficient to start +Emacs as `emacs -Q'. The `minimal-org.el' setup file can have contents +as shown below. + + ;;; Minimal setup to load latest `org-mode' + + ;; activate debugging + (setq debug-on-error t + debug-on-signal nil + debug-on-quit nil) + + ;; add latest org-mode to load path + (add-to-list 'load-path (expand-file-name "/path/to/org-mode/lisp")) + (add-to-list 'load-path (expand-file-name "/path/to/org-mode/contrib/lisp")) + + ;; activate org + (require 'org-install) + If an error occurs, a backtrace can be very useful (see below on how to create one). Often a small example file helps, along with clear information about: @@ -1951,7 +1992,7 @@ * Column formulas:: Formulas valid for an entire column * Editing and debugging formulas:: Fixing formulas * Updating the table:: Recomputing all dependent fields -* Advanced features:: Field names, parameters and automatic recalc +* Advanced features:: Field and column names, parameters and automatic recalc  File: org, Node: References, Next: Formula syntax for Calc, Prev: The spreadsheet, Up: The spreadsheet @@ -2475,8 +2516,8 @@ ----------------------- If you want the recalculation of fields to happen automatically, or if -you want to be able to assign names to fields and columns, you need to -reserve the first column of the table for special marking characters. +you want to be able to assign names(1) to fields and columns, you need +to reserve the first column of the table for special marking characters. `C-# (`org-table-rotate-recalc-marks')' Rotate the calculation mark in first column through the states ` ', @@ -2565,6 +2606,11 @@ |---+-------------+---+-----+--------------------------------------| #+TBLFM: $5=taylor($2,$4,$3);n3 + ---------- Footnotes ---------- + + (1) Such names must start by an alphabetic character and use only +alphanumeric/underscore characters. +  File: org, Node: Org-Plot, Prev: The spreadsheet, Up: Tables @@ -2784,11 +2830,13 @@ ./papers/last.pdf same as above file:/myself@some.where:papers/last.pdf file, path on remote machine /myself@some.where:papers/last.pdf same as above - file:sometextfile::NNN file with line number to jump to + file:sometextfile::NNN file, jump to line number file:projects.org another Org file - file:projects.org::some words text search in Org file + file:projects.org::some words text search in Org file(1) file:projects.org::*task title heading search in Org file - docview:papers/last.pdf::NNN open file in doc-view mode at page NNN + file+sys:/path/to/file open via OS, like double-click + file+emacs:/path/to/file force opening by Emacs + docview:papers/last.pdf::NNN open in doc-view mode at page id:B7423F4D-2E8A-471B-8810-C40F074717E9 Link to heading by ID news:comp.emacs Usenet link mailto:adent@galaxy.net Mail link @@ -2805,7 +2853,7 @@ gnus:group#id Gnus article link bbdb:R.*Stallman BBDB link (with regexp) irc:/irc.com/#emacs/bob IRC link - info:org#External%20links Info node link (with encoded space) + info:org#External links Info node link shell:ls *.org A shell command elisp:org-agenda Interactive Elisp command elisp:(find-file-other-frame "Elisp.org") Elisp form to evaluate @@ -2829,6 +2877,15 @@ `bbdb:Richard Stallman'), or if you need to remove ambiguities about the end of the link, enclose them in square brackets. + ---------- Footnotes ---------- + + (1) The actual behavior of the search will depend on the value of +the variable `org-link-search-must-match-exact-headline'. If its value +is nil, then a fuzzy text search will be done. If it is t, then only +the exact headline will be matched. If the value is `'query-to-create', +then an exact headline will be searched; if it is not found, then the +user will be queried to create it. +  File: org, Node: Handling links, Next: Using links outside Org, Prev: External links, Up: Hyperlinks @@ -2947,7 +3004,9 @@ application and visit the file with Emacs, use a `C-u' prefix. If you want to avoid opening in Emacs, use a `C-u C-u' prefix. If the cursor is on a headline, but not on a link, offer all links - in the headline and entry text. + in the headline and entry text. If you want to setup the frame + configuration for following links, customize + `org-link-frame-setup'. `' When `org-return-follows-link' is set, `' will also follow @@ -3593,13 +3652,16 @@ Since it is normally too much to record a note for every state, Org-mode expects configuration on a per-keyword basis for this. This -is achieved by adding special markers `!' (for a timestamp) and `@' -(for a note) in parentheses after each keyword. For example, with the -setting +is achieved by adding special markers `!' (for a timestamp) or `@' (for +a note with timestamp) in parentheses after each keyword. For example, +with the setting (setq org-todo-keywords '((sequence "TODO(t)" "WAIT(w@/!)" "|" "DONE(d!)" "CANCELED(c@)"))) + To record a timestamp without a note for TODO keywords configured +with `@', just type `C-c C-c' to enter a blank note when prompted. + you not only define global TODO keywords and fast access keys, but also request that a time is recorded when the entry is set to DONE(2), and that a note is recorded when switching to WAIT or CANCELED. The @@ -4220,18 +4282,19 @@ 7 Properties and columns ************************ -Properties are a set of key-value pairs associated with an entry. There -are two main applications for properties in Org-mode. First, properties -are like tags, but with a value. Second, you can use properties to -implement (very basic) database capabilities in an Org buffer. For an -example of the first application, imagine maintaining a file where you -document bugs and plan releases for a piece of software. Instead of -using tags like `:release_1:', `:release_2:', one can use a property, -say `:Release:', that in different subtrees has different values, such -as `1.0' or `2.0'. For an example of the second application of -properties, imagine keeping track of your music CDs, where properties -could be things such as the album, artist, date of release, number of -tracks, and so on. +A property is a key-value pair associated with an entry. Properties +can be set so they are associated with a single entry, with every entry +in a tree, or with every entry in an Org-mode file. + + There are two main applications for properties in Org-mode. First, +properties are like tags, but with a value. Imagine maintaining a file +where you document bugs and plan releases for a piece of software. +Instead of using tags like `:release_1:', `:release_2:', you can use a +property, say `:Release:', that in different subtrees has different +values, such as `1.0' or `2.0'. Second, you can use properties to +implement (very basic) database capabilities in an Org buffer. Imagine +keeping track of your music CDs, where properties could be things such +as the album, artist, date of release, number of tracks, and so on. Properties can be conveniently edited and viewed in column view (*note Column view::). @@ -4251,8 +4314,9 @@ 7.1 Property syntax =================== -Properties are key-value pairs. They need to be inserted into a special -drawer (*note Drawers::) with the name `PROPERTIES'. Each property is +Properties are key-value pairs. When they are associated with a single +entry or with a tree they need to be inserted into a special drawer +(*note Drawers::) with the name `PROPERTIES'. Each property is specified on a single line, with the key (surrounded by colons) first, and the value after it. Here is an example: @@ -4267,6 +4331,10 @@ :NDisks: 1 :END: + Depending on the value of `org-use-property-inheritance', a property +set this way will either be associated with a single entry, or the +sub-tree defined by the entry, see *note Property inheritance::. + You may define the allowed values for a particular property `:Xyz:' by setting a property `:Xyz_ALL:'. This special property is _inherited_, so if you set it in a level 1 entry, it will apply to the @@ -4285,6 +4353,31 @@ file, use a line like #+PROPERTY: NDisks_ALL 1 2 3 4 + If you want to add to the value of an existing property, append a +`+' to the property name. The following results in the property `var' +having the value "foo=1 bar=2". + #+PROPERTY: var foo=1 + #+PROPERTY: var+ bar=2 + + It is also possible to add to the values of inherited properties. +The following results in the `genres' property having the value "Classic +Baroque" under the `Goldberg Variations' subtree. + * CD collection + ** Classic + :PROPERTIES: + :GENRES: Classic + :END: + *** Goldberg Variations + :PROPERTIES: + :Title: Goldberg Variations + :Composer: J.S. Bach + :Artist: Glen Gould + :Publisher: Deutsche Grammophon + :NDisks: 1 + :GENRES+: Baroque + :END: + Note that a property can only have one entry per Drawer. + Property values set with the global variable `org-global-properties' can be inherited by all entries in all Org files. @@ -4789,11 +4882,11 @@ ========================================= A timestamp is a specification of a date (possibly with a time or a -range of times) in a special format, either `<2003-09-16 Tue>' or -`<2003-09-16 Tue 09:39>' or `<2003-09-16 Tue 12:00-12:30>'(1). A +range of times) in a special format, either `<2003-09-16 Tue>'(1) or +`<2003-09-16 Tue 09:39>' or `<2003-09-16 Tue 12:00-12:30>'(2). A timestamp can appear anywhere in the headline or body of an Org tree -entry. Its presence causes entries to be shown on specific dates in -the agenda (*note Weekly/daily agenda::). We distinguish: +entry. Its presence causes entries to be shown on specific dates in the +agenda (*note Weekly/daily agenda::). We distinguish: PLAIN TIMESTAMP; EVENT; APPOINTMENT A simple timestamp just assigns a date/time to an item. This is @@ -4816,7 +4909,7 @@ DIARY-STYLE SEXP ENTRIES For more complex date specifications, Org-mode supports using the special sexp diary entries implemented in the Emacs calendar/diary - package(2). For example + package(3). For example * The nerd meeting on every 2nd Thursday of the month <%%(org-float t 4 2)> @@ -4840,10 +4933,14 @@ ---------- Footnotes ---------- - (1) This is inspired by the standard ISO 8601 date/time format. To + (1) In this simplest form, the day name is optional when you type +the date yourself. However, any dates inserted or modified by Org will +add that day name, for reading convenience. + + (2) This is inspired by the standard ISO 8601 date/time format. To use an alternative format, see *note Custom time format::. - (2) When working with the standard diary sexp functions, you need to + (3) When working with the standard diary sexp functions, you need to be very careful with the order of the arguments. That order depend evilly on the variable `calendar-date-style' (or, for older Emacs versions, `european-calendar-style'). For example, to specify a date @@ -4883,6 +4980,9 @@ multiples of 5 minutes, see the option `org-time-stamp-rounding-minutes'. +`C-c C-c' + Normalize timestamp, insert/fix day name if missing or wrong. + `C-c < (`org-date-from-calendar')' Insert a timestamp corresponding to the cursor date in the Calendar. @@ -5414,7 +5514,8 @@ report as an Org-mode table into the current file. When the cursor is at an existing clock table, just update it. When called with a prefix argument, jump to the first clock report in the - current document and update it. + current document and update it. The clock table always includes + also trees with `:ARCHIVE:' tag. `C-c C-c or C-c C-x C-u (`org-dblock-update')' Update dynamic block at point. The cursor needs to be in the @@ -6043,7 +6144,7 @@ .......................... In the template itself, special `%'-escapes(1) allow dynamic insertion -of content. The templates are expanded in the order given here: +of content. The templates are expanded in the order given here: %[FILE] insert the contents of the file given by FILE. %(SEXP) evaluate Elisp SEXP and replace with the result. @@ -6762,7 +6863,7 @@ (*note Block agenda::). (2) `org-anniversary' is just like `diary-anniversary', but the -argument order is allways according to ISO and therefore independent of +argument order is always according to ISO and therefore independent of the value of `calendar-date-style'.  @@ -7257,8 +7358,8 @@ `o' Delete other windows. -`v d or short d (`org-aganda-day-view')' -`v w or short w (`org-aganda-day-view')' +`v d or short d (`org-agenda-day-view')' +`v w or short w (`org-agenda-day-view')' `v m (`org-agenda-month-view')' `v y (`org-agenda-month-year')' `v SPC (`org-agenda-reset-view')' @@ -7554,14 +7655,17 @@ `S- (`org-agenda-do-date-later')' Change the timestamp associated with the current line by one day - into the future. With a numeric prefix argument, change it by - that many days. For example, `3 6 5 S-' will change it by - a year. With a `C-u' prefix, change the time by one hour. If you - immediately repeat the command, it will continue to change hours - even without the prefix arg. With a double `C-u C-u' prefix, do - the same for changing minutes. The stamp is changed in the - original Org file, but the change is not directly reflected in the - agenda buffer. Use `r' or `g' to update the buffer. + into the future. If the date is in the past, the first call to + this command will move it to today. + With a numeric prefix argument, change it by that many days. For + example, `3 6 5 S-' will change it by a year. With a `C-u' + prefix, change the time by one hour. If you immediately repeat + the command, it will continue to change hours even without the + prefix arg. With a double `C-u C-u' prefix, do the same for + changing minutes. + The stamp is changed in the original Org file, but the change is + not directly reflected in the agenda buffer. Use `r' or `g' to + update the buffer. `S- (`org-agenda-do-date-earlier')' Change the timestamp associated with the current line by one day @@ -7996,10 +8100,10 @@ `org-agenda-custom-commands' take precedence. From the command line you may also use - emacs -f org-batch-store-agenda-views -kill + emacs -eval (org-batch-store-agenda-views) -kill or, if you need to modify some parameters(4) emacs -eval '(org-batch-store-agenda-views \ - org-agenda-span month \ + org-agenda-span (quote month) \ org-agenda-start-day "2007-11-01" \ org-agenda-include-diary nil \ org-agenda-files (quote ("~/org/project.org")))' \ @@ -8356,7 +8460,8 @@ other text that can be marked up by font-lock in Emacs, you can ask for the example to look like the fontified Emacs buffer(1). This is done with the `src' block, where you also need to specify the name of the -major mode that should be used to fontify the example(2): +major mode that should be used to fontify the example(2), see *note +Easy Templates:: for shortcuts to easily insert code blocks. #+BEGIN_SRC emacs-lisp (defun org-xor (a b) @@ -8784,9 +8889,9 @@ exchange with a broad range of other applications. LaTeX export lets you use Org-mode and its structured editing functions to easily create LaTeX files. DocBook export makes it possible to convert Org files to -many other formats using DocBook tools. OpenDocumentText export allows -seamless colloboration across organizational boundaries. For project -management you can create gantt and resource charts by using +many other formats using DocBook tools. OpenDocument Text(ODT) export +allows seamless colloboration across organizational boundaries. For +project management you can create gantt and resource charts by using TaskJuggler export. To incorporate entries with associated times like deadlines or appointments into a desktop calendar program like iCal, Org-mode can also produce extracts in the iCalendar format. Currently @@ -8804,7 +8909,7 @@ * HTML export:: Exporting to HTML * LaTeX and PDF export:: Exporting to LaTeX, and processing to PDF * DocBook export:: Exporting to DocBook -* OpenDocumentText export:: Exporting to OpenDocumentText +* OpenDocument Text export:: Exporting to OpenDocument Text * TaskJuggler export:: Exporting to TaskJuggler * Freemind export:: Exporting to Freemind mind maps * XOXO export:: Exporting to XOXO @@ -8819,7 +8924,8 @@ You may use tags to select the parts of a document that should be exported, or to exclude parts from export. This behavior is governed by two variables: `org-export-select-tags' and -`org-export-exclude-tags'. +`org-export-exclude-tags', respectively defaulting to `'(:export:)' and +`'(:noexport:)'. 1. Org first checks if any of the _select_ tags is present in the buffer. If yes, all trees that do not carry one of these tags @@ -9182,7 +9288,7 @@ tables, place something like the following before the table: #+CAPTION: This is a table with lines around and between cells - #+ATTR_HTML: border="2" rules="all" frame="all" + #+ATTR_HTML: border="2" rules="all" frame="border"  File: org, Node: Images in HTML export, Next: Math formatting in HTML export, Prev: Tables in HTML export, Up: HTML export @@ -9743,7 +9849,7 @@ For more information, see the documentation on Worg.  -File: org, Node: DocBook export, Next: OpenDocumentText export, Prev: LaTeX and PDF export, Up: Exporting +File: org, Node: DocBook export, Next: OpenDocument Text export, Prev: LaTeX and PDF export, Up: Exporting 12.7 DocBook export =================== @@ -9934,157 +10040,772 @@ "  -File: org, Node: OpenDocumentText export, Next: TaskJuggler export, Prev: DocBook export, Up: Exporting +File: org, Node: OpenDocument Text export, Next: TaskJuggler export, Prev: DocBook export, Up: Exporting -12.8 OpenDocumentText export -============================ +12.8 OpenDocument Text export +============================= -Org-mode 7.6 supports export to OpenDocumentText format using -`org-odt.el' module contributed by Jambunathan K. This module can be -enabled in one of the following ways based on your mode of installation. - - 1. If you have downloaded the Org from the Web, either as a - distribution `.zip' or `.tar' file, or as a Git archive, enable - the `odt' option in variable `org-modules'. - - 2. If you are using Org that comes bundled with Emacs, then you can - install the OpenDocumentText exporter using the package manager. - To do this, customize the variable `package-archives' to include - `http://orgmode.org/pkg/releases/' as one of the package archives. +Orgmode(1) supports export to OpenDocument Text (ODT) format using the +`org-odt.el' module. Documents created by this exporter use the +`OpenDocument-v1.2 specification'(2) and are compatible with +LibreOffice 3.4. * Menu: -* OpenDocumentText export commands::How to invoke OpenDocumentText export -* Applying Custom Styles:: How to apply custom styles to the output -* Converting to Other formats:: How to convert to formats like doc, docx etc -* Links in OpenDocumentText export:: How links will be interpreted and formatted -* Tables in OpenDocumentText export:: Tables are exported as HTML tables -* Images in OpenDocumentText export:: How to insert figures into DocBook output -* Additional Documentation:: Where to find more information +* Pre-requisites for ODT export:: What packages ODT exporter relies on +* ODT export commands:: How to invoke ODT export +* Applying custom styles:: How to apply custom styles to the output +* Links in ODT export:: How links will be interpreted and formatted +* Tables in ODT export:: How Tables are exported +* Images in ODT export:: How to insert images +* Math formatting in ODT export:: How LaTeX fragments are formatted +* Literal examples in ODT export:: How source and example blocks are formatted +* Advanced topics in ODT export:: Read this if you are a power user + + ---------- Footnotes ---------- + + (1) Versions 7.8 or later + + (2) Open Document Format for Office Applications (OpenDocument) +Version 1.2 +(http://docs.oasis-open.org/office/v1.2/OpenDocument-v1.2.html)  -File: org, Node: OpenDocumentText export commands, Next: Applying Custom Styles, Prev: OpenDocumentText export, Up: OpenDocumentText export +File: org, Node: Pre-requisites for ODT export, Next: ODT export commands, Prev: OpenDocument Text export, Up: OpenDocument Text export -12.8.1 OpenDocumentText export commands ---------------------------------------- +12.8.1 Pre-requisites for ODT export +------------------------------------ + +The ODT exporter relies on the `zip' program to create the final +output. Check the availability of this program before proceeding +further. + + +File: org, Node: ODT export commands, Next: Applying custom styles, Prev: Pre-requisites for ODT export, Up: OpenDocument Text export + +12.8.2 ODT export commands +-------------------------- + +Exporting to ODT +................ `C-c C-e o (`org-export-as-odt')' - Export as OpenDocumentText file. For an Org file, `myfile.org', - the OpenDocumentText file will be `myfile.odt'. The file will be - overwritten without warning. If there is an active region(1), - only the region will be exported. If the selected region is a - single tree(2), the tree head will become the document title. If - the tree head entry has, or inherits, an `EXPORT_FILE_NAME' - property, that name will be used for the export. + Export as OpenDocument Text file. If + `org-export-odt-preferred-output-format' is specified, + automatically convert the exported file to that format. *Note + Automatically exporting to other formats: + x-export-to-other-formats. + + For an Org file `myfile.org', the ODT file will be `myfile.odt'. + The file will be overwritten without warning. If there is an + active region,(1) only the region will be exported. If the + selected region is a single tree,(2) the tree head will become the + document title. If the tree head entry has, or inherits, an + `EXPORT_FILE_NAME' property, that name will be used for the export. `C-c C-e O (`org-export-as-odt-and-open')' - Export as OpenDocumentText file and open the resulting file. + Export as OpenDocument Text file and open the resulting file. If + `org-export-odt-preferred-output-format' is specified, open the + converted file instead. *Note Automatically exporting to other + formats: x-export-to-other-formats. + +Automatically exporting to other formats +........................................ + +Very often, you will find yourself exporting to ODT format, only to +immediately save the exported document to a different format like `pdf'. +In such cases, you will find it convenient to configure a converter +(*note Exporting and converting to other formats::) and specify your +preferred output format by customizing the variable +`org-export-odt-preferred-output-format'. This way, the export commands +(*note Exporting to ODT: x-export-to-odt.) can be extended to also +export to the preferred format. ---------- Footnotes ---------- (1) This requires `transient-mark-mode' to be turned on - (2) To select the current subtree, use `C-c @'. + (2) To select the current subtree, use `C-c @'  -File: org, Node: Applying Custom Styles, Next: Converting to Other formats, Prev: OpenDocumentText export commands, Up: OpenDocumentText export +File: org, Node: Applying custom styles, Next: Links in ODT export, Prev: ODT export commands, Up: OpenDocument Text export -12.8.2 Applying Custom Styles +12.8.3 Applying custom styles ----------------------------- -OpenDocumentExporter ships with a custom `styles.xml' for formatting of -the exported file. To customize the output to suit your needs you can -use one of the following methods: +The ODT exporter ships with a set of OpenDocument styles (*note Working +with OpenDocument style files::) that ensure a well-formatted output. +These factory styles, however, may not cater to your specific tastes. +To customize the output, you can either modify the above styles files +directly, or generate the required styles using an application like +LibreOffice. The latter method is suitable for expert and non-expert +users alike, and is described here. + +12.8.3.1 Applying custom styles - the easy way +.............................................. + + 1. Create a sample `example.org' file with the below settings and + export it to ODT format. + + #+OPTIONS: H:10 num:t + + 2. Open the above `example.odt' using LibreOffice. Use the `Stylist' + to locate the target styles - these typically have the `Org' + prefix - and modify those to your taste. Save the modified file + either as an OpenDocument Text (`.odt') or OpenDocument Template + (`.ott') file. + + 3. Customize the variable `org-export-odt-styles-file' and point it + to the newly created file. For additional configuration options + *note Overriding factory styles: x-overriding-factory-styles. + + If you would like to choose a style on a per-file basis, you can + use the `#+ODT_STYLES_FILE' option. A typical setting will look + like + + #+ODT_STYLES_FILE: "/path/to/example.ott" - 1. Customize the variable `org-export-odt-styles-file' to point to - either a `styles.xml' file, a OpenDocument Text Template file - `.ott' or a combination of Text or Template Document together with - a set of member files. Use the first two options if the - styles.xml has no references to additional set of files and use - the last option if the `styles.xml' references additional files - like header and footer images. + or - 2. Use an external tool like unoconv to apply custom templates. + #+ODT_STYLES_FILE: ("/path/to/file.ott" ("styles.xml" "image/hdr.png")) - For best results, it is necessary that the style names used by -OpenDocumentText exporter match that used in the `styles.xml'. + +12.8.3.2 Using third-party styles and templates +............................................... + +You can use third-party styles and templates for customizing your +output. This will produce the desired output only if the template +provides all style names that the `ODT' exporter relies on. Unless +this condition is met, the output is going to be less than +satisfactory. So it is highly recommended that you only work with +templates that are directly derived from the factory settings.  -File: org, Node: Converting to Other formats, Next: Links in OpenDocumentText export, Prev: Applying Custom Styles, Up: OpenDocumentText export +File: org, Node: Links in ODT export, Next: Tables in ODT export, Prev: Applying custom styles, Up: OpenDocument Text export -12.8.3 Converting to Other formats ----------------------------------- +12.8.4 Links in ODT export +-------------------------- + +The ODT exporter creates cross-references (aka bookmarks) for internal +links. It creates Internet-style links for all other links. -Often times there is a need to convert OpenDocumentText files to other -formats like doc, docx or pdf. You can accomplish this by one of the -following methods: + +File: org, Node: Tables in ODT export, Next: Images in ODT export, Prev: Links in ODT export, Up: OpenDocument Text export + +12.8.5 Tables in ODT export +--------------------------- -`M-x org-lparse' - Export the outline first to one of the native formats (like - OpenDocumentText) and immediately post-process it to other formats - using an external converter. +Export of native Org-mode tables (*note Tables::) and simple `table.el' +tables is supported. However, export of complex `table.el' tables - +tables that have column or row spans - is not supported. Such tables +are stripped from the exported document. -`M-x org-lparse-convert' - Export an existing document to other formats using an external - converter. + By default, a table is exported with top and bottom frames and with +rules separating row and column groups (*note Column groups::). If the +table specifies alignment and relative width for its columns (*note +Column width and alignment::) then these are honored on export.(1) + + If you are not satisfied with the default formatting of tables, you +can create custom table styles and associate them with a table using +the `#+ATTR_ODT' line. *Note Customizing tables in ODT export::. + + ---------- Footnotes ---------- - You can choose the converter used for conversion by customizing the -variable `org-lparse-convert-process'. + (1) The column widths are interpreted as weighted ratios with the +default weight being 1  -File: org, Node: Links in OpenDocumentText export, Next: Tables in OpenDocumentText export, Prev: Converting to Other formats, Up: OpenDocumentText export +File: org, Node: Images in ODT export, Next: Math formatting in ODT export, Prev: Tables in ODT export, Up: OpenDocument Text export -12.8.4 Links in OpenDocumentText export ---------------------------------------- +12.8.6 Images in ODT export +--------------------------- + +Embedding images +................ + +You can embed images within the exported document by providing a link +to the desired image file with no link description. For example, to +embed `img.png' do either of the following: -OpenDocumentExporter creates cross-references (aka bookmarks) for links -that are destined locally. It creates internet style links for all -other links. + [[file:img.png]] + + [[./img.png]] + +Embedding clickable images +.......................... + +You can create clickable images by providing a link whose description +is a link to an image file. For example, to embed a image +`org-mode-unicorn.png' which when clicked jumps to `http://Orgmode.org' +website, do the following + + [[http://orgmode.org][./org-mode-unicorn.png]] + +Sizing and scaling of embedded images +..................................... + +You can control the size and scale of the embedded images using the +`#+ATTR_ODT' attribute. + + Note that the exporter specifies the desired size of the image in +the final document in units of centimetres. In order to scale the +embedded images, the exporter needs to compute the size of the image. +This is done by retrieving the image size in pixels and converting the +pixel units to centimetres using `org-export-odt-pixels-per-inch'. The +default value of this variable is set to `display-pixels-per-inch'. +You can tweak this variable to achieve the best results. + + The examples below illustrate the various possibilities. + +Explicitly size the image + To embed `img.png' as a 10 cm x 10 cm image, do the following: + + #+ATTR_ODT: :width 10 :height 10 + [[./img.png]] + +Scale the image + To embed `img.png' at half its size, do the following: + + #+ATTR_ODT: :scale 0.5 + [[./img.png]] + +Scale the image to a specific width + To embed `img.png' with a width of 10 cm while retaining the + original height:width ratio, do the following: + + #+ATTR_ODT: :width 10 + [[./img.png]] + +Scale the image to a specific height + To embed `img.png' with a height of 10 cm while retaining the + original height:width ratio, do the following + + #+ATTR_ODT: :height 10 + [[./img.png]]  -File: org, Node: Tables in OpenDocumentText export, Next: Images in OpenDocumentText export, Prev: Links in OpenDocumentText export, Up: OpenDocumentText export +File: org, Node: Math formatting in ODT export, Next: Literal examples in ODT export, Prev: Images in ODT export, Up: OpenDocument Text export + +12.8.7 Math formatting in ODT export +------------------------------------ -12.8.5 Tables in OpenDocumentText export ----------------------------------------- +The ODT exporter has special support for handling math. + +* Menu: -Export of `table.el' tables with row or column spanning is not -supported. Such tables are stripped from the exported document. +* Working with LaTeX math snippets:: How to embed LaTeX math fragments +* Working with MathML or OpenDocument formula files:: How to embed equations in native format  -File: org, Node: Images in OpenDocumentText export, Next: Additional Documentation, Prev: Tables in OpenDocumentText export, Up: OpenDocumentText export +File: org, Node: Working with LaTeX math snippets, Next: Working with MathML or OpenDocument formula files, Prev: Math formatting in ODT export, Up: Math formatting in ODT export -12.8.6 Images in OpenDocumentText export ----------------------------------------- +12.8.7.1 Working with LaTeX math snippets +......................................... -OpenDocumentText exporter can embed images within the exported -document. To embed images, provide a link to the desired image file -with no link description. For example, the following links -`[[file:img.jpg]]' or `[[./img.jpg]]', will result in embedding of -`img.jpg' in the exported file. +LaTeX math snippets (*note LaTeX fragments::) can be embedded in the ODT +document in one of the following ways: - The exporter can also embed scaled and explicitly sized images -within the exported document. The markup of the scale and size -specifications has not been standardized yet and is hence conveniently -skipped in this document. + 1. MathML - The exporter can also make an image the clickable part of a link. -To create clickable images, provide a link whose description is a link -to an image file. For example, the following link -`[[http://orgmode.org][./img.jpg]]', will result in a clickable image -that links to `http://Orgmode.org' website. + This option is activated on a per-file basis with + + #+OPTIONS: LaTeX:t + + With this option, LaTeX fragments are first converted into MathML + fragments using an external LaTeX-to-MathML converter program. The + resulting MathML fragments are then embedded as an OpenDocument + Formula in the exported document. + + You can specify the LaTeX-to-MathML converter by customizing the + variables `org-latex-to-mathml-convert-command' and + `org-latex-to-mathml-jar-file'. + + If you prefer to use `MathToWeb'(1) as your converter, you can + configure the above variables as shown below. + + (setq org-latex-to-mathml-convert-command + "java -jar %j -unicode -force -df %o %I" + org-latex-to-mathml-jar-file + "/path/to/mathtoweb.jar") + + You can use the following commands to quickly verify the + reliability of the LaTeX-to-MathML converter. + + `M-x org-export-as-odf' + Convert a LaTeX math snippet to OpenDocument formula (`.odf') + file. + + `M-x org-export-as-odf-and-open' + Convert a LaTeX math snippet to OpenDocument formula (`.odf') + file and open the formula file with the system-registered + application. + + 2. PNG images + + This option is activated on a per-file basis with + + #+OPTIONS: LaTeX:dvipng + + 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 `dvipng' program be available on + your system. + + ---------- Footnotes ---------- + + (1) See MathToWeb +(http://www.mathtoweb.com/cgi-bin/mathtoweb_home.pl)  -File: org, Node: Additional Documentation, Prev: Images in OpenDocumentText export, Up: OpenDocumentText export +File: org, Node: Working with MathML or OpenDocument formula files, Prev: Working with LaTeX math snippets, Up: Math formatting in ODT export -12.8.7 Additional documentation -------------------------------- +12.8.7.2 Working with MathML or OpenDocument formula files +.......................................................... + +For various reasons, you may find embedding LaTeX math snippets in an +ODT document less than reliable. In that case, you can embed a math +equation by linking to its MathML(`.mml') source or its OpenDocument +formula (`.odf') file as shown below: + + [[./equation.mml]] + + or + + [[./equation.odf]] + + +File: org, Node: Literal examples in ODT export, Next: Advanced topics in ODT export, Prev: Math formatting in ODT export, Up: OpenDocument Text export + +12.8.8 Literal examples in ODT export +------------------------------------- + +Export of literal examples (*note Literal examples::) with full +fontification is supported. This feature is enabled by default and is +activated automatically if an enhanced version of `htmlfontify.el' is +available in the `load-path'.(1) + + The character styles used for fontification of the literal blocks are +auto-generated by the exporter in conjunction with `htmlfontify.el' +library and need not be included in the default `styles.xml' file. +These auto-generated styles have the `OrgSrc' prefix and inherit their +color based on the face used by Emacs `font-lock' library. + + If you prefer to use your own custom styles for fontification and +disable their auto-generation altogether, you can do so by customizing +the variable `org-export-odt-create-custom-styles-for-srcblocks'. + + You can turn off fontification support for literal examples by +customizing the variable `org-export-odt-fontify-srcblocks'. + + ---------- Footnotes ---------- + + (1) The `htmlfontify.el' that ships with standard Emacs <= 24.1 has +no support for ODT fontification. A copy of the proposed version is +available as an attachment to Emacs Bug #9914 +(http://debbugs.gnu.org/cgi/bugreport.cgi?msg=5;filename=htmlfontify.el;att=9;bug=9914). + + +File: org, Node: Advanced topics in ODT export, Prev: Literal examples in ODT export, Up: OpenDocument Text export + +12.8.9 Advanced topics in ODT export +------------------------------------ + +If you rely heavily on ODT export, you may want to exploit the full set +of features that the exporter offers. This section describes features +that would be of interest to power users. + +* Menu: + +* Exporting and converting to other formats:: How to produce `pdf' and other formats +* Working with OpenDocument style files:: Explore the internals +* Creating one-off styles:: How to produce custom highlighting etc +* Customizing tables in ODT export:: How to define and use Table templates +* Validating OpenDocument XML:: How to debug corrupt OpenDocument files + + +File: org, Node: Exporting and converting to other formats, Next: Working with OpenDocument style files, Prev: Advanced topics in ODT export, Up: Advanced topics in ODT export + +12.8.9.1 Exporting and converting to other formats +.................................................. + +The ODT exporter adds support for exporting Org outlines to formats +that are not supported natively by Org. It also adds support to convert +document from one format to another. To use these features, you need to +configure a command-line converter. Once a command-line converter is +configured you can use it to extend the list of formats to which Org can +export. *Note Automatically exporting to other formats: +x-export-to-other-formats. You can also use it to perform one-off +document conversion as detailed below. + +`M-x org-export-odt-convert' + Convert an existing document from one format to another as + determined by the variable `org-export-odt-convert-capabilities' + (*note Configure converter capabilities: + x-odt-converter-capabilities.). *Please note* that you can use + this command to even convert documents that are produced outside + of Org and in other formats than ODT format. + +Pre-configured converters +......................... + +The ODT exporter supports two converters out of the box: + + 1. `unoconv' + + This converter is available as an installable package in your + favorite distribution. + + 2. `BasicODConverter' + + This converter is distributed as a LibreOffice extension and can + be found in your Org distribution. See the subdirectory pointed + to by the variable `org-odt-data-dir'. + + +Installing a new converter +.......................... + +If you prefer to use a converter other than the two mentioned above, +then you may have to do additional configuration. You can proceed as +follows: + + 1. Register the converter + + Name your converter and add it to the list of known converters by + customizing the variable `org-export-odt-convert-processes'. Also + specify how the converter can be invoked via command-line to + effect the conversion. + + 2. Configure its capabilities + + Specify the set of formats the converter can handle by customizing + the variable `org-export-odt-convert-capabilities'. Use the + default value for this variable as a guide for configuring your + converter. As suggested by the default setting, you can specify + the full set of formats supported by the converter and not limit + yourself to specifying formats that are related to just the + OpenDocument Text format. + + 3. Choose the converter + + Select the newly added converter as the preferred one by + customizing the variable `org-export-odt-convert-process'. + + +File: org, Node: Working with OpenDocument style files, Next: Creating one-off styles, Prev: Exporting and converting to other formats, Up: Advanced topics in ODT export + +12.8.9.2 Working with OpenDocument style files +.............................................. + +This section explores the internals of the ODT exporter and the means +by which it produces styled documents. Read this section if you are +interested in exploring the automatic and custom OpenDocument styles +used by the exporter. + +Factory styles +.............. + +The ODT exporter relies on two files for generating its output. These +files are bundled with the distribution under the directory pointed to +by the variable `org-odt-styles-dir'. The two files are: + + * `OrgOdtStyles.xml' + + This file contributes to the `styles.xml' file of the final `ODT' + document. This file gets modified for the following purposes: + 1. To control outline numbering based on user settings. + + 2. To add styles generated by `htmlfontify.el' for fontification + of code blocks. + + * `OrgOdtContentTemplate.xml' + + This file contributes to the `content.xml' file of the final `ODT' + document. The contents of the Org outline are inserted between the + `'...`' elements of this file. + + Apart from serving as a template file for the final `content.xml', + the file serves the following purposes: + 1. It contains automatic styles for formatting of tables which + are referenced by the exporter. + + 2. It contains `'...`' + elements that control how various entities - tables, images, + equations etc - are numbered. + +Overriding factory styles +......................... + +The following two variables control the location from which the ODT +exporter picks up the custom styles and content template files. You can +customize these variables to override the factory styles used by the +exporter. + + * `org-export-odt-styles-file' + + Use this variable to specify the `styles.xml' that will be used in + the final output. You can specify one of the following values: + + 1. A `styles.xml' file + + Use this file instead of the default `styles.xml' + + 2. A `.odt' or `.ott' file + + Use the `styles.xml' contained in the specified OpenDocument + Text or Template file + + 3. A `.odt' or `.ott' file and a subset of files contained + within them + + Use the `styles.xml' contained in the specified OpenDocument + Text or Template file. Additionally extract the specified + member files and embed those within the final `ODT' document. + + Use this option if the `styles.xml' file references + additional files like header and footer images. + + 4. `nil' + + Use the default `styles.xml' -The OpenDocumentText exporter is still in development. For up to date -information, please follow Org mailing list -closely. + * `org-export-odt-content-template-file' + + Use this variable to specify the blank `content.xml' that will be + used in the final output. + + +File: org, Node: Creating one-off styles, Next: Customizing tables in ODT export, Prev: Working with OpenDocument style files, Up: Advanced topics in ODT export + +12.8.9.3 Creating one-off styles +................................ + +There are times when you would want one-off formatting in the exported +document. You can achieve this by embedding raw OpenDocument XML in +the Org file. The use of this feature is better illustrated with +couple of examples. + + 1. Embedding ODT tags as part of regular text + + You can include simple OpenDocument tags by prefixing them with + `@'. For example, to highlight a region of text do the following: + + @This is a + highlighted text@. But this is a + regular text. + + *Hint:* To see the above example in action, edit your + `styles.xml'(*note Factory styles: x-orgodtstyles-xml.) and add a + custom `Highlight' style as shown below. + + + + + + 2. Embedding a one-line OpenDocument XML + + You can add a simple OpenDocument one-liner using the `#+ODT:' + directive. For example, to force a page break do the following: + + #+ODT: + + *Hint:* To see the above example in action, edit your + `styles.xml'(*note Factory styles: x-orgodtstyles-xml.) and add a + custom `PageBreak' style as shown below. + + + + + + 3. Embedding a block of OpenDocument XML + + You can add a large block of OpenDocument XML using the + `#+BEGIN_ODT'...`#+END_ODT' construct. + + For example, to create a one-off paragraph that uses bold text, do + the following: + + #+BEGIN_ODT + + This paragraph is specially formatted and uses bold text. + + #+END_ODT + + + +File: org, Node: Customizing tables in ODT export, Next: Validating OpenDocument XML, Prev: Creating one-off styles, Up: Advanced topics in ODT export + +12.8.9.4 Customizing tables in ODT export +......................................... + +You can override the default formatting of the table by specifying a +custom table style with the `#+ATTR_ODT' line. For a discussion on +default formatting of tables *note Tables in ODT export::. + + This feature closely mimics the way table templates are defined in +the OpenDocument-v1.2 specification.(1) + +Custom table styles - an illustration +..................................... + +To have a quick preview of this feature, install the below setting and +export the table that follows. + + (setq org-export-odt-table-styles + (append org-export-odt-table-styles + '(("TableWithHeaderRowAndColumn" "Custom" + ((use-first-row-styles . t) + (use-first-column-styles . t))) + ("TableWithFirstRowandLastRow" "Custom" + ((use-first-row-styles . t) + (use-last-row-styles . t)))))) + + #+ATTR_ODT: TableWithHeaderRowAndColumn + | Name | Phone | Age | + | Peter | 1234 | 17 | + | Anna | 4321 | 25 | + + In the above example, you used a template named `Custom' and +installed two table styles with the names `TableWithHeaderRowAndColumn' +and `TableWithFirstRowandLastRow'. (*Important:* The OpenDocument +styles needed for producing the above template have been pre-defined +for you. These styles are available under the section marked `Custom +Table Template' in `OrgOdtContentTemplate.xml' (*note Factory styles: +x-orgodtcontenttemplate-xml.). If you need additional templates you +have to define these styles yourselves. + +Custom table styles - the nitty-gritty +...................................... + +To use this feature proceed as follows: + + 1. Create a table template(2) + + A table template is nothing but a set of `table-cell' and + `paragraph' styles for each of the following table cell categories: + + - Body + + - First column + + - Last column + + - First row + + - Last row + + - Even row + + - Odd row + + - Even column + + - Odd Column + + The names for the above styles must be chosen based on the name of + the table template using a well-defined convention. + + The naming convention is better illustrated with an example. For + a table template with the name `Custom', the needed style names + are listed in the following table. + + Table cell type `table-cell' style `paragraph' style + ------------------------------------------------------------------------------- + + Body `CustomTableCell' `CustomTableParagraph' + First column `CustomFirstColumnTableCell'`CustomFirstColumnTableParagraph' + Last column `CustomLastColumnTableCell' `CustomLastColumnTableParagraph' + First row `CustomFirstRowTableCell' `CustomFirstRowTableParagraph' + Last row `CustomLastRowTableCell' `CustomLastRowTableParagraph' + Even row `CustomEvenRowTableCell' `CustomEvenRowTableParagraph' + Odd row `CustomOddRowTableCell' `CustomOddRowTableParagraph' + Even column `CustomEvenColumnTableCell' `CustomEvenColumnTableParagraph' + Odd column `CustomOddColumnTableCell' `CustomOddColumnTableParagraph' + + To create a table template with the name `Custom', define the above + styles in the + `'...`' element + of the content template file (*note Factory styles: + x-orgodtcontenttemplate-xml.). + + 2. Define a table style(3) + + To define a table style, create an entry for the style in the + variable `org-export-odt-table-styles' and specify the following: + + - the name of the table template created in step (1) + + - the set of cell styles in that template that are to be + activated + + For example, the entry below defines two different table styles + `TableWithHeaderRowsAndColumns' and `TableWithHeaderColumns' based + on the same template `Custom'. The styles achieve their intended + effect by selectively activating the individual cell styles in + that template. + + (setq org-export-odt-table-styles + (append org-export-odt-table-styles + '(("TableWithHeaderRowAndColumn" "Custom" + ((use-first-row-styles . t) + (use-first-column-styles . t))) + ("TableWithFirstRowandLastRow" "Custom" + ((use-first-row-styles . t) + (use-last-row-styles . t)))))) + + 3. Associate a table with the table style + + To do this, specify the table style created in step (2) as part of + the `ATTR_ODT' line as shown below. + + #+ATTR_ODT: TableWithHeaderRowAndColumn + | Name | Phone | Age | + | Peter | 1234 | 17 | + | Anna | 4321 | 25 | + + ---------- Footnotes ---------- + + (1) OpenDocument-v1.2 Specification +(http://docs.oasis-open.org/office/v1.2/OpenDocument-v1.2.html) + + (2) See the `' element of the +OpenDocument-v1.2 specification + + (3) See the attributes `table:template-name', +`table:use-first-row-styles', `table:use-last-row-styles', +`table:use-first-column-styles', `table:use-last-column-styles', +`table:use-banding-rows-styles', and `table:use-banding-column-styles' +of the `' element in the OpenDocument-v1.2 specification + + +File: org, Node: Validating OpenDocument XML, Prev: Customizing tables in ODT export, Up: Advanced topics in ODT export + +12.8.9.5 Validating OpenDocument XML +.................................... + +Occasionally, you will discover that the document created by the ODT +exporter cannot be opened by your favorite application. One of the +common reasons for this is that the `.odt' file is corrupt. In such +cases, you may want to validate the document against the OpenDocument +RELAX NG Compact Syntax (RNC) schema. + + For de-compressing the `.odt' file(1): *note (emacs)File Archives::. +For general help with validation (and schema-sensitive editing) of XML +files: *note (nxml-mode)Introduction::. + + If you have ready access to OpenDocument `.rnc' files and the needed +schema-locating rules in a single folder, you can customize the variable +`org-export-odt-schema-dir' to point to that directory. The ODT +exporter will take care of updating the `rng-schema-locating-files' for +you. + + ---------- Footnotes ---------- + + (1) `.odt' files are nothing but `zip' archives  -File: org, Node: TaskJuggler export, Next: Freemind export, Prev: OpenDocumentText export, Up: Exporting +File: org, Node: TaskJuggler export, Next: Freemind export, Prev: OpenDocument Text export, Up: Exporting 12.9 TaskJuggler export ======================= @@ -10611,18 +11332,18 @@ `:sitemap-ignore-case' Should sorting be case-sensitive? Default `nil'. `:sitemap-file-entry-format'With this option one can tell how a sitemap's - entry is formated in the sitemap. This is a + entry is formatted in the sitemap. This is a format string with some escape sequences: `%t' stands for the title of the file, `%a' stands for the author of the file and `%d' stands for the date of the file. The date is retrieved with the `org-publish-find-date' function and - formated with + formatted with `org-publish-sitemap-date-format'. Default `%t'. `:sitemap-date-format' Format string for the `format-time-string' function that tells how a sitemap entry's date - is to be formated. This property bypasses + is to be formatted. This property bypasses `org-publish-sitemap-date-format' which defaults to `%Y-%m-%d'. `:sitemap-sans-extension' When non-nil, remove filenames' extensions @@ -10839,15 +11560,19 @@ 14.1 Structure of code blocks ============================= -The structure of code blocks is as follows: +Live code blocks can be specified with a `src' block or inline.(1) The +structure of a `src' block is - #+srcname: - #+begin_src
    + #+NAME: + #+BEGIN_SRC
    - #+end_src + #+END_SRC + + The `#+NAME:' line is optional, and can be used to name the code +block. Live code blocks require that a language be specified on the +`#+BEGIN_SRC' line. Switches and header arguments are optional. - Switches and header arguments are optional. Code can also be -embedded in text inline using + Live code blocks can also be specified inline using src_{} @@ -10855,30 +11580,38 @@ src_[
    ]{} -`' - This name is associated with the code block. This is similar to - the `#+tblname' lines that can be used to name tables in Org-mode - files. Referencing the name of a code block makes it possible to - evaluate the block from other places in the file, other files, or - from Org-mode table formulas (see *note The spreadsheet::). Names - are assumed to be unique by evaluation functions and the behavior - of multiple blocks of the same name is undefined. +`<#+NAME: name>' + This line associates a name with the code block. This is similar + to the `#+TBLNAME: NAME' lines that can be used to name tables in + Org-mode files. Referencing the name of a code block makes it + possible to evaluate the block from other places in the file, from + other files, or from Org-mode table formulas (see *note The + spreadsheet::). Names are assumed to be unique and the behavior + of Org-mode when two or more blocks share the same name is + undefined. `' - The language of the code in the block. + The language of the code in the block (see *note Languages::). `' - Optional switches controlling exportation of the code block (see - switches discussion in *note Literal examples::) + Optional switches control code block export (see the discussion of + switches in *note Literal examples::) `
    ' Optional header arguments control many aspects of evaluation, - export and tangling of code blocks. See the *note Header - arguments::. Header arguments can also be set on a per-buffer or - per-subtree basis using properties. + export and tangling of code blocks (see *note Header arguments::). + Header arguments can also be set on a per-buffer or per-subtree + basis using properties. + +`source code, header arguments' `' - The source code. + Source code in the specified language. + + ---------- Footnotes ---------- + + (1) Note that `src' blocks may be inserted using Org-mode's *note +Easy Templates:: system  File: org, Node: Editing source code, Next: Exporting code blocks, Prev: Structure of code blocks, Up: Working With Source Code @@ -10924,12 +11657,12 @@ 14.3 Exporting code blocks ========================== -It is possible to export the _contents_ of code blocks, the _results_ -of code block evaluation, _neither_, or _both_. For most languages, -the default exports the contents of code blocks. However, for some -languages (e.g. `ditaa') the default exports the results of code block -evaluation. For information on exporting code block bodies, see *note -Literal examples::. +It is possible to export the _code_ of code blocks, the _results_ of +code block evaluation, _both_ the code and the results of code block +evaluation, or _none_. For most languages, the default exports code. +However, for some languages (e.g. `ditaa') the default exports the +results of code block evaluation. For information on exporting code +block bodies, see *note Literal examples::. The `:exports' header argument can be used to specify export behavior: @@ -11010,81 +11743,73 @@ 14.5 Evaluating code blocks =========================== -Code blocks can be evaluated(1) and the results placed in the Org-mode -buffer. By default, evaluation is only turned on for `emacs-lisp' code -blocks, however support exists for evaluating blocks in many languages. -See *note Languages:: for a list of supported languages. See *note -Structure of code blocks:: for information on the syntax used to define -a code block. +Code blocks can be evaluated(1) and the results of evaluation +optionally placed in the Org-mode buffer. By default, the evaluation +facility is only enabled for Lisp code blocks specified as +`emacs-lisp'. However, souce code blocks in many languages can be +evaluated within Org-mode (see *note Languages:: for a list of +supported languages and *note Structure of code blocks:: for +information on the syntax used to define a code block). There are a number of ways to evaluate code blocks. The simplest is to press `C-c C-c' or `C-c C-v e' with the point on a code block(2). This will call the `org-babel-execute-src-block' function to evaluate -the block and insert its results into the Org-mode buffer. +the block and insert its results into the Org-mode buffer. It is also possible to evaluate named code blocks from anywhere in an -Org-mode buffer or an Org-mode table. `#+call' (or synonymously -`#+function' or `#+lob') lines can be used to remotely execute code -blocks located in the current Org-mode buffer or in the "Library of -Babel" (see *note Library of Babel::). These lines use the following -syntax to place a call on a line by itself. +Org-mode buffer or an Org-mode table. Live code blocks located in the +current Org-mode buffer or in the "Library of Babel" (see *note Library +of Babel::) can be executed. Named code blocks can be executed with a +separate `#+CALL:' line or inline within a block of text. + + The syntax of the `#+CALL:' line is - #+call: () - #+call: [
    ]()
    + #+CALL: () + #+CALL: []() - The following syntax can be used to place these calls within a block -of prose. + The syntax for inline evaluation of named code blocks is - ...prose... call_() ...prose... - ...prose... call_[
    ]()[
    ] ...prose... + ... call_() ... + ... call_[]()[] ... `' - The name of the code block to be evaluated. + The name of the code block to be evaluated (see *note Structure of + code blocks::). `' Arguments specified in this section will be passed to the code - block. These arguments should relate to `:var' header arguments - in the called code block expressed using standard function call - syntax. For example if the original code block named `double' has - the header argument `:var n=2', then the call line passing the - number four to that block would be written as `#+call: - double(n=2)'. - -`
    ' - Header arguments can be placed either inside the call to the code - block or at the end of the line as shown below. - - #+call: code_bloc_name[XXXX](arguments) YYYY - - Header arguments located in these two locations are treated - differently. - - `XXXX' - Those placed in the `XXXX' location are passed through and - applied to the code block being called. These header - arguments affect how the code block is evaluated, for example - `[:results output]' will collect the results from `STDOUT' of - the called code block. - - `YYYY' - Those placed in the `YYYY' location are applied to the call - line and do not affect the code block being called. These - header arguments affect how the results are incorporated into - the Org-mode buffer when the call line is evaluated, and how - the call line is exported. For example `:results org' at the - end of the call line will insert the results of the call line - inside of an Org-mode block. + block. These arguments use standard function call syntax, rather + than header argument syntax. For example, a `#+CALL:' line that + passes the number four to a code block named `double', which + declares the header argument `:var n=2', would be written as + `#+CALL: double(n=4)'. + +`' + Inside header arguments are passed through and applied to the + named code block. These arguments use header argument syntax + rather than standard function call syntax. Inside header + arguments affect how the code block is evaluated. For example, + `[:results output]' will collect the results of everything printed + to `STDOUT' during execution of the code block. + +`' + End header arguments are applied to the calling instance and do + not affect evaluation of the named code block. They affect how + the results are incorporated into the Org-mode buffer and how the + call line is exported. For example, `:results html' will insert + the results of the call line evaluation in the Org buffer, wrapped + in a `BEGIN_HTML:' block. - For more examples of passing header arguments to `#+call:' lines + For more examples of passing header arguments to `#+CALL:' lines see *note Header arguments in function calls::. ---------- Footnotes ---------- (1) Whenever code is evaluated there is a potential for that code to -do harm. Org-mode provides a number of safeguards to ensure that it -only evaluates code with explicit confirmation from the user. For -information on these safeguards (and on how to disable them) see *note -Code evaluation security::. +do harm. Org-mode provides safeguards to ensure that code is only +evaluated after explicit confirmation from the user. For information +on these safeguards (and on how to disable them) see *note Code +evaluation security::. (2) The `org-babel-no-eval-on-ctrl-c-ctrl-c' variable can be used to remove code evaluation from the `C-c C-c' key binding. @@ -11095,15 +11820,20 @@ 14.6 Library of Babel ===================== -The "Library of Babel" is a library of code blocks that can be called -from any Org-mode file. The library is housed in an Org-mode file -located in the `contrib' directory of Org-mode. Org-mode users can -deposit functions they believe to be generally useful in the library. - - Code blocks defined in the "Library of Babel" can be called remotely -as if they were in the current Org-mode buffer (see *note Evaluating -code blocks:: for information on the syntax of remote code block -evaluation). +The "Library of Babel" consists of code blocks that can be called from +any Org-mode file. Code blocks defined in the "Library of Babel" can +be called remotely as if they were in the current Org-mode buffer (see +*note Evaluating code blocks:: for information on the syntax of remote +code block evaluation). + + The central repository of code blocks in the "Library of Babel" is +housed in an Org-mode file located in the `contrib' directory of +Org-mode. + + Users can add code blocks they believe to be generally useful to +their "Library of Babel." The code blocks can be stored in any +Org-mode file and then loaded into the library with +`org-babel-lob-ingest'. Code blocks located in any Org-mode file can be loaded into the "Library of Babel" with the `org-babel-lob-ingest' function, bound to @@ -11234,17 +11964,17 @@ Buffer-wide header arguments ............................ -Buffer-wide header arguments may be specified through the use of a -special line placed anywhere in an Org-mode file. The line consists of -the `#+BABEL:' keyword followed by a series of header arguments which -may be specified using the standard header argument syntax. +Buffer-wide header arguments may be specified as properties through the +use of `#+PROPERTY:' lines placed anywhere in an Org-mode file (see +*note Property syntax::). For example the following would set `session' to `*R*', and `results' to `silent' for every code block in the buffer, ensuring that all execution took place in the same session, and no results would be inserted into the buffer. - #+BABEL: :session *R* :results silent + #+PROPERTY: session *R* + #+PROPERTY: results silent  File: org, Node: Header arguments in Org-mode properties, Next: Code block specific header arguments, Prev: Buffer-wide header arguments, Up: Using header arguments @@ -11257,12 +11987,13 @@ basis. An example of setting a header argument for all code blocks in a buffer is - #+property: tangle yes + #+PROPERTY: tangle yes When properties are used to set default header arguments, they are -looked up with inheritance, so the value of the `:cache' header -argument will default to `yes' in all code blocks in the subtree rooted -at the following heading: +looked up with inheritance, regardless of the value of +`org-use-property-inheritance'. In the following example the value of +the `:cache' header argument will default to `yes' in all code blocks +in the subtree rooted at the following heading: * outline header :PROPERTIES: @@ -11282,7 +12013,7 @@ The most common way to assign values to header arguments is at the code block level. This can be done by listing a sequence of header -arguments and their values as part of the `#+begin_src' line. +arguments and their values as part of the `#+BEGIN_SRC' line. Properties set in this way override both the values of `org-babel-default-header-args' and header arguments specified as properties. In the following example, the `:results' header argument @@ -11291,35 +12022,36 @@ `code', meaning only the body of the code block will be preserved on export to HTML or LaTeX. - #+source: factorial - #+begin_src haskell :results silent :exports code :var n=0 + #+NAME: factorial + #+BEGIN_SRC haskell :results silent :exports code :var n=0 fac 0 = 1 fac n = n * fac (n-1) - #+end_src + #+END_SRC Similarly, it is possible to set header arguments for inline code -blocks: +blocks src_haskell[:exports both]{fac 5} Code block header arguments can span multiple lines using -=#+header:= or =#+headers:= lines preceding a code block or nested in -between the name and body of a named code block. +`#+HEADER:' or `#+HEADERS:' lines preceding a code block or nested +between the `#+NAME:' line and the `#+BEGIN_SRC' line of a named code +block. Multi-line header arguments on an un-named code block: - #+headers: :var data1=1 - #+begin_src emacs-lisp :var data2=2 + #+HEADERS: :var data1=1 + #+BEGIN_SRC emacs-lisp :var data2=2 (message "data1:%S, data2:%S" data1 data2) - #+end_src + #+END_SRC #+results: : data1:1, data2:2 Multi-line header arguments on a named code block: - #+source: named-block - #+header: :var data=2 - #+begin_src emacs-lisp + #+NAME: named-block + #+HEADER: :var data=2 + #+BEGIN_SRC emacs-lisp (message "data:%S" data) - #+end_src + #+END_SRC #+results: named-block : data:2 @@ -11331,17 +12063,17 @@ .................................. At the most specific level, header arguments for "Library of Babel" or -function call lines can be set as shown in the two examples below. For -more information on the structure of `#+call:' lines see *note -Evaluating code blocks::. +`#+CALL:' lines can be set as shown in the two examples below. For more +information on the structure of `#+CALL:' lines see *note Evaluating +code blocks::. The following will apply the `:exports results' header argument to -the evaluation of the `#+call:' line. - #+call: factorial(n=5) :exports results +the evaluation of the `#+CALL:' line. + #+CALL: factorial(n=5) :exports results The following will apply the `:session special' header argument to the evaluation of the `factorial' code block. - #+call: factorial[:session special](n=5) + #+CALL: factorial[:session special](n=5)  File: org, Node: Specific header arguments, Prev: Using header arguments, Up: Header arguments @@ -11349,7 +12081,9 @@ 14.8.2 Specific header arguments -------------------------------- -The following header arguments are defined: +Header arguments consist of an initial colon followed by the name of the +argument in lowercase letters. The following header arguments are +defined: * Menu: @@ -11393,81 +12127,128 @@ The specifics of how arguments are included in a code block vary by language; these are addressed in the language-specific documentation. However, the syntax used to specify arguments is the same across all -languages. The values passed to arguments can be literal values, -values from org-mode tables and literal example blocks, the results of -other code blocks, or Emacs Lisp code--see the "Emacs Lisp evaluation -of variables" heading below. +languages. In every case, variables require a default value when they +are declared. + + The values passed to arguments can either be literal values, +references, or Emacs Lisp code (see *note Emacs Lisp evaluation of +variables: var.). References include anything in the Org-mode file +that takes a `#+NAME:', `#+TBLNAME:', or `#+RESULTS:' line. This +includes tables, lists, `#+BEGIN_EXAMPLE' blocks, other code blocks, +and the results of other code blocks. - These values can be indexed in a manner similar to arrays--see the -"indexable variable values" heading below. + Argument values can be indexed in a manner similar to arrays (see +*note Indexable variable values: var.). The following syntax is used to pass arguments to code blocks using the `:var' header argument. :var name=assign - where `assign' can take one of the following forms - - * literal value either a string `"string"' or a number `9'. - - * reference a table name: - - #+tblname: example-table + The argument, `assign', can either be a literal value, such as a +string `"string"' or a number `9', or a reference to a table, a list, a +literal example, another code block (with or without arguments), or the +results of evaluating another code block. + + Here are examples of passing values by reference: + +"table" + an Org mode table named with either a `#+NAME:' or `#+TBLNAME:' + line + #+TBLNAME: example-table | 1 | | 2 | | 3 | | 4 | - #+source: table-length - #+begin_src emacs-lisp :var table=example-table + #+NAME: table-length + #+BEGIN_SRC emacs-lisp :var table=example-table (length table) - #+end_src + #+END_SRC #+results: table-length : 4 - a code block name, as assigned by `#+srcname:', followed by - parentheses: +"list" + a simple list named with a `#+NAME:' line (note that nesting is not + carried through to the source code block) + + #+NAME: example-list + - simple + - not + - nested + - list + + #+BEGIN_SRC emacs-lisp :var x=example-list + (print x) + #+END_SRC + + #+results: + | simple | list | + +"code block without arguments" + a code block name (from the example above), as assigned by + `#+NAME:', optionally followed by parentheses - #+begin_src emacs-lisp :var length=table-length() + #+BEGIN_SRC emacs-lisp :var length=table-length() (* 2 length) - #+end_src + #+END_SRC #+results: : 8 - In addition, an argument can be passed to the code block referenced - by `:var'. The argument is passed within the parentheses - following the code block name: +"code block with arguments" + a code block name, as assigned by `#+NAME:', followed by + parentheses and optional arguments passed within the parentheses + following the code block name using standard function call syntax - #+source: double - #+begin_src emacs-lisp :var input=8 + #+NAME: double + #+BEGIN_SRC emacs-lisp :var input=8 (* 2 input) - #+end_src + #+END_SRC #+results: double : 16 - #+source: squared - #+begin_src emacs-lisp :var input=double(input=1) + #+NAME: squared + #+BEGIN_SRC emacs-lisp :var input=double(input=1) (* input input) - #+end_src + #+END_SRC #+results: squared : 4 +"literal example" + a literal example block named with a `#+NAME:' line + + #+NAME: literal-example + #+BEGIN_EXAMPLE + A literal example + on two lines + #+END_EXAMPLE + + #+NAME: read-literal-example + #+BEGIN_SRC emacs-lisp :var x=literal-example + (concatenate 'string x " for you.") + #+END_SRC + + #+results: read-literal-example + : A literal example + : on two lines for you. + + Alternate argument syntax ......................... It is also possible to specify arguments in a potentially more natural -way using the `#+source:' line of a code block. As in the following -example arguments can be packed inside of parenthesis, separated by +way using the `#+NAME:' line of a code block. As in the following +example, arguments can be packed inside of parentheses, separated by commas, following the source name. - #+source: double(input=0, x=2) - #+begin_src emacs-lisp + #+NAME: double(input=0, x=2) + #+BEGIN_SRC emacs-lisp (* 2 (+ input x)) - #+end_src + #+END_SRC Indexable variable values ......................... @@ -11481,15 +12262,15 @@ `:rownames' are applied. The following example assigns the last cell of the first row the table `example-table' to the variable `data': - #+results: example-table + #+NAME: example-table | 1 | a | | 2 | b | | 3 | c | | 4 | d | - #+begin_src emacs-lisp :var data=example-table[0,-1] + #+BEGIN_SRC emacs-lisp :var data=example-table[0,-1] data - #+end_src + #+END_SRC #+results: : a @@ -11499,16 +12280,16 @@ referenced. For example the following assigns the middle three rows of `example-table' to `data'. - #+results: example-table + #+NAME: example-table | 1 | a | | 2 | b | | 3 | c | | 4 | d | | 5 | 3 | - #+begin_src emacs-lisp :var data=example-table[1:3] + #+BEGIN_SRC emacs-lisp :var data=example-table[1:3] data - #+end_src + #+END_SRC #+results: | 2 | b | @@ -11520,15 +12301,15 @@ `0:-1', as shown in the following example in which the entire first column is referenced. - #+results: example-table + #+NAME: example-table | 1 | a | | 2 | b | | 3 | c | | 4 | d | - #+begin_src emacs-lisp :var data=example-table[,0] + #+BEGIN_SRC emacs-lisp :var data=example-table[,0] data - #+end_src + #+END_SRC #+results: | 1 | 2 | 3 | 4 | @@ -11537,16 +12318,16 @@ tables. Any number of dimensions can be indexed. Dimensions are separated from one another by commas, as shown in the following example. - #+source: 3D - #+begin_src emacs-lisp + #+NAME: 3D + #+BEGIN_SRC emacs-lisp '(((1 2 3) (4 5 6) (7 8 9)) ((10 11 12) (13 14 15) (16 17 18)) ((19 20 21) (22 23 24) (25 26 27))) - #+end_src + #+END_SRC - #+begin_src emacs-lisp :var data=3D[1,,1] + #+BEGIN_SRC emacs-lisp :var data=3D[1,,1] data - #+end_src + #+END_SRC #+results: | 11 | 14 | 17 | @@ -11560,23 +12341,23 @@ variable value. The following example demonstrates use of this evaluation to reliably pass the file-name of the org-mode buffer to a code block--note that evaluation of header arguments is guaranteed to -take place in the original org-mode file, while there is no such +take place in the original Org-mode file, while there is no such guarantee for evaluation of the code block body. - #+begin_src sh :var filename=(buffer-file-name) :exports both + #+BEGIN_SRC sh :var filename=(buffer-file-name) :exports both wc -w $filename - #+end_src + #+END_SRC Note that values read from tables and lists will not be evaluated as Emacs Lisp, as shown in the following example. - #+results: table + #+NAME: table | (a b c) | - #+headers: :var data=table[0,0] - #+begin_src perl + #+HEADERS: :var data=table[0,0] + #+BEGIN_SRC perl $data - #+end_src + #+END_SRC #+results: : (a b c) @@ -11729,9 +12510,9 @@ In other words, if you want your plot to go into a folder called `Work' in your home directory, you could use - #+begin_src R :file myplot.png :dir ~/Work + #+BEGIN_SRC R :file myplot.png :dir ~/Work matplot(matrix(rnorm(100), 10), type="l") - #+end_src + #+END_SRC Remote execution ................ @@ -11740,9 +12521,9 @@ syntax, in which case the code will be evaluated on the remote machine. An example is - #+begin_src R :file plot.png :dir /dand@yakuba.princeton.edu: + #+BEGIN_SRC R :file plot.png :dir /dand@yakuba.princeton.edu: plot(1:10, main=system("hostname", intern=TRUE)) - #+end_src + #+END_SRC Text results will be returned to the local Org-mode buffer as usual, and file output will be created on the remote machine with relative @@ -11772,7 +12553,7 @@ * `:dir' should typically not be used to create files during export with `:exports results' or `:exports both'. The reason is that, in order to retain portability of exported material between - machines, during export links inserted into the buffer will *not* + machines, during export links inserted into the buffer will _not_ be expanded against `default directory'. Therefore, if `default-directory' is altered using `:dir', it is probable that the file will be created in a location to which the link does not @@ -11965,33 +12746,33 @@ tangling the following Org-mode file, the bodies of code blocks will be concatenated into the resulting pure code file. - #+begin_src sh :tangle yes :noweb yes :shebang #!/bin/sh + #+BEGIN_SRC sh :tangle yes :noweb yes :shebang #!/bin/sh <> - #+end_src + #+END_SRC * the mount point of the fullest disk :PROPERTIES: :noweb-ref: fullest-disk :END: ** query all mounted disks - #+begin_src sh + #+BEGIN_SRC sh df \ - #+end_src + #+END_SRC ** strip the header row - #+begin_src sh + #+BEGIN_SRC sh |sed '1d' \ - #+end_src + #+END_SRC ** sort by the percent full - #+begin_src sh + #+BEGIN_SRC sh |awk '{print $5 " " $6}'|sort -n |tail -1 \ - #+end_src + #+END_SRC ** extract the mount point - #+begin_src sh + #+BEGIN_SRC sh |awk '{print $2}' - #+end_src + #+END_SRC  File: org, Node: cache, Next: sep, Prev: noweb-ref, Up: Specific header arguments @@ -12019,18 +12800,18 @@ not be re-run unless the results of `random' have changed since it was last run. - #+srcname: random - #+begin_src R :cache yes + #+NAME: random + #+BEGIN_SRC R :cache yes runif(1) - #+end_src + #+END_SRC #+results[a2a72cd647ad44515fab62e144796432793d68e1]: random 0.4659510825295 - #+srcname: caller - #+begin_src emacs-lisp :var x=random :cache yes + #+NAME: caller + #+BEGIN_SRC emacs-lisp :var x=random :cache yes x - #+end_src + #+END_SRC #+results[bec9c8724e397d5df3b696502df3ed7892fc4f5f]: caller 0.254227238707244 @@ -12067,17 +12848,17 @@ `:hlines no' or relying on the default value yields the following results. - #+tblname: many-cols + #+TBLNAME: many-cols | a | b | c | |---+---+---| | d | e | f | |---+---+---| | g | h | i | - #+source: echo-table - #+begin_src python :var tab=many-cols + #+NAME: echo-table + #+BEGIN_SRC python :var tab=many-cols return tab - #+end_src + #+END_SRC #+results: echo-table | a | b | c | @@ -12087,17 +12868,17 @@ * `yes' Leaves hlines in the table. Setting `:hlines yes' has this effect. - #+tblname: many-cols + #+TBLNAME: many-cols | a | b | c | |---+---+---| | d | e | f | |---+---+---| | g | h | i | - #+source: echo-table - #+begin_src python :var tab=many-cols :hlines yes + #+NAME: echo-table + #+BEGIN_SRC python :var tab=many-cols :hlines yes return tab - #+end_src + #+END_SRC #+results: echo-table | a | b | c | @@ -12113,22 +12894,26 @@ ..................... The `:colnames' header argument accepts the values `yes', `no', or -`nil' for unassigned. The default value is `nil'. +`nil' for unassigned. The default value is `nil'. Note that the +behavior of the `:colnames' header argument may differ across +languages. For example Emacs Lisp code blocks ignore the `:colnames' +header argument entirely given the ease with which tables with column +names may be handled directly in Emacs Lisp. * `nil' If an input table looks like it has column names (because its second row is an hline), then the column names will be removed from the table before processing, then reapplied to the results. - #+tblname: less-cols + #+TBLNAME: less-cols | a | |---| | b | | c | - #+srcname: echo-table-again - #+begin_src python :var tab=less-cols + #+NAME: echo-table-again + #+BEGIN_SRC python :var tab=less-cols return [[val + '*' for val in row] for row in tab] - #+end_src + #+END_SRC #+results: echo-table-again | a | @@ -12160,14 +12945,14 @@ * `yes' The first column of the table is removed from the table before processing, and is then reapplied to the results. - #+tblname: with-rownames + #+TBLNAME: with-rownames | one | 1 | 2 | 3 | 4 | 5 | | two | 6 | 7 | 8 | 9 | 10 | - #+srcname: echo-table-once-again - #+begin_src python :var tab=with-rownames :rownames yes + #+NAME: echo-table-once-again + #+BEGIN_SRC python :var tab=with-rownames :rownames yes return [[val + 10 for val in row] for row in tab] - #+end_src + #+END_SRC #+results: echo-table-once-again | one | 11 | 12 | 13 | 14 | 15 | @@ -12196,12 +12981,24 @@ ................. The `:eval' header argument can be used to limit the evaluation of -specific code blocks. `:eval' accepts two arguments "never" and -"query". `:eval never' will ensure that a code block is never -evaluated, this can be useful for protecting against the evaluation of -dangerous code blocks. `:eval query' will require a query for every -execution of a code block regardless of the value of the -`org-confirm-babel-evaluate' variable. +specific code blocks. The `:eval' header argument can be useful for +protecting against the evaluation of dangerous code blocks or to ensure +that evaluation will require a query regardless of the value of the +`org-confirm-babel-evaluate' variable. The possible values of `:eval' +and their effects are shown below. + +`never or no' + The code block will not be evaluated under any circumstances. + +`query' + Evaluation of the code block will require a query. + +`never-export or no-export' + The code block will not be evaluated during export but may still + be called interactively. + +`query-export' + Evaluation of the code block during export will require a query. If this header argument is not set then evaluation is determined by the value of the `org-confirm-babel-evaluate' variable see *note Code @@ -12283,24 +13080,24 @@ if the same code were passed to a non-interactive interpreter running as an external process. For example, compare the following two blocks: - #+begin_src python :results output + #+BEGIN_SRC python :results output print "hello" 2 print "bye" - #+end_src + #+END_SRC - #+resname: + #+results: : hello : bye In non-session mode, the `2' is not printed and does not appear. - #+begin_src python :results output :session + #+BEGIN_SRC python :results output :session print "hello" 2 print "bye" - #+end_src + #+END_SRC - #+resname: + #+results: : hello : 2 : bye @@ -12846,6 +13643,8 @@ - If the cursor is on the `#+BEGIN' line of a dynamic block, the block is updated. + - If the cursor is at a timestamp, fix the day name in the timestamp. +  File: org, Node: Clean view, Next: TTY keys, Prev: The very busy C-c C-c key, Up: Miscellaneous @@ -13135,7 +13934,7 @@ (add-hook 'org-mode-hook (lambda () (org-set-local 'yas/trigger-key [tab]) - (define-key yas/keymap [tab] 'yas/next-field-group))) + (define-key yas/keymap [tab] 'yas/next-field-or-maybe-expand))) The latest version of yasnippet doesn't play well with Org mode. If the above code does not fix the conflict, start by defining the @@ -13886,7 +14685,7 @@ emacs -batch -l ~/.emacs \ -eval '(org-batch-agenda "a" \ - org-agenda-span month \ + org-agenda-span (quote month) \ org-agenda-include-diary nil \ org-agenda-files (quote ("~/org/project.org")))' \ | lpr @@ -14538,7 +15337,7 @@ * David O'Toole wrote `org-publish.el' and drafted the manual chapter about publishing. - * Jambunathan K contributed the OpenDocumentText exporter. + * Jambunathan K contributed the ODT exporter. * Sebastien Vauban reported many issues with LaTeX and BEAMER export and enabled source code highlighling in Gnus. @@ -14589,8 +15388,12 @@ (line 29) * #+ATTR_LaTeX: Tables in LaTeX export. (line 14) +* #+ATTR_ODT <1>: Customizing tables in ODT export. + (line 6) +* #+ATTR_ODT: Tables in ODT export. + (line 16) * #+AUTHOR: Export options. (line 19) -* #+BEGIN, clocktable: The clock table. (line 35) +* #+BEGIN, clocktable: The clock table. (line 36) * #+BEGIN, columnview: Capturing column view. (line 11) * #+BEGIN:dynamic block: Dynamic blocks. (line 15) @@ -14602,9 +15405,13 @@ * #+BEGIN_HTML: Quoting HTML tags. (line 12) * #+BEGIN_LaTeX: Quoting LaTeX code. (line 12) * #+BEGIN_QUOTE: Paragraphs. (line 26) -* #+BEGIN_SRC: Literal examples. (line 27) +* #+BEGIN_SRC <1>: Structure of code blocks. + (line 6) +* #+BEGIN_SRC: Literal examples. (line 28) * #+BEGIN_VERSE: Paragraphs. (line 13) * #+BIND: Export options. (line 19) +* #+CALL: Evaluating code blocks. + (line 17) * #+CAPTION <1>: Images in DocBook export. (line 30) * #+CAPTION <2>: Images in LaTeX export. @@ -14629,6 +15436,10 @@ * #+EXPORT_EXCLUDE_TAGS: Export options. (line 19) * #+EXPORT_SELECT_TAGS: Export options. (line 19) * #+FILETAGS: Tag inheritance. (line 20) +* #+HEADER:: Code block specific header arguments. + (line 30) +* #+HEADERS:: Code block specific header arguments. + (line 30) * #+HTML: Quoting HTML tags. (line 12) * #+INCLUDE: Include files. (line 7) * #+INFOJS_OPT: JavaScript support. (line 26) @@ -14653,6 +15464,10 @@ * #+LINK_HOME: Export options. (line 19) * #+LINK_UP: Export options. (line 19) * #+MACRO: Macro replacement. (line 6) +* #+NAME: Structure of code blocks. + (line 6) +* #+ODT_STYLES_FILE: Applying custom styles. + (line 28) * #+OPTIONS <1>: Export options. (line 19) * #+OPTIONS: Headings and sections. (line 14) @@ -14661,7 +15476,7 @@ * #+ORGTBL, SEND: A LaTeX example. (line 14) * #+PLOT: Org-Plot. (line 6) * #+PRIORITIES: Priorities. (line 44) -* #+PROPERTY: Property syntax. (line 37) +* #+PROPERTY: Property syntax. (line 42) * #+SEQ_TODO: Per-file keywords. (line 6) * #+SETUPFILE: In-buffer settings. (line 61) * #+STARTUP:: In-buffer settings. (line 74) @@ -14682,8 +15497,7 @@ (line 6) * action, for publishing: Publishing action. (line 6) * activation: Activation. (line 6) -* active region <1>: OpenDocumentText export commands. - (line 6) +* active region <1>: ODT export commands. (line 9) * active region <2>: DocBook export commands. (line 6) * active region <3>: LaTeX/PDF export commands. @@ -14701,12 +15515,12 @@ * agenda: Weekly/daily agenda. (line 6) * agenda dispatcher: Agenda dispatcher. (line 6) * agenda files: Agenda files. (line 6) -* agenda files, removing buffers: Agenda commands. (line 518) +* agenda files, removing buffers: Agenda commands. (line 521) * agenda views: Agenda Views. (line 6) * agenda views, custom: Custom agenda views. (line 6) * agenda views, exporting <1>: Exporting Agenda Views. (line 6) -* agenda views, exporting: Agenda commands. (line 505) +* agenda views, exporting: Agenda commands. (line 508) * agenda views, user-defined: Special agenda views. (line 6) * agenda, column view: Agenda column view. (line 6) @@ -14722,6 +15536,8 @@ * API, for properties <1>: Using the property API. (line 6) * API, for properties: Property API. (line 6) +* appointment <1>: Weekly/daily agenda. (line 103) +* appointment: Timestamps. (line 14) * appointment reminders: Weekly/daily agenda. (line 103) * appt.el: Weekly/daily agenda. (line 103) * archive locations: Moving subtrees. (line 20) @@ -14735,7 +15551,9 @@ * autoload: Activation. (line 6) * babel, languages: Languages. (line 6) * babel, library of: Library of Babel. (line 6) -* backtrace of an error: Feedback. (line 40) +* backtrace of an error: Feedback. (line 68) +* BasicODConverter: Exporting and converting to other formats. + (line 33) * Baur, Steven L.: Cooperation. (line 74) * BBDB links: External links. (line 6) * BBDB, anniversaries: Weekly/daily agenda. (line 69) @@ -14754,7 +15572,7 @@ * calculations, in tables <1>: The spreadsheet. (line 6) * calculations, in tables: Built-in table editor. (line 156) -* calendar commands, from agenda: Agenda commands. (line 454) +* calendar commands, from agenda: Agenda commands. (line 457) * calendar integration: Weekly/daily agenda. (line 28) * calendar, for selecting date: The date/time prompt. (line 76) @@ -14824,8 +15642,10 @@ * contents, global visibility state: Visibility cycling. (line 22) * context-sensitive commands, hooks: Context-sensitive commands. (line 6) -* convert: Converting to Other formats. +* convert: Exporting and converting to other formats. (line 6) +* converter: Exporting and converting to other formats. + (line 26) * coordinates, of field: References. (line 86) * copying, of subtrees: Structure editing. (line 6) * Countdown timer: Countdown timer. (line 6) @@ -14859,7 +15679,7 @@ (line 98) * demotion, of subtrees: Structure editing. (line 6) * dependencies, of TODO states: TODO dependencies. (line 6) -* diary entries, creating from agenda: Agenda commands. (line 459) +* diary entries, creating from agenda: Agenda commands. (line 462) * diary integration: Weekly/daily agenda. (line 28) * dictionary word completion: Completion. (line 6) * directories, for publishing: Sources and destinations. @@ -14868,7 +15688,7 @@ (line 6) * dispatching agenda commands: Agenda dispatcher. (line 6) * display changing, in agenda: Agenda commands. (line 64) -* doc, docx: Converting to Other formats. +* doc, docx: Exporting and converting to other formats. (line 6) * DocBook export: DocBook export. (line 6) * DocBook recursive sections: Recursive sections. (line 6) @@ -14882,6 +15702,8 @@ * drawers: Drawers. (line 6) * Duration, computing: Durations and time values. (line 6) +* dvipng <1>: Working with LaTeX math snippets. + (line 44) * dvipng: Math formatting in HTML export. (line 6) * dynamic blocks: Dynamic blocks. (line 6) @@ -14893,19 +15715,21 @@ * effort filtering, in agenda: Agenda commands. (line 193) * Elisp links: External links. (line 6) * emacsserver: Protocols. (line 6) -* embedding images in OpenDocumentText: Images in OpenDocumentText export. +* embedding images in ODT: Images in ODT export. (line 6) * emphasized text: Export options. (line 39) * entitiesplain, STARTUP keyword: In-buffer settings. (line 160) * entitiespretty, STARTUP keyword: In-buffer settings. (line 160) -* evaluate time range: Creating timestamps. (line 59) +* evaluate time range: Creating timestamps. (line 62) * even, STARTUP keyword: In-buffer settings. (line 128) +* export, OpenDocument: OpenDocument Text export. + (line 6) * export, selective by tags or TODO keyword: Selective export. (line 6) * exporting: Exporting. (line 6) * exporting agenda views <1>: Exporting Agenda Views. (line 13) -* exporting agenda views: Agenda commands. (line 505) +* exporting agenda views: Agenda commands. (line 508) * exporting, not: Comment lines. (line 6) * extended TODO keywords: TODO extensions. (line 6) * external archiving: Moving subtrees. (line 6) @@ -15008,7 +15832,7 @@ (line 6) * iCalendar export: iCalendar export. (line 6) * idle, resolve, dangling: Resolving idle time. (line 6) -* images, embedding in OpenDocumentText: Images in OpenDocumentText export. +* images, embedding in ODT: Images in ODT export. (line 6) * images, inline in DocBook: Images in DocBook export. (line 6) @@ -15016,7 +15840,7 @@ (line 6) * images, inline in LaTeX: Images in LaTeX export. (line 6) -* images, inlining: Handling links. (line 134) +* images, inlining: Handling links. (line 136) * imenu.el: Cooperation. (line 33) * in-buffer settings: In-buffer settings. (line 6) * inactive timestamp: Timestamps. (line 49) @@ -15030,8 +15854,8 @@ * inheritance, of tags: Tag inheritance. (line 6) * inlined images, markup rules: Images and tables. (line 21) * inlineimages, STARTUP keyword <1>: In-buffer settings. (line 101) -* inlineimages, STARTUP keyword: Handling links. (line 134) -* inlining images: Handling links. (line 134) +* inlineimages, STARTUP keyword: Handling links. (line 136) +* inlining images: Handling links. (line 136) * inlining images in DocBook: Images in DocBook export. (line 6) * inlining images in HTML: Images in HTML export. @@ -15050,7 +15874,7 @@ * italic text, markup rules: Emphasis and monospace. (line 6) * jumping, to headlines: Motion. (line 6) -* K, Jambunathan: OpenDocumentText export. +* K, Jambunathan: OpenDocument Text export. (line 6) * key bindings, global: Activation. (line 6) * keyword options: Per-file keywords. (line 6) @@ -15074,20 +15898,22 @@ (line 6) * level, require for tags/property match: Matching tags and properties. (line 59) +* LibreOffice: OpenDocument Text export. + (line 6) * line-break preservation: Export options. (line 39) * link abbreviations: Link abbreviations. (line 6) * link abbreviations, completion of: Completion. (line 6) * link completion: Handling links. (line 66) * link format: Link format. (line 6) * links, external: External links. (line 6) -* links, finding next/previous: Handling links. (line 154) +* links, finding next/previous: Handling links. (line 156) * links, handling: Handling links. (line 6) * links, in HTML export: Links in HTML export. (line 6) * links, internal: Internal links. (line 6) * links, publishing: Publishing links. (line 6) * links, radio targets: Radio targets. (line 6) -* links, returning to: Handling links. (line 147) +* links, returning to: Handling links. (line 149) * Lisp forms, as table formulas: Formula syntax for Lisp. (line 6) * lists, in other modes: Tables in arbitrary syntax. @@ -15113,7 +15939,7 @@ * maintainer: Feedback. (line 6) * mapping entries, API: Using the mapping API. (line 6) -* mark ring: Handling links. (line 143) +* mark ring: Handling links. (line 145) * marking characters, tables: Advanced features. (line 39) * match view: Matching tags and properties. (line 6) @@ -15125,6 +15951,8 @@ * math symbols: Special symbols. (line 6) * MathJax: Math formatting in HTML export. (line 6) +* MathML: Working with LaTeX math snippets. + (line 9) * MH-E links: External links. (line 6) * mind map: Freemind export. (line 6) * minor mode for structure editing: Orgstruct mode. (line 6) @@ -15146,7 +15974,7 @@ * nohideblocks, STARTUP keyword: Blocks. (line 13) * noindent, STARTUP keyword: In-buffer settings. (line 86) * noinlineimages, STARTUP keyword <1>: In-buffer settings. (line 101) -* noinlineimages, STARTUP keyword: Handling links. (line 134) +* noinlineimages, STARTUP keyword: Handling links. (line 136) * nologdone, STARTUP keyword: In-buffer settings. (line 107) * nolognoteclock-out, STARTUP keyword: In-buffer settings. (line 107) * nologredeadline, STARTUP keyword: In-buffer settings. (line 107) @@ -15156,7 +15984,9 @@ * occur, command: Sparse trees. (line 6) * odd, STARTUP keyword: In-buffer settings. (line 128) * odd-levels-only outlines: Clean view. (line 6) -* OpenDocumentText export: OpenDocumentText export. +* ODT: OpenDocument Text export. + (line 6) +* OpenDocument: OpenDocument Text export. (line 6) * option keyword completion: Completion. (line 6) * options, for custom agenda views: Setting Options. (line 6) @@ -15171,6 +16001,10 @@ * org-hide-block-startup: In-buffer settings. (line 155) * org-list-insert-radio-list: Radio lists. (line 6) * Org-mode, turning on: Activation. (line 21) +* org-modules: OpenDocument Text export. + (line 6) +* org-odt.el: OpenDocument Text export. + (line 6) * org-pretty-entities: In-buffer settings. (line 159) * org-publish-project-alist: Project alist. (line 6) * Orgstruct mode: Orgstruct mode. (line 6) @@ -15192,7 +16026,7 @@ (line 6) * per-file keywords: Per-file keywords. (line 6) * plain lists: Plain lists. (line 6) -* plain text external links: External links. (line 60) +* plain text external links: External links. (line 62) * plot tables using Gnuplot: Org-Plot. (line 6) * presentation, of agenda items: Presentation and sorting. (line 6) @@ -15215,14 +16049,14 @@ (line 6) * properties, searching: Property searches. (line 6) * properties, special: Special properties. (line 6) -* property EXPORT_FILE_NAME <1>: OpenDocumentText export commands. - (line 7) +* property EXPORT_FILE_NAME <1>: ODT export commands. (line 10) * property EXPORT_FILE_NAME <2>: DocBook export commands. (line 7) * property EXPORT_FILE_NAME: LaTeX/PDF export commands. (line 7) * property syntax: Property syntax. (line 6) -* property, _ALL: Property syntax. (line 37) +* property, +: Property syntax. (line 47) +* property, _ALL: Property syntax. (line 42) * property, ARCHIVE <1>: Moving subtrees. (line 29) * property, ARCHIVE: Property inheritance. (line 34) @@ -15260,7 +16094,7 @@ * property, LOGGING <1>: Property inheritance. (line 38) * property, LOGGING: Tracking TODO state changes. - (line 42) + (line 45) * property, ORDERED <1>: Checkboxes. (line 46) * property, ORDERED: TODO dependencies. (line 6) * property, special, ALLTAGS: Special properties. (line 13) @@ -15301,8 +16135,7 @@ * references, to fields: References. (line 15) * references, to ranges: References. (line 63) * refiling notes: Refiling notes. (line 6) -* region, active <1>: OpenDocumentText export commands. - (line 6) +* region, active <1>: ODT export commands. (line 9) * region, active <2>: DocBook export commands. (line 6) * region, active <3>: LaTeX/PDF export commands. @@ -15318,7 +16151,8 @@ (line 55) * relative timer: Relative timer. (line 6) * remember.el: Cooperation. (line 42) -* remote editing, bulk, from agenda: Agenda commands. (line 402) +* reminders: Weekly/daily agenda. (line 103) +* remote editing, bulk, from agenda: Agenda commands. (line 405) * remote editing, from agenda: Agenda commands. (line 272) * remote editing, undo: Agenda commands. (line 273) * remote references: References. (line 123) @@ -15373,12 +16207,18 @@ (line 6) * source code, extracting: Extracting source code. (line 6) +* source code, inline: Structure of code blocks. + (line 16) +* source code, language: Structure of code blocks. + (line 37) * source code, languages: Languages. (line 6) * source code, library: Library of Babel. (line 6) * source code, noweb reference: Noweb reference syntax. (line 6) * source code, results of evaluation: Results of evaluation. (line 6) +* source code, switches: Structure of code blocks. + (line 41) * source code, working with: Working With Source Code. (line 6) * sparse tree, for deadlines: Inserting deadline/schedule. @@ -15393,7 +16233,7 @@ * speed keys: Speed keys. (line 6) * speedbar.el: Cooperation. (line 45) * spreadsheet capabilities: The spreadsheet. (line 6) -* square brackets, around links: External links. (line 60) +* square brackets, around links: External links. (line 62) * statistics, for checkboxes: Checkboxes. (line 30) * statistics, for TODO items: Breaking down tasks. (line 6) * storing links: Handling links. (line 10) @@ -15402,7 +16242,9 @@ (line 6) * structure editing: Structure editing. (line 6) * structure of document: Document Structure. (line 6) -* styles, custom: Applying Custom Styles. +* styles, custom <1>: Working with OpenDocument style files. + (line 6) +* styles, custom: Applying custom styles. (line 6) * sublevels, inclusion into tags match: Tag inheritance. (line 6) * sublevels, inclusion into TODO list: Global TODO list. (line 35) @@ -15428,16 +16270,17 @@ * table.el: Cooperation. (line 49) * tables <1>: Export options. (line 39) * tables: Tables. (line 6) -* tables, in DocBook export <1>: Tables in OpenDocumentText export. - (line 6) -* tables, in DocBook export <2>: Links in OpenDocumentText export. +* tables, in DocBook export <1>: Tables in ODT export. (line 6) +* tables, in DocBook export <2>: Links in ODT export. (line 6) * tables, in DocBook export: Tables in DocBook export. (line 6) * tables, in HTML: Tables in HTML export. (line 6) * tables, in LaTeX export: Tables in LaTeX export. (line 6) +* tables, in ODT export: Customizing tables in ODT export. + (line 6) * tables, in other modes: Tables in arbitrary syntax. (line 6) * tables, markup rules: Images and tables. (line 6) @@ -15457,7 +16300,9 @@ * tasks, breaking down: Breaking down tasks. (line 6) * tasks, repeated: Repeated tasks. (line 6) * template insertion: Easy Templates. (line 6) -* template, custom: Applying Custom Styles. +* template, custom <1>: Working with OpenDocument style files. + (line 6) +* template, custom: Applying custom styles. (line 6) * templates, for Capture: Capture templates. (line 6) * TeX interpretation: Embedded LaTeX. (line 6) @@ -15506,8 +16351,7 @@ * transient mark mode <1>: Built-in table editor. (line 156) * transient mark mode: Structure editing. (line 126) -* transient-mark-mode <1>: OpenDocumentText export commands. - (line 6) +* transient-mark-mode <1>: ODT export commands. (line 9) * transient-mark-mode <2>: DocBook export commands. (line 6) * transient-mark-mode <3>: LaTeX/PDF export commands. @@ -15526,6 +16370,8 @@ (line 6) * undoing remote-editing events: Agenda commands. (line 273) * unison: Uploading files. (line 6) +* unoconv: Exporting and converting to other formats. + (line 28) * updating, table: Updating the table. (line 6) * URL links: External links. (line 6) * USENET links: External links. (line 6) @@ -15549,6 +16395,8 @@ * XEmacs: Installation. (line 6) * XOXO export: XOXO export. (line 6) * yasnippet.el: Conflicts. (line 39) +* zip: Pre-requisites for ODT export. + (line 6)  File: org, Node: Key Index, Next: Command and Function Index, Prev: Main Index, Up: Top @@ -15560,7 +16408,7 @@ * Menu: * $: Agenda commands. (line 307) -* %: Agenda commands. (line 404) +* %: Agenda commands. (line 407) * ': CDLaTeX mode. (line 42) * +: Agenda commands. (line 329) * ,: Agenda commands. (line 321) @@ -15577,7 +16425,7 @@ * <2>: The date/time prompt. (line 82) * <3>: Setting tags. (line 116) -* <4>: Handling links. (line 118) +* <4>: Handling links. (line 122) * : Built-in table editor. (line 65) * <1>: Agenda commands. (line 28) @@ -15592,7 +16440,7 @@ * <6>: Plain lists. (line 70) * <7>: Structure editing. (line 31) * : Visibility cycling. (line 10) -* > <1>: Agenda commands. (line 379) +* > <1>: Agenda commands. (line 382) * > <2>: Agenda files. (line 60) * > <3>: The date/time prompt. (line 82) @@ -15608,10 +16456,10 @@ * a: Agenda commands. (line 295) * A: Agenda commands. (line 64) * a: Using column view. (line 59) -* B: Agenda commands. (line 413) +* B: Agenda commands. (line 416) * b: Agenda commands. (line 93) -* C: Agenda commands. (line 487) -* c: Agenda commands. (line 454) +* C: Agenda commands. (line 490) +* c: Agenda commands. (line 457) * C-#: Advanced features. (line 10) * C-': Agenda files. (line 22) * C-,: Agenda files. (line 22) @@ -15621,12 +16469,12 @@ * C-c !: Creating timestamps. (line 15) * C-c #: Checkboxes. (line 83) * C-c $: Moving subtrees. (line 9) -* C-c %: Handling links. (line 140) -* C-c &: Handling links. (line 144) +* C-c %: Handling links. (line 142) +* C-c &: Handling links. (line 146) * C-c ' <1>: Cooperation. (line 61) * C-c ' <2>: Editing source code. (line 6) * C-c ' <3>: Include files. (line 31) -* C-c ' <4>: Literal examples. (line 69) +* C-c ' <4>: Literal examples. (line 70) * C-c ': Editing and debugging formulas. (line 36) * C-c * <1>: Updating the table. (line 13) @@ -15654,13 +16502,13 @@ * C-c / r: Sparse trees. (line 17) * C-c / t: TODO basics. (line 33) * C-c ;: Comment lines. (line 12) -* C-c <: Creating timestamps. (line 26) +* C-c <: Creating timestamps. (line 29) * C-c : Built-in table editor. (line 105) * C-c = <1>: Editing and debugging formulas. (line 13) * C-c =: Column formulas. (line 29) -* C-c >: Creating timestamps. (line 30) +* C-c >: Creating timestamps. (line 33) * C-c ?: Editing and debugging formulas. (line 22) * C-c [: Agenda files. (line 15) @@ -15720,28 +16568,29 @@ * C-c C-c <3>: Key bindings and useful functions. (line 11) * C-c C-c <4>: Evaluating code blocks. - (line 13) + (line 14) * C-c C-c <5>: Previewing LaTeX fragments. (line 15) * C-c C-c <6>: Using capture. (line 15) -* C-c C-c <7>: The clock table. (line 15) +* C-c C-c <7>: The clock table. (line 16) * C-c C-c <8>: Clocking commands. (line 43) -* C-c C-c <9>: Capturing column view. +* C-c C-c <9>: Creating timestamps. (line 26) +* C-c C-c <10>: Capturing column view. (line 51) -* C-c C-c <10>: Using column view. (line 52) -* C-c C-c <11>: Property syntax. (line 57) -* C-c C-c <12>: Setting tags. (line 18) -* C-c C-c <13>: Checkboxes. (line 52) -* C-c C-c <14>: Editing and debugging formulas. +* C-c C-c <11>: Using column view. (line 52) +* C-c C-c <12>: Property syntax. (line 87) +* C-c C-c <13>: Setting tags. (line 18) +* C-c C-c <14>: Checkboxes. (line 52) +* C-c C-c <15>: Editing and debugging formulas. (line 46) -* C-c C-c <15>: Built-in table editor. +* C-c C-c <16>: Built-in table editor. (line 57) -* C-c C-c <16>: Footnotes. (line 87) +* C-c C-c <17>: Footnotes. (line 87) * C-c C-c: Plain lists. (line 127) -* C-c C-c c: Property syntax. (line 75) -* C-c C-c D: Property syntax. (line 72) -* C-c C-c d: Property syntax. (line 69) -* C-c C-c s: Property syntax. (line 61) +* C-c C-c c: Property syntax. (line 105) +* C-c C-c D: Property syntax. (line 102) +* C-c C-c d: Property syntax. (line 99) +* C-c C-c s: Property syntax. (line 91) * C-c C-d <1>: Agenda commands. (line 349) * C-c C-d: Inserting deadline/schedule. (line 9) @@ -15779,10 +16628,8 @@ (line 24) * C-c C-e n: ASCII/Latin-1/UTF-8 export. (line 21) -* C-c C-e O: OpenDocumentText export commands. - (line 13) -* C-c C-e o: OpenDocumentText export commands. - (line 6) +* C-c C-e O: ODT export commands. (line 23) +* C-c C-e o: ODT export commands. (line 9) * C-c C-e P: Triggering publication. (line 10) * C-c C-e p: LaTeX/PDF export commands. @@ -15814,7 +16661,7 @@ * C-c C-o <1>: Key bindings and useful functions. (line 11) * C-c C-o <2>: Agenda commands. (line 56) -* C-c C-o <3>: Creating timestamps. (line 35) +* C-c C-o <3>: Creating timestamps. (line 38) * C-c C-o <4>: Handling links. (line 101) * C-c C-o: Footnotes. (line 91) * C-c C-p: Motion. (line 9) @@ -15856,7 +16703,7 @@ (line 22) * C-c C-v h: Key bindings and useful functions. (line 24) -* C-c C-v i: Library of Babel. (line 16) +* C-c C-v i: Library of Babel. (line 21) * C-c C-v l: Key bindings and useful functions. (line 25) * C-c C-v p: Key bindings and useful functions. @@ -15906,18 +16753,18 @@ (line 23) * C-c C-x C-l: Previewing LaTeX fragments. (line 9) -* C-c C-x C-n: Handling links. (line 150) +* C-c C-x C-n: Handling links. (line 152) * C-c C-x C-o: Clocking commands. (line 32) -* C-c C-x C-p: Handling links. (line 150) +* C-c C-x C-p: Handling links. (line 152) * C-c C-x C-r: The clock table. (line 10) * C-c C-x C-s <1>: Agenda commands. (line 307) * C-c C-x C-s: Moving subtrees. (line 9) * C-c C-x C-t: Custom time format. (line 12) * C-c C-x C-u <1>: Dynamic blocks. (line 21) -* C-c C-x C-u <2>: The clock table. (line 15) +* C-c C-x C-u <2>: The clock table. (line 16) * C-c C-x C-u: Capturing column view. (line 51) -* C-c C-x C-v: Handling links. (line 131) +* C-c C-x C-v: Handling links. (line 133) * C-c C-x C-w <1>: Built-in table editor. (line 130) * C-c C-x C-w: Structure editing. (line 55) @@ -15937,14 +16784,14 @@ * C-c C-x o <1>: Checkboxes. (line 75) * C-c C-x o: TODO dependencies. (line 29) * C-c C-x p <1>: Header arguments in Org-mode properties. - (line 23) -* C-c C-x p: Property syntax. (line 48) + (line 24) +* C-c C-x p: Property syntax. (line 78) * C-c C-x v: Visibility cycling. (line 53) * C-c C-y <1>: Clocking commands. (line 43) -* C-c C-y: Creating timestamps. (line 56) +* C-c C-y: Creating timestamps. (line 59) * C-c C-z <1>: Agenda commands. (line 337) * C-c C-z: Drawers. (line 28) -* C-c l <1>: Literal examples. (line 77) +* C-c l <1>: Literal examples. (line 78) * C-c l: Handling links. (line 9) * C-c { <1>: CDLaTeX mode. (line 20) * C-c {: Editing and debugging formulas. @@ -15980,7 +16827,7 @@ * C-u C-c C-x a: Internal archiving. (line 39) * C-u C-c C-x C-s: Moving subtrees. (line 11) * C-u C-c C-x C-u <1>: Dynamic blocks. (line 22) -* C-u C-c C-x C-u <2>: The clock table. (line 19) +* C-u C-c C-x C-u <2>: The clock table. (line 20) * C-u C-c C-x C-u: Capturing column view. (line 55) * C-u C-u : Visibility cycling. (line 71) @@ -16005,7 +16852,7 @@ (line 46) * C-x C-w <1>: Exporting Agenda Views. (line 12) -* C-x C-w: Agenda commands. (line 504) +* C-x C-w: Agenda commands. (line 507) * C-x n b: Structure editing. (line 109) * C-x n s: Structure editing. (line 106) * C-x n w: Structure editing. (line 112) @@ -16019,9 +16866,9 @@ * g: Agenda commands. (line 168) * G: Agenda commands. (line 157) * g: Using column view. (line 23) -* H: Agenda commands. (line 491) -* i: Agenda commands. (line 459) -* I: Agenda commands. (line 384) +* H: Agenda commands. (line 494) +* i: Agenda commands. (line 462) +* I: Agenda commands. (line 387) * J: Agenda commands. (line 102) * j: Agenda commands. (line 99) * k: Agenda commands. (line 352) @@ -16031,8 +16878,8 @@ (line 26) * l: Agenda commands. (line 109) * L: Agenda commands. (line 31) -* M: Agenda commands. (line 478) -* m: Agenda commands. (line 402) +* M: Agenda commands. (line 481) +* m: Agenda commands. (line 405) * M- <1>: Editing and debugging formulas. (line 76) * M- <2>: Built-in table editor. @@ -16052,7 +16899,7 @@ * M- <2>: Plain lists. (line 108) * M-: Structure editing. (line 40) * M- <1>: Completion. (line 16) -* M- <2>: Property syntax. (line 45) +* M- <2>: Property syntax. (line 75) * M- <3>: Setting tags. (line 6) * M- <4>: Per-file keywords. (line 24) * M-: Editing and debugging formulas. @@ -16102,43 +16949,43 @@ * M-x org-iswitchb: Agenda files. (line 26) * mouse-1 <1>: The date/time prompt. (line 82) -* mouse-1 <2>: Handling links. (line 122) +* mouse-1 <2>: Handling links. (line 124) * mouse-1: Footnotes. (line 91) * mouse-2 <1>: Agenda commands. (line 34) -* mouse-2 <2>: Handling links. (line 122) +* mouse-2 <2>: Handling links. (line 124) * mouse-2: Footnotes. (line 91) * mouse-3 <1>: Agenda commands. (line 28) -* mouse-3: Handling links. (line 127) +* mouse-3: Handling links. (line 129) * n <1>: Agenda commands. (line 19) * n: Using column view. (line 42) -* O: Agenda commands. (line 388) +* O: Agenda commands. (line 391) * o: Agenda commands. (line 66) * P: Agenda commands. (line 326) * p <1>: Agenda commands. (line 20) * p: Using column view. (line 42) -* q <1>: Agenda commands. (line 517) +* q <1>: Agenda commands. (line 520) * q: Using column view. (line 26) * r: Agenda commands. (line 161) * R: Agenda commands. (line 131) * r <1>: Global TODO list. (line 23) * r: Using column view. (line 19) -* S: Agenda commands. (line 482) +* S: Agenda commands. (line 485) * s: Agenda commands. (line 171) * S- <1>: Agenda commands. (line 334) * S- <2>: The date/time prompt. (line 82) -* S- <3>: Creating timestamps. (line 44) +* S- <3>: Creating timestamps. (line 47) * S- <4>: Priorities. (line 29) * S- <5>: Editing and debugging formulas. (line 66) * S-: Plain lists. (line 95) -* S- <1>: Agenda commands. (line 375) -* S- <2>: The clock table. (line 23) +* S- <1>: Agenda commands. (line 378) +* S- <2>: The clock table. (line 24) * S- <3>: The date/time prompt. (line 82) -* S- <4>: Creating timestamps. (line 39) +* S- <4>: Creating timestamps. (line 42) * S- <5>: Using column view. (line 35) -* S- <6>: Property syntax. (line 65) +* S- <6>: Property syntax. (line 95) * S- <7>: Multiple sets in one file. (line 32) * S- <8>: TODO basics. (line 28) @@ -16148,12 +16995,12 @@ * S-: Built-in table editor. (line 159) * S- <1>: Agenda commands. (line 364) -* S- <2>: The clock table. (line 23) +* S- <2>: The clock table. (line 24) * S- <3>: The date/time prompt. (line 82) -* S- <4>: Creating timestamps. (line 39) +* S- <4>: Creating timestamps. (line 42) * S- <5>: Using column view. (line 35) -* S- <6>: Property syntax. (line 65) +* S- <6>: Property syntax. (line 95) * S- <7>: Multiple sets in one file. (line 32) * S- <8>: TODO basics. (line 28) @@ -16166,7 +17013,7 @@ * S- <1>: Agenda commands. (line 329) * S- <2>: The date/time prompt. (line 82) -* S- <3>: Creating timestamps. (line 44) +* S- <3>: Creating timestamps. (line 47) * S- <4>: Priorities. (line 29) * S-: Editing and debugging formulas. (line 66) @@ -16175,8 +17022,8 @@ * S-M-: Using column view. (line 72) * T: Agenda commands. (line 312) * t: Agenda commands. (line 277) -* U: Agenda commands. (line 410) -* u: Agenda commands. (line 407) +* U: Agenda commands. (line 413) +* u: Agenda commands. (line 410) * v: Using column view. (line 55) * v [: Agenda commands. (line 120) * v A: Agenda commands. (line 127) @@ -16192,8 +17039,8 @@ * v w: Agenda commands. (line 72) * v y: Agenda commands. (line 74) * w: Agenda commands. (line 72) -* x: Agenda commands. (line 518) -* X: Agenda commands. (line 391) +* x: Agenda commands. (line 521) +* X: Agenda commands. (line 394) * z: Agenda commands. (line 337) * {: Agenda commands. (line 259) * }: Agenda commands. (line 259) @@ -16211,7 +17058,6 @@ * lisp-complete-symbol: Editing and debugging formulas. (line 63) * next-error: Sparse trees. (line 29) -* org-aganda-day-view: Agenda commands. (line 69) * org-agenda-action: Agenda commands. (line 352) * org-agenda-add-note: Agenda commands. (line 337) * org-agenda-archive: Agenda commands. (line 307) @@ -16220,36 +17066,37 @@ * org-agenda-archive-to-archive-sibling: Agenda commands. (line 303) * org-agenda-archives-mode: Agenda commands. (line 124) * org-agenda-archives-mode 'files: Agenda commands. (line 127) -* org-agenda-bulk-action: Agenda commands. (line 413) -* org-agenda-bulk-mark: Agenda commands. (line 402) -* org-agenda-bulk-mark-regexp: Agenda commands. (line 404) -* org-agenda-bulk-remove-all-marks: Agenda commands. (line 410) -* org-agenda-bulk-unmark: Agenda commands. (line 407) -* org-agenda-clock-cancel: Agenda commands. (line 391) +* org-agenda-bulk-action: Agenda commands. (line 416) +* org-agenda-bulk-mark: Agenda commands. (line 405) +* org-agenda-bulk-mark-regexp: Agenda commands. (line 407) +* org-agenda-bulk-remove-all-marks: Agenda commands. (line 413) +* org-agenda-bulk-unmark: Agenda commands. (line 410) +* org-agenda-clock-cancel: Agenda commands. (line 394) * org-agenda-clock-goto: Agenda commands. (line 102) -* org-agenda-clock-in: Agenda commands. (line 384) -* org-agenda-clock-out: Agenda commands. (line 388) +* org-agenda-clock-in: Agenda commands. (line 387) +* org-agenda-clock-out: Agenda commands. (line 391) * org-agenda-clockreport-mode: Agenda commands. (line 131) * org-agenda-columns <1>: Agenda column view. (line 11) * org-agenda-columns: Agenda commands. (line 175) -* org-agenda-convert-date: Agenda commands. (line 487) -* org-agenda-date-prompt: Agenda commands. (line 379) +* org-agenda-convert-date: Agenda commands. (line 490) +* org-agenda-date-prompt: Agenda commands. (line 382) +* org-agenda-day-view: Agenda commands. (line 69) * org-agenda-deadline: Agenda commands. (line 349) -* org-agenda-diary-entry: Agenda commands. (line 459) -* org-agenda-do-date-earlier: Agenda commands. (line 375) +* org-agenda-diary-entry: Agenda commands. (line 462) +* org-agenda-do-date-earlier: Agenda commands. (line 378) * org-agenda-do-date-later: Agenda commands. (line 364) * org-agenda-earlier: Agenda commands. (line 93) * org-agenda-entry-text-mode: Agenda commands. (line 149) -* org-agenda-exit: Agenda commands. (line 518) +* org-agenda-exit: Agenda commands. (line 521) * org-agenda-file-to-front: Agenda files. (line 15) * org-agenda-filter-by-tag: Agenda commands. (line 193) * org-agenda-filter-by-tag-refine: Agenda commands. (line 252) * org-agenda-follow-mode: Agenda commands. (line 40) * org-agenda-goto: Agenda commands. (line 34) -* org-agenda-goto-calendar: Agenda commands. (line 454) +* org-agenda-goto-calendar: Agenda commands. (line 457) * org-agenda-goto-date: Agenda commands. (line 99) * org-agenda-goto-today: Agenda commands. (line 96) -* org-agenda-holidays: Agenda commands. (line 491) +* org-agenda-holidays: Agenda commands. (line 494) * org-agenda-kill: Agenda commands. (line 286) * org-agenda-later: Agenda commands. (line 87) * org-agenda-list: Weekly/daily agenda. (line 9) @@ -16260,11 +17107,11 @@ * org-agenda-month-year: Agenda commands. (line 74) * org-agenda-next-line: Agenda commands. (line 19) * org-agenda-open-link: Agenda commands. (line 56) -* org-agenda-phases-of-moon: Agenda commands. (line 478) +* org-agenda-phases-of-moon: Agenda commands. (line 481) * org-agenda-previous-line: Agenda commands. (line 20) * org-agenda-priority-down: Agenda commands. (line 334) * org-agenda-priority-up: Agenda commands. (line 329) -* org-agenda-quit: Agenda commands. (line 517) +* org-agenda-quit: Agenda commands. (line 520) * org-agenda-recenter: Agenda commands. (line 31) * org-agenda-redo: Agenda commands. (line 161) * org-agenda-refile: Agenda commands. (line 292) @@ -16277,7 +17124,7 @@ * org-agenda-show-and-scroll-up: Agenda commands. (line 28) * org-agenda-show-priority: Agenda commands. (line 326) * org-agenda-show-tags: Agenda commands. (line 312) -* org-agenda-sunrise-sunset: Agenda commands. (line 482) +* org-agenda-sunrise-sunset: Agenda commands. (line 485) * org-agenda-switch-to: Agenda commands. (line 37) * org-agenda-todo: Agenda commands. (line 277) * org-agenda-todo-nextset: Agenda commands. (line 281) @@ -16307,7 +17154,7 @@ * org-beamer-select-environment: Beamer class export. (line 83) * org-buffer-property-keys: Using the property API. (line 35) -* org-calendar-goto-agenda: Agenda commands. (line 455) +* org-calendar-goto-agenda: Agenda commands. (line 458) * org-capture: Using capture. (line 6) * org-capture-finalize: Using capture. (line 15) * org-capture-kill: Using capture. (line 31) @@ -16327,7 +17174,7 @@ * org-clock-out: Clocking commands. (line 32) * org-clock-report: The clock table. (line 10) * org-clock-timestamps-up/down: Clocking commands. (line 48) -* org-clocktable-try-shift: The clock table. (line 23) +* org-clocktable-try-shift: The clock table. (line 24) * org-clone-subtree-with-time-shift: Structure editing. (line 81) * org-columns: Using column view. (line 9) * org-columns-delete: Using column view. (line 75) @@ -16342,7 +17189,7 @@ * org-columns-set-tags-or-toggle: Using column view. (line 52) * org-columns-show-value: Using column view. (line 55) * org-columns-widen: Using column view. (line 70) -* org-compute-property-at-point: Property syntax. (line 75) +* org-compute-property-at-point: Property syntax. (line 105) * org-copy-subtree: Structure editing. (line 59) * org-copy-visible: Visibility cycling. (line 53) * org-cut-subtree: Structure editing. (line 55) @@ -16350,15 +17197,15 @@ * org-cycle <2>: Structure editing. (line 31) * org-cycle: Visibility cycling. (line 10) * org-cycle-agenda-files: Agenda files. (line 22) -* org-date-from-calendar: Creating timestamps. (line 26) +* org-date-from-calendar: Creating timestamps. (line 29) * org-dblock-update <1>: Dynamic blocks. (line 21) -* org-dblock-update <2>: The clock table. (line 15) +* org-dblock-update <2>: The clock table. (line 16) * org-dblock-update: Capturing column view. (line 51) * org-deadline: Inserting deadline/schedule. (line 9) -* org-delete-property: Property syntax. (line 69) -* org-delete-property-globally: Property syntax. (line 72) +* org-delete-property: Property syntax. (line 99) +* org-delete-property-globally: Property syntax. (line 102) * org-demote: Using the mapping API. (line 83) * org-demote-subtree: Structure editing. (line 46) @@ -16384,7 +17231,7 @@ * org-entry-remove-from-multivalued-property: Using the property API. (line 56) * org-evaluate-time-range <1>: Clocking commands. (line 43) -* org-evaluate-time-range: Creating timestamps. (line 56) +* org-evaluate-time-range: Creating timestamps. (line 59) * org-export: The export dispatcher. (line 12) * org-export-as-ascii: ASCII/Latin-1/UTF-8 export. @@ -16410,10 +17257,8 @@ (line 21) * org-export-as-latin1-to-buffer: ASCII/Latin-1/UTF-8 export. (line 24) -* org-export-as-odt: OpenDocumentText export commands. - (line 6) -* org-export-as-odt-and-open: OpenDocumentText export commands. - (line 13) +* org-export-as-odt: ODT export commands. (line 9) +* org-export-as-odt-and-open: ODT export commands. (line 23) * org-export-as-pdf: LaTeX/PDF export commands. (line 28) * org-export-as-pdf-and-open: LaTeX/PDF export commands. @@ -16439,7 +17284,7 @@ * org-forward-same-level: Motion. (line 12) * org-global-cycle: Visibility cycling. (line 22) * org-goto: Motion. (line 21) -* org-goto-calendar: Creating timestamps. (line 30) +* org-goto-calendar: Creating timestamps. (line 33) * org-insert-columns-dblock: Capturing column view. (line 49) * org-insert-export-options-template: Export options. (line 16) @@ -16450,7 +17295,7 @@ * org-insert-link: Handling links. (line 65) * org-insert-property-drawer <1>: Using the property API. (line 38) -* org-insert-property-drawer: Property syntax. (line 55) +* org-insert-property-drawer: Property syntax. (line 85) * org-insert-todo-heading <1>: Checkboxes. (line 72) * org-insert-todo-heading <2>: TODO basics. (line 52) * org-insert-todo-heading: Structure editing. (line 22) @@ -16459,19 +17304,19 @@ (line 13) * org-mark-entry-for-agenda-action: Inserting deadline/schedule. (line 23) -* org-mark-ring-goto: Handling links. (line 144) -* org-mark-ring-push: Handling links. (line 140) +* org-mark-ring-goto: Handling links. (line 146) +* org-mark-ring-push: Handling links. (line 142) * org-match-sparse-tree: Tag searches. (line 9) * org-move-subtree-down: Structure editing. (line 52) * org-move-subtree-up: Structure editing. (line 49) * org-narrow-to-block: Structure editing. (line 109) * org-narrow-to-subtree: Structure editing. (line 106) -* org-next-link: Handling links. (line 150) +* org-next-link: Handling links. (line 152) * org-occur: Sparse trees. (line 17) -* org-open-at-point <1>: Creating timestamps. (line 35) +* org-open-at-point <1>: Creating timestamps. (line 38) * org-open-at-point: Handling links. (line 101) * org-paste-subtree: Structure editing. (line 63) -* org-previous-link: Handling links. (line 150) +* org-previous-link: Handling links. (line 152) * org-priority <1>: Using the mapping API. (line 71) * org-priority: Priorities. (line 24) @@ -16480,9 +17325,9 @@ * org-promote: Using the mapping API. (line 80) * org-promote-subtree: Structure editing. (line 43) -* org-property-action: Property syntax. (line 57) -* org-property-next-allowed-value: Property syntax. (line 65) -* org-property-previous-allowed-value: Property syntax. (line 65) +* org-property-action: Property syntax. (line 87) +* org-property-next-allowed-value: Property syntax. (line 95) +* org-property-previous-allowed-value: Property syntax. (line 95) * org-publish: Triggering publication. (line 8) * org-publish-all: Triggering publication. @@ -16502,7 +17347,7 @@ (line 17) * org-search-view: Search view. (line 9) * org-set-effort: Effort estimates. (line 14) -* org-set-property: Property syntax. (line 48) +* org-set-property: Property syntax. (line 78) * org-set-startup-visibility: Visibility cycling. (line 71) * org-set-tags-command: Setting tags. (line 10) * org-show-todo-key: TODO basics. (line 33) @@ -16617,10 +17462,10 @@ * org-timer: Relative timer. (line 10) * org-timer-item: Relative timer. (line 13) * org-timer-start: Relative timer. (line 30) -* org-timestamp-down-day: Creating timestamps. (line 39) -* org-timestamp-down-down: Creating timestamps. (line 44) -* org-timestamp-up: Creating timestamps. (line 44) -* org-timestamp-up-day: Creating timestamps. (line 39) +* org-timestamp-down-day: Creating timestamps. (line 42) +* org-timestamp-down-down: Creating timestamps. (line 47) +* org-timestamp-up: Creating timestamps. (line 47) +* org-timestamp-up-day: Creating timestamps. (line 42) * org-todo <1>: Using the mapping API. (line 67) * org-todo <2>: Clocking commands. (line 52) @@ -16630,7 +17475,7 @@ * org-toggle-archive-tag: Internal archiving. (line 36) * org-toggle-checkbox: Checkboxes. (line 52) * org-toggle-heading: Structure editing. (line 115) -* org-toggle-inline-images: Handling links. (line 131) +* org-toggle-inline-images: Handling links. (line 133) * org-toggle-ordered-property <1>: Checkboxes. (line 75) * org-toggle-ordered-property: TODO dependencies. (line 29) * org-toggle-tag: Using the mapping API. @@ -16642,12 +17487,12 @@ * org-update-statistics-cookies: Checkboxes. (line 83) * org-write-agenda <1>: Exporting Agenda Views. (line 12) -* org-write-agenda: Agenda commands. (line 504) +* org-write-agenda: Agenda commands. (line 507) * org-yank: Structure editing. (line 69) * outline-next-visible-heading: Motion. (line 8) * outline-previous-visible-heading: Motion. (line 9) * outline-up-heading: Motion. (line 18) -* pcomplete: Property syntax. (line 45) +* pcomplete: Property syntax. (line 75) * previous-error: Sparse trees. (line 32) * show-all: Visibility cycling. (line 33) * show-branches: Visibility cycling. (line 43) @@ -16684,12 +17529,12 @@ * org-agenda-custom-commands <2>: Setting Options. (line 6) * org-agenda-custom-commands <3>: Storing searches. (line 9) * org-agenda-custom-commands: Sparse trees. (line 37) -* org-agenda-diary-file: Agenda commands. (line 462) +* org-agenda-diary-file: Agenda commands. (line 465) * org-agenda-dim-blocked-tasks: TODO dependencies. (line 39) * org-agenda-entry-text-maxlines: Agenda commands. (line 152) * org-agenda-exporter-settings <1>: Exporting Agenda Views. (line 13) -* org-agenda-exporter-settings: Agenda commands. (line 505) +* org-agenda-exporter-settings: Agenda commands. (line 508) * org-agenda-files <1>: iCalendar export. (line 37) * org-agenda-files <2>: Sorting of agenda items. (line 8) @@ -16747,7 +17592,7 @@ * org-attach-directory: Attachments. (line 6) * org-attach-method: Attachments. (line 32) * org-babel-default-header-args <1>: Header arguments in Org-mode properties. - (line 23) + (line 24) * org-babel-default-header-args: System-wide header arguments. (line 6) * org-calc-default-modes: Formula syntax for Calc. @@ -16755,8 +17600,8 @@ * org-clock-idle-time: Resolving idle time. (line 11) * org-clock-into-drawer: Clocking commands. (line 7) * org-clock-modeline-total: Clocking commands. (line 18) -* org-clocktable-defaults: The clock table. (line 37) -* org-coderef-label-format: Literal examples. (line 57) +* org-clocktable-defaults: The clock table. (line 38) +* org-coderef-label-format: Literal examples. (line 58) * org-columns-default-format <1>: Agenda column view. (line 18) * org-columns-default-format <2>: Agenda commands. (line 178) * org-columns-default-format <3>: Effort estimates. (line 31) @@ -16789,7 +17634,7 @@ * org-display-custom-times <1>: Publishing options. (line 12) * org-display-custom-times: Custom time format. (line 6) * org-display-internal-link-with-indirect-buffer: Handling links. - (line 130) + (line 132) * org-disputed-keys: Conflicts. (line 34) * org-done (face): Faces for TODO keywords. (line 6) @@ -16880,10 +17725,28 @@ (line 8) * org-export-latex-packages-alist: Header and sectioning. (line 8) -* org-export-odt-styles-file <1>: Converting to Other formats. - (line 6) -* org-export-odt-styles-file: Applying Custom Styles. - (line 6) +* org-export-odt-convert: Exporting and converting to other formats. + (line 15) +* org-export-odt-convert-capabilities: Exporting and converting to other formats. + (line 54) +* org-export-odt-convert-process: Exporting and converting to other formats. + (line 66) +* org-export-odt-convert-processes: Exporting and converting to other formats. + (line 49) +* org-export-odt-create-custom-styles-for-srcblocks: Literal examples in ODT export. + (line 17) +* org-export-odt-fontify-srcblocks: Literal examples in ODT export. + (line 11) +* org-export-odt-pixels-per-inch: Images in ODT export. + (line 33) +* org-export-odt-preferred-output-format: ODT export commands. + (line 10) +* org-export-odt-schema-dir: Validating OpenDocument XML. + (line 16) +* org-export-odt-styles-file: Applying custom styles. + (line 28) +* org-export-odt-table-styles: Customizing tables in ODT export. + (line 98) * org-export-plist-vars: Export options. (line 39) * org-export-preserve-breaks: Publishing options. (line 12) * org-export-publishing-directory: Publishing options. (line 12) @@ -16943,7 +17806,7 @@ * org-format-latex-options: LaTeX fragments. (line 39) * org-from-is-user-regexp: Template expansion. (line 42) * org-global-properties <1>: Effort estimates. (line 31) -* org-global-properties: Property syntax. (line 40) +* org-global-properties: Property syntax. (line 70) * org-goto-auto-isearch: Motion. (line 26) * org-goto-interface: Motion. (line 37) * org-hide (face): Clean view. (line 66) @@ -16968,8 +17831,13 @@ * org-keep-stored-link-after-insertion: Handling links. (line 66) * org-latex-low-levels: LaTeX/PDF export commands. (line 37) +* org-latex-to-mathml-convert-command: Working with LaTeX math snippets. + (line 20) +* org-latex-to-mathml-jar-file: Working with LaTeX math snippets. + (line 20) * org-link-abbrev-alist <1>: In-buffer settings. (line 49) * org-link-abbrev-alist: Link abbreviations. (line 12) +* org-link-frame-setup: Handling links. (line 104) * org-link-to-org-use-id: Handling links. (line 21) * org-list-automatic-rules <1>: Checkboxes. (line 6) * org-list-automatic-rules: Plain lists. (line 64) @@ -16981,7 +17849,7 @@ * org-log-done <1>: In-buffer settings. (line 105) * org-log-done <2>: Agenda commands. (line 112) * org-log-done: Tracking TODO state changes. - (line 26) + (line 29) * org-log-into-drawer <1>: Agenda commands. (line 340) * org-log-into-drawer: Tracking TODO state changes. (line 6) @@ -17002,6 +17870,8 @@ * org-odd-levels-only <3>: In-buffer settings. (line 125) * org-odd-levels-only: Matching tags and properties. (line 59) +* org-odt-data-dir: Exporting and converting to other formats. + (line 35) * org-outline-path-complete-in-steps: Refiling notes. (line 12) * org-overriding-columns-format: Agenda column view. (line 18) * org-plain-list-ordered-item-terminator: Plain lists. (line 14) @@ -17029,7 +17899,7 @@ * org-remove-highlights-with-change <1>: Clocking commands. (line 68) * org-remove-highlights-with-change: Sparse trees. (line 20) * org-replace-disputed-keys: Conflicts. (line 19) -* org-return-follows-link: Handling links. (line 121) +* org-return-follows-link: Handling links. (line 123) * org-reverse-note-order: Refiling notes. (line 12) * org-show-entry-below: Sparse trees. (line 6) * org-show-following-heading: Sparse trees. (line 6) @@ -17047,7 +17917,7 @@ * org-startup-folded: Visibility cycling. (line 58) * org-startup-indented: In-buffer settings. (line 86) * org-startup-with-inline-images <1>: In-buffer settings. (line 98) -* org-startup-with-inline-images: Handling links. (line 134) +* org-startup-with-inline-images: Handling links. (line 136) * org-store-link-functions: Adding hyperlink types. (line 65) * org-stuck-projects: Stuck projects. (line 17) @@ -17100,7 +17970,9 @@ (line 29) * org-use-property-inheritance <1>: Using the property API. (line 18) -* org-use-property-inheritance <2>: iCalendar export. (line 45) +* org-use-property-inheritance <2>: Header arguments in Org-mode properties. + (line 13) +* org-use-property-inheritance <3>: iCalendar export. (line 45) * org-use-property-inheritance: Property inheritance. (line 6) * org-use-speed-commands: Speed keys. (line 6) @@ -17123,450 +17995,481 @@  Tag Table: -Node: Top1278 -Node: Introduction22407 -Node: Summary22877 -Node: Installation25932 -Ref: Installation-Footnote-128008 -Node: Activation28356 -Ref: Activation-Footnote-129983 -Node: Feedback30105 -Ref: Feedback-Footnote-132683 -Node: Conventions32810 -Node: Document Structure34169 -Node: Outlines35093 -Node: Headlines35749 -Ref: Headlines-Footnote-136749 -Node: Visibility cycling36925 -Ref: Visibility cycling-Footnote-140068 -Ref: Visibility cycling-Footnote-240126 -Ref: Visibility cycling-Footnote-340176 -Node: Motion40446 -Node: Structure editing41783 -Ref: Structure editing-Footnote-148161 -Node: Sparse trees48261 -Ref: Sparse trees-Footnote-150768 -Ref: Sparse trees-Footnote-250974 -Ref: Sparse trees-Footnote-351045 -Node: Plain lists51160 -Ref: Plain lists-Footnote-158689 -Ref: Plain lists-Footnote-259043 -Ref: Plain lists-Footnote-359139 -Ref: Plain lists-Footnote-459381 -Ref: Plain lists-Footnote-559552 -Ref: Plain lists-Footnote-659623 -Ref: Plain lists-Footnote-759681 -Ref: Plain lists-Footnote-859857 -Ref: Plain lists-Footnote-959957 -Ref: Plain lists-Footnote-1060059 -Ref: Plain lists-Footnote-1160127 -Node: Drawers60206 -Ref: Drawers-Footnote-161419 -Node: Blocks61524 -Node: Footnotes62085 -Ref: Footnotes-Footnote-166658 -Ref: Footnotes-Footnote-266755 -Node: Orgstruct mode66832 -Node: Tables67950 -Node: Built-in table editor68591 -Ref: Built-in table editor-Footnote-178073 -Node: Column width and alignment78173 -Ref: Column width and alignment-Footnote-180731 -Ref: Column width and alignment-Footnote-280777 -Node: Column groups80874 -Node: Orgtbl mode82386 -Node: The spreadsheet83191 -Node: References84570 -Ref: References-Footnote-190706 -Ref: References-Footnote-290930 -Ref: References-Footnote-391199 -Ref: References-Footnote-491302 -Node: Formula syntax for Calc91592 -Ref: Formula syntax for Calc-Footnote-194588 -Node: Formula syntax for Lisp94912 -Node: Durations and time values96645 -Node: Field and range formulas97727 -Node: Column formulas100137 -Node: Editing and debugging formulas102028 -Node: Updating the table106706 -Node: Advanced features108054 -Node: Org-Plot112492 -Node: Hyperlinks115354 -Node: Link format116111 -Node: Internal links117389 -Ref: Internal links-Footnote-1119203 -Ref: Internal links-Footnote-2119389 -Node: Radio targets119629 -Node: External links120319 -Node: Handling links123840 -Ref: Handling links-Footnote-1131632 -Ref: Handling links-Footnote-2131792 -Ref: Handling links-Footnote-3132088 -Ref: Handling links-Footnote-4132334 -Ref: Handling links-Footnote-5132411 -Ref: Handling links-Footnote-6132485 -Node: Using links outside Org132567 -Node: Link abbreviations133052 -Node: Search options135350 -Ref: Search options-Footnote-1137232 -Node: Custom searches137313 -Node: TODO Items138323 -Ref: TODO Items-Footnote-1139431 -Node: TODO basics139545 -Node: TODO extensions142147 -Node: Workflow states143177 -Ref: Workflow states-Footnote-1144502 -Node: TODO types144595 -Ref: TODO types-Footnote-1146193 -Node: Multiple sets in one file146275 -Node: Fast access to TODO states148140 -Ref: Fast access to TODO states-Footnote-1149002 -Node: Per-file keywords149296 -Ref: Per-file keywords-Footnote-1150692 -Node: Faces for TODO keywords150893 -Node: TODO dependencies151937 -Node: Progress logging154108 -Node: Closing items154820 -Ref: Closing items-Footnote-1155869 -Ref: Closing items-Footnote-2155938 -Node: Tracking TODO state changes156011 -Ref: Tracking TODO state changes-Footnote-1158904 -Ref: Tracking TODO state changes-Footnote-2158961 -Node: Tracking your habits159249 -Node: Priorities163456 -Ref: Priorities-Footnote-1165461 -Node: Breaking down tasks165530 -Ref: Breaking down tasks-Footnote-1167522 -Node: Checkboxes167618 -Ref: Checkboxes-Footnote-1172068 -Ref: Checkboxes-Footnote-2172192 -Node: Tags172368 -Node: Tag inheritance173367 -Ref: Tag inheritance-Footnote-1174739 -Ref: Tag inheritance-Footnote-2174839 -Node: Setting tags174965 -Ref: Setting tags-Footnote-1181288 -Node: Tag searches181371 -Node: Properties and Columns182604 -Node: Property syntax184008 -Node: Special properties186993 -Node: Property searches188514 -Node: Property inheritance189946 -Node: Column view191762 -Node: Defining columns192996 -Node: Scope of column definitions193394 -Node: Column attributes194324 -Ref: Column attributes-Footnote-1198943 -Node: Using column view199076 -Node: Capturing column view201938 -Ref: Capturing column view-Footnote-1204930 -Node: Property API205066 -Node: Dates and Times205420 -Node: Timestamps206399 -Ref: Timestamps-Footnote-1208758 -Ref: Timestamps-Footnote-2208889 -Node: Creating timestamps209658 -Node: The date/time prompt212402 -Ref: The date/time prompt-Footnote-1216977 -Ref: The date/time prompt-Footnote-2217140 -Ref: The date/time prompt-Footnote-3217246 -Node: Custom time format217339 -Node: Deadlines and scheduling219063 -Ref: Deadlines and scheduling-Footnote-1221754 -Node: Inserting deadline/schedule221909 -Ref: Inserting deadline/schedule-Footnote-1224220 -Ref: Inserting deadline/schedule-Footnote-2224372 -Ref: Inserting deadline/schedule-Footnote-3224480 -Node: Repeated tasks224588 -Ref: Repeated tasks-Footnote-1227934 -Ref: Repeated tasks-Footnote-2228183 -Node: Clocking work time228382 -Ref: Clocking work time-Footnote-1229565 -Node: Clocking commands229703 -Ref: Clocking commands-Footnote-1233753 -Ref: Clocking commands-Footnote-2233860 -Ref: Clocking commands-Footnote-3233910 -Ref: Clocking commands-Footnote-4233968 -Node: The clock table234046 -Ref: The clock table-Footnote-1240584 -Ref: The clock table-Footnote-2240678 -Node: Resolving idle time240803 -Ref: Resolving idle time-Footnote-1244058 -Node: Effort estimates244396 -Ref: Effort estimates-Footnote-1247160 -Ref: Effort estimates-Footnote-2247248 -Node: Relative timer247355 -Node: Countdown timer249202 -Node: Capture - Refile - Archive249693 -Node: Capture250674 -Node: Setting up capture252008 -Ref: Setting up capture-Footnote-1252433 -Node: Using capture252499 -Node: Capture templates254655 -Node: Template elements256541 -Node: Template expansion262163 -Ref: Template expansion-Footnote-1265530 -Ref: Template expansion-Footnote-2265617 -Ref: Template expansion-Footnote-3265799 -Node: Attachments265897 -Ref: Attachments-Footnote-1269279 -Node: RSS Feeds269429 -Node: Protocols271019 -Node: Refiling notes271733 -Ref: Refiling notes-Footnote-1273872 -Node: Archiving273968 -Node: Moving subtrees274667 -Ref: Moving subtrees-Footnote-1276378 -Node: Internal archiving276822 -Node: Agenda Views279452 -Node: Agenda files281643 -Ref: Agenda files-Footnote-1284462 -Ref: Agenda files-Footnote-2284611 -Node: Agenda dispatcher284804 -Ref: Agenda dispatcher-Footnote-1287017 -Ref: Agenda dispatcher-Footnote-2287111 -Node: Built-in agenda views287213 -Node: Weekly/daily agenda287862 -Ref: Weekly/daily agenda-Footnote-1292798 -Ref: Weekly/daily agenda-Footnote-2293025 -Node: Global TODO list293201 -Node: Matching tags and properties295729 -Node: Timeline302348 -Node: Search view303040 -Node: Stuck projects304333 -Ref: Stuck projects-Footnote-1306393 -Node: Presentation and sorting306423 -Node: Categories307313 -Ref: Categories-Footnote-1308114 -Node: Time-of-day specifications308551 -Node: Sorting of agenda items310523 -Node: Agenda commands312061 -Ref: Agenda commands-Footnote-1335285 -Ref: Agenda commands-Footnote-2335366 -Ref: Agenda commands-Footnote-3335777 -Node: Custom agenda views335860 -Node: Storing searches336501 -Ref: Storing searches-Footnote-1339035 -Node: Block agenda339152 -Node: Setting Options340390 -Node: Exporting Agenda Views343316 -Ref: Exporting Agenda Views-Footnote-1348212 -Ref: Exporting Agenda Views-Footnote-2348270 -Ref: Exporting Agenda Views-Footnote-3348426 -Ref: Exporting Agenda Views-Footnote-4348613 -Node: Agenda column view348695 -Node: Markup351384 -Node: Structural markup elements352357 -Node: Document title353090 -Node: Headings and sections353852 -Node: Table of contents354522 -Node: Initial text355285 -Node: Lists356401 -Node: Paragraphs356685 -Node: Footnote markup357835 -Node: Emphasis and monospace358171 -Node: Horizontal rules358571 -Node: Comment lines358868 -Node: Images and tables359403 -Node: Literal examples361007 -Ref: Literal examples-Footnote-1364813 -Ref: Literal examples-Footnote-2365794 -Ref: Literal examples-Footnote-3365966 -Ref: Literal examples-Footnote-4366145 -Ref: Literal examples-Footnote-5366382 -Node: Include files366476 -Node: Index entries367994 -Node: Macro replacement368456 -Node: Embedded LaTeX369286 -Ref: Embedded LaTeX-Footnote-1370229 -Node: Special symbols370419 -Ref: Special symbols-Footnote-1372031 -Node: Subscripts and superscripts372186 -Node: LaTeX fragments373440 -Ref: LaTeX fragments-Footnote-1376080 -Ref: LaTeX fragments-Footnote-2376253 -Ref: LaTeX fragments-Footnote-3376559 -Node: Previewing LaTeX fragments376736 -Node: CDLaTeX mode377746 -Ref: CDLaTeX mode-Footnote-1380233 -Node: Exporting380381 -Node: Selective export382309 -Node: Export options383357 -Ref: Export options-Footnote-1388053 -Node: The export dispatcher388144 -Ref: The export dispatcher-Footnote-1389450 -Node: ASCII/Latin-1/UTF-8 export389548 -Ref: ASCII/Latin-1/UTF-8 export-Footnote-1391947 -Ref: ASCII/Latin-1/UTF-8 export-Footnote-2392005 -Node: HTML export392057 -Node: HTML Export commands393081 -Ref: HTML Export commands-Footnote-1395029 -Ref: HTML Export commands-Footnote-2395087 -Node: HTML preamble and postamble395139 -Node: Quoting HTML tags396490 -Node: Links in HTML export397148 -Node: Tables in HTML export398283 -Node: Images in HTML export398828 -Ref: Images in HTML export-Footnote-1400121 -Node: Math formatting in HTML export400183 -Ref: Math formatting in HTML export-Footnote-1401619 -Node: Text areas in HTML export401754 -Node: CSS support402598 -Ref: CSS support-Footnote-1405490 -Ref: CSS support-Footnote-2405676 -Node: JavaScript support405876 -Node: LaTeX and PDF export409491 -Ref: LaTeX and PDF export-Footnote-1410505 -Node: LaTeX/PDF export commands410765 -Ref: LaTeX/PDF export commands-Footnote-1412671 -Ref: LaTeX/PDF export commands-Footnote-2412729 -Node: Header and sectioning412781 -Ref: Header and sectioning-Footnote-1413857 -Node: Quoting LaTeX code413983 -Node: Tables in LaTeX export414618 -Node: Images in LaTeX export415656 -Ref: Images in LaTeX export-Footnote-1417882 -Node: Beamer class export418102 -Node: DocBook export423802 -Node: DocBook export commands424675 -Ref: DocBook export commands-Footnote-1426228 -Ref: DocBook export commands-Footnote-2426288 -Node: Quoting DocBook code426340 -Node: Recursive sections427389 -Node: Tables in DocBook export428117 -Node: Images in DocBook export428582 -Node: Special characters430516 -Node: OpenDocumentText export431557 -Node: OpenDocumentText export commands432935 -Ref: OpenDocumentText export commands-Footnote-1433821 -Ref: OpenDocumentText export commands-Footnote-2433881 -Node: Applying Custom Styles433933 -Node: Converting to Other formats434965 -Node: Links in OpenDocumentText export435758 -Node: Tables in OpenDocumentText export436155 -Node: Images in OpenDocumentText export436535 -Node: Additional Documentation437604 -Node: TaskJuggler export437936 -Node: Freemind export443254 -Node: XOXO export443607 -Node: iCalendar export444138 -Ref: iCalendar export-Footnote-1446832 -Ref: iCalendar export-Footnote-2446922 -Ref: iCalendar export-Footnote-3447022 -Node: Publishing447159 -Node: Configuration448027 -Node: Project alist448809 -Node: Sources and destinations449971 -Node: Selecting files451488 -Node: Publishing action452487 -Ref: Publishing action-Footnote-1454277 -Node: Publishing options454631 -Node: Publishing links458307 -Node: Sitemap459990 -Node: Generating an index463202 -Node: Uploading files463787 -Node: Sample configuration465550 -Node: Simple example466039 -Node: Complex example466712 -Node: Triggering publication468767 -Node: Working With Source Code469755 -Node: Structure of code blocks471446 -Node: Editing source code472965 -Node: Exporting code blocks474515 -Node: Extracting source code476239 -Node: Evaluating code blocks477600 -Ref: Evaluating code blocks-Footnote-1480876 -Ref: Evaluating code blocks-Footnote-2481184 -Node: Library of Babel481312 -Node: Languages482122 -Node: Header arguments484426 -Node: Using header arguments484911 -Node: System-wide header arguments485671 -Node: Language-specific header arguments486494 -Node: Buffer-wide header arguments486897 -Node: Header arguments in Org-mode properties487672 -Node: Code block specific header arguments488697 -Node: Header arguments in function calls490501 -Node: Specific header arguments491252 -Node: var493296 -Node: results498980 -Node: file503223 -Node: dir504129 -Node: exports507053 -Node: tangle507707 -Node: mkdirp508518 -Node: comments508849 -Node: padline509987 -Node: no-expand510517 -Node: session511009 -Node: noweb511456 -Node: noweb-ref512941 -Node: cache514193 -Node: sep515695 -Node: hlines516267 -Node: colnames517779 -Node: rownames518999 -Node: shebang520011 -Node: eval520406 -Node: Results of evaluation521114 -Node: Noweb reference syntax524881 -Node: Key bindings and useful functions525876 -Node: Batch execution527370 -Node: Miscellaneous528465 -Node: Completion529294 -Node: Easy Templates531269 -Node: Speed keys532678 -Node: Code evaluation security533504 -Node: Customization536213 -Node: In-buffer settings536804 -Ref: In-buffer settings-Footnote-1546039 -Node: The very busy C-c C-c key546087 -Node: Clean view547995 -Ref: Clean view-Footnote-1551981 -Ref: Clean view-Footnote-2552042 -Ref: Clean view-Footnote-3552226 -Ref: Clean view-Footnote-4552287 -Ref: Clean view-Footnote-5552399 -Ref: Clean view-Footnote-6552454 -Node: TTY keys552579 -Node: Interaction554345 -Node: Cooperation554742 -Node: Conflicts558540 -Node: org-crypt.el562552 -Node: Hacking563866 -Node: Hooks564718 -Node: Add-on packages565134 -Node: Adding hyperlink types565675 -Node: Context-sensitive commands569597 -Ref: Context-sensitive commands-Footnote-1571173 -Node: Tables in arbitrary syntax571307 -Node: Radio tables572719 -Node: A LaTeX example575262 -Ref: A LaTeX example-Footnote-1579184 -Ref: A LaTeX example-Footnote-2579332 -Node: Translator functions579767 -Ref: Translator functions-Footnote-1582990 -Node: Radio lists583078 -Node: Dynamic blocks584207 -Node: Special agenda views586423 -Ref: Special agenda views-Footnote-1590674 -Node: Extracting agenda information590809 -Node: Using the property API594881 -Node: Using the mapping API598173 -Node: MobileOrg602566 -Node: Setting up the staging area604043 -Ref: Setting up the staging area-Footnote-1605142 -Ref: Setting up the staging area-Footnote-2605443 -Node: Pushing to MobileOrg605705 -Ref: Pushing to MobileOrg-Footnote-1606695 -Ref: Pushing to MobileOrg-Footnote-2607111 -Node: Pulling from MobileOrg607168 -Ref: Pulling from MobileOrg-Footnote-1609588 -Ref: Pulling from MobileOrg-Footnote-2609648 -Node: History and Acknowledgments610025 -Node: Main Index621261 -Node: Key Index691229 -Node: Command and Function Index737352 -Node: Variable Index769416 +Node: Top1245 +Node: Introduction23031 +Node: Summary23501 +Node: Installation26556 +Ref: Installation-Footnote-128632 +Node: Activation28980 +Ref: Activation-Footnote-130607 +Node: Feedback30729 +Ref: Feedback-Footnote-134378 +Node: Conventions34505 +Node: Document Structure35864 +Node: Outlines36788 +Node: Headlines37444 +Ref: Headlines-Footnote-138444 +Node: Visibility cycling38620 +Ref: Visibility cycling-Footnote-141763 +Ref: Visibility cycling-Footnote-241821 +Ref: Visibility cycling-Footnote-341871 +Node: Motion42141 +Node: Structure editing43478 +Ref: Structure editing-Footnote-149856 +Node: Sparse trees49956 +Ref: Sparse trees-Footnote-152463 +Ref: Sparse trees-Footnote-252669 +Ref: Sparse trees-Footnote-352740 +Node: Plain lists52855 +Ref: Plain lists-Footnote-160384 +Ref: Plain lists-Footnote-260738 +Ref: Plain lists-Footnote-360834 +Ref: Plain lists-Footnote-461076 +Ref: Plain lists-Footnote-561247 +Ref: Plain lists-Footnote-661318 +Ref: Plain lists-Footnote-761376 +Ref: Plain lists-Footnote-861552 +Ref: Plain lists-Footnote-961652 +Ref: Plain lists-Footnote-1061754 +Ref: Plain lists-Footnote-1161822 +Node: Drawers61901 +Ref: Drawers-Footnote-163114 +Node: Blocks63219 +Node: Footnotes63780 +Ref: Footnotes-Footnote-168353 +Ref: Footnotes-Footnote-268450 +Node: Orgstruct mode68527 +Node: Tables69645 +Node: Built-in table editor70286 +Ref: Built-in table editor-Footnote-179768 +Node: Column width and alignment79868 +Ref: Column width and alignment-Footnote-182426 +Ref: Column width and alignment-Footnote-282472 +Node: Column groups82569 +Node: Orgtbl mode84081 +Node: The spreadsheet84886 +Node: References86276 +Ref: References-Footnote-192412 +Ref: References-Footnote-292636 +Ref: References-Footnote-392905 +Ref: References-Footnote-493008 +Node: Formula syntax for Calc93298 +Ref: Formula syntax for Calc-Footnote-196294 +Node: Formula syntax for Lisp96618 +Node: Durations and time values98351 +Node: Field and range formulas99433 +Node: Column formulas101843 +Node: Editing and debugging formulas103734 +Node: Updating the table108412 +Node: Advanced features109760 +Ref: Advanced features-Footnote-1114237 +Node: Org-Plot114343 +Node: Hyperlinks117205 +Node: Link format117962 +Node: Internal links119240 +Ref: Internal links-Footnote-1121054 +Ref: Internal links-Footnote-2121240 +Node: Radio targets121480 +Node: External links122170 +Ref: External links-Footnote-1125841 +Node: Handling links126231 +Ref: Handling links-Footnote-1134132 +Ref: Handling links-Footnote-2134292 +Ref: Handling links-Footnote-3134588 +Ref: Handling links-Footnote-4134834 +Ref: Handling links-Footnote-5134911 +Ref: Handling links-Footnote-6134985 +Node: Using links outside Org135067 +Node: Link abbreviations135552 +Node: Search options137850 +Ref: Search options-Footnote-1139732 +Node: Custom searches139813 +Node: TODO Items140823 +Ref: TODO Items-Footnote-1141931 +Node: TODO basics142045 +Node: TODO extensions144647 +Node: Workflow states145677 +Ref: Workflow states-Footnote-1147002 +Node: TODO types147095 +Ref: TODO types-Footnote-1148693 +Node: Multiple sets in one file148775 +Node: Fast access to TODO states150640 +Ref: Fast access to TODO states-Footnote-1151502 +Node: Per-file keywords151796 +Ref: Per-file keywords-Footnote-1153192 +Node: Faces for TODO keywords153393 +Node: TODO dependencies154437 +Node: Progress logging156608 +Node: Closing items157320 +Ref: Closing items-Footnote-1158369 +Ref: Closing items-Footnote-2158438 +Node: Tracking TODO state changes158511 +Ref: Tracking TODO state changes-Footnote-1161555 +Ref: Tracking TODO state changes-Footnote-2161612 +Node: Tracking your habits161900 +Node: Priorities166107 +Ref: Priorities-Footnote-1168112 +Node: Breaking down tasks168181 +Ref: Breaking down tasks-Footnote-1170173 +Node: Checkboxes170269 +Ref: Checkboxes-Footnote-1174719 +Ref: Checkboxes-Footnote-2174843 +Node: Tags175019 +Node: Tag inheritance176018 +Ref: Tag inheritance-Footnote-1177390 +Ref: Tag inheritance-Footnote-2177490 +Node: Setting tags177616 +Ref: Setting tags-Footnote-1183939 +Node: Tag searches184022 +Node: Properties and Columns185255 +Node: Property syntax186691 +Node: Special properties190790 +Node: Property searches192311 +Node: Property inheritance193743 +Node: Column view195559 +Node: Defining columns196793 +Node: Scope of column definitions197191 +Node: Column attributes198121 +Ref: Column attributes-Footnote-1202740 +Node: Using column view202873 +Node: Capturing column view205735 +Ref: Capturing column view-Footnote-1208727 +Node: Property API208863 +Node: Dates and Times209217 +Node: Timestamps210196 +Ref: Timestamps-Footnote-1212558 +Ref: Timestamps-Footnote-2212744 +Ref: Timestamps-Footnote-3212875 +Node: Creating timestamps213644 +Node: The date/time prompt216468 +Ref: The date/time prompt-Footnote-1221043 +Ref: The date/time prompt-Footnote-2221206 +Ref: The date/time prompt-Footnote-3221312 +Node: Custom time format221405 +Node: Deadlines and scheduling223129 +Ref: Deadlines and scheduling-Footnote-1225820 +Node: Inserting deadline/schedule225975 +Ref: Inserting deadline/schedule-Footnote-1228286 +Ref: Inserting deadline/schedule-Footnote-2228438 +Ref: Inserting deadline/schedule-Footnote-3228546 +Node: Repeated tasks228654 +Ref: Repeated tasks-Footnote-1232000 +Ref: Repeated tasks-Footnote-2232249 +Node: Clocking work time232448 +Ref: Clocking work time-Footnote-1233631 +Node: Clocking commands233769 +Ref: Clocking commands-Footnote-1237819 +Ref: Clocking commands-Footnote-2237926 +Ref: Clocking commands-Footnote-3237976 +Ref: Clocking commands-Footnote-4238034 +Node: The clock table238112 +Ref: The clock table-Footnote-1244721 +Ref: The clock table-Footnote-2244815 +Node: Resolving idle time244940 +Ref: Resolving idle time-Footnote-1248195 +Node: Effort estimates248533 +Ref: Effort estimates-Footnote-1251297 +Ref: Effort estimates-Footnote-2251385 +Node: Relative timer251492 +Node: Countdown timer253339 +Node: Capture - Refile - Archive253830 +Node: Capture254811 +Node: Setting up capture256145 +Ref: Setting up capture-Footnote-1256570 +Node: Using capture256636 +Node: Capture templates258792 +Node: Template elements260678 +Node: Template expansion266300 +Ref: Template expansion-Footnote-1269668 +Ref: Template expansion-Footnote-2269755 +Ref: Template expansion-Footnote-3269937 +Node: Attachments270035 +Ref: Attachments-Footnote-1273417 +Node: RSS Feeds273567 +Node: Protocols275157 +Node: Refiling notes275871 +Ref: Refiling notes-Footnote-1278010 +Node: Archiving278106 +Node: Moving subtrees278805 +Ref: Moving subtrees-Footnote-1280516 +Node: Internal archiving280960 +Node: Agenda Views283590 +Node: Agenda files285781 +Ref: Agenda files-Footnote-1288600 +Ref: Agenda files-Footnote-2288749 +Node: Agenda dispatcher288942 +Ref: Agenda dispatcher-Footnote-1291155 +Ref: Agenda dispatcher-Footnote-2291249 +Node: Built-in agenda views291351 +Node: Weekly/daily agenda292000 +Ref: Weekly/daily agenda-Footnote-1296936 +Ref: Weekly/daily agenda-Footnote-2297163 +Node: Global TODO list297338 +Node: Matching tags and properties299866 +Node: Timeline306485 +Node: Search view307177 +Node: Stuck projects308470 +Ref: Stuck projects-Footnote-1310530 +Node: Presentation and sorting310560 +Node: Categories311450 +Ref: Categories-Footnote-1312251 +Node: Time-of-day specifications312688 +Node: Sorting of agenda items314660 +Node: Agenda commands316198 +Ref: Agenda commands-Footnote-1339518 +Ref: Agenda commands-Footnote-2339599 +Ref: Agenda commands-Footnote-3340010 +Node: Custom agenda views340093 +Node: Storing searches340734 +Ref: Storing searches-Footnote-1343268 +Node: Block agenda343385 +Node: Setting Options344623 +Node: Exporting Agenda Views347549 +Ref: Exporting Agenda Views-Footnote-1352450 +Ref: Exporting Agenda Views-Footnote-2352508 +Ref: Exporting Agenda Views-Footnote-3352664 +Ref: Exporting Agenda Views-Footnote-4352851 +Node: Agenda column view352933 +Node: Markup355622 +Node: Structural markup elements356595 +Node: Document title357328 +Node: Headings and sections358090 +Node: Table of contents358760 +Node: Initial text359523 +Node: Lists360639 +Node: Paragraphs360923 +Node: Footnote markup362073 +Node: Emphasis and monospace362409 +Node: Horizontal rules362809 +Node: Comment lines363106 +Node: Images and tables363641 +Node: Literal examples365245 +Ref: Literal examples-Footnote-1369123 +Ref: Literal examples-Footnote-2370104 +Ref: Literal examples-Footnote-3370276 +Ref: Literal examples-Footnote-4370455 +Ref: Literal examples-Footnote-5370692 +Node: Include files370786 +Node: Index entries372304 +Node: Macro replacement372766 +Node: Embedded LaTeX373596 +Ref: Embedded LaTeX-Footnote-1374539 +Node: Special symbols374729 +Ref: Special symbols-Footnote-1376341 +Node: Subscripts and superscripts376496 +Node: LaTeX fragments377750 +Ref: LaTeX fragments-Footnote-1380390 +Ref: LaTeX fragments-Footnote-2380563 +Ref: LaTeX fragments-Footnote-3380869 +Node: Previewing LaTeX fragments381046 +Node: CDLaTeX mode382056 +Ref: CDLaTeX mode-Footnote-1384543 +Node: Exporting384691 +Node: Selective export386626 +Node: Export options387736 +Ref: Export options-Footnote-1392432 +Node: The export dispatcher392523 +Ref: The export dispatcher-Footnote-1393829 +Node: ASCII/Latin-1/UTF-8 export393927 +Ref: ASCII/Latin-1/UTF-8 export-Footnote-1396326 +Ref: ASCII/Latin-1/UTF-8 export-Footnote-2396384 +Node: HTML export396436 +Node: HTML Export commands397460 +Ref: HTML Export commands-Footnote-1399408 +Ref: HTML Export commands-Footnote-2399466 +Node: HTML preamble and postamble399518 +Node: Quoting HTML tags400869 +Node: Links in HTML export401527 +Node: Tables in HTML export402662 +Node: Images in HTML export403210 +Ref: Images in HTML export-Footnote-1404503 +Node: Math formatting in HTML export404565 +Ref: Math formatting in HTML export-Footnote-1406001 +Node: Text areas in HTML export406136 +Node: CSS support406980 +Ref: CSS support-Footnote-1409872 +Ref: CSS support-Footnote-2410058 +Node: JavaScript support410258 +Node: LaTeX and PDF export413873 +Ref: LaTeX and PDF export-Footnote-1414887 +Node: LaTeX/PDF export commands415147 +Ref: LaTeX/PDF export commands-Footnote-1417053 +Ref: LaTeX/PDF export commands-Footnote-2417111 +Node: Header and sectioning417163 +Ref: Header and sectioning-Footnote-1418239 +Node: Quoting LaTeX code418365 +Node: Tables in LaTeX export419000 +Node: Images in LaTeX export420038 +Ref: Images in LaTeX export-Footnote-1422264 +Node: Beamer class export422484 +Node: DocBook export428184 +Node: DocBook export commands429058 +Ref: DocBook export commands-Footnote-1430611 +Ref: DocBook export commands-Footnote-2430671 +Node: Quoting DocBook code430723 +Node: Recursive sections431772 +Node: Tables in DocBook export432500 +Node: Images in DocBook export432965 +Node: Special characters434899 +Node: OpenDocument Text export435940 +Ref: OpenDocument Text export-Footnote-1436953 +Ref: OpenDocument Text export-Footnote-2436983 +Node: Pre-requisites for ODT export437127 +Node: ODT export commands437486 +Ref: x-export-to-odt437717 +Ref: x-export-to-other-formats438801 +Ref: ODT export commands-Footnote-1439340 +Ref: ODT export commands-Footnote-2439400 +Node: Applying custom styles439451 +Node: Links in ODT export441619 +Node: Tables in ODT export441939 +Ref: Tables in ODT export-Footnote-1442901 +Node: Images in ODT export442994 +Node: Math formatting in ODT export445219 +Node: Working with LaTeX math snippets445678 +Ref: Working with LaTeX math snippets-Footnote-1447697 +Node: Working with MathML or OpenDocument formula files447772 +Node: Literal examples in ODT export448343 +Ref: Literal examples in ODT export-Footnote-1449528 +Node: Advanced topics in ODT export449804 +Node: Exporting and converting to other formats450567 +Ref: x-odt-converter-capabilities452712 +Node: Working with OpenDocument style files453310 +Ref: x-factory-styles453813 +Ref: x-orgodtstyles-xml454045 +Ref: x-orgodtcontenttemplate-xml454372 +Ref: x-overriding-factory-styles455028 +Ref: x-org-export-odt-styles-file455302 +Ref: x-org-export-odt-content-template-file456190 +Node: Creating one-off styles456338 +Node: Customizing tables in ODT export458536 +Ref: Customizing tables in ODT export-Footnote-1463548 +Ref: Customizing tables in ODT export-Footnote-2463652 +Ref: Customizing tables in ODT export-Footnote-3463740 +Node: Validating OpenDocument XML464055 +Ref: Validating OpenDocument XML-Footnote-1465079 +Node: TaskJuggler export465131 +Node: Freemind export470450 +Node: XOXO export470803 +Node: iCalendar export471334 +Ref: iCalendar export-Footnote-1474028 +Ref: iCalendar export-Footnote-2474118 +Ref: iCalendar export-Footnote-3474218 +Node: Publishing474355 +Node: Configuration475223 +Node: Project alist476005 +Node: Sources and destinations477167 +Node: Selecting files478684 +Node: Publishing action479683 +Ref: Publishing action-Footnote-1481473 +Node: Publishing options481827 +Node: Publishing links485503 +Node: Sitemap487186 +Node: Generating an index490401 +Node: Uploading files490986 +Node: Sample configuration492749 +Node: Simple example493238 +Node: Complex example493911 +Node: Triggering publication495966 +Node: Working With Source Code496954 +Node: Structure of code blocks498645 +Ref: Structure of code blocks-Footnote-1500514 +Node: Editing source code500608 +Node: Exporting code blocks502158 +Node: Extracting source code503901 +Node: Evaluating code blocks505262 +Ref: Evaluating code blocks-Footnote-1508329 +Ref: Evaluating code blocks-Footnote-2508626 +Node: Library of Babel508754 +Node: Languages509731 +Node: Header arguments512035 +Node: Using header arguments512520 +Node: System-wide header arguments513280 +Node: Language-specific header arguments514103 +Node: Buffer-wide header arguments514506 +Node: Header arguments in Org-mode properties515196 +Node: Code block specific header arguments516303 +Node: Header arguments in function calls518129 +Node: Specific header arguments518876 +Node: var521025 +Node: results528146 +Node: file532389 +Node: dir533295 +Node: exports536219 +Node: tangle536873 +Node: mkdirp537684 +Node: comments538015 +Node: padline539153 +Node: no-expand539683 +Node: session540175 +Node: noweb540622 +Node: noweb-ref542107 +Node: cache543359 +Node: sep544855 +Node: hlines545427 +Node: colnames546935 +Node: rownames548414 +Node: shebang549423 +Node: eval549818 +Node: Results of evaluation550839 +Node: Noweb reference syntax554606 +Node: Key bindings and useful functions555601 +Node: Batch execution557095 +Node: Miscellaneous558190 +Node: Completion559019 +Node: Easy Templates560994 +Node: Speed keys562403 +Node: Code evaluation security563229 +Node: Customization565938 +Node: In-buffer settings566529 +Ref: In-buffer settings-Footnote-1575764 +Node: The very busy C-c C-c key575812 +Node: Clean view577794 +Ref: Clean view-Footnote-1581780 +Ref: Clean view-Footnote-2581841 +Ref: Clean view-Footnote-3582025 +Ref: Clean view-Footnote-4582086 +Ref: Clean view-Footnote-5582198 +Ref: Clean view-Footnote-6582253 +Node: TTY keys582378 +Node: Interaction584144 +Node: Cooperation584541 +Node: Conflicts588339 +Node: org-crypt.el592361 +Node: Hacking593675 +Node: Hooks594527 +Node: Add-on packages594943 +Node: Adding hyperlink types595484 +Node: Context-sensitive commands599406 +Ref: Context-sensitive commands-Footnote-1600982 +Node: Tables in arbitrary syntax601116 +Node: Radio tables602528 +Node: A LaTeX example605071 +Ref: A LaTeX example-Footnote-1608993 +Ref: A LaTeX example-Footnote-2609141 +Node: Translator functions609576 +Ref: Translator functions-Footnote-1612799 +Node: Radio lists612887 +Node: Dynamic blocks614016 +Node: Special agenda views616232 +Ref: Special agenda views-Footnote-1620483 +Node: Extracting agenda information620618 +Node: Using the property API624690 +Node: Using the mapping API627982 +Node: MobileOrg632375 +Node: Setting up the staging area633852 +Ref: Setting up the staging area-Footnote-1634951 +Ref: Setting up the staging area-Footnote-2635252 +Node: Pushing to MobileOrg635514 +Ref: Pushing to MobileOrg-Footnote-1636504 +Ref: Pushing to MobileOrg-Footnote-2636920 +Node: Pulling from MobileOrg636977 +Ref: Pulling from MobileOrg-Footnote-1639397 +Ref: Pulling from MobileOrg-Footnote-2639457 +Node: History and Acknowledgments639834 +Node: Main Index651057 +Node: Key Index724563 +Node: Command and Function Index770609 +Node: Variable Index802523  End Tag Table Binary files /tmp/5ZGVPYkO4E/org-mode-7.7/doc/orgcard_letter.pdf and /tmp/wVYJOtUNwn/org-mode-7.8.02/doc/orgcard_letter.pdf differ Binary files /tmp/5ZGVPYkO4E/org-mode-7.7/doc/orgcard.pdf and /tmp/wVYJOtUNwn/org-mode-7.8.02/doc/orgcard.pdf differ diff -Nru org-mode-7.7/doc/orgcard.tex org-mode-7.8.02/doc/orgcard.tex --- org-mode-7.7/doc/orgcard.tex 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/doc/orgcard.tex 2011-12-13 00:34:24.000000000 +0000 @@ -1,5 +1,5 @@ % Reference Card for Org Mode -\def\orgversionnumber{7.7} +\def\orgversionnumber{7.8.02} \def\versionyear{2011} % latest update \def\year{2011} % latest copyright year @@ -17,8 +17,8 @@ \pdflayout=(0l) % Nothing else needs to be changed below this line. -% Copyright (C) 1987, 1993, 1996, 1997, 2001, 2002, 2003, 2004, 2005, -% 2006, 2007, 2008, 2009 Free Software Foundation, Inc. +% Copyright (C) 1987, 1993, 1996-1997, 2001-2011 +% Free Software Foundation, Inc. % This file is part of GNU Emacs. @@ -445,6 +445,7 @@ \key{execute code block at point}{C-c C-c} \key{open results of code block at point}{C-c C-o} \key{check code block at point for errors}{C-c C-v c} +\key{insert a header argument with completion}{C-c C-v j} \key{view expanded body of code block at point}{C-c C-v v} \key{view information about code block at point}{C-c C-v I} \key{go to named code block}{C-c C-v g} @@ -460,7 +461,7 @@ \key{tangle code blocks in supplied file}{C-c C-v f} \key{ingest all code blocks in supplied file into the Library of Babel}{C-c C-v i} \key{switch to the session of the current code block}{C-c C-v z} -\key{load expanded body of the current code block into a session}{C-c C-v l} +\key{load the current code block into a session}{C-c C-v l} \key{view sha1 hash of the current code block}{C-c C-v a} \section{Completion} @@ -525,7 +526,7 @@ \section{Timestamps} \key{prompt for date and insert timestamp}{C-c .} -\key{like \kbd{C-c} . but insert date and time format}{C-u C-c .} +\key{like \kbd{C-c .} but insert date and time format}{C-u C-c .} \key{like \kbd{C-c .} but make stamp inactive}{C-c !} % FIXME \key{insert DEADLINE timestamp}{C-c C-d} \key{insert SCHEDULED timestamp}{C-c C-s} @@ -673,7 +674,7 @@ \section{Notes} [1] This is only a suggestion for a binding of this command. Choose -your own key as shown under INSTALLATION. +your own key as shown under ACTIVATION. [2] Keybinding affected by {\tt org-support-shift-select} and also {\tt org-replace-disputed-keys}. @@ -686,4 +687,3 @@ % compile-command: "tex refcard" % End: -% arch-tag: 139f6750-5cfc-49ca-92b5-237fe5795290 Binary files /tmp/5ZGVPYkO4E/org-mode-7.7/doc/orgguide.pdf and /tmp/wVYJOtUNwn/org-mode-7.8.02/doc/orgguide.pdf differ diff -Nru org-mode-7.7/doc/orgguide.texi org-mode-7.8.02/doc/orgguide.texi --- org-mode-7.7/doc/orgguide.texi 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/doc/orgguide.texi 2011-12-13 00:34:24.000000000 +0000 @@ -3,8 +3,8 @@ @setfilename ../../info/orgguide @settitle The compact Org-mode Guide -@set VERSION 7.7 -@set DATE July 2011 +@set VERSION 7.8.02 +@set DATE December 2011 @c Use proper quote and backtick for code sections in PDF output @c Cf. Texinfo manual 14.2 @@ -2677,10 +2677,6 @@ @bye -@ignore - arch-tag: 8f0a8557-0acc-4436-b2b2-0197699e1452 -@end ignore - @c Local variables: @c fill-column: 77 @c End: Binary files /tmp/5ZGVPYkO4E/org-mode-7.7/doc/org.pdf and /tmp/wVYJOtUNwn/org-mode-7.8.02/doc/org.pdf differ diff -Nru org-mode-7.7/doc/org.texi org-mode-7.8.02/doc/org.texi --- org-mode-7.7/doc/org.texi 2011-09-10 13:31:22.000000000 +0000 +++ org-mode-7.8.02/doc/org.texi 2011-12-13 15:58:58.000000000 +0000 @@ -4,8 +4,8 @@ @setfilename ../../info/org @settitle The Org Manual -@set VERSION 7.7 -@set DATE July 2011 +@set VERSION 7.8.02 +@set DATE December 2011 @c Use proper quote and backtick for code sections in PDF output @c Cf. Texinfo manual 14.2 @@ -265,8 +265,7 @@ @copying This manual is for Org version @value{VERSION}. -Copyright @copyright{} 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 -Free Software Foundation, Inc. +Copyright @copyright{} 2004-2011 Free Software Foundation, Inc. @quotation Permission is granted to copy, distribute and/or modify this document @@ -303,7 +302,7 @@ @subtitle Release @value{VERSION} @author by Carsten Dominik -with contributions by David O'Toole, Bastien Guerry, Philip Rooke, Dan Davison, Eric Schulte, and Thomas Dye +with contributions by David O'Toole, Bastien Guerry, Philip Rooke, Dan Davison, Eric Schulte, Thomas Dye and Jambunathan K. @c The following two commands start the copyright page. @page @@ -389,7 +388,7 @@ * Column formulas:: Formulas valid for an entire column * Editing and debugging formulas:: Fixing formulas * Updating the table:: Recomputing all dependent fields -* Advanced features:: Field names, parameters and automatic recalc +* Advanced features:: Field and column names, parameters and automatic recalc Hyperlinks @@ -580,7 +579,7 @@ * HTML export:: Exporting to HTML * LaTeX and PDF export:: Exporting to @LaTeX{}, and processing to PDF * DocBook export:: Exporting to DocBook -* OpenDocumentText export:: Exporting to OpenDocumentText +* OpenDocument Text export:: Exporting to OpenDocument Text * TaskJuggler export:: Exporting to TaskJuggler * Freemind export:: Exporting to Freemind mind maps * XOXO export:: Exporting to XOXO @@ -617,15 +616,30 @@ * Images in DocBook export:: How to insert figures into DocBook output * Special characters:: How to handle special characters -OpenDocument export +OpenDocument Text export -* OpenDocumentText export commands:: How to invoke OpenDocumentText export -* Applying Custom Styles:: How to apply custom styles to the output -* Converting to Other formats:: How to convert to formats like doc, docx etc -* Links in OpenDocumentText export:: How links will be interpreted and formatted -* Tables in OpenDocumentText export:: How Tables are handled -* Images in OpenDocumentText export:: How to insert figures -* Additional Documentation:: How to handle special characters +* Pre-requisites for @acronym{ODT} export:: What packages @acronym{ODT} exporter relies on +* @acronym{ODT} export commands:: How to invoke @acronym{ODT} export +* Applying custom styles:: How to apply custom styles to the output +* Links in @acronym{ODT} export:: How links will be interpreted and formatted +* Tables in @acronym{ODT} export:: How Tables are exported +* Images in @acronym{ODT} export:: How to insert images +* Math formatting in @acronym{ODT} export:: How @LaTeX{} fragments are formatted +* Literal examples in @acronym{ODT} export:: How source and example blocks are formatted +* Advanced topics in @acronym{ODT} export:: Read this if you are a power user + +Math formatting in @acronym{ODT} export + +* Working with @LaTeX{} math snippets:: How to embed @LaTeX{} math fragments +* Working with MathML or OpenDocument formula files:: How to embed equations in native format + +Advanced topics in @acronym{ODT} export + +* Exporting and converting to other formats:: How to produce @samp{pdf} and other formats +* Working with OpenDocument style files:: Explore the internals +* Creating one-off styles:: How to produce custom highlighting etc +* Customizing tables in @acronym{ODT} export:: How to define and use Table templates +* Validating OpenDocument XML:: How to debug corrupt OpenDocument files Publishing @@ -994,6 +1008,36 @@ that you only need to add your description. If you re not sending the Email from within Emacs, please copy and paste the content into your Email program. +Sometimes you might face a problem due to an error in your Emacs or Org-mode +setup. Before reporting a bug, it is very helpful to start Emacs with minimal +customisations and reproduce the problem. Doing so often helps you determine +if the problem is with your customisation or with Org-mode itself. You can +start a typical minimal session with a command like the example below. + +@example +$ emacs -Q -l /path/to/minimal-org.el +@end example + +However if you are using Org-mode as distributed with Emacs, a minimal setup +is not necessary. In that case it is sufficient to start Emacs as @code{emacs +-Q}. The @code{minimal-org.el} setup file can have contents as shown below. + +@example +;;; Minimal setup to load latest `org-mode' + +;; activate debugging +(setq debug-on-error t + debug-on-signal nil + debug-on-quit nil) + +;; add latest org-mode to load path +(add-to-list 'load-path (expand-file-name "/path/to/org-mode/lisp")) +(add-to-list 'load-path (expand-file-name "/path/to/org-mode/contrib/lisp")) + +;; activate org +(require 'org-install) +@end example + If an error occurs, a backtrace can be very useful (see below on how to create one). Often a small example file helps, along with clear information about: @@ -2283,7 +2327,7 @@ * Column formulas:: Formulas valid for an entire column * Editing and debugging formulas:: Fixing formulas * Updating the table:: Recomputing all dependent fields -* Advanced features:: Field names, parameters and automatic recalc +* Advanced features:: Field and column names, parameters and automatic recalc @end menu @node References, Formula syntax for Calc, The spreadsheet, The spreadsheet @@ -2840,9 +2884,11 @@ @node Advanced features, , Updating the table, The spreadsheet @subsection Advanced features -If you want the recalculation of fields to happen automatically, or if -you want to be able to assign @i{names} to fields and columns, you need -to reserve the first column of the table for special marking characters. +If you want the recalculation of fields to happen automatically, or if you +want to be able to assign @i{names}@footnote{Such names must start by an +alphabetic character and use only alphanumeric/underscore characters.} to +fields and columns, you need to reserve the first column of the table for +special marking characters. @table @kbd @orgcmd{C-#,org-table-rotate-recalc-marks} @@ -3175,11 +3221,19 @@ ./papers/last.pdf @r{same as above} file:/myself@@some.where:papers/last.pdf @r{file, path on remote machine} /myself@@some.where:papers/last.pdf @r{same as above} -file:sometextfile::NNN @r{file with line number to jump to} +file:sometextfile::NNN @r{file, jump to line number} file:projects.org @r{another Org file} -file:projects.org::some words @r{text search in Org file} +file:projects.org::some words @r{text search in Org file}@footnote{ +The actual behavior of the search will depend on the value of +the variable @code{org-link-search-must-match-exact-headline}. If its value +is nil, then a fuzzy text search will be done. If it is t, then only the +exact headline will be matched. If the value is @code{'query-to-create}, +then an exact headline will be searched; if it is not found, then the user +will be queried to create it.} file:projects.org::*task title @r{heading search in Org file} -docview:papers/last.pdf::NNN @r{open file in doc-view mode at page NNN} +file+sys:/path/to/file @r{open via OS, like double-click} +file+emacs:/path/to/file @r{force opening by Emacs} +docview:papers/last.pdf::NNN @r{open in doc-view mode at page} id:B7423F4D-2E8A-471B-8810-C40F074717E9 @r{Link to heading by ID} news:comp.emacs @r{Usenet link} mailto:adent@@galaxy.net @r{Mail link} @@ -3196,7 +3250,7 @@ gnus:group#id @r{Gnus article link} bbdb:R.*Stallman @r{BBDB link (with regexp)} irc:/irc.com/#emacs/bob @r{IRC link} -info:org#External%20links @r{Info node link (with encoded space)} +info:org#External links @r{Info node link} shell:ls *.org @r{A shell command} elisp:org-agenda @r{Interactive Elisp command} elisp:(find-file-other-frame "Elisp.org") @r{Elisp form to evaluate} @@ -3345,6 +3399,7 @@ @cindex following links @orgcmd{C-c C-o,org-open-at-point} @vindex org-file-apps +@vindex org-link-frame-setup Open link at point. This will launch a web browser for URLs (using @command{browse-url-at-point}), run VM/MH-E/Wanderlust/Rmail/Gnus/BBDB for the corresponding links, and execute the command in a shell link. When the @@ -3358,7 +3413,9 @@ visit the file with Emacs, use a @kbd{C-u} prefix. If you want to avoid opening in Emacs, use a @kbd{C-u C-u} prefix.@* If the cursor is on a headline, but not on a link, offer all links in the -headline and entry text. +headline and entry text. If you want to setup the frame configuration for +following links, customize @code{org-link-frame-setup}. + @orgkey @key{RET} @vindex org-return-follows-link When @code{org-return-follows-link} is set, @kbd{@key{RET}} will also follow @@ -4028,14 +4085,18 @@ Since it is normally too much to record a note for every state, Org-mode expects configuration on a per-keyword basis for this. This is achieved by -adding special markers @samp{!} (for a timestamp) and @samp{@@} (for a note) -in parentheses after each keyword. For example, with the setting +adding special markers @samp{!} (for a timestamp) or @samp{@@} (for a note +with timestamp) in parentheses after each keyword. For example, with the +setting @lisp (setq org-todo-keywords '((sequence "TODO(t)" "WAIT(w@@/!)" "|" "DONE(d!)" "CANCELED(c@@)"))) @end lisp +To record a timestamp without a note for TODO keywords configured with +@samp{@@}, just type @kbd{C-c C-c} to enter a blank note when prompted. + @noindent @vindex org-log-done you not only define global TODO keywords and fast access keys, but also @@ -4698,18 +4759,19 @@ @chapter Properties and columns @cindex properties -Properties are a set of key-value pairs associated with an entry. There -are two main applications for properties in Org-mode. First, properties -are like tags, but with a value. Second, you can use properties to -implement (very basic) database capabilities in an Org buffer. For -an example of the first application, imagine maintaining a file where +A property is a key-value pair associated with an entry. Properties can be +set so they are associated with a single entry, with every entry in a tree, +or with every entry in an Org-mode file. + +There are two main applications for properties in Org-mode. First, +properties are like tags, but with a value. Imagine maintaining a file where you document bugs and plan releases for a piece of software. Instead of -using tags like @code{:release_1:}, @code{:release_2:}, one can use a +using tags like @code{:release_1:}, @code{:release_2:}, you can use a property, say @code{:Release:}, that in different subtrees has different -values, such as @code{1.0} or @code{2.0}. For an example of the second -application of properties, imagine keeping track of your music CDs, -where properties could be things such as the album, artist, date of -release, number of tracks, and so on. +values, such as @code{1.0} or @code{2.0}. Second, you can use properties to +implement (very basic) database capabilities in an Org buffer. Imagine +keeping track of your music CDs, where properties could be things such as the +album, artist, date of release, number of tracks, and so on. Properties can be conveniently edited and viewed in column view (@pxref{Column view}). @@ -4728,7 +4790,8 @@ @cindex property syntax @cindex drawer, for properties -Properties are key-value pairs. They need to be inserted into a special +Properties are key-value pairs. When they are associated with a single entry +or with a tree they need to be inserted into a special drawer (@pxref{Drawers}) with the name @code{PROPERTIES}. Each property is specified on a single line, with the key (surrounded by colons) first, and the value after it. Here is an example: @@ -4746,6 +4809,10 @@ :END: @end example +Depending on the value of @code{org-use-property-inheritance}, a property set +this way will either be associated with a single entry, or the sub-tree +defined by the entry, see @ref{Property inheritance}. + You may define the allowed values for a particular property @samp{:Xyz:} by setting a property @samp{:Xyz_ALL:}. This special property is @emph{inherited}, so if you set it in a level 1 entry, it will apply to @@ -4770,6 +4837,37 @@ #+PROPERTY: NDisks_ALL 1 2 3 4 @end example +If you want to add to the value of an existing property, append a @code{+} to +the property name. The following results in the property @code{var} having +the value ``foo=1 bar=2''. +@cindex property, + +@example +#+PROPERTY: var foo=1 +#+PROPERTY: var+ bar=2 +@end example + +It is also possible to add to the values of inherited properties. The +following results in the @code{genres} property having the value ``Classic +Baroque'' under the @code{Goldberg Variations} subtree. +@cindex property, + +@example +* CD collection +** Classic + :PROPERTIES: + :GENRES: Classic + :END: +*** Goldberg Variations + :PROPERTIES: + :Title: Goldberg Variations + :Composer: J.S. Bach + :Artist: Glen Gould + :Publisher: Deutsche Grammophon + :NDisks: 1 + :GENRES+: Baroque + :END: +@end example +Note that a property can only have one entry per Drawer. + @vindex org-global-properties Property values set with the global variable @code{org-global-properties} can be inherited by all entries in all @@ -5263,17 +5361,20 @@ @cindex scheduling A timestamp is a specification of a date (possibly with a time or a range of -times) in a special format, either @samp{<2003-09-16 Tue>} or -@samp{<2003-09-16 Tue 09:39>} or @samp{<2003-09-16 Tue -12:00-12:30>}@footnote{This is inspired by the standard ISO 8601 date/time -format. To use an alternative format, see @ref{Custom time format}.}. A -timestamp can appear anywhere in the headline or body of an Org tree entry. -Its presence causes entries to be shown on specific dates in the agenda -(@pxref{Weekly/daily agenda}). We distinguish: +times) in a special format, either @samp{<2003-09-16 Tue>}@footnote{In this +simplest form, the day name is optional when you type the date yourself. +However, any dates inserted or modified by Org will add that day name, for +reading convenience.} or @samp{<2003-09-16 Tue 09:39>} or @samp{<2003-09-16 +Tue 12:00-12:30>}@footnote{This is inspired by the standard ISO 8601 +date/time format. To use an alternative format, see @ref{Custom time +format}.}. A timestamp can appear anywhere in the headline or body of an Org +tree entry. Its presence causes entries to be shown on specific dates in the +agenda (@pxref{Weekly/daily agenda}). We distinguish: @table @var @item Plain timestamp; Event; Appointment @cindex timestamp +@cindex appointment A simple timestamp just assigns a date/time to an item. This is just like writing down an appointment or event in a paper agenda. In the timeline and agenda displays, the headline of an entry associated with a @@ -5369,6 +5470,9 @@ contains date and time. The default time can be rounded to multiples of 5 minutes, see the option @code{org-time-stamp-rounding-minutes}. @c +@orgkey{C-c C-c} +Normalize timestamp, insert/fix day name if missing or wrong. +@c @orgcmd{C-c <,org-date-from-calendar} Insert a timestamp corresponding to the cursor date in the Calendar. @c @@ -5671,7 +5775,7 @@ @orgcmd{C-c C-d,org-deadline} Insert @samp{DEADLINE} keyword along with a stamp. The insertion will happen in the line directly following the headline. Any CLOSED timestamp will be -removed. When called with a prefix arg, an existing deadline will be removed +removed. When called with a prefix arg, an existing deadline will be removed from the entry. Depending on the variable @code{org-log-redeadline}@footnote{with corresponding @code{#+STARTUP} keywords @code{logredeadline}, @code{lognoteredeadline}, and @code{nologredeadline}}, a note will be taken when changing an existing @@ -5925,7 +6029,8 @@ report as an Org-mode table into the current file. When the cursor is at an existing clock table, just update it. When called with a prefix argument, jump to the first clock report in the current document and -update it. +update it. The clock table always includes also trees with +@code{:ARCHIVE:} tag. @orgcmdkkc{C-c C-c,C-c C-x C-u,org-dblock-update} Update dynamic block at point. The cursor needs to be in the @code{#+BEGIN} line of the dynamic block. @@ -6543,7 +6648,7 @@ In the template itself, special @kbd{%}-escapes@footnote{If you need one of these sequences literally, escape the @kbd{%} with a backslash.} allow -dynamic insertion of content. The templates are expanded in the order given here: +dynamic insertion of content. The templates are expanded in the order given here: @smallexample %[@var{file}] @r{insert the contents of the file given by @var{file}.} @@ -7226,7 +7331,7 @@ #+CATEGORY: Holiday %%(org-calendar-holiday) ; special function for holiday names #+CATEGORY: Ann -%%(org-anniversary 1956 5 14)@footnote{@code{org-anniversary} is just like @code{diary-anniversary}, but the argument order is allways according to ISO and therefore independent of the value of @code{calendar-date-style}.} Arthur Dent is %d years old +%%(org-anniversary 1956 5 14)@footnote{@code{org-anniversary} is just like @code{diary-anniversary}, but the argument order is always according to ISO and therefore independent of the value of @code{calendar-date-style}.} Arthur Dent is %d years old %%(org-anniversary 1869 10 2) Mahatma Gandhi would be %d years old @end example @@ -7272,6 +7377,8 @@ @subsubheading Appointment reminders @cindex @file{appt.el} @cindex appointment reminders +@cindex appointment +@cindex reminders Org can interact with Emacs appointments notification facility. To add all the appointments of your agenda files, use the command @@ -7804,8 +7911,8 @@ @item o Delete other windows. @c -@orgcmdkskc{v d,d,org-aganda-day-view} -@xorgcmdkskc{v w,w,org-aganda-day-view} +@orgcmdkskc{v d,d,org-agenda-day-view} +@xorgcmdkskc{v w,w,org-agenda-day-view} @xorgcmd{v m,org-agenda-month-view} @xorgcmd{v y,org-agenda-month-year} @xorgcmd{v SPC,org-agenda-reset-view} @@ -8129,13 +8236,15 @@ @c @orgcmd{S-@key{right},org-agenda-do-date-later} Change the timestamp associated with the current line by one day into the -future. With a numeric prefix argument, change it by that many days. For -example, @kbd{3 6 5 S-@key{right}} will change it by a year. With a -@kbd{C-u} prefix, change the time by one hour. If you immediately repeat the -command, it will continue to change hours even without the prefix arg. With -a double @kbd{C-u C-u} prefix, do the same for changing minutes. The stamp -is changed in the original Org file, but the change is not directly reflected -in the agenda buffer. Use @kbd{r} or @kbd{g} to update the buffer. +future. If the date is in the past, the first call to this command will move +it to today.@* +With a numeric prefix argument, change it by that many days. For example, +@kbd{3 6 5 S-@key{right}} will change it by a year. With a @kbd{C-u} prefix, +change the time by one hour. If you immediately repeat the command, it will +continue to change hours even without the prefix arg. With a double @kbd{C-u +C-u} prefix, do the same for changing minutes.@* +The stamp is changed in the original Org file, but the change is not directly +reflected in the agenda buffer. Use @kbd{r} or @kbd{g} to update the buffer. @c @orgcmd{S-@key{left},org-agenda-do-date-earlier} Change the timestamp associated with the current line by one day @@ -8593,14 +8702,14 @@ @noindent From the command line you may also use @example -emacs -f org-batch-store-agenda-views -kill +emacs -eval (org-batch-store-agenda-views) -kill @end example @noindent or, if you need to modify some parameters@footnote{Quoting depends on the system you use, please check the FAQ for examples.} @example emacs -eval '(org-batch-store-agenda-views \ - org-agenda-span month \ + org-agenda-span (quote month) \ org-agenda-start-day "2007-11-01" \ org-agenda-include-diary nil \ org-agenda-files (quote ("~/org/project.org")))' \ @@ -8987,7 +9096,8 @@ need to specify the name of the major mode that should be used to fontify the example@footnote{Code in @samp{src} blocks may also be evaluated either interactively or on export. See @pxref{Working With Source Code} for more -information on evaluating code blocks.}: +information on evaluating code blocks.}, see @ref{Easy Templates} for +shortcuts to easily insert code blocks. @cindex #+BEGIN_SRC @example @@ -9428,13 +9538,13 @@ broad range of other applications. @LaTeX{} export lets you use Org-mode and its structured editing functions to easily create @LaTeX{} files. DocBook export makes it possible to convert Org files to many other formats using -DocBook tools. OpenDocumentText export allows seamless colloboration across -organizational boundaries. For project management you can create gantt and -resource charts by using TaskJuggler export. To incorporate entries with -associated times like deadlines or appointments into a desktop calendar -program like iCal, Org-mode can also produce extracts in the iCalendar -format. Currently Org-mode only supports export, not import of these -different formats. +DocBook tools. OpenDocument Text(@acronym{ODT}) export allows seamless +colloboration across organizational boundaries. For project management you +can create gantt and resource charts by using TaskJuggler export. To +incorporate entries with associated times like deadlines or appointments into +a desktop calendar program like iCal, Org-mode can also produce extracts in +the iCalendar format. Currently Org-mode only supports export, not import of +these different formats. Org supports export of selected regions when @code{transient-mark-mode} is enabled (default in Emacs 23). @@ -9447,7 +9557,7 @@ * HTML export:: Exporting to HTML * LaTeX and PDF export:: Exporting to @LaTeX{}, and processing to PDF * DocBook export:: Exporting to DocBook -* OpenDocumentText export:: Exporting to OpenDocumentText +* OpenDocument Text export:: Exporting to OpenDocument Text * TaskJuggler export:: Exporting to TaskJuggler * Freemind export:: Exporting to Freemind mind maps * XOXO export:: Exporting to XOXO @@ -9463,7 +9573,8 @@ @cindex org-export-with-tasks You may use tags to select the parts of a document that should be exported, or to exclude parts from export. This behavior is governed by two variables: -@code{org-export-select-tags} and @code{org-export-exclude-tags}. +@code{org-export-select-tags} and @code{org-export-exclude-tags}, +respectively defaulting to @code{'(:export:)} and @code{'(:noexport:)}. @enumerate @item @@ -9877,7 +9988,7 @@ @cindex #+ATTR_HTML @example #+CAPTION: This is a table with lines around and between cells -#+ATTR_HTML: border="2" rules="all" frame="all" +#+ATTR_HTML: border="2" rules="all" frame="border" @end example @node Images in HTML export, Math formatting in HTML export, Tables in HTML export, HTML export @@ -10471,7 +10582,7 @@ For more information, see the documentation on Worg. -@node DocBook export, OpenDocumentText export, LaTeX and PDF export, Exporting +@node DocBook export, OpenDocument Text export, LaTeX and PDF export, Exporting @section DocBook export @cindex DocBook export @cindex PDF export @@ -10670,39 +10781,46 @@ @c begin opendocument -@node OpenDocumentText export, TaskJuggler export, DocBook export, Exporting -@section OpenDocumentText export -@cindex OpenDocumentText export +@node OpenDocument Text export, TaskJuggler export, DocBook export, Exporting +@section OpenDocument Text export @cindex K, Jambunathan - -Org-mode 7.6 supports export to OpenDocumentText format using -@file{org-odt.el} module contributed by Jambunathan K. This module can be -enabled in one of the following ways based on your mode of installation. - -@enumerate -@item -If you have downloaded the Org from the Web, either as a distribution -@file{.zip} or @file{.tar} file, or as a Git archive, enable the @code{odt} -option in variable @code{org-modules}. -@item -If you are using Org that comes bundled with Emacs, then you can install the -OpenDocumentText exporter using the package manager. To do this, customize -the variable @code{package-archives} to include -@uref{http://orgmode.org/pkg/releases/} as one of the package archives. -@end enumerate +@cindex ODT +@cindex OpenDocument +@cindex export, OpenDocument +@cindex LibreOffice +@cindex org-odt.el +@cindex org-modules + +Orgmode@footnote{Versions 7.8 or later} supports export to OpenDocument Text +(@acronym{ODT}) format using the @file{org-odt.el} module. Documents created +by this exporter use the @cite{OpenDocument-v1.2 +specification}@footnote{@url{http://docs.oasis-open.org/office/v1.2/OpenDocument-v1.2.html, +Open Document Format for Office Applications (OpenDocument) Version 1.2}} and +are compatible with LibreOffice 3.4. @menu -* OpenDocumentText export commands::How to invoke OpenDocumentText export -* Applying Custom Styles:: How to apply custom styles to the output -* Converting to Other formats:: How to convert to formats like doc, docx etc -* Links in OpenDocumentText export:: How links will be interpreted and formatted -* Tables in OpenDocumentText export:: Tables are exported as HTML tables -* Images in OpenDocumentText export:: How to insert figures into DocBook output -* Additional Documentation:: Where to find more information +* Pre-requisites for @acronym{ODT} export:: What packages @acronym{ODT} exporter relies on +* @acronym{ODT} export commands:: How to invoke @acronym{ODT} export +* Applying custom styles:: How to apply custom styles to the output +* Links in @acronym{ODT} export:: How links will be interpreted and formatted +* Tables in @acronym{ODT} export:: How Tables are exported +* Images in @acronym{ODT} export:: How to insert images +* Math formatting in @acronym{ODT} export:: How @LaTeX{} fragments are formatted +* Literal examples in @acronym{ODT} export:: How source and example blocks are formatted +* Advanced topics in @acronym{ODT} export:: Read this if you are a power user @end menu -@node OpenDocumentText export commands, Applying Custom Styles, OpenDocumentText export, OpenDocumentText export -@subsection OpenDocumentText export commands +@node Pre-requisites for @acronym{ODT} export, @acronym{ODT} export commands, OpenDocument Text export, OpenDocument Text export +@subsection Pre-requisites for @acronym{ODT} export +@cindex zip +The @acronym{ODT} exporter relies on the @file{zip} program to create the final +output. Check the availability of this program before proceeding further. + +@node @acronym{ODT} export commands, Applying custom styles, Pre-requisites for @acronym{ODT} export, OpenDocument Text export +@subsection @acronym{ODT} export commands + +@subsubheading Exporting to @acronym{ODT} +@anchor{x-export-to-odt} @cindex region, active @cindex active region @@ -10710,113 +10828,791 @@ @table @kbd @orgcmd{C-c C-e o,org-export-as-odt} @cindex property EXPORT_FILE_NAME -Export as OpenDocumentText file. For an Org file, @file{myfile.org}, the -OpenDocumentText file will be @file{myfile.odt}. The file will be -overwritten without warning. If there is an active region@footnote{This -requires @code{transient-mark-mode} to be turned on}, only the region will be -exported. If the selected region is a single tree@footnote{To select the -current subtree, use @kbd{C-c @@}.}, the tree head will become the document -title. If the tree head entry has, or inherits, an @code{EXPORT_FILE_NAME} -property, that name will be used for the export. + +Export as OpenDocument Text file. +@vindex org-export-odt-preferred-output-format +If @code{org-export-odt-preferred-output-format} is specified, automatically +convert the exported file to that format. +@xref{x-export-to-other-formats,,Automatically exporting to other formats}. + +For an Org file @file{myfile.org}, the @acronym{ODT} file will be +@file{myfile.odt}. The file will be overwritten without warning. If there +is an active region,@footnote{This requires @code{transient-mark-mode} to be +turned on} only the region will be exported. If the selected region is a +single tree,@footnote{To select the current subtree, use @kbd{C-c @@}} the +tree head will become the document title. If the tree head entry has, or +inherits, an @code{EXPORT_FILE_NAME} property, that name will be used for the +export. + @orgcmd{C-c C-e O,org-export-as-odt-and-open} -Export as OpenDocumentText file and open the resulting file. -@end table +Export as OpenDocument Text file and open the resulting file. +@vindex org-export-odt-preferred-output-format +If @code{org-export-odt-preferred-output-format} is specified, open the +converted file instead. +@xref{x-export-to-other-formats,,Automatically exporting to other formats}. +@end table + +@subsubheading Automatically exporting to other formats +@anchor{x-export-to-other-formats} +@vindex org-export-odt-preferred-output-format +Very often, you will find yourself exporting to @acronym{ODT} format, only to +immediately save the exported document to a different format like @samp{pdf}. +In such cases, you will find it convenient to configure a converter +(@pxref{Exporting and converting to other formats}) and specify your +preferred output format by customizing the variable +@code{org-export-odt-preferred-output-format}. This way, the export commands +(@pxref{x-export-to-odt,,Exporting to ODT}) can be extended to also export to +the preferred format. -@node Applying Custom Styles, Converting to Other formats, OpenDocumentText export commands, OpenDocumentText export -@subsection Applying Custom Styles +@node Applying custom styles, Links in @acronym{ODT} export, @acronym{ODT} export commands, OpenDocument Text export +@subsection Applying custom styles @cindex styles, custom @cindex template, custom -@vindex org-export-odt-styles-file +The @acronym{ODT} exporter ships with a set of OpenDocument styles +(@pxref{Working with OpenDocument style files}) that ensure a well-formatted +output. These factory styles, however, may not cater to your specific +tastes. To customize the output, you can either modify the above styles +files directly, or generate the required styles using an application like +LibreOffice. The latter method is suitable for expert and non-expert +users alike, and is described here. -OpenDocumentExporter ships with a custom @file{styles.xml} for formatting of -the exported file. To customize the output to suit your needs you can use -one of the following methods: +@subsubsection Applying custom styles - the easy way @enumerate @item -Customize the variable @code{org-export-odt-styles-file} to point to either a -@file{styles.xml} file, a OpenDocument Text Template file @code{.ott} or a -combination of Text or Template Document together with a set of member files. -Use the first two options if the styles.xml has no references to additional -set of files and use the last option if the @file{styles.xml} references -additional files like header and footer images. +Create a sample @file{example.org} file with the below settings and export it +to @acronym{ODT} format. + +@example +#+OPTIONS: H:10 num:t +@end example + +@item +Open the above @file{example.odt} using LibreOffice. Use the @file{Stylist} +to locate the target styles - these typically have the @samp{Org} prefix - +and modify those to your taste. Save the modified file either as an +OpenDocument Text (@file{.odt}) or OpenDocument Template (@file{.ott}) file. + @item -Use an external tool like unoconv to apply custom templates. +@cindex #+ODT_STYLES_FILE +@vindex org-export-odt-styles-file +Customize the variable @code{org-export-odt-styles-file} and point it to the +newly created file. For additional configuration options +@pxref{x-overriding-factory-styles,,Overriding factory styles}. + +If you would like to choose a style on a per-file basis, you can use the +@code{#+ODT_STYLES_FILE} option. A typical setting will look like + +@example +#+ODT_STYLES_FILE: "/path/to/example.ott" +@end example + +or + +@example +#+ODT_STYLES_FILE: ("/path/to/file.ott" ("styles.xml" "image/hdr.png")) +@end example + @end enumerate -For best results, it is necessary that the style names used by -OpenDocumentText exporter match that used in the @file{styles.xml}. +@subsubsection Using third-party styles and templates -@node Converting to Other formats, Links in OpenDocumentText export, Applying Custom Styles, OpenDocumentText export -@subsection Converting to Other formats +You can use third-party styles and templates for customizing your output. +This will produce the desired output only if the template provides all +style names that the @samp{ODT} exporter relies on. Unless this condition is +met, the output is going to be less than satisfactory. So it is highly +recommended that you only work with templates that are directly derived from +the factory settings. -@cindex convert -@cindex doc, docx +@node Links in @acronym{ODT} export, Tables in @acronym{ODT} export, Applying custom styles, OpenDocument Text export +@subsection Links in @acronym{ODT} export +@cindex tables, in DocBook export -@vindex org-export-odt-styles-file +The @acronym{ODT} exporter creates cross-references (aka bookmarks) for +internal links. It creates Internet-style links for all other links. + +@node Tables in @acronym{ODT} export, Images in @acronym{ODT} export, Links in @acronym{ODT} export, OpenDocument Text export +@subsection Tables in @acronym{ODT} export +@cindex tables, in DocBook export + +Export of native Org-mode tables (@pxref{Tables}) and simple @file{table.el} +tables is supported. However, export of complex @file{table.el} tables - +tables that have column or row spans - is not supported. Such tables are +stripped from the exported document. + +By default, a table is exported with top and bottom frames and with +rules separating row and column groups (@pxref{Column groups}). If the table +specifies alignment and relative width for its columns (@pxref{Column width +and alignment}) then these are honored on export.@footnote{The column widths +are interpreted as weighted ratios with the default weight being 1} + +@cindex #+ATTR_ODT +If you are not satisfied with the default formatting of tables, you can +create custom table styles and associate them with a table using +the @code{#+ATTR_ODT} line. @xref{Customizing tables in @acronym{ODT} export}. + +@node Images in @acronym{ODT} export, Math formatting in @acronym{ODT} export, Tables in @acronym{ODT} export, OpenDocument Text export +@subsection Images in @acronym{ODT} export +@cindex images, embedding in @acronym{ODT} +@cindex embedding images in @acronym{ODT} + +@subsubheading Embedding images +You can embed images within the exported document by providing a link to the +desired image file with no link description. For example, to embed +@samp{img.png} do either of the following: + +@example +[[file:img.png]] +@end example + +@example +[[./img.png]] +@end example + +@subsubheading Embedding clickable images +You can create clickable images by providing a link whose description is a +link to an image file. For example, to embed a image +@file{org-mode-unicorn.png} which when clicked jumps to +@uref{http://Orgmode.org} website, do the following + +@example +[[http://orgmode.org][./org-mode-unicorn.png]] +@end example + +@subsubheading Sizing and scaling of embedded images + +You can control the size and scale of the embedded images using the +@code{#+ATTR_ODT} attribute. + +@vindex org-export-odt-pixels-per-inch +Note that the exporter specifies the desired size of the image in the final +document in units of centimetres. In order to scale the embedded images, the +exporter needs to compute the size of the image. This is done by retrieving +the image size in pixels and converting the pixel units to centimetres using +@code{org-export-odt-pixels-per-inch}. The default value of this variable is +set to @code{display-pixels-per-inch}. You can tweak this variable to +achieve the best results. + +The examples below illustrate the various possibilities. + +@table @asis -Often times there is a need to convert OpenDocumentText files to other -formats like doc, docx or pdf. You can accomplish this by one of the -following methods: +@item Explicitly size the image +To embed @file{img.png} as a 10 cm x 10 cm image, do the following: + +@example +#+ATTR_ODT: :width 10 :height 10 +[[./img.png]] +@end example + +@item Scale the image +To embed @file{img.png} at half its size, do the following: + +@example +#+ATTR_ODT: :scale 0.5 +[[./img.png]] +@end example + +@item Scale the image to a specific width +To embed @file{img.png} with a width of 10 cm while retaining the original +height:width ratio, do the following: + +@example +#+ATTR_ODT: :width 10 +[[./img.png]] +@end example + +@item Scale the image to a specific height +To embed @file{img.png} with a height of 10 cm while retaining the original +height:width ratio, do the following + +@example +#+ATTR_ODT: :height 10 +[[./img.png]] +@end example +@end table + +@node Math formatting in @acronym{ODT} export, Literal examples in @acronym{ODT} export, Images in @acronym{ODT} export, OpenDocument Text export +@subsection Math formatting in @acronym{ODT} export + +The @acronym{ODT} exporter has special support for handling math. + +@menu +* Working with @LaTeX{} math snippets:: How to embed @LaTeX{} math fragments +* Working with MathML or OpenDocument formula files:: How to embed equations in native format +@end menu + +@node Working with @LaTeX{} math snippets, Working with MathML or OpenDocument formula files, Math formatting in @acronym{ODT} export, Math formatting in @acronym{ODT} export +@subsubsection Working with @LaTeX{} math snippets + +@LaTeX{} math snippets (@pxref{LaTeX fragments}) can be embedded in the ODT +document in one of the following ways: + +@cindex MathML +@enumerate +@item MathML + +This option is activated on a per-file basis with + +@example +#+OPTIONS: LaTeX:t +@end example + +With this option, @LaTeX{} fragments are first converted into MathML +fragments using an external @LaTeX{}-to-MathML converter program. The +resulting MathML fragments are then embedded as an OpenDocument Formula in +the exported document. + +@vindex org-latex-to-mathml-convert-command +@vindex org-latex-to-mathml-jar-file + +You can specify the LaTeX-to-MathML converter by customizing the variables +@code{org-latex-to-mathml-convert-command} and +@code{org-latex-to-mathml-jar-file}. + +If you prefer to use @file{MathToWeb}@footnote{See +@uref{http://www.mathtoweb.com/cgi-bin/mathtoweb_home.pl, MathToWeb}} as your +converter, you can configure the above variables as shown below. + +@lisp +(setq org-latex-to-mathml-convert-command + "java -jar %j -unicode -force -df %o %I" + org-latex-to-mathml-jar-file + "/path/to/mathtoweb.jar") +@end lisp + +You can use the following commands to quickly verify the reliability of +the @LaTeX{}-to-MathML converter. @table @kbd -@item M-x org-lparse -Export the outline first to one of the native formats (like OpenDocumentText) -and immediately post-process it to other formats using an external converter. -@item M-x org-lparse-convert -Export an existing document to other formats using an external converter. +@item M-x org-export-as-odf +Convert a @LaTeX{} math snippet to OpenDocument formula (@file{.odf}) file. + +@item M-x org-export-as-odf-and-open +Convert a @LaTeX{} math snippet to OpenDocument formula (@file{.odf}) file and +open the formula file with the system-registered application. @end table -You can choose the converter used for conversion by customizing the variable -@code{org-lparse-convert-process}. +@cindex dvipng +@item PNG images -@node Links in OpenDocumentText export, Tables in OpenDocumentText export, Converting to Other formats, OpenDocumentText export -@subsection Links in OpenDocumentText export -@cindex tables, in DocBook export +This option is activated on a per-file basis with -OpenDocumentExporter creates cross-references (aka bookmarks) for links that -are destined locally. It creates internet style links for all other links. +@example +#+OPTIONS: LaTeX:dvipng +@end example -@node Tables in OpenDocumentText export, Images in OpenDocumentText export, Links in OpenDocumentText export, OpenDocumentText export -@subsection Tables in OpenDocumentText export -@cindex tables, in DocBook export +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. +@end enumerate -Export of @file{table.el} tables with row or column spanning is not -supported. Such tables are stripped from the exported document. +@node Working with MathML or OpenDocument formula files, , Working with @LaTeX{} math snippets, Math formatting in @acronym{ODT} export +@subsubsection Working with MathML or OpenDocument formula files -@node Images in OpenDocumentText export, Additional Documentation, Tables in OpenDocumentText export, OpenDocumentText export -@subsection Images in OpenDocumentText export -@cindex images, embedding in OpenDocumentText -@cindex embedding images in OpenDocumentText - -OpenDocumentText exporter can embed images within the exported document. To -embed images, provide a link to the desired image file with no link -description. For example, the following links @samp{[[file:img.jpg]]} or -@samp{[[./img.jpg]]}, will result in embedding of @samp{img.jpg} in the -exported file. - -The exporter can also embed scaled and explicitly sized images within the -exported document. The markup of the scale and size specifications has not -been standardized yet and is hence conveniently skipped in this document. - -The exporter can also make an image the clickable part of a link. To create -clickable images, provide a link whose description is a link to an image -file. For example, the following link -@samp{[[http://orgmode.org][./img.jpg]]}, will result in a clickable image -that links to @uref{http://Orgmode.org} website. - -@node Additional Documentation, , Images in OpenDocumentText export, OpenDocumentText export -@subsection Additional documentation - -The OpenDocumentText exporter is still in development. For up to date -information, please follow Org mailing list @email{emacs-orgmode@@gnu.org} -closely. +For various reasons, you may find embedding @LaTeX{} math snippets in an +@acronym{ODT} document less than reliable. In that case, you can embed a +math equation by linking to its MathML(@file{.mml}) source or its +OpenDocument formula (@file{.odf}) file as shown below: + +@example +[[./equation.mml]] +@end example + +or + +@example +[[./equation.odf]] +@end example + +@node Literal examples in @acronym{ODT} export, Advanced topics in @acronym{ODT} export, Math formatting in @acronym{ODT} export, OpenDocument Text export +@subsection Literal examples in @acronym{ODT} export + +Export of literal examples (@pxref{Literal examples}) with full fontification +is supported. This feature is enabled by default and is activated +automatically if an enhanced version of @file{htmlfontify.el} is available in +the @code{load-path}.@footnote{The @file{htmlfontify.el} that ships with +standard Emacs <= 24.1 has no support for @acronym{ODT} fontification. A +copy of the proposed version is available as an attachment to +@url{http://debbugs.gnu.org/cgi/bugreport.cgi?msg=5;filename=htmlfontify.el;att=9;bug=9914, +Emacs Bug #9914}.} + +@vindex org-export-odt-fontify-srcblocks + +The character styles used for fontification of the literal blocks are +auto-generated by the exporter in conjunction with @file{htmlfontify.el} +library and need not be included in the default @file{styles.xml} file. +These auto-generated styles have the @samp{OrgSrc} prefix and inherit their color +based on the face used by Emacs @code{font-lock} library. + +@vindex org-export-odt-create-custom-styles-for-srcblocks +If you prefer to use your own custom styles for fontification and disable +their auto-generation altogether, you can do so by customizing the variable +@code{org-export-odt-create-custom-styles-for-srcblocks}. + +You can turn off fontification support for literal examples by customizing +the variable @code{org-export-odt-fontify-srcblocks}. + + +@node Advanced topics in @acronym{ODT} export, , Literal examples in @acronym{ODT} export, OpenDocument Text export +@subsection Advanced topics in @acronym{ODT} export + +If you rely heavily on @acronym{ODT} export, you may want to exploit the full +set of features that the exporter offers. This section describes features +that would be of interest to power users. + +@menu +* Exporting and converting to other formats:: How to produce @samp{pdf} and other formats +* Working with OpenDocument style files:: Explore the internals +* Creating one-off styles:: How to produce custom highlighting etc +* Customizing tables in @acronym{ODT} export:: How to define and use Table templates +* Validating OpenDocument XML:: How to debug corrupt OpenDocument files +@end menu + +@node Exporting and converting to other formats, Working with OpenDocument style files, Advanced topics in @acronym{ODT} export, Advanced topics in @acronym{ODT} export +@subsubsection Exporting and converting to other formats +@cindex convert +@cindex doc, docx + +The @acronym{ODT} exporter adds support for exporting Org outlines to formats +that are not supported natively by Org. It also adds support to convert +document from one format to another. To use these features, you need to +configure a command-line converter. Once a command-line converter is +configured you can use it to extend the list of formats to which Org can +export. @xref{x-export-to-other-formats,,Automatically exporting to other +formats}. You can also use it to perform one-off document conversion as +detailed below. + +@vindex org-export-odt-convert +@table @kbd + +@item M-x org-export-odt-convert +Convert an existing document from one format to another as determined by the +variable @code{org-export-odt-convert-capabilities} +(@pxref{x-odt-converter-capabilities,,Configure converter +capabilities}). @strong{Please note} that you can use this command to even +convert documents that are produced outside of Org and in other formats than +@acronym{ODT} format. +@end table + +@subsubheading Pre-configured converters + +@cindex converter +The @acronym{ODT} exporter supports two converters out of the box: + +@enumerate + +@cindex @file{unoconv} +@item @file{unoconv} + +This converter is available as an installable package in your favorite +distribution. + +@cindex @file{BasicODConverter} +@item @file{BasicODConverter} + +@vindex org-odt-data-dir +This converter is distributed as a LibreOffice extension and can be found in +your Org distribution. See the subdirectory pointed to by the variable +@code{org-odt-data-dir}. + +@end enumerate + +@subsubheading Installing a new converter +If you prefer to use a converter other than the two mentioned above, then you +may have to do additional configuration. You can proceed as follows: + +@enumerate +@item Register the converter + +@vindex org-export-odt-convert-processes +Name your converter and add it to the list of known converters by customizing +the variable @code{org-export-odt-convert-processes}. Also specify how the +converter can be invoked via command-line to effect the conversion. + +@item Configure its capabilities +@vindex org-export-odt-convert-capabilities + +@anchor{x-odt-converter-capabilities} + +Specify the set of formats the converter can handle by customizing the +variable @code{org-export-odt-convert-capabilities}. Use the default value +for this variable as a guide for configuring your converter. As suggested by +the default setting, you can specify the full set of formats supported by the +converter and not limit yourself to specifying formats that are related to +just the OpenDocument Text format. + +@item Choose the converter + +@vindex org-export-odt-convert-process +Select the newly added converter as the preferred one by customizing the +variable @code{org-export-odt-convert-process}. +@end enumerate + +@node Working with OpenDocument style files, Creating one-off styles, Exporting and converting to other formats, Advanced topics in @acronym{ODT} export +@subsubsection Working with OpenDocument style files +@cindex styles, custom +@cindex template, custom + +This section explores the internals of the @acronym{ODT} exporter and the +means by which it produces styled documents. Read this section if you are +interested in exploring the automatic and custom OpenDocument styles used by +the exporter. + +@anchor{x-factory-styles} +@subsubheading Factory styles + +The @acronym{ODT} exporter relies on two files for generating its output. +These files are bundled with the distribution under the directory pointed to +by the variable @code{org-odt-styles-dir}. The two files are: + +@itemize +@anchor{x-orgodtstyles-xml} +@item +@file{OrgOdtStyles.xml} + +This file contributes to the @file{styles.xml} file of the final @samp{ODT} +document. This file gets modified for the following purposes: +@enumerate + +@item +To control outline numbering based on user settings. + +@item +To add styles generated by @file{htmlfontify.el} for fontification of code +blocks. +@end enumerate + +@anchor{x-orgodtcontenttemplate-xml} +@item +@file{OrgOdtContentTemplate.xml} + +This file contributes to the @file{content.xml} file of the final @samp{ODT} +document. The contents of the Org outline are inserted between the +@samp{}@dots{}@samp{} elements of this file. + +Apart from serving as a template file for the final @file{content.xml}, the +file serves the following purposes: +@enumerate + +@item +It contains automatic styles for formatting of tables which are referenced by +the exporter. + +@item +It contains @samp{}@dots{}@samp{} +elements that control how various entities - tables, images, equations etc - +are numbered. +@end enumerate +@end itemize + +@anchor{x-overriding-factory-styles} +@subsubheading Overriding factory styles +The following two variables control the location from which the @acronym{ODT} +exporter picks up the custom styles and content template files. You can +customize these variables to override the factory styles used by the +exporter. + +@itemize +@anchor{x-org-export-odt-styles-file} +@item +@code{org-export-odt-styles-file} + +Use this variable to specify the @file{styles.xml} that will be used in the +final output. You can specify one of the following values: + +@enumerate +@item A @file{styles.xml} file + +Use this file instead of the default @file{styles.xml} + +@item A @file{.odt} or @file{.ott} file + +Use the @file{styles.xml} contained in the specified OpenDocument Text or +Template file + +@item A @file{.odt} or @file{.ott} file and a subset of files contained within them + +Use the @file{styles.xml} contained in the specified OpenDocument Text or +Template file. Additionally extract the specified member files and embed +those within the final @samp{ODT} document. + +Use this option if the @file{styles.xml} file references additional files +like header and footer images. + +@item @code{nil} + +Use the default @file{styles.xml} +@end enumerate + +@anchor{x-org-export-odt-content-template-file} +@item +@code{org-export-odt-content-template-file} + +Use this variable to specify the blank @file{content.xml} that will be used +in the final output. +@end itemize + +@node Creating one-off styles, Customizing tables in @acronym{ODT} export, Working with OpenDocument style files, Advanced topics in @acronym{ODT} export +@subsubsection Creating one-off styles + +There are times when you would want one-off formatting in the exported +document. You can achieve this by embedding raw OpenDocument XML in the Org +file. The use of this feature is better illustrated with couple of examples. + +@enumerate +@item Embedding ODT tags as part of regular text + +You can include simple OpenDocument tags by prefixing them with +@samp{@@}. For example, to highlight a region of text do the following: + +@example +@@This is a +highlighted text@@. But this is a +regular text. +@end example + +@strong{Hint:} To see the above example in action, edit your +@file{styles.xml}(@pxref{x-orgodtstyles-xml,,Factory styles}) and add a +custom @samp{Highlight} style as shown below. + +@example + + + +@end example + +@item Embedding a one-line OpenDocument XML + +You can add a simple OpenDocument one-liner using the @code{#+ODT:} +directive. For example, to force a page break do the following: + +@example +#+ODT: +@end example + +@strong{Hint:} To see the above example in action, edit your +@file{styles.xml}(@pxref{x-orgodtstyles-xml,,Factory styles}) and add a +custom @samp{PageBreak} style as shown below. + +@example + + + +@end example + +@item Embedding a block of OpenDocument XML + +You can add a large block of OpenDocument XML using the +@code{#+BEGIN_ODT}@dots{}@code{#+END_ODT} construct. + +For example, to create a one-off paragraph that uses bold text, do the +following: + +@example +#+BEGIN_ODT + +This paragraph is specially formatted and uses bold text. + +#+END_ODT +@end example + +@end enumerate + +@node Customizing tables in @acronym{ODT} export, Validating OpenDocument XML, Creating one-off styles, Advanced topics in @acronym{ODT} export +@subsubsection Customizing tables in @acronym{ODT} export +@cindex tables, in ODT export + +@cindex #+ATTR_ODT +You can override the default formatting of the table by specifying a custom +table style with the @code{#+ATTR_ODT} line. For a discussion on default +formatting of tables @pxref{Tables in @acronym{ODT} export}. + +This feature closely mimics the way table templates are defined in the +OpenDocument-v1.2 +specification.@footnote{@url{http://docs.oasis-open.org/office/v1.2/OpenDocument-v1.2.html, +OpenDocument-v1.2 Specification}} + + + +@subsubheading Custom table styles - an illustration + +To have a quick preview of this feature, install the below setting and export +the table that follows. + +@lisp +(setq org-export-odt-table-styles + (append org-export-odt-table-styles + '(("TableWithHeaderRowAndColumn" "Custom" + ((use-first-row-styles . t) + (use-first-column-styles . t))) + ("TableWithFirstRowandLastRow" "Custom" + ((use-first-row-styles . t) + (use-last-row-styles . t)))))) +@end lisp + +@example +#+ATTR_ODT: TableWithHeaderRowAndColumn +| Name | Phone | Age | +| Peter | 1234 | 17 | +| Anna | 4321 | 25 | +@end example + +In the above example, you used a template named @samp{Custom} and installed +two table styles with the names @samp{TableWithHeaderRowAndColumn} and +@samp{TableWithFirstRowandLastRow}. (@strong{Important:} The OpenDocument +styles needed for producing the above template have been pre-defined for you. +These styles are available under the section marked @samp{Custom Table +Template} in @file{OrgOdtContentTemplate.xml} +(@pxref{x-orgodtcontenttemplate-xml,,Factory styles}). If you need +additional templates you have to define these styles yourselves. + +@subsubheading Custom table styles - the nitty-gritty +To use this feature proceed as follows: + +@enumerate +@item +Create a table template@footnote{See the @code{} +element of the OpenDocument-v1.2 specification} + +A table template is nothing but a set of @samp{table-cell} and +@samp{paragraph} styles for each of the following table cell categories: + +@itemize @minus +@item Body +@item First column +@item Last column +@item First row +@item Last row +@item Even row +@item Odd row +@item Even column +@item Odd Column +@end itemize + +The names for the above styles must be chosen based on the name of the table +template using a well-defined convention. + +The naming convention is better illustrated with an example. For a table +template with the name @samp{Custom}, the needed style names are listed in +the following table. + +@multitable {Table cell type} {CustomEvenColumnTableCell} {CustomEvenColumnTableParagraph} +@headitem Table cell type +@tab @code{table-cell} style +@tab @code{paragraph} style +@item +@tab +@tab +@item Body +@tab @samp{CustomTableCell} +@tab @samp{CustomTableParagraph} +@item First column +@tab @samp{CustomFirstColumnTableCell} +@tab @samp{CustomFirstColumnTableParagraph} +@item Last column +@tab @samp{CustomLastColumnTableCell} +@tab @samp{CustomLastColumnTableParagraph} +@item First row +@tab @samp{CustomFirstRowTableCell} +@tab @samp{CustomFirstRowTableParagraph} +@item Last row +@tab @samp{CustomLastRowTableCell} +@tab @samp{CustomLastRowTableParagraph} +@item Even row +@tab @samp{CustomEvenRowTableCell} +@tab @samp{CustomEvenRowTableParagraph} +@item Odd row +@tab @samp{CustomOddRowTableCell} +@tab @samp{CustomOddRowTableParagraph} +@item Even column +@tab @samp{CustomEvenColumnTableCell} +@tab @samp{CustomEvenColumnTableParagraph} +@item Odd column +@tab @samp{CustomOddColumnTableCell} +@tab @samp{CustomOddColumnTableParagraph} +@end multitable + +To create a table template with the name @samp{Custom}, define the above +styles in the +@code{}...@code{} element +of the content template file (@pxref{x-orgodtcontenttemplate-xml,,Factory +styles}). + +@item +Define a table style@footnote{See the attributes @code{table:template-name}, +@code{table:use-first-row-styles}, @code{table:use-last-row-styles}, +@code{table:use-first-column-styles}, @code{table:use-last-column-styles}, +@code{table:use-banding-rows-styles}, and +@code{table:use-banding-column-styles} of the @code{} element in +the OpenDocument-v1.2 specification} + +@vindex org-export-odt-table-styles +To define a table style, create an entry for the style in the variable +@code{org-export-odt-table-styles} and specify the following: + +@itemize @minus +@item the name of the table template created in step (1) +@item the set of cell styles in that template that are to be activated +@end itemize + +For example, the entry below defines two different table styles +@samp{TableWithHeaderRowsAndColumns} and @samp{TableWithHeaderColumns} based +on the same template @samp{Custom}. The styles achieve their intended effect +by selectively activating the individual cell styles in that template. + +@lisp +(setq org-export-odt-table-styles + (append org-export-odt-table-styles + '(("TableWithHeaderRowAndColumn" "Custom" + ((use-first-row-styles . t) + (use-first-column-styles . t))) + ("TableWithFirstRowandLastRow" "Custom" + ((use-first-row-styles . t) + (use-last-row-styles . t)))))) +@end lisp + +@item +Associate a table with the table style + +To do this, specify the table style created in step (2) as part of +the @code{ATTR_ODT} line as shown below. + +@example +#+ATTR_ODT: TableWithHeaderRowAndColumn +| Name | Phone | Age | +| Peter | 1234 | 17 | +| Anna | 4321 | 25 | +@end example +@end enumerate + +@node Validating OpenDocument XML, , Customizing tables in @acronym{ODT} export, Advanced topics in @acronym{ODT} export +@subsubsection Validating OpenDocument XML + +Occasionally, you will discover that the document created by the +@acronym{ODT} exporter cannot be opened by your favorite application. One of +the common reasons for this is that the @file{.odt} file is corrupt. In such +cases, you may want to validate the document against the OpenDocument RELAX +NG Compact Syntax (RNC) schema. + +For de-compressing the @file{.odt} file@footnote{@file{.odt} files are +nothing but @samp{zip} archives}: @inforef{File Archives,,emacs}. For +general help with validation (and schema-sensitive editing) of XML files: +@inforef{Introduction,,nxml-mode}. + +@vindex org-export-odt-schema-dir +If you have ready access to OpenDocument @file{.rnc} files and the needed +schema-locating rules in a single folder, you can customize the variable +@code{org-export-odt-schema-dir} to point to that directory. The +@acronym{ODT} exporter will take care of updating the +@code{rng-schema-locating-files} for you. @c end opendocument -@node TaskJuggler export, Freemind export, OpenDocumentText export, Exporting +@node TaskJuggler export, Freemind export, OpenDocument Text export, Exporting @section TaskJuggler export @cindex TaskJuggler export @cindex Project management @@ -11406,16 +12202,16 @@ @tab Should sorting be case-sensitive? Default @code{nil}. @item @code{:sitemap-file-entry-format} -@tab With this option one can tell how a sitemap's entry is formated in the +@tab With this option one can tell how a sitemap's entry is formatted in the sitemap. This is a format string with some escape sequences: @code{%t} stands for the title of the file, @code{%a} stands for the author of the file and @code{%d} stands for the date of the file. The date is retrieved with the -@code{org-publish-find-date} function and formated with +@code{org-publish-find-date} function and formatted with @code{org-publish-sitemap-date-format}. Default @code{%t}. @item @code{:sitemap-date-format} @tab Format string for the @code{format-time-string} function that tells how -a sitemap entry's date is to be formated. This property bypasses +a sitemap entry's date is to be formatted. This property bypasses @code{org-publish-sitemap-date-format} which defaults to @code{%Y-%m-%d}. @item @code{:sitemap-sans-extension} @@ -11630,18 +12426,26 @@ @section Structure of code blocks @cindex code block, structure @cindex source code, block structure +@cindex #+NAME +@cindex #+BEGIN_SRC -The structure of code blocks is as follows: +Live code blocks can be specified with a @samp{src} block or +inline.@footnote{Note that @samp{src} blocks may be inserted using Org-mode's +@ref{Easy Templates} system} The structure of a @samp{src} block is @example -#+srcname: -#+begin_src
    +#+NAME: +#+BEGIN_SRC
    -#+end_src +#+END_SRC @end example -Switches and header arguments are optional. Code can also be embedded in text -inline using +The @code{#+NAME:} line is optional, and can be used to name the code +block. Live code blocks require that a language be specified on the +@code{#+BEGIN_SRC} line. Switches and header arguments are optional. +@cindex source code, inline + +Live code blocks can also be specified inline using @example src_@{@} @@ -11654,26 +12458,30 @@ @end example @table @code -@item -This name is associated with the code block. This is similar to the -@samp{#+tblname} lines that can be used to name tables in Org-mode files. -Referencing the name of a code block makes it possible to evaluate the -block from other places in the file, other files, or from Org-mode table -formulas (see @ref{The spreadsheet}). Names are assumed to be unique by -evaluation functions and the behavior of multiple blocks of the same name is +@item <#+NAME: name> +This line associates a name with the code block. This is similar to the +@code{#+TBLNAME: NAME} lines that can be used to name tables in Org-mode +files. Referencing the name of a code block makes it possible to evaluate +the block from other places in the file, from other files, or from Org-mode +table formulas (see @ref{The spreadsheet}). Names are assumed to be unique +and the behavior of Org-mode when two or more blocks share the same name is undefined. +@cindex #+NAME @item -The language of the code in the block. +The language of the code in the block (see @ref{Languages}). +@cindex source code, language @item -Optional switches controlling exportation of the code block (see switches discussion in +Optional switches control code block export (see the discussion of switches in @ref{Literal examples}) +@cindex source code, switches @item
    Optional header arguments control many aspects of evaluation, export and -tangling of code blocks. See the @ref{Header arguments}. +tangling of code blocks (see @ref{Header arguments}). Header arguments can also be set on a per-buffer or per-subtree basis using properties. +@item source code, header arguments @item -The source code. +Source code in the specified language. @end table @comment node-name, next, previous, up @@ -11722,12 +12530,12 @@ @cindex code block, exporting @cindex source code, exporting -It is possible to export the @emph{contents} of code blocks, the -@emph{results} of code block evaluation, @emph{neither}, or @emph{both}. For -most languages, the default exports the contents of code blocks. However, for -some languages (e.g.@: @code{ditaa}) the default exports the results of code -block evaluation. For information on exporting code block bodies, see -@ref{Literal examples}. +It is possible to export the @emph{code} of code blocks, the @emph{results} +of code block evaluation, @emph{both} the code and the results of code block +evaluation, or @emph{none}. For most languages, the default exports code. +However, for some languages (e.g.@: @code{ditaa}) the default exports the +results of code block evaluation. For information on exporting code block +bodies, see @ref{Literal examples}. The @code{:exports} header argument can be used to specify export behavior: @@ -11805,14 +12613,15 @@ @cindex source code, evaluating Code blocks can be evaluated@footnote{Whenever code is evaluated there is a -potential for that code to do harm. Org-mode provides a number of safeguards -to ensure that it only evaluates code with explicit confirmation from the -user. For information on these safeguards (and on how to disable them) see -@ref{Code evaluation security}.} and the results placed in the Org-mode -buffer. By default, evaluation is only turned on for @code{emacs-lisp} code -blocks, however support exists for evaluating blocks in many languages. See -@ref{Languages} for a list of supported languages. See @ref{Structure of -code blocks} for information on the syntax used to define a code block. +potential for that code to do harm. Org-mode provides safeguards to ensure +that code is only evaluated after explicit confirmation from the user. For +information on these safeguards (and on how to disable them) see @ref{Code +evaluation security}.} and the results of evaluation optionally placed in the +Org-mode buffer. By default, the evaluation facility is only enabled for +Lisp code blocks specified as @code{emacs-lisp}. However, souce code blocks +in many languages can be evaluated within Org-mode (see @ref{Languages} for a +list of supported languages and @ref{Structure of code blocks} for +information on the syntax used to define a code block). @kindex C-c C-c There are a number of ways to evaluate code blocks. The simplest is to press @@ -11821,63 +12630,51 @@ evaluation from the @kbd{C-c C-c} key binding.}. This will call the @code{org-babel-execute-src-block} function to evaluate the block and insert its results into the Org-mode buffer. +@cindex #+CALL It is also possible to evaluate named code blocks from anywhere in an -Org-mode buffer or an Org-mode table. @code{#+call} (or synonymously -@code{#+function} or @code{#+lob}) lines can be used to remotely execute code -blocks located in the current Org-mode buffer or in the ``Library of Babel'' -(see @ref{Library of Babel}). These lines use the following syntax to place -a call on a line by itself. +Org-mode buffer or an Org-mode table. Live code blocks located in the current +Org-mode buffer or in the ``Library of Babel'' (see @ref{Library of Babel}) +can be executed. Named code blocks can be executed with a separate +@code{#+CALL:} line or inline within a block of text. + +The syntax of the @code{#+CALL:} line is @example -#+call: () -#+call: [
    ]()
    +#+CALL: () +#+CALL: []() @end example -The following syntax can be used to place these calls within a block of -prose. +The syntax for inline evaluation of named code blocks is @example -...prose... call_() ...prose... -...prose... call_[
    ]()[
    ] ...prose... +... call_() ... +... call_[]()[] ... @end example @table @code @item -The name of the code block to be evaluated. +The name of the code block to be evaluated (see @ref{Structure of code blocks}). @item Arguments specified in this section will be passed to the code block. These -arguments should relate to @code{:var} header arguments in the called code -block expressed using standard function call syntax. For example if the -original code block named @code{double} has the header argument @code{:var -n=2}, then the call line passing the number four to that block would be -written as @code{#+call: double(n=2)}. -@item
    -Header arguments can be placed either inside the call to the code block or at -the end of the line as shown below. - -@example -#+call: code_bloc_name[XXXX](arguments) YYYY -@end example - -Header arguments located in these two locations are treated differently. - -@table @code -@item XXXX -Those placed in the @code{XXXX} location are passed through and applied to -the code block being called. These header arguments affect how the code -block is evaluated, for example @code{[:results output]} will collect the -results from @code{STDOUT} of the called code block. -@item YYYY -Those placed in the @code{YYYY} location are applied to the call line and do -not affect the code block being called. These header arguments affect how -the results are incorporated into the Org-mode buffer when the call line is -evaluated, and how the call line is exported. For example @code{:results -org} at the end of the call line will insert the results of the call line -inside of an Org-mode block. -@end table +arguments use standard function call syntax, rather than +header argument syntax. For example, a @code{#+CALL:} line that passes the +number four to a code block named @code{double}, which declares the header +argument @code{:var n=2}, would be written as @code{#+CALL: double(n=4)}. +@item +Inside header arguments are passed through and applied to the named code +block. These arguments use header argument syntax rather than standard +function call syntax. Inside header arguments affect how the code block is +evaluated. For example, @code{[:results output]} will collect the results of +everything printed to @code{STDOUT} during execution of the code block. +@item +End header arguments are applied to the calling instance and do not affect +evaluation of the named code block. They affect how the results are +incorporated into the Org-mode buffer and how the call line is exported. For +example, @code{:results html} will insert the results of the call line +evaluation in the Org buffer, wrapped in a @code{BEGIN_HTML:} block. -For more examples of passing header arguments to @code{#+call:} lines see +For more examples of passing header arguments to @code{#+CALL:} lines see @ref{Header arguments in function calls}. @end table @@ -11887,15 +12684,19 @@ @cindex source code, library @cindex code block, library -The ``Library of Babel'' is a library of code blocks -that can be called from any Org-mode file. The library is housed in an -Org-mode file located in the @samp{contrib} directory of Org-mode. -Org-mode users can deposit functions they believe to be generally -useful in the library. - -Code blocks defined in the ``Library of Babel'' can be called remotely as if -they were in the current Org-mode buffer (see @ref{Evaluating code blocks} -for information on the syntax of remote code block evaluation). +The ``Library of Babel'' consists of code blocks that can be called from any +Org-mode file. Code blocks defined in the ``Library of Babel'' can be called +remotely as if they were in the current Org-mode buffer (see @ref{Evaluating +code blocks} for information on the syntax of remote code block evaluation). + + +The central repository of code blocks in the ``Library of Babel'' is housed +in an Org-mode file located in the @samp{contrib} directory of Org-mode. + +Users can add code blocks they believe to be generally useful to their +``Library of Babel.'' The code blocks can be stored in any Org-mode file and +then loaded into the library with @code{org-babel-lob-ingest}. + @kindex C-c C-v i Code blocks located in any Org-mode file can be loaded into the ``Library of @@ -12052,10 +12853,9 @@ @node Buffer-wide header arguments, Header arguments in Org-mode properties, Language-specific header arguments, Using header arguments @subsubheading Buffer-wide header arguments -Buffer-wide header arguments may be specified through the use of a special -line placed anywhere in an Org-mode file. The line consists of the -@code{#+BABEL:} keyword followed by a series of header arguments which may be -specified using the standard header argument syntax. +Buffer-wide header arguments may be specified as properties through the use +of @code{#+PROPERTY:} lines placed anywhere in an Org-mode file (see +@ref{Property syntax}). For example the following would set @code{session} to @code{*R*}, and @code{results} to @code{silent} for every code block in the buffer, ensuring @@ -12063,7 +12863,8 @@ inserted into the buffer. @example -#+BABEL: :session *R* :results silent +#+PROPERTY: session *R* +#+PROPERTY: results silent @end example @node Header arguments in Org-mode properties, Code block specific header arguments, Buffer-wide header arguments, Using header arguments @@ -12074,13 +12875,15 @@ of setting a header argument for all code blocks in a buffer is @example -#+property: tangle yes +#+PROPERTY: tangle yes @end example +@vindex org-use-property-inheritance When properties are used to set default header arguments, they are looked up -with inheritance, so the value of the @code{:cache} header argument will default -to @code{yes} in all code blocks in the subtree rooted at the following -heading: +with inheritance, regardless of the value of +@code{org-use-property-inheritance}. In the following example the value of +the @code{:cache} header argument will default to @code{yes} in all code +blocks in the subtree rooted at the following heading: @example * outline header @@ -12101,7 +12904,7 @@ The most common way to assign values to header arguments is at the code block level. This can be done by listing a sequence of header -arguments and their values as part of the @code{#+begin_src} line. +arguments and their values as part of the @code{#+BEGIN_SRC} line. Properties set in this way override both the values of @code{org-babel-default-header-args} and header arguments specified as properties. In the following example, the @code{:results} header argument @@ -12111,28 +12914,30 @@ preserved on export to HTML or LaTeX. @example -#+source: factorial -#+begin_src haskell :results silent :exports code :var n=0 +#+NAME: factorial +#+BEGIN_SRC haskell :results silent :exports code :var n=0 fac 0 = 1 fac n = n * fac (n-1) -#+end_src +#+END_SRC @end example -Similarly, it is possible to set header arguments for inline code blocks: +Similarly, it is possible to set header arguments for inline code blocks @example src_haskell[:exports both]@{fac 5@} @end example -Code block header arguments can span multiple lines using =#+header:= or -=#+headers:= lines preceding a code block or nested in between the name and -body of a named code block. +Code block header arguments can span multiple lines using @code{#+HEADER:} or +@code{#+HEADERS:} lines preceding a code block or nested between the +@code{#+NAME:} line and the @code{#+BEGIN_SRC} line of a named code block. +@cindex #+HEADER: +@cindex #+HEADERS: Multi-line header arguments on an un-named code block: @example - #+headers: :var data1=1 - #+begin_src emacs-lisp :var data2=2 + #+HEADERS: :var data1=1 + #+BEGIN_SRC emacs-lisp :var data2=2 (message "data1:%S, data2:%S" data1 data2) - #+end_src + #+END_SRC #+results: : data1:1, data2:2 @@ -12140,11 +12945,11 @@ Multi-line header arguments on a named code block: @example - #+source: named-block - #+header: :var data=2 - #+begin_src emacs-lisp + #+NAME: named-block + #+HEADER: :var data=2 + #+BEGIN_SRC emacs-lisp (message "data:%S" data) - #+end_src + #+END_SRC #+results: named-block : data:2 @@ -12155,25 +12960,26 @@ @subsubheading Header arguments in function calls At the most specific level, header arguments for ``Library of Babel'' or -function call lines can be set as shown in the two examples below. For more -information on the structure of @code{#+call:} lines see @ref{Evaluating code +@code{#+CALL:} lines can be set as shown in the two examples below. For more +information on the structure of @code{#+CALL:} lines see @ref{Evaluating code blocks}. The following will apply the @code{:exports results} header argument to the -evaluation of the @code{#+call:} line. +evaluation of the @code{#+CALL:} line. @example -#+call: factorial(n=5) :exports results +#+CALL: factorial(n=5) :exports results @end example The following will apply the @code{:session special} header argument to the evaluation of the @code{factorial} code block. @example -#+call: factorial[:session special](n=5) +#+CALL: factorial[:session special](n=5) @end example @node Specific header arguments, , Using header arguments, Header arguments @subsection Specific header arguments -The following header arguments are defined: +Header arguments consist of an initial colon followed by the name of the +argument in lowercase letters. The following header arguments are defined: @menu * var:: Pass arguments to code blocks @@ -12212,13 +13018,18 @@ The @code{:var} header argument is used to pass arguments to code blocks. The specifics of how arguments are included in a code block vary by language; these are addressed in the language-specific documentation. However, the -syntax used to specify arguments is the same across all languages. The -values passed to arguments can be literal values, values from org-mode tables -and literal example blocks, the results of other code blocks, or Emacs Lisp -code---see the ``Emacs Lisp evaluation of variables'' heading below. +syntax used to specify arguments is the same across all languages. In every +case, variables require a default value when they are declared. + +The values passed to arguments can either be literal values, references, or +Emacs Lisp code (see @ref{var, Emacs Lisp evaluation of variables}). References +include anything in the Org-mode file that takes a @code{#+NAME:}, +@code{#+TBLNAME:}, or @code{#+RESULTS:} line. This includes tables, lists, +@code{#+BEGIN_EXAMPLE} blocks, other code blocks, and the results of other +code blocks. -These values can be indexed in a manner similar to arrays---see the -``indexable variable values'' heading below. +Argument values can be indexed in a manner similar to arrays (see @ref{var, +Indexable variable values}). The following syntax is used to pass arguments to code blocks using the @code{:var} header argument. @@ -12227,76 +13038,122 @@ :var name=assign @end example -where @code{assign} can take one of the following forms +The argument, @code{assign}, can either be a literal value, such as a string +@samp{"string"} or a number @samp{9}, or a reference to a table, a list, a +literal example, another code block (with or without arguments), or the +results of evaluating another code block. -@itemize @bullet -@item literal value -either a string @code{"string"} or a number @code{9}. -@item reference -a table name: +Here are examples of passing values by reference: +@table @dfn + +@item table +an Org mode table named with either a @code{#+NAME:} or @code{#+TBLNAME:} line @example -#+tblname: example-table +#+TBLNAME: example-table | 1 | | 2 | | 3 | | 4 | -#+source: table-length -#+begin_src emacs-lisp :var table=example-table +#+NAME: table-length +#+BEGIN_SRC emacs-lisp :var table=example-table (length table) -#+end_src +#+END_SRC #+results: table-length : 4 @end example -a code block name, as assigned by @code{#+srcname:}, followed by -parentheses: +@item list +a simple list named with a @code{#+NAME:} line (note that nesting is not +carried through to the source code block) @example -#+begin_src emacs-lisp :var length=table-length() +#+NAME: example-list + - simple + - not + - nested + - list + +#+BEGIN_SRC emacs-lisp :var x=example-list + (print x) +#+END_SRC + +#+results: +| simple | list | +@end example + +@item code block without arguments +a code block name (from the example above), as assigned by @code{#+NAME:}, +optionally followed by parentheses + +@example +#+BEGIN_SRC emacs-lisp :var length=table-length() (* 2 length) -#+end_src +#+END_SRC #+results: : 8 @end example -In addition, an argument can be passed to the code block referenced -by @code{:var}. The argument is passed within the parentheses following the -code block name: +@item code block with arguments +a code block name, as assigned by @code{#+NAME:}, followed by parentheses and +optional arguments passed within the parentheses following the +code block name using standard function call syntax @example -#+source: double -#+begin_src emacs-lisp :var input=8 +#+NAME: double +#+BEGIN_SRC emacs-lisp :var input=8 (* 2 input) -#+end_src +#+END_SRC #+results: double : 16 -#+source: squared -#+begin_src emacs-lisp :var input=double(input=1) +#+NAME: squared +#+BEGIN_SRC emacs-lisp :var input=double(input=1) (* input input) -#+end_src +#+END_SRC #+results: squared : 4 @end example -@end itemize + +@item literal example +a literal example block named with a @code{#+NAME:} line + +@example +#+NAME: literal-example +#+BEGIN_EXAMPLE +A literal example +on two lines +#+END_EXAMPLE + +#+NAME: read-literal-example +#+BEGIN_SRC emacs-lisp :var x=literal-example + (concatenate 'string x " for you.") +#+END_SRC + +#+results: read-literal-example +: A literal example +: on two lines for you. + +@end example + +@end table @subsubheading Alternate argument syntax It is also possible to specify arguments in a potentially more natural way -using the @code{#+source:} line of a code block. As in the following -example arguments can be packed inside of parenthesis, separated by commas, +using the @code{#+NAME:} line of a code block. As in the following +example, arguments can be packed inside of parentheses, separated by commas, following the source name. @example -#+source: double(input=0, x=2) -#+begin_src emacs-lisp +#+NAME: double(input=0, x=2) +#+BEGIN_SRC emacs-lisp (* 2 (+ input x)) -#+end_src +#+END_SRC @end example @subsubheading Indexable variable values @@ -12310,15 +13167,15 @@ @code{example-table} to the variable @code{data}: @example -#+results: example-table +#+NAME: example-table | 1 | a | | 2 | b | | 3 | c | | 4 | d | -#+begin_src emacs-lisp :var data=example-table[0,-1] +#+BEGIN_SRC emacs-lisp :var data=example-table[0,-1] data -#+end_src +#+END_SRC #+results: : a @@ -12330,16 +13187,16 @@ to @code{data}. @example -#+results: example-table +#+NAME: example-table | 1 | a | | 2 | b | | 3 | c | | 4 | d | | 5 | 3 | -#+begin_src emacs-lisp :var data=example-table[1:3] +#+BEGIN_SRC emacs-lisp :var data=example-table[1:3] data -#+end_src +#+END_SRC #+results: | 2 | b | @@ -12353,15 +13210,15 @@ column is referenced. @example -#+results: example-table +#+NAME: example-table | 1 | a | | 2 | b | | 3 | c | | 4 | d | -#+begin_src emacs-lisp :var data=example-table[,0] +#+BEGIN_SRC emacs-lisp :var data=example-table[,0] data -#+end_src +#+END_SRC #+results: | 1 | 2 | 3 | 4 | @@ -12372,16 +13229,16 @@ another by commas, as shown in the following example. @example -#+source: 3D -#+begin_src emacs-lisp +#+NAME: 3D +#+BEGIN_SRC emacs-lisp '(((1 2 3) (4 5 6) (7 8 9)) ((10 11 12) (13 14 15) (16 17 18)) ((19 20 21) (22 23 24) (25 26 27))) -#+end_src +#+END_SRC -#+begin_src emacs-lisp :var data=3D[1,,1] +#+BEGIN_SRC emacs-lisp :var data=3D[1,,1] data -#+end_src +#+END_SRC #+results: | 11 | 14 | 17 | @@ -12390,31 +13247,31 @@ @subsubheading Emacs Lisp evaluation of variables Emacs lisp code can be used to initialize variable values. When a variable -value starts with @code{(}, @code{[}, @code{'} or @code{`} it will be evaluated as -Emacs Lisp and the result of the evaluation will be assigned as the variable -value. The following example demonstrates use of this evaluation to reliably -pass the file-name of the org-mode buffer to a code block---note that -evaluation of header arguments is guaranteed to take place in the original -org-mode file, while there is no such guarantee for evaluation of the code -block body. +value starts with @code{(}, @code{[}, @code{'} or @code{`} it will be +evaluated as Emacs Lisp and the result of the evaluation will be assigned as +the variable value. The following example demonstrates use of this +evaluation to reliably pass the file-name of the org-mode buffer to a code +block---note that evaluation of header arguments is guaranteed to take place +in the original Org-mode file, while there is no such guarantee for +evaluation of the code block body. @example -#+begin_src sh :var filename=(buffer-file-name) :exports both +#+BEGIN_SRC sh :var filename=(buffer-file-name) :exports both wc -w $filename -#+end_src +#+END_SRC @end example Note that values read from tables and lists will not be evaluated as Emacs Lisp, as shown in the following example. @example -#+results: table +#+NAME: table | (a b c) | -#+headers: :var data=table[0,0] -#+begin_src perl +#+HEADERS: :var data=table[0,0] +#+BEGIN_SRC perl $data -#+end_src +#+END_SRC #+results: : (a b c) @@ -12557,9 +13414,9 @@ in your home directory, you could use @example -#+begin_src R :file myplot.png :dir ~/Work +#+BEGIN_SRC R :file myplot.png :dir ~/Work matplot(matrix(rnorm(100), 10), type="l") -#+end_src +#+END_SRC @end example @subsubheading Remote execution @@ -12567,9 +13424,9 @@ which case the code will be evaluated on the remote machine. An example is @example -#+begin_src R :file plot.png :dir /dand@@yakuba.princeton.edu: +#+BEGIN_SRC R :file plot.png :dir /dand@@yakuba.princeton.edu: plot(1:10, main=system("hostname", intern=TRUE)) -#+end_src +#+END_SRC @end example Text results will be returned to the local Org-mode buffer as usual, and file @@ -12600,7 +13457,7 @@ @code{:dir} should typically not be used to create files during export with @code{:exports results} or @code{:exports both}. The reason is that, in order to retain portability of exported material between machines, during export -links inserted into the buffer will *not* be expanded against @code{default +links inserted into the buffer will @emph{not} be expanded against @code{default directory}. Therefore, if @code{default-directory} is altered using @code{:dir}, it is probable that the file will be created in a location to which the link does not point. @@ -12774,33 +13631,33 @@ the resulting pure code file. @example - #+begin_src sh :tangle yes :noweb yes :shebang #!/bin/sh + #+BEGIN_SRC sh :tangle yes :noweb yes :shebang #!/bin/sh <> - #+end_src + #+END_SRC * the mount point of the fullest disk :PROPERTIES: :noweb-ref: fullest-disk :END: ** query all mounted disks - #+begin_src sh + #+BEGIN_SRC sh df \ - #+end_src + #+END_SRC ** strip the header row - #+begin_src sh + #+BEGIN_SRC sh |sed '1d' \ - #+end_src + #+END_SRC ** sort by the percent full - #+begin_src sh + #+BEGIN_SRC sh |awk '@{print $5 " " $6@}'|sort -n |tail -1 \ - #+end_src + #+END_SRC ** extract the mount point - #+begin_src sh + #+BEGIN_SRC sh |awk '@{print $2@}' - #+end_src + #+END_SRC @end example @node cache, sep, noweb-ref, Specific header arguments @@ -12830,18 +13687,18 @@ changed since it was last run. @example - #+srcname: random - #+begin_src R :cache yes + #+NAME: random + #+BEGIN_SRC R :cache yes runif(1) - #+end_src + #+END_SRC #+results[a2a72cd647ad44515fab62e144796432793d68e1]: random 0.4659510825295 - #+srcname: caller - #+begin_src emacs-lisp :var x=random :cache yes + #+NAME: caller + #+BEGIN_SRC emacs-lisp :var x=random :cache yes x - #+end_src + #+END_SRC #+results[bec9c8724e397d5df3b696502df3ed7892fc4f5f]: caller 0.254227238707244 @@ -12875,17 +13732,17 @@ default value yields the following results. @example -#+tblname: many-cols +#+TBLNAME: many-cols | a | b | c | |---+---+---| | d | e | f | |---+---+---| | g | h | i | -#+source: echo-table -#+begin_src python :var tab=many-cols +#+NAME: echo-table +#+BEGIN_SRC python :var tab=many-cols return tab -#+end_src +#+END_SRC #+results: echo-table | a | b | c | @@ -12897,17 +13754,17 @@ Leaves hlines in the table. Setting @code{:hlines yes} has this effect. @example -#+tblname: many-cols +#+TBLNAME: many-cols | a | b | c | |---+---+---| | d | e | f | |---+---+---| | g | h | i | -#+source: echo-table -#+begin_src python :var tab=many-cols :hlines yes +#+NAME: echo-table +#+BEGIN_SRC python :var tab=many-cols :hlines yes return tab -#+end_src +#+END_SRC #+results: echo-table | a | b | c | @@ -12923,6 +13780,10 @@ The @code{:colnames} header argument accepts the values @code{yes}, @code{no}, or @code{nil} for unassigned. The default value is @code{nil}. +Note that the behavior of the @code{:colnames} header argument may differ +across languages. For example Emacs Lisp code blocks ignore the +@code{:colnames} header argument entirely given the ease with which tables +with column names may be handled directly in Emacs Lisp. @itemize @bullet @item @code{nil} @@ -12932,16 +13793,16 @@ processing, then reapplied to the results. @example -#+tblname: less-cols +#+TBLNAME: less-cols | a | |---| | b | | c | -#+srcname: echo-table-again -#+begin_src python :var tab=less-cols +#+NAME: echo-table-again +#+BEGIN_SRC python :var tab=less-cols return [[val + '*' for val in row] for row in tab] -#+end_src +#+END_SRC #+results: echo-table-again | a | @@ -12977,14 +13838,14 @@ and is then reapplied to the results. @example -#+tblname: with-rownames +#+TBLNAME: with-rownames | one | 1 | 2 | 3 | 4 | 5 | | two | 6 | 7 | 8 | 9 | 10 | -#+srcname: echo-table-once-again -#+begin_src python :var tab=with-rownames :rownames yes +#+NAME: echo-table-once-again +#+BEGIN_SRC python :var tab=with-rownames :rownames yes return [[val + 10 for val in row] for row in tab] -#+end_src +#+END_SRC #+results: echo-table-once-again | one | 11 | 12 | 13 | 14 | 15 | @@ -13007,12 +13868,23 @@ @node eval, , shebang, Specific header arguments @subsubsection @code{:eval} The @code{:eval} header argument can be used to limit the evaluation of -specific code blocks. @code{:eval} accepts two arguments ``never'' and -``query''. @code{:eval never} will ensure that a code block is never -evaluated, this can be useful for protecting against the evaluation of -dangerous code blocks. @code{:eval query} will require a query for every -execution of a code block regardless of the value of the -@code{org-confirm-babel-evaluate} variable. +specific code blocks. The @code{:eval} header argument can be useful for +protecting against the evaluation of dangerous code blocks or to ensure that +evaluation will require a query regardless of the value of the +@code{org-confirm-babel-evaluate} variable. The possible values of +@code{:eval} and their effects are shown below. + +@table @code +@item never or no +The code block will not be evaluated under any circumstances. +@item query +Evaluation of the code block will require a query. +@item never-export or no-export +The code block will not be evaluated during export but may still be called +interactively. +@item query-export +Evaluation of the code block during export will require a query. +@end table If this header argument is not set then evaluation is determined by the value of the @code{org-confirm-babel-evaluate} variable see @ref{Code evaluation @@ -13081,26 +13953,26 @@ process. For example, compare the following two blocks: @example -#+begin_src python :results output +#+BEGIN_SRC python :results output print "hello" 2 print "bye" -#+end_src +#+END_SRC -#+resname: +#+results: : hello : bye @end example In non-session mode, the `2' is not printed and does not appear. @example -#+begin_src python :results output :session +#+BEGIN_SRC python :results output :session print "hello" 2 print "bye" -#+end_src +#+END_SRC -#+resname: +#+results: : hello : 2 : bye @@ -13767,6 +14639,8 @@ @item If the cursor is on the @code{#+BEGIN} line of a dynamic block, the block is updated. +@item +If the cursor is at a timestamp, fix the day name in the timestamp. @end itemize @node Clean view, TTY keys, The very busy C-c C-c key, Miscellaneous @@ -14088,7 +14962,7 @@ (add-hook 'org-mode-hook (lambda () (org-set-local 'yas/trigger-key [tab]) - (define-key yas/keymap [tab] 'yas/next-field-group))) + (define-key yas/keymap [tab] 'yas/next-field-or-maybe-expand))) @end lisp The latest version of yasnippet doesn't play well with Org mode. If the @@ -14896,7 +15770,7 @@ @example emacs -batch -l ~/.emacs \ -eval '(org-batch-agenda "a" \ - org-agenda-span month \ + org-agenda-span (quote month) \ org-agenda-include-diary nil \ org-agenda-files (quote ("~/org/project.org")))' \ | lpr @@ -15549,7 +16423,7 @@ @i{David O'Toole} wrote @file{org-publish.el} and drafted the manual chapter about publishing. @item -@i{Jambunathan K} contributed the OpenDocumentText exporter. +@i{Jambunathan K} contributed the @acronym{ODT} exporter. @item @i{Sebastien Vauban} reported many issues with LaTeX and BEAMER export and enabled source code highlighling in Gnus. @@ -15607,10 +16481,6 @@ @bye -@ignore - arch-tag: 7893d1Fe-cc57-4d13-b5e5-f494a1CBC7ac -@end ignore - @c Local variables: @c fill-column: 77 @c indent-tabs-mode: nil diff -Nru org-mode-7.7/doc/pdflayout.sty org-mode-7.8.02/doc/pdflayout.sty --- org-mode-7.7/doc/pdflayout.sty 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/doc/pdflayout.sty 2011-12-13 00:34:24.000000000 +0000 @@ -41,7 +41,3 @@ \else \def\pdflayout=(#1#2){} \fi - -% archtag: 63c938a5-cc78-4964-962d-603c90d34afc - -% arch-tag: 3464d27c-1439-473a-bc47-a7c501e8c156 diff -Nru org-mode-7.7/etc/styles/COPYRIGHT-AND-LICENSE org-mode-7.8.02/etc/styles/COPYRIGHT-AND-LICENSE --- org-mode-7.7/etc/styles/COPYRIGHT-AND-LICENSE 1970-01-01 00:00:00.000000000 +0000 +++ org-mode-7.8.02/etc/styles/COPYRIGHT-AND-LICENSE 2011-12-13 00:34:24.000000000 +0000 @@ -0,0 +1,36 @@ +OrgOdtContentTemplate.xml --- Aux XML file (Org-mode's OpenDocument export) +OrgOdtStyles.xml --- Aux XML file (Org-mode's OpenDocument export) + +Copyright (C) 2010-2011 Free Software Foundation, Inc. + +Author: Jambunathan K +Keywords: outlines, hypermedia, calendar, wp +Homepage: http://orgmode.org + +These file are not (yet) part of GNU Emacs. +However, it is distributed under the same license. + +GNU Emacs is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +GNU Emacs is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Emacs. If not, see . + +Commentary: + +Above files are part of Org-mode's OpenDocument export module. + +OrgOdtContentTemplate.xml provides a template within which the content +of an exported document is enclosed. This file contributes to +"content.xml" file within an exported document and acts as a +repository of automatic styles. + +OrgOdtStyles.xml contributes to "styles.xml" file within an exported +document and acts as a repository of custom styles. diff -Nru org-mode-7.7/etc/styles/OrgOdtContentTemplate.xml org-mode-7.8.02/etc/styles/OrgOdtContentTemplate.xml --- org-mode-7.7/etc/styles/OrgOdtContentTemplate.xml 1970-01-01 00:00:00.000000000 +0000 +++ org-mode-7.8.02/etc/styles/OrgOdtContentTemplate.xml 2011-12-13 00:34:24.000000000 +0000 @@ -0,0 +1,208 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru org-mode-7.7/etc/styles/OrgOdtStyles.xml org-mode-7.8.02/etc/styles/OrgOdtStyles.xml --- org-mode-7.7/etc/styles/OrgOdtStyles.xml 1970-01-01 00:00:00.000000000 +0000 +++ org-mode-7.8.02/etc/styles/OrgOdtStyles.xml 2011-12-13 00:34:24.000000000 +0000 @@ -0,0 +1,703 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru org-mode-7.7/lisp/ob-asymptote.el org-mode-7.8.02/lisp/ob-asymptote.el --- org-mode-7.7/lisp/ob-asymptote.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/ob-asymptote.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,11 +1,10 @@ ;;; ob-asymptote.el --- org-babel functions for asymptote evaluation -;; Copyright (C) 2009, 2010 Free Software Foundation, Inc. +;; Copyright (C) 2009-2011 Free Software Foundation, Inc. ;; Author: Eric Schulte ;; Keywords: literate programming, reproducible research ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; This file is part of GNU Emacs. @@ -98,9 +97,8 @@ The elisp value PAIR is converted into Asymptote code specifying a variable of the same value." (let ((var (car pair)) - (val (if (symbolp (cdr pair)) - (symbol-name (cdr pair)) - (cdr pair)))) + (val (let ((v (cdr pair))) + (if (symbolp v) (symbol-name v) v)))) (cond ((integerp val) (format "int %S=%S;" var val)) @@ -108,58 +106,45 @@ (format "real %S=%S;" var val)) ((stringp val) (format "string %S=\"%s\";" var val)) + ((and (listp val) (not (listp (car val)))) + (let* ((type (org-babel-asymptote-define-type val)) + (fmt (if (eq 'string type) "\"%s\"" "%s")) + (vect (mapconcat (lambda (e) (format fmt e)) val ", "))) + (format "%s[] %S={%s};" type var vect))) ((listp val) - (let* ((dimension-2-p (not (null (cdr val)))) - (dim (if dimension-2-p "[][]" "[]")) - (type (org-babel-asymptote-define-type val)) - (array (org-babel-asymptote-table-to-array - val - (if dimension-2-p '(:lstart "{" :lend "}," :llend "}"))))) - (format "%S%s %S=%s;" type dim var array)))))) - -(defun org-babel-asymptote-table-to-array (table params) - "Convert values of an elisp table into a string of an asymptote array. -Empty cells are ignored." - (labels ((atom-to-string (table) - (cond - ((null table) '()) - ((not (listp (car table))) - (cons (if (and (stringp (car table)) - (not (string= (car table) ""))) - (format "\"%s\"" (car table)) - (format "%s" (car table))) - (atom-to-string (cdr table)))) - (t - (cons (atom-to-string (car table)) - (atom-to-string (cdr table)))))) - ;; Remove any empty row - (fix-empty-lines (table) - (delq nil (mapcar (lambda (l) (delq "" l)) table)))) - (orgtbl-to-generic - (fix-empty-lines (atom-to-string table)) - (org-combine-plists '(:hline nil :sep "," :tstart "{" :tend "}") params)))) + (let* ((type (org-babel-asymptote-define-type val)) + (fmt (if (eq 'string type) "\"%s\"" "%s")) + (array (mapconcat (lambda (row) + (concat "{" + (mapconcat (lambda (e) (format fmt e)) + row ", ") + "}")) + val ","))) + (format "%S[][] %S={%s};" type var array)))))) (defun org-babel-asymptote-define-type (data) "Determine type of DATA. -DATA is a list. Type symbol is returned as 'symbol. The type is -usually the type of the first atom encountered, except for arrays -of int, where every cell must be of int type." - (labels ((anything-but-int (el) - (cond - ((null el) nil) - ((not (listp (car el))) - (cond - ((floatp (car el)) 'real) - ((stringp (car el)) 'string) - (t - (anything-but-int (cdr el))))) - (t - (or (anything-but-int (car el)) - (anything-but-int (cdr el))))))) - (or (anything-but-int data) 'int))) + +DATA is a list. Return type as a symbol. + +The type is `string' if any element in DATA is +a string. Otherwise, it is either `real', if some elements are +floats, or `int'." + (let* ((type 'int) + find-type ; for byte-compiler + (find-type + (function + (lambda (row) + (catch 'exit + (mapc (lambda (el) + (cond ((listp el) (funcall find-type el)) + ((stringp el) (throw 'exit (setq type 'string))) + ((floatp el) (setq type 'real)))) + row)))))) + (funcall find-type data) type)) (provide 'ob-asymptote) -;; arch-tag: f2f5bd0d-78e8-412b-8e6c-6dadc94cc06b + ;;; ob-asymptote.el ends here diff -Nru org-mode-7.7/lisp/ob-awk.el org-mode-7.8.02/lisp/ob-awk.el --- org-mode-7.7/lisp/ob-awk.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/ob-awk.el 2011-12-13 00:34:24.000000000 +0000 @@ -5,7 +5,6 @@ ;; Author: Eric Schulte ;; Keywords: literate programming, reproducible research ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; This file is part of GNU Emacs. @@ -24,8 +23,6 @@ ;;; Commentary: -;;; Commentary: - ;; Babel's awk can use special header argument: ;; ;; - :in-file takes a path to a file of data to be processed by awk @@ -51,7 +48,7 @@ "Expand BODY according to PARAMS, return the expanded body." (dolist (pair (mapcar #'cdr (org-babel-get-header params :var))) (setf body (replace-regexp-in-string - (regexp-quote (concat "$" (car pair))) (cdr pair) body))) + (regexp-quote (format "$%s" (car pair))) (cdr pair) body))) body) (defun org-babel-execute:awk (body params) @@ -114,6 +111,6 @@ (provide 'ob-awk) -;; arch-tag: 844e2c88-6aad-4018-868d-a2df6bcdf68f + ;;; ob-awk.el ends here diff -Nru org-mode-7.7/lisp/ob-calc.el org-mode-7.8.02/lisp/ob-calc.el --- org-mode-7.7/lisp/ob-calc.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/ob-calc.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,11 +1,10 @@ ;;; ob-calc.el --- org-babel functions for calc code evaluation -;; Copyright (C) 2010 Free Software Foundation, Inc +;; Copyright (C) 2010-2011 Free Software Foundation, Inc ;; Author: Eric Schulte ;; Keywords: literate programming, reproducible research ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; This file is part of GNU Emacs. @@ -29,10 +28,15 @@ ;;; Code: (require 'ob) (require 'calc) -(require 'calc-store) -(unless (featurep 'xemacs) (require 'calc-trail)) +(unless (featurep 'xemacs) + (require 'calc-trail) + (require 'calc-store)) (eval-when-compile (require 'ob-comint)) +(declare-function calc-store-into "calc-store" (&optional var)) +(declare-function calc-recall "calc-store" (&optional var)) +(declare-function math-evaluate-expr "calc-ext" (x)) + (defvar org-babel-default-header-args:calc nil "Default arguments for evaluating an calc source block.") @@ -99,6 +103,6 @@ (provide 'ob-calc) -;; arch-tag: 5c57a3b7-5818-4c6c-acda-7a94831a6449 + ;;; ob-calc.el ends here diff -Nru org-mode-7.7/lisp/ob-C.el org-mode-7.8.02/lisp/ob-C.el --- org-mode-7.7/lisp/ob-C.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/ob-C.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,11 +1,10 @@ ;;; ob-C.el --- org-babel functions for C and similar languages -;; Copyright (C) 2010 Free Software Foundation, Inc. +;; Copyright (C) 2010-2011 Free Software Foundation, Inc. ;; Author: Eric Schulte ;; Keywords: literate programming, reproducible research ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; This file is part of GNU Emacs. @@ -180,7 +179,7 @@ (format "int %S = %S;" var val)) ((floatp val) (format "double %S = %S;" var val)) - ((or (characterp val)) + ((or (integerp val)) (format "char %S = '%S';" var val)) ((stringp val) (format "char %S[%d] = \"%s\";" @@ -191,6 +190,6 @@ (provide 'ob-C) -;; arch-tag: 8f49e462-54e3-417b-9a8d-423864893b37 + ;;; ob-C.el ends here diff -Nru org-mode-7.7/lisp/ob-clojure.el org-mode-7.8.02/lisp/ob-clojure.el --- org-mode-7.7/lisp/ob-clojure.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/ob-clojure.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,11 +1,11 @@ ;;; ob-clojure.el --- org-babel functions for clojure evaluation -;; Copyright (C) 2009, 2010 Free Software Foundation, Inc. +;; Copyright (C) 2009-2011 Free Software Foundation, Inc. -;; Author: Joel Boehland, Eric Schulte +;; Author: Joel Boehland +;; Eric Schulte ;; Keywords: literate programming, reproducible research ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; This file is part of GNU Emacs. @@ -92,6 +92,6 @@ (provide 'ob-clojure) -;; arch-tag: a43b33f2-653e-46b1-ac56-2805cf05b7d1 + ;;; ob-clojure.el ends here diff -Nru org-mode-7.7/lisp/ob-comint.el org-mode-7.8.02/lisp/ob-comint.el --- org-mode-7.7/lisp/ob-comint.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/ob-comint.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,11 +1,10 @@ ;;; ob-comint.el --- org-babel functions for interaction with comint buffers -;; Copyright (C) 2009, 2010 Free Software Foundation, Inc. +;; Copyright (C) 2009-2011 Free Software Foundation, Inc. ;; Author: Eric Schulte ;; Keywords: literate programming, reproducible research, comint ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; This file is part of GNU Emacs. @@ -54,6 +53,7 @@ (error "buffer %s doesn't exist or has no process" ,buffer)) (set-buffer ,buffer) ,@body))) +(def-edebug-spec org-babel-comint-in-buffer (form body)) (defmacro org-babel-comint-with-output (meta &rest body) "Evaluate BODY in BUFFER and return process output. @@ -115,6 +115,7 @@ string-buffer)) (setq raw (substring string-buffer (match-end 0)))) (split-string string-buffer comint-prompt-regexp))))) +(def-edebug-spec org-babel-comint-with-output (form body)) (defun org-babel-comint-input-command (buffer cmd) "Pass CMD to BUFFER. @@ -158,6 +159,6 @@ (provide 'ob-comint) -;; arch-tag: 9adddce6-0864-4be3-b0b5-6c5157dc7889 + ;;; ob-comint.el ends here diff -Nru org-mode-7.7/lisp/ob-css.el org-mode-7.8.02/lisp/ob-css.el --- org-mode-7.7/lisp/ob-css.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/ob-css.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,11 +1,10 @@ ;;; ob-css.el --- org-babel functions for css evaluation -;; Copyright (C) 2009, 2010 Free Software Foundation, Inc. +;; Copyright (C) 2009-2011 Free Software Foundation, Inc. ;; Author: Eric Schulte ;; Keywords: literate programming, reproducible research ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; This file is part of GNU Emacs. @@ -44,6 +43,6 @@ (provide 'ob-css) -;; arch-tag: f4447e8c-50ab-41f9-b322-b7b9574d9fbe + ;;; ob-css.el ends here diff -Nru org-mode-7.7/lisp/ob-ditaa.el org-mode-7.8.02/lisp/ob-ditaa.el --- org-mode-7.7/lisp/ob-ditaa.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/ob-ditaa.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,11 +1,10 @@ ;;; ob-ditaa.el --- org-babel functions for ditaa evaluation -;; Copyright (C) 2009, 2010 Free Software Foundation, Inc. +;; Copyright (C) 2009-2011 Free Software Foundation, Inc. ;; Author: Eric Schulte ;; Keywords: literate programming, reproducible research ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; This file is part of GNU Emacs. @@ -74,6 +73,6 @@ (provide 'ob-ditaa) -;; arch-tag: 492cd006-07d9-4fac-bef6-5bb60b48842e + ;;; ob-ditaa.el ends here diff -Nru org-mode-7.7/lisp/ob-dot.el org-mode-7.8.02/lisp/ob-dot.el --- org-mode-7.7/lisp/ob-dot.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/ob-dot.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,11 +1,10 @@ ;;; ob-dot.el --- org-babel functions for dot evaluation -;; Copyright (C) 2009, 2010 Free Software Foundation, Inc. +;; Copyright (C) 2009-2011 Free Software Foundation, Inc. ;; Author: Eric Schulte ;; Keywords: literate programming, reproducible research ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; This file is part of GNU Emacs. @@ -85,6 +84,6 @@ (provide 'ob-dot) -;; arch-tag: 817d0516-7b47-4f77-a8b2-2aadd8e4d0e2 + ;;; ob-dot.el ends here diff -Nru org-mode-7.7/lisp/ob.el org-mode-7.8.02/lisp/ob.el --- org-mode-7.7/lisp/ob.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/ob.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,11 +1,11 @@ ;;; ob.el --- working with code blocks in org-mode -;; Copyright (C) 2009, 2010 Free Software Foundation, Inc. +;; Copyright (C) 2009-2011 Free Software Foundation, Inc. -;; Author: Eric Schulte, Dan Davison +;; Author: Eric Schulte +;; Dan Davison ;; Keywords: literate programming, reproducible research ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; This file is part of GNU Emacs. @@ -32,6 +32,7 @@ (defvar org-src-lang-modes) (defvar org-babel-library-of-babel) (declare-function show-all "outline" ()) +(declare-function org-reduce "org" (CL-FUNC CL-SEQ &rest CL-KEYS)) (declare-function tramp-compat-make-temp-file "tramp-compat" (filename &optional dir-flag)) (declare-function tramp-dissect-file-name "tramp" (name &optional nodefault)) @@ -71,6 +72,7 @@ (declare-function org-babel-ref-goto-headline-id "ob-ref" (id)) (declare-function org-babel-ref-headline-body "ob-ref" ()) (declare-function org-babel-lob-execute-maybe "ob-lob" ()) +(declare-function org-babel-map-call-lines "ob-lob" (file &rest body)) (declare-function org-number-sequence "org-compat" (from &optional to inc)) (declare-function org-at-item-p "org-list" ()) (declare-function org-list-parse-list "org-list" (&optional delete)) @@ -113,7 +115,7 @@ :type 'boolean) (defvar org-babel-src-name-regexp - "^[ \t]*#\\+\\(srcname\\|source\\|function\\):[ \t]*" + "^[ \t]*#\\+name:[ \t]*" "Regular expression used to match a source name line.") (defvar org-babel-multi-line-header-regexp @@ -137,13 +139,13 @@ ;; (4) header arguments "\\([^\n]*\\)\n" ;; (5) body - "\\([^\000]*?\\)[ \t]*#\\+end_src") + "\\([^\000]*?\n\\)?[ \t]*#\\+end_src") "Regexp used to identify code blocks.") (defvar org-babel-inline-src-block-regexp (concat ;; (1) replacement target (2) lang - "[^-[:alnum:]]\\(src_\\([^ \f\t\n\r\v]+\\)" + "\\(?:^\\|[^-[:alnum:]]\\)\\(src_\\([^ \f\t\n\r\v]+\\)" ;; (3,4) (unused, headers) "\\(\\|\\[\\(.*?\\)\\]\\)" ;; (5) body @@ -159,6 +161,39 @@ (lambda (p) (when (funcall (if others #'not #'identity) (eq (car p) key)) p)) params))) +(defun org-babel-get-inline-src-block-matches() + "Set match data if within body of an inline source block. +Returns non-nil if match-data set" + (let ((src-at-0-p (save-excursion + (beginning-of-line 1) + (string= "src" (thing-at-point 'word)))) + (first-line-p (= 1 (line-number-at-pos))) + (orig (point))) + (let ((search-for (cond ((and src-at-0-p first-line-p "src_")) + (first-line-p "[ \t]src_") + (t "[ \f\t\n\r\v]src_"))) + (lower-limit (if first-line-p + nil + (- (point-at-bol) 1)))) + (save-excursion + (when (or (and src-at-0-p (bobp)) + (and (re-search-forward "}" (point-at-eol) t) + (re-search-backward search-for lower-limit t) + (> orig (point)))) + (when (looking-at org-babel-inline-src-block-regexp) + t )))))) + +(defvar org-babel-inline-lob-one-liner-regexp) +(defun org-babel-get-lob-one-liner-matches() + "Set match data if on line of an lob one liner. +Returns non-nil if match-data set" + (save-excursion + (unless (= (point) (point-at-bol)) ;; move before inline block + (re-search-backward "[ \f\t\n\r\v]" nil t)) + (if (looking-at org-babel-inline-lob-one-liner-regexp) + t + nil))) + (defun org-babel-get-src-block-info (&optional light) "Get information on the current source block. @@ -183,22 +218,30 @@ (nth 2 info) (org-babel-parse-header-arguments (match-string 1))))) (when (looking-at org-babel-src-name-w-name-regexp) - (setq name (org-babel-clean-text-properties (match-string 4))) - (when (match-string 6) + (setq name (org-babel-clean-text-properties (match-string 3))) + (when (and (match-string 5) (> (length (match-string 5)) 0)) (setf (nth 2 info) ;; merge functional-syntax vars and header-args (org-babel-merge-params - (mapcar (lambda (ref) (cons :var ref)) - (org-babel-ref-split-args (match-string 6))) + (mapcar + (lambda (ref) (cons :var ref)) + (mapcar + (lambda (var) ;; check that each variable is initialized + (if (string-match ".+=.+" var) + var + (error + "variable \"%s\"%s must be assigned a default value" + var (if name (format " in block \"%s\"" name) "")))) + (org-babel-ref-split-args (match-string 5)))) (nth 2 info)))))) ;; inline source block - (when (save-excursion (re-search-backward "[ \f\t\n\r\v]" nil t) - (looking-at org-babel-inline-src-block-regexp)) + (when (org-babel-get-inline-src-block-matches) (setq info (org-babel-parse-inline-src-block-match)))) ;; resolve variable references and add summary parameters (when (and info (not light)) (setf (nth 2 info) (org-babel-process-params (nth 2 info)))) (when info (append info (list name indent))))) +(defvar org-current-export-file) ; dynamically bound (defun org-babel-confirm-evaluate (info) "Confirm evaluation of the code block INFO. This behavior can be suppressed by setting the value of @@ -211,11 +254,15 @@ (let* ((eval (or (cdr (assoc :eval (nth 2 info))) (when (assoc :noeval (nth 2 info)) "no"))) (query (cond ((equal eval "query") t) + ((and org-current-export-file + (equal eval "query-export")) t) ((functionp org-confirm-babel-evaluate) (funcall org-confirm-babel-evaluate (nth 0 info) (nth 1 info))) (t org-confirm-babel-evaluate)))) (if (or (equal eval "never") (equal eval "no") + (and org-current-export-file (or (equal eval "no-export") + (equal eval "never-export"))) (and query (not (yes-or-no-p (format "Evaluate this%scode block%son your system? " @@ -223,7 +270,9 @@ (if (nth 4 info) (format " (%s) " (nth 4 info)) " ")))))) (prog1 nil (message "Evaluation %s" - (if (or (equal eval "never") (equal eval "no")) + (if (or (equal eval "never") (equal eval "no") + (equal eval "no-export") + (equal eval "never-export")) "Disabled" "Aborted"))) t))) @@ -313,10 +362,35 @@ (add-hook 'org-metadown-hook 'org-babel-pop-to-session-maybe) +(defconst org-babel-common-header-args-w-values + '((cache . ((no yes))) + (cmdline . :any) + (colnames . ((nil no yes))) + (comments . ((no link yes org both noweb))) + (dir . :any) + (eval . ((never query))) + (exports . ((code results both none))) + (file . :any) + (hlines . ((no yes))) + (mkdirp . ((yes no))) + (no-expand) + (noeval) + (noweb . ((yes no tangle))) + (noweb-ref . :any) + (padline . ((yes no))) + (results . ((file list vector table scalar verbatim) + (raw org html latex code pp wrap) + (replace silent append prepend) + (output value))) + (rownames . ((no yes))) + (sep . :any) + (session . :any) + (shebang . :any) + (tangle . ((tangle yes no :any))) + (var . :any))) + (defconst org-babel-header-arg-names - '(cache cmdline colnames dir exports file noweb results - session tangle var eval noeval comments no-expand shebang - padline noweb-ref) + (mapcar #'car org-babel-common-header-args-w-values) "Common header arguments used by org-babel. Note that individual languages may define their own language specific header arguments as well.") @@ -331,7 +405,7 @@ '((:session . "none") (:results . "replace") (:exports . "results")) "Default arguments to use when evaluating an inline source block.") -(defvar org-babel-data-names '("TBLNAME" "RESNAME" "RESULTS" "DATA")) +(defvar org-babel-data-names '("TBLNAME" "RESULTS" "NAME")) (defvar org-babel-result-regexp (concat "^[ \t]*#\\+" @@ -364,11 +438,17 @@ (defvar org-babel-after-execute-hook nil "Hook for functions to be called after `org-babel-execute-src-block'") + (defun org-babel-named-src-block-regexp-for-name (name) "This generates a regexp used to match a src block named NAME." - (concat org-babel-src-name-regexp (regexp-quote name) "[ \t\n]*" + (concat org-babel-src-name-regexp (regexp-quote name) + "\\([ \t]\\|$\\|(\\)" ".*[\r\n]" (substring org-babel-src-block-regexp 1))) +(defun org-babel-named-data-regexp-for-name (name) + "This generates a regexp used to match data named NAME." + (concat org-babel-result-regexp (regexp-quote name) "\\([ \t]\\|$\\)")) + ;;; functions (defvar call-process-region) ;;;###autoload @@ -379,9 +459,8 @@ execution and the collection and formatting of results can be controlled through a variety of header arguments. -With prefix argument ARG, force re-execution even if a an -existing result cached in the buffer would otherwise have been -returned. +With prefix argument ARG, force re-execution even if an existing +result cached in the buffer would otherwise have been returned. Optionally supply a value for INFO in the form returned by `org-babel-get-src-block-info'. @@ -463,7 +542,7 @@ (defun org-babel-expand-body:generic (body params &optional var-lines) "Expand BODY with PARAMS. -Expand a block of code with org-babel according to it's header +Expand a block of code with org-babel according to its header arguments. This generic implementation of body expansion is called for languages which have not defined their own specific org-babel-expand-body:lang function." @@ -518,6 +597,7 @@ (interactive) ;; TODO: report malformed code block ;; TODO: report incompatible combinations of header arguments + ;; TODO: report uninitialized variables (let ((too-close 2)) ;; <- control closeness to report potential match (dolist (header (mapcar (lambda (arg) (substring (symbol-name (car arg)) 1)) (and (org-babel-where-is-src-block-head) @@ -532,6 +612,41 @@ (message "No suspicious header arguments found."))) ;;;###autoload +(defun org-babel-insert-header-arg () + "Insert a header argument selecting from lists of common args and values." + (interactive) + (let* ((lang (car (org-babel-get-src-block-info 'light))) + (lang-headers (intern (concat "org-babel-header-arg-names:" lang))) + (headers (append (if (boundp lang-headers) + (mapcar (lambda (h) (cons h :any)) + (eval lang-headers)) + nil) + org-babel-common-header-args-w-values)) + (arg (org-icompleting-read + "Header Arg: " + (mapcar + (lambda (header-spec) (symbol-name (car header-spec))) + headers)))) + (insert ":" arg) + (let ((vals (cdr (assoc (intern arg) headers)))) + (when vals + (insert + " " + (cond + ((eq vals :any) + (read-from-minibuffer "value: ")) + ((listp vals) + (mapconcat + (lambda (group) + (let ((arg (org-icompleting-read + "value: " + (cons "default" (mapcar #'symbol-name group))))) + (if (and arg (not (string= "default" arg))) + (concat arg " ") + ""))) + vals "")))))))) + +;;;###autoload (defun org-babel-load-in-session (&optional arg info) "Load the body of the current source-code block. Evaluate the header arguments for the source block before @@ -624,6 +739,7 @@ (if (org-bound-and-true-p org-edit-src-from-org-mode) (org-edit-src-exit))) t))) +(def-edebug-spec org-babel-do-in-edit-buffer (body)) (defun org-babel-do-key-sequence-in-edit-buffer (key) "Read key sequence and execute the command in edit buffer. @@ -720,6 +836,7 @@ (goto-char end-block)))) (unless visited-p (kill-buffer to-be-removed)) (goto-char point)))) +(def-edebug-spec org-babel-map-src-blocks (form body)) ;;;###autoload (defmacro org-babel-map-inline-src-blocks (file &rest body) @@ -742,6 +859,7 @@ (goto-char (match-end 0)))) (unless visited-p (kill-buffer to-be-removed)) (goto-char point)))) +(def-edebug-spec org-babel-map-inline-src-blocks (form body)) ;;;###autoload (defun org-babel-execute-buffer (&optional arg) @@ -754,7 +872,9 @@ (org-babel-map-src-blocks nil (org-babel-execute-src-block arg)) (org-babel-map-inline-src-blocks nil - (org-babel-execute-src-block arg)))) + (org-babel-execute-src-block arg)) + (org-babel-map-call-lines nil + (org-babel-lob-execute-maybe)))) ;;;###autoload (defun org-babel-execute-subtree (&optional arg) @@ -783,7 +903,7 @@ lst) (norm (arg) (let ((v (if (and (listp (cdr arg)) (null (cddr arg))) - (copy-seq (cdr arg)) + (copy-sequence (cdr arg)) (cdr arg)))) (when (and v (not (and (sequencep v) (not (consp v)) @@ -856,86 +976,6 @@ (when hash (kill-new hash) (message hash)))) (add-hook 'org-ctrl-c-ctrl-c-hook 'org-babel-hash-at-point) -(defun org-babel-result-hide-spec () - "Hide portions of results lines. -Add `org-babel-hide-result' as an invisibility spec for hiding -portions of results lines." - (add-to-invisibility-spec '(org-babel-hide-result . t))) -(add-hook 'org-mode-hook 'org-babel-result-hide-spec) - -(defvar org-babel-hide-result-overlays nil - "Overlays hiding results.") - -(defun org-babel-result-hide-all () - "Fold all results in the current buffer." - (interactive) - (org-babel-show-result-all) - (save-excursion - (while (re-search-forward org-babel-result-regexp nil t) - (save-excursion (goto-char (match-beginning 0)) - (org-babel-hide-result-toggle-maybe))))) - -(defun org-babel-show-result-all () - "Unfold all results in the current buffer." - (mapc 'delete-overlay org-babel-hide-result-overlays) - (setq org-babel-hide-result-overlays nil)) - -;;;###autoload -(defun org-babel-hide-result-toggle-maybe () - "Toggle visibility of result at point." - (interactive) - (let ((case-fold-search t)) - (if (save-excursion - (beginning-of-line 1) - (looking-at org-babel-result-regexp)) - (progn (org-babel-hide-result-toggle) - t) ;; to signal that we took action - nil))) ;; to signal that we did not - -(defun org-babel-hide-result-toggle (&optional force) - "Toggle the visibility of the current result." - (interactive) - (save-excursion - (beginning-of-line) - (if (re-search-forward org-babel-result-regexp nil t) - (let ((start (progn (beginning-of-line 2) (- (point) 1))) - (end (progn (goto-char (- (org-babel-result-end) 1)) (point))) - ov) - (if (memq t (mapcar (lambda (overlay) - (eq (overlay-get overlay 'invisible) - 'org-babel-hide-result)) - (overlays-at start))) - (if (or (not force) (eq force 'off)) - (mapc (lambda (ov) - (when (member ov org-babel-hide-result-overlays) - (setq org-babel-hide-result-overlays - (delq ov org-babel-hide-result-overlays))) - (when (eq (overlay-get ov 'invisible) - 'org-babel-hide-result) - (delete-overlay ov))) - (overlays-at start))) - (setq ov (make-overlay start end)) - (overlay-put ov 'invisible 'org-babel-hide-result) - ;; make the block accessible to isearch - (overlay-put - ov 'isearch-open-invisible - (lambda (ov) - (when (member ov org-babel-hide-result-overlays) - (setq org-babel-hide-result-overlays - (delq ov org-babel-hide-result-overlays))) - (when (eq (overlay-get ov 'invisible) - 'org-babel-hide-result) - (delete-overlay ov)))) - (push ov org-babel-hide-result-overlays))) - (error "Not looking at a result line")))) - -;; org-tab-after-check-for-cycling-hook -(add-hook 'org-tab-first-hook 'org-babel-hide-result-toggle-maybe) -;; Remove overlays when changing major mode -(add-hook 'org-mode-hook - (lambda () (org-add-hook 'change-major-mode-hook - 'org-babel-show-result-all 'append 'local))) - (defvar org-file-properties) (defun org-babel-params-from-properties (&optional lang) "Retrieve parameters specified as properties. @@ -943,40 +983,21 @@ may be specified in the properties of the current outline entry." (save-match-data (let (val sym) - (delq nil - (mapcar - (lambda (header-arg) - (and (setq val - (or (org-entry-get (point) header-arg t) - (org-entry-get (point) (concat ":" header-arg) t))) - (cons (intern (concat ":" header-arg)) - (org-babel-read val)))) + (org-babel-parse-multiple-vars + (delq nil (mapcar - 'symbol-name - (append - org-babel-header-arg-names - (progn - (setq sym (intern (concat "org-babel-header-arg-names:" lang))) - (and (boundp sym) (eval sym)))))))))) - -(defun org-babel-params-from-buffer () - "Retrieve per-buffer parameters. - Return an association list of any source block params which -may be specified in the current buffer." - (let (local-properties) - (save-match-data - (save-excursion - (save-restriction - (widen) - (goto-char (point-min)) - (while (re-search-forward - (org-make-options-regexp (list "BABEL" "PROPERTIES")) nil t) - (setq local-properties - (org-babel-merge-params - local-properties - (org-babel-parse-header-arguments - (org-match-string-no-properties 2))))) - local-properties))))) + (lambda (header-arg) + (and (setq val (org-entry-get (point) header-arg t)) + (cons (intern (concat ":" header-arg)) + (org-babel-read val)))) + (mapcar + 'symbol-name + (append + org-babel-header-arg-names + (progn + (setq sym (intern (concat "org-babel-header-arg-names:" + lang))) + (and (boundp sym) (eval sym))))))))))) (defvar org-src-preserve-indentation) (defun org-babel-parse-src-block-match () @@ -988,9 +1009,10 @@ (body (org-babel-clean-text-properties (let* ((body (match-string 5)) (sub-length (- (length body) 1))) - (if (string= "\n" (substring body sub-length)) + (if (and (> sub-length 0) + (string= "\n" (substring body sub-length))) (substring body 0 sub-length) - body)))) + (or body ""))))) (preserve-indentation (or org-src-preserve-indentation (string-match "-i\\>" switches)))) (list lang @@ -1002,7 +1024,6 @@ (buffer-string))) (org-babel-merge-params org-babel-default-header-args - (org-babel-params-from-buffer) (org-babel-params-from-properties lang) (if (boundp lang-headers) (eval lang-headers) nil) (org-babel-parse-header-arguments @@ -1019,50 +1040,105 @@ (org-babel-clean-text-properties (match-string 5))) (org-babel-merge-params org-babel-default-inline-header-args - (org-babel-params-from-buffer) (org-babel-params-from-properties lang) (if (boundp lang-headers) (eval lang-headers) nil) (org-babel-parse-header-arguments (org-babel-clean-text-properties (or (match-string 4) ""))))))) +(defun org-babel-balanced-split (string alts) + "Split STRING on instances of ALTS. +ALTS is a cons of two character options where each option may be +either the numeric code of a single character or a list of +character alternatives. For example to split on balanced +instances of \"[ \t]:\" set ALTS to '((32 9) . 58)." + (flet ((matches (ch spec) (or (and (numberp spec) (= spec ch)) + (member ch spec))) + (matched (ch last) + (if (consp alts) + (and (matches ch (cdr alts)) + (matches last (car alts))) + (matches ch alts)))) + (let ((balance 0) (quote nil) (partial nil) (lst nil) (last 0)) + (mapc (lambda (ch) ; split on [], (), "" balanced instances of [ \t]: + (setq balance (+ balance + (cond ((or (equal 91 ch) (equal 40 ch)) 1) + ((or (equal 93 ch) (equal 41 ch)) -1) + (t 0)))) + (when (and (equal 34 ch) (not (equal 92 last))) + (setq quote (not quote))) + (setq partial (cons ch partial)) + (when (and (= balance 0) (not quote) (matched ch last)) + (setq lst (cons (apply #'string (nreverse + (if (consp alts) + (cddr partial) + (cdr partial)))) + lst)) + (setq partial nil)) + (setq last ch)) + (string-to-list string)) + (nreverse (cons (apply #'string (nreverse partial)) lst))))) + +(defun org-babel-join-splits-near-ch (ch list) + "Join splits where \"=\" is on either end of the split." + (flet ((last= (str) (= ch (aref str (1- (length str))))) + (first= (str) (= ch (aref str 0)))) + (reverse + (org-reduce (lambda (acc el) + (let ((head (car acc))) + (if (and head (or (last= head) (first= el))) + (cons (concat head el) (cdr acc)) + (cons el acc)))) + list :initial-value nil)))) + (defun org-babel-parse-header-arguments (arg-string) "Parse a string of header arguments returning an alist." (when (> (length arg-string) 0) - (delq nil - (mapcar - (lambda (arg) - (if (string-match - "\\([^ \f\t\n\r\v]+\\)[ \f\t\n\r\v]+\\([^ \f\t\n\r\v]+.*\\)" - arg) - (cons (intern (match-string 1 arg)) - (org-babel-read (org-babel-chomp (match-string 2 arg)))) - (cons (intern (org-babel-chomp arg)) nil))) - (let ((balance 0) (partial nil) (lst nil) (last 0)) - (mapc (lambda (ch) ; split on [] balanced instances of [ \t]: - (setq balance (+ balance - (cond ((equal 91 ch) 1) - ((equal 93 ch) -1) - (t 0)))) - (setq partial (cons ch partial)) - (when (and (= ch 58) (= balance 0) - (or (= last 32) (= last 9))) - (setq lst (cons (apply #'string (nreverse (cddr partial))) - lst)) - (setq partial (list ch))) - (setq last ch)) - (string-to-list arg-string)) - (nreverse (cons (apply #'string (nreverse partial)) lst))))))) + (org-babel-parse-multiple-vars + (delq nil + (mapcar + (lambda (arg) + (if (string-match + "\\([^ \f\t\n\r\v]+\\)[ \f\t\n\r\v]+\\([^ \f\t\n\r\v]+.*\\)" + arg) + (cons (intern (match-string 1 arg)) + (org-babel-read (org-babel-chomp (match-string 2 arg)))) + (cons (intern (org-babel-chomp arg)) nil))) + ((lambda (raw) + (cons (car raw) (mapcar (lambda (r) (concat ":" r)) (cdr raw)))) + (org-babel-balanced-split arg-string '((32 9) . 58)))))))) + +(defun org-babel-parse-multiple-vars (header-arguments) + "Expand multiple variable assignments behind a single :var keyword. + +This allows expression of multiple variables with one :var as +shown below. + +#+PROPERTY: var foo=1, bar=2" + (let (results) + (mapc (lambda (pair) + (if (eq (car pair) :var) + (mapcar (lambda (v) (push (cons :var (org-babel-trim v)) results)) + (org-babel-join-splits-near-ch + 61 (org-babel-balanced-split (cdr pair) 32))) + (push pair results))) + header-arguments) + (nreverse results))) (defun org-babel-process-params (params) "Expand variables in PARAMS and add summary parameters." - (let* ((vars-and-names (org-babel-disassemble-tables - (mapcar (lambda (el) - (if (consp (cdr el)) - (cdr el) (org-babel-ref-parse (cdr el)))) - (org-babel-get-header params :var)) - (cdr (assoc :hlines params)) - (cdr (assoc :colnames params)) - (cdr (assoc :rownames params)))) + (let* ((processed-vars (mapcar (lambda (el) + (if (consp (cdr el)) + (cdr el) + (org-babel-ref-parse (cdr el)))) + (org-babel-get-header params :var))) + (vars-and-names (if (and (assoc :colname-names params) + (assoc :rowname-names params)) + (list processed-vars) + (org-babel-disassemble-tables + processed-vars + (cdr (assoc :hlines params)) + (cdr (assoc :colnames params)) + (cdr (assoc :rownames params))))) (raw-result (or (cdr (assoc :results params)) "")) (result-params (append (split-string (if (stringp raw-result) @@ -1169,7 +1245,7 @@ (setq var (cons (car var) (org-babel-del-hlines (cdr var)))))) var) vars) - cnames rnames))) + (reverse cnames) (reverse rnames)))) (defun org-babel-reassemble-table (table colnames rownames) "Add column and row names to a table. @@ -1244,7 +1320,7 @@ (regexp (org-babel-named-src-block-regexp-for-name name)) msg) (goto-char (point-min)) (when (or (re-search-forward regexp nil t) - (re-search-backward regexp nil t)) + (re-search-backward regexp nil t)) (match-beginning 0))))) (defun org-babel-src-block-names (&optional file) @@ -1253,7 +1329,7 @@ (when file (find-file file)) (goto-char (point-min)) (let (names) (while (re-search-forward org-babel-src-name-w-name-regexp nil t) - (setq names (cons (match-string 4) names))) + (setq names (cons (match-string 3) names))) names))) ;;;###autoload @@ -1269,16 +1345,21 @@ (progn (goto-char point) (org-show-context)) (message "result '%s' not found in this buffer" name)))) -(defun org-babel-find-named-result (name) +(defun org-babel-find-named-result (name &optional point) "Find a named result. Return the location of the result named NAME in the current buffer or nil if no such result exists." (save-excursion - (goto-char (point-min)) - (when (re-search-forward - (concat org-babel-result-regexp - "[ \t]" (regexp-quote name) "[ \t\n\f\v\r]") nil t) - (beginning-of-line 0) (point)))) + (goto-char (or point (point-min))) + (catch 'is-a-code-block + (when (re-search-forward + (concat org-babel-result-regexp + "[ \t]" (regexp-quote name) "[ \t\n\f\v\r]") nil t) + (when (and (string= "name" (downcase (match-string 1))) + (or (looking-at org-babel-src-block-regexp) + (looking-at org-babel-multi-line-header-regexp))) + (throw 'is-a-code-block (org-babel-find-named-result name (point)))) + (beginning-of-line 0) (point))))) (defun org-babel-result-names (&optional file) "Returns the names of results in FILE or the current buffer." @@ -1333,6 +1414,8 @@ region is not active then the point is demarcated." (interactive "P") (let ((info (org-babel-get-src-block-info 'light)) + (headers (progn (org-babel-where-is-src-block-head) + (match-string 4))) (stars (concat (make-string (or (org-current-level) 1) ?*) " "))) (if info (mapc @@ -1345,11 +1428,16 @@ (buffer-substring (point-at-bol) (point-at-eol))) (delete-region (point-at-bol) (point-at-eol))) - (insert (concat (if (looking-at "^") "" "\n") - indent "#+end_src\n" - (if arg stars indent) "\n" - indent "#+begin_src " lang - (if (looking-at "[\n\r]") "" "\n"))))) + (insert (concat + (if (looking-at "^") "" "\n") + indent "#+end_src\n" + (if arg stars indent) "\n" + indent "#+begin_src " lang + (if (> (length headers) 1) + (concat " " headers) headers) + (if (looking-at "[\n\r]") + "" + (concat "\n" (make-string (current-column) ? ))))))) (move-end-of-line 2)) (sort (if (region-active-p) (list (mark) (point)) (list (point))) #'>)) (let ((start (point)) @@ -1368,7 +1456,6 @@ (goto-char start) (move-end-of-line 1))))) (defvar org-babel-lob-one-liner-regexp) -(defvar org-babel-inline-lob-one-liner-regexp) (defun org-babel-where-is-src-block-result (&optional insert info hash indent) "Find where the current source block results begin. Return the point at the beginning of the result of the current @@ -1379,13 +1466,11 @@ (let* ((on-lob-line (save-excursion (beginning-of-line 1) (looking-at org-babel-lob-one-liner-regexp))) - (inlinep (save-excursion - (re-search-backward "[ \f\t\n\r\v]" nil t) - (when (looking-at org-babel-inline-src-block-regexp) - (match-end 0)))) + (inlinep (when (org-babel-get-inline-src-block-matches) + (match-end 0))) (name (if on-lob-line (nth 0 (org-babel-lob-get-info)) - (nth 4 (or info (org-babel-get-src-block-info))))) + (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)) @@ -1537,6 +1622,10 @@ is a good option if you code block will output org-mode formatted text. +wrap ---- results are added directly to the Org-mode file as with + \"raw\", but are wrapped in a RESULTS drawer, allowing + them to later be replaced or removed automatically. + org ----- similar in effect to raw, only the results are wrapped in an org code block. Similar to the raw option, on export the results will be interpreted as org-formatted @@ -1570,10 +1659,8 @@ (save-excursion (let* ((inlinep (save-excursion - (or (= (point) (point-at-bol)) - (re-search-backward "[ \f\t\n\r\v]" nil t)) - (when (or (looking-at org-babel-inline-src-block-regexp) - (looking-at org-babel-inline-lob-one-liner-regexp)) + (when (or (org-babel-get-inline-src-block-matches) + (org-babel-get-lob-one-liner-matches)) (goto-char (match-end 0)) (insert (if (listp result) "\n" " ")) (point)))) @@ -1605,41 +1692,45 @@ ((member "prepend" result-params)))) ; already there (setq results-switches (if results-switches (concat " " results-switches) "")) - ;; insert results based on type - (cond - ;; do nothing for an empty result - ((= (length result) 0)) - ;; insert a list if preferred - ((member "list" result-params) - (insert - (org-babel-trim - (org-list-to-generic - (cons 'unordered - (mapcar - (lambda (el) (list nil (if (stringp el) el (format "%S" el)))) - (if (listp result) result (list result)))) - '(:splicep nil :istart "- " :iend "\n"))) - "\n")) - ;; assume the result is a table if it's not a string - ((not (stringp result)) - (goto-char beg) - (insert (concat (orgtbl-to-orgtbl - (if (or (eq 'hline (car result)) - (and (listp (car result)) - (listp (cdr (car result))))) - result (list result)) - '(:fmt (lambda (cell) (format "%s" cell)))) "\n")) - (goto-char beg) (when (org-at-table-p) (org-table-align))) - ((member "file" result-params) - (insert result)) - (t (goto-char beg) (insert result))) - (when (listp result) (goto-char (org-table-end))) - (setq end (point-marker)) - ;; possibly wrap result (flet ((wrap (start finish) (goto-char beg) (insert (concat start "\n")) (goto-char end) (insert (concat finish "\n")) - (setq end (point-marker)))) + (setq end (point-marker))) + (proper-list-p (it) (and (listp it) (null (cdr (last it)))))) + ;; insert results based on type + (cond + ;; do nothing for an empty result + ((null result)) + ;; insert a list if preferred + ((member "list" result-params) + (insert + (org-babel-trim + (org-list-to-generic + (cons 'unordered + (mapcar + (lambda (el) (list nil (if (stringp el) el (format "%S" el)))) + (if (listp result) result (list result)))) + '(:splicep nil :istart "- " :iend "\n"))) + "\n")) + ;; assume the result is a table if it's not a string + ((proper-list-p result) + (goto-char beg) + (insert (concat (orgtbl-to-orgtbl + (if (or (eq 'hline (car result)) + (and (listp (car result)) + (listp (cdr (car result))))) + result (list result)) + '(:fmt (lambda (cell) (format "%s" cell)))) "\n")) + (goto-char beg) (when (org-at-table-p) (org-table-align))) + ((and (listp result) (not (proper-list-p result))) + (insert (format "%s\n" result))) + ((member "file" result-params) + (when inlinep (goto-char inlinep)) + (insert result)) + (t (goto-char beg) (insert result))) + (when (proper-list-p result) (goto-char (org-table-end))) + (setq end (point-marker)) + ;; possibly wrap result (cond ((member "html" result-params) (wrap "#+BEGIN_HTML" "#+END_HTML")) @@ -1653,10 +1744,9 @@ ((member "raw" result-params) (goto-char beg) (if (org-at-table-p) (org-cycle))) ((member "wrap" result-params) - (when (and (stringp result) (not (member "file" result-params))) - (org-babel-examplize-region beg end results-switches)) - (wrap "#+BEGIN_RESULT" "#+END_RESULT")) - ((and (stringp result) (not (member "file" result-params))) + (wrap ":RESULTS:" ":END:")) + ((and (not (proper-list-p result)) + (not (member "file" result-params))) (org-babel-examplize-region beg end results-switches) (setq end (point))))) ;; possibly indent the results to match the #+results line @@ -1665,7 +1755,7 @@ (not (and (listp result) (member "append" result-params)))) (indent-rigidly beg end indent)))) - (if (= (length result) 0) + (if (null result) (if (member "value" result-params) (message "Code block returned no value.") (message "Code block produced no output.")) @@ -1676,8 +1766,9 @@ (interactive) (let ((location (org-babel-where-is-src-block-result nil info)) start) (when location + (setq start (- location 1)) (save-excursion - (goto-char location) (setq start (point)) (forward-line 1) + (goto-char location) (forward-line 1) (delete-region start (org-babel-result-end)))))) (defun org-babel-result-end () @@ -1688,6 +1779,8 @@ ((org-at-item-p) (let* ((struct (org-list-struct)) (prvs (org-list-prevs-alist struct))) (org-list-get-list-end (point-at-bol) struct prvs))) + ((looking-at "^\\([ \t]*\\):RESULTS:") + (re-search-forward (concat "^" (match-string 1) ":END:"))) (t (let ((case-fold-search t) (blocks-re (regexp-opt @@ -1756,12 +1849,11 @@ This takes into account some special considerations for certain parameters when merging lists." (let ((results-exclusive-groups - '(("file" "list" "vector" "table" "scalar" "verbatim" "raw" "org" - "html" "latex" "code" "pp" "wrap") - ("replace" "silent" "append" "prepend") - ("output" "value"))) + (mapcar (lambda (group) (mapcar #'symbol-name group)) + (cdr (assoc 'results org-babel-common-header-args-w-values)))) (exports-exclusive-groups - '(("code" "results" "both" "none"))) + (mapcar (lambda (group) (mapcar #'symbol-name group)) + (cdr (assoc 'exports org-babel-common-header-args-w-values)))) (variable-index 0) params results exports tangle noweb cache vars shebang comments padline) (flet ((e-merge (exclusive-groups &rest result-params) @@ -1805,12 +1897,16 @@ vars)) vars) (list (cons name pair)))) - ;; if no name is given, then assign to variables in order - (prog1 (setf (cddr (nth variable-index vars)) - (concat (symbol-name - (car (nth variable-index vars))) - "=" (cdr pair))) - (incf variable-index))))) + ;; if no name is given and we already have named variables + ;; then assign to named variables in order + (if (and vars (nth variable-index vars)) + (prog1 (setf (cddr (nth variable-index vars)) + (concat (symbol-name + (car (nth variable-index vars))) + "=" (cdr pair))) + (incf variable-index)) + (error "variable \"%s\" must be assigned a default value" + (cdr pair)))))) (:results (setq results (e-merge results-exclusive-groups results @@ -1895,21 +1991,15 @@ (lang (nth 0 info)) (body (nth 1 info)) (comment (string= "noweb" (cdr (assoc :comments (nth 2 info))))) + (rx-prefix (concat "\\(" org-babel-src-name-regexp "\\|" + ":noweb-ref[ \t]+" "\\)")) (new-body "") index source-name evaluate prefix blocks-in-buffer) (flet ((nb-add (text) (setq new-body (concat new-body text))) (c-wrap (text) (with-temp-buffer (funcall (intern (concat lang "-mode"))) (comment-region (point) (progn (insert text) (point))) - (org-babel-trim (buffer-string)))) - (blocks () ;; return the info lists of all blocks in this buffer - (let (infos) - (save-restriction - (widen) - (org-babel-map-src-blocks nil - (setq infos (cons (org-babel-get-src-block-info 'light) - infos)))) - (reverse infos)))) + (org-babel-trim (buffer-string))))) (with-temp-buffer (insert body) (goto-char (point-min)) (setq index (point)) @@ -1943,21 +2033,20 @@ (when (org-babel-ref-goto-headline-id source-name) (org-babel-ref-headline-body))) ;; find the expansion of reference in this buffer - (mapconcat - (lambda (i) - (when (string= source-name - (or (cdr (assoc :noweb-ref (nth 2 i))) - (nth 4 i))) - (let ((body (org-babel-expand-noweb-references i))) - (if comment - ((lambda (cs) - (concat (c-wrap (car cs)) "\n" - body "\n" (c-wrap (cadr cs)))) - (org-babel-tangle-comment-links i)) - body)))) - (or blocks-in-buffer - (setq blocks-in-buffer (blocks))) - "") + (let ((rx (concat rx-prefix source-name)) + expansion) + (save-excursion + (goto-char (point-min)) + (while (re-search-forward rx nil t) + (let* ((i (org-babel-get-src-block-info 'light)) + (body (org-babel-expand-noweb-references i))) + (if comment + ((lambda (cs) + (concat (c-wrap (car cs)) "\n" + body "\n" (c-wrap (cadr cs)))) + (org-babel-tangle-comment-links i)) + (setq expansion (concat expansion body)))))) + expansion) ;; possibly raise an error if named block doesn't exist (if (member lang org-babel-noweb-error-langs) (error "%s" (concat @@ -2044,7 +2133,7 @@ cell)) (defun org-babel-number-p (string) - "If STRING represents a number return it's value." + "If STRING represents a number return its value." (if (and (string-match "^-?[0-9]*\\.?[0-9]*$" string) (= (length (substring string (match-beginning 0) (match-end 0))) @@ -2198,6 +2287,6 @@ (provide 'ob) -;; arch-tag: 01a7ebee-06c5-4ee4-a709-e660d28c0af1 + ;;; ob.el ends here diff -Nru org-mode-7.7/lisp/ob-emacs-lisp.el org-mode-7.8.02/lisp/ob-emacs-lisp.el --- org-mode-7.7/lisp/ob-emacs-lisp.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/ob-emacs-lisp.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,11 +1,10 @@ ;;; ob-emacs-lisp.el --- org-babel functions for emacs-lisp code evaluation -;; Copyright (C) 2009, 2010 Free Software Foundation, Inc +;; Copyright (C) 2009-2011 Free Software Foundation, Inc ;; Author: Eric Schulte ;; Keywords: literate programming, reproducible research ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; This file is part of GNU Emacs. @@ -76,6 +75,6 @@ (provide 'ob-emacs-lisp) -;; arch-tag: e9a3acca-dc84-472a-9f5a-23c35befbcd6 + ;;; ob-emacs-lisp.el ends here diff -Nru org-mode-7.7/lisp/ob-eval.el org-mode-7.8.02/lisp/ob-eval.el --- org-mode-7.7/lisp/ob-eval.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/ob-eval.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,11 +1,10 @@ ;;; ob-eval.el --- org-babel functions for external code evaluation -;; Copyright (C) 2009, 2010 Free Software Foundation, Inc. +;; Copyright (C) 2009-2011 Free Software Foundation, Inc. ;; Author: Eric Schulte ;; Keywords: literate programming, reproducible research, comint ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; This file is part of GNU Emacs. @@ -257,6 +256,6 @@ (provide 'ob-eval) -;; arch-tag: 5328b17f-957d-42d9-94da-a2952682d04d + ;;; ob-eval.el ends here diff -Nru org-mode-7.7/lisp/ob-exp.el org-mode-7.8.02/lisp/ob-exp.el --- org-mode-7.7/lisp/ob-exp.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/ob-exp.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,11 +1,11 @@ ;;; ob-exp.el --- Exportation of org-babel source blocks -;; Copyright (C) 2009, 2010 Free Software Foundation, Inc. +;; Copyright (C) 2009-2011 Free Software Foundation, Inc. -;; Author: Eric Schulte, Dan Davison +;; Author: Eric Schulte +;; Dan Davison ;; Keywords: literate programming, reproducible research ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; This file is part of GNU Emacs. @@ -36,7 +36,6 @@ (declare-function org-babel-eval-wipe-error-buffer "ob-eval" ()) (add-to-list 'org-export-interblocks '(src org-babel-exp-inline-src-blocks)) (add-to-list 'org-export-interblocks '(lob org-babel-exp-lob-one-liners)) -(add-hook 'org-export-blocks-postblock-hook 'org-exp-res/src-name-cleanup) (org-export-blocks-add-block '(src org-babel-exp-src-block nil)) @@ -73,6 +72,7 @@ (setq results ,@body)) (set-buffer export-buffer) results))) +(def-edebug-spec org-babel-exp-in-export-file (form body)) (defun org-babel-exp-src-block (body &rest headers) "Process source block for export. @@ -104,7 +104,6 @@ (org-babel-process-params (org-babel-merge-params org-babel-default-header-args - (org-babel-params-from-buffer) (org-babel-params-from-properties lang) (if (boundp lang-headers) (eval lang-headers) nil) raw-params)))) @@ -128,10 +127,10 @@ (while (and (< (point) end) (re-search-forward org-babel-inline-src-block-regexp end t)) (let* ((info (save-match-data (org-babel-parse-inline-src-block-match))) - (params (nth 2 info)) code-replacement) + (params (nth 2 info))) (save-match-data (goto-char (match-beginning 2)) - (when (not (org-babel-in-example-or-verbatim)) + (unless (org-babel-in-example-or-verbatim) ;; expand noweb references in the original file (setf (nth 1 info) (if (and (cdr (assoc :noweb params)) @@ -139,39 +138,25 @@ (org-babel-expand-noweb-references info (get-file-buffer org-current-export-file)) (nth 1 info))) - (setq code-replacement (org-babel-exp-do-export info 'inline)))) - (if code-replacement - (replace-match code-replacement nil nil nil 1) - (org-babel-examplize-region (match-beginning 1) (match-end 1)) - (forward-char 2)))))) - -(defun org-exp-res/src-name-cleanup () - "Clean up #+results and #+srcname lines for export. -This function should only be called after all block processing -has taken place." - (interactive) - (save-excursion - (goto-char (point-min)) - (while (org-re-search-forward-unprotected - (concat - "\\("org-babel-src-name-regexp"\\|"org-babel-result-regexp"\\)") - nil t) - (delete-region - (progn (beginning-of-line) (point)) - (progn (end-of-line) (+ 1 (point))))))) + (let ((code-replacement (save-match-data + (org-babel-exp-do-export info 'inline)))) + (if code-replacement + (replace-match code-replacement nil nil nil 1) + (org-babel-examplize-region (match-beginning 1) (match-end 1)) + (forward-char 2))))))))) (defun org-babel-in-example-or-verbatim () "Return true if point is in example or verbatim code. Example and verbatim code include escaped portions of an org-mode buffer code that should be treated as normal org-mode text." - (or (org-in-indented-comment-line) - (save-match-data + (or (save-match-data (save-excursion (goto-char (point-at-bol)) (looking-at "[ \t]*:[ \t]"))) (org-in-verbatim-emphasis) - (org-in-regexps-block-p "^[ \t]*#\\+begin_src" "^[ \t]*#\\+end_src"))) + (org-in-block-p org-list-forbidden-blocks) + (org-between-regexps-p "^[ \t]*#\\+begin_src" "^[ \t]*#\\+end_src"))) (defvar org-babel-default-lob-header-args) (defun org-babel-exp-lob-one-liners (start end) @@ -182,8 +167,8 @@ (save-excursion (goto-char start) (while (and (< (point) end) - (re-search-forward org-babel-lob-one-liner-regexp nil t)) - (unless (and (match-string 12) (org-babel-in-example-or-verbatim)) + (re-search-forward org-babel-lob-one-liner-regexp end t)) + (unless (org-babel-in-example-or-verbatim) (let* ((lob-info (org-babel-lob-get-info)) (inlinep (match-string 11)) (inline-start (match-end 11)) @@ -195,7 +180,6 @@ (org-babel-merge-params org-babel-default-header-args org-babel-default-lob-header-args - (org-babel-params-from-buffer) (org-babel-params-from-properties) (org-babel-parse-header-arguments (org-babel-clean-text-properties @@ -231,7 +215,7 @@ (defun org-babel-exp-code (info) "Return the original code block formatted for export." (org-fill-template - "#+BEGIN_SRC %lang%flags\n%body\n#+END_SRC\n" + "#+BEGIN_SRC %lang%flags\n%body\n#+END_SRC" `(("lang" . ,(nth 0 info)) ("flags" . ,((lambda (f) (when f (concat " " f))) (nth 3 info))) ("body" . ,(nth 1 info))))) @@ -257,7 +241,15 @@ (nth 2 info) `((:results . ,(if silent "silent" "replace"))))))) (cond - ((or (equal type 'block) (equal type 'inline)) + ((equal type 'block) + (org-babel-execute-src-block nil info)) + ((equal type 'inline) + ;; position the point on the inline source block allowing + ;; `org-babel-insert-result' to check that the block is + ;; inline + (re-search-backward "[ \f\t\n\r\v]" nil t) + (re-search-forward org-babel-inline-src-block-regexp nil t) + (re-search-backward "src_" nil t) (org-babel-execute-src-block nil info)) ((equal type 'lob) (save-excursion @@ -266,6 +258,6 @@ (provide 'ob-exp) -;; arch-tag: 523abf4c-76d1-44ed-9f27-e3bddf34bf0f + ;;; ob-exp.el ends here diff -Nru org-mode-7.7/lisp/ob-fortran.el org-mode-7.8.02/lisp/ob-fortran.el --- org-mode-7.7/lisp/ob-fortran.el 1970-01-01 00:00:00.000000000 +0000 +++ org-mode-7.8.02/lisp/ob-fortran.el 2011-12-13 00:34:24.000000000 +0000 @@ -0,0 +1,162 @@ +;;; ob-fortran.el --- org-babel functions for fortran + +;; Copyright (C) 2011 Sergey Litvinov, Eric Schulte + +;; Authors: Sergey Litvinov (based on ob-C.el by Eric Schulte), Eric Schulte +;; Keywords: literate programming, reproducible research, fortran +;; Homepage: http://orgmode.org +;; Version: 7.8.02 + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 3, or (at your option) +;; any later version. +;; +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Commentary: + +;; Org-Babel support for evaluating fortran code. + +;;; Code: +(require 'ob) +(require 'ob-eval) +(require 'cc-mode) + +(declare-function org-entry-get "org" + (pom property &optional inherit literal-nil)) + +(defvar org-babel-tangle-lang-exts) +(add-to-list 'org-babel-tangle-lang-exts '("fortran" . "F90")) + +(defvar org-babel-default-header-args:fortran '()) + +(defvar org-babel-fortran-compiler "gfortran" + "fortran command used to compile a fortran source code file into an + executable.") + +(defun org-babel-execute:fortran (body params) + "This function should only be called by `org-babel-execute:fortran'" + (let* ((tmp-src-file (org-babel-temp-file "fortran-src-" ".F90")) + (tmp-bin-file (org-babel-temp-file "fortran-bin-")) + (cmdline (cdr (assoc :cmdline params))) + (flags (cdr (assoc :flags params))) + (full-body (org-babel-expand-body:fortran body params)) + (compile + (progn + (with-temp-file tmp-src-file (insert full-body)) + (org-babel-eval + (format "%s -o %s %s %s" + org-babel-fortran-compiler + (org-babel-process-file-name tmp-bin-file) + (mapconcat 'identity + (if (listp flags) flags (list flags)) " ") + (org-babel-process-file-name tmp-src-file)) "")))) + ((lambda (results) + (org-babel-reassemble-table + (if (member "vector" (cdr (assoc :result-params params))) + (let ((tmp-file (org-babel-temp-file "f-"))) + (with-temp-file tmp-file (insert results)) + (org-babel-import-elisp-from-file tmp-file)) + (org-babel-read results)) + (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))))) + (org-babel-trim + (org-babel-eval + (concat tmp-bin-file (if cmdline (concat " " cmdline) "")) ""))))) + +(defun org-babel-expand-body:fortran (body params) + "Expand a block of fortran or fortran code with org-babel according to +it's header arguments." + (let ((vars (mapcar #'cdr (org-babel-get-header params :var))) + (main-p (not (string= (cdr (assoc :main params)) "no"))) + (includes (or (cdr (assoc :includes params)) + (org-babel-read (org-entry-get nil "includes" t)))) + (defines (org-babel-read + (or (cdr (assoc :defines params)) + (org-babel-read (org-entry-get nil "defines" t)))))) + (mapconcat 'identity + (list + ;; includes + (mapconcat + (lambda (inc) (format "#include %s" inc)) + (if (listp includes) includes (list includes)) "\n") + ;; defines + (mapconcat + (lambda (inc) (format "#define %s" inc)) + (if (listp defines) defines (list defines)) "\n") + ;; body + (if main-p + (org-babel-fortran-ensure-main-wrap + (concat + ;; variables + (mapconcat 'org-babel-fortran-var-to-fortran vars "\n") + body) params) + body) "\n") "\n"))) + +(defun org-babel-fortran-ensure-main-wrap (body params) + "Wrap body in a \"program ... end program\" block if none exists." + (if (string-match "^[ \t]*program[ \t]*.*" (capitalize body)) + (let ((vars (mapcar #'cdr (org-babel-get-header params :var)))) + (if vars (error "cannot use :vars if 'program' statment is present")) + body) + (format "program main\n%s\nend program main\n" body))) + +(defun org-babel-prep-session:fortran (session params) + "This function does nothing as fortran is a compiled language with no +support for sessions" + (error "fortran is a compiled languages -- no support for sessions")) + +(defun org-babel-load-session:fortran (session body params) + "This function does nothing as fortran is a compiled language with no +support for sessions" + (error "fortran is a compiled languages -- no support for sessions")) + +;; helper functions + +(defun org-babel-fortran-var-to-fortran (pair) + "fortranonvert an elisp val into a string of fortran code specifying a var +of the same value." + ;; TODO list support + (let ((var (car pair)) + (val (cdr pair))) + (when (symbolp val) + (setq val (symbol-name val)) + (when (= (length val) 1) + (setq val (string-to-char val)))) + (cond + ((integerp val) + (format "integer, parameter :: %S = %S\n" var val)) + ((floatp val) + (format "real, parameter :: %S = %S\n" var val)) + ((or (integerp val)) + (format "character, parameter :: %S = '%S'\n" var val)) + ((stringp val) + (format "character(len=%d), parameter :: %S = '%s'\n" + (length val) var val)) + ((listp val) + (format "real, parameter :: %S(%d) = %s\n" + var (length val) (ob-fortran-transform-list val))) + (t + (error (format "the type of parameter %s is not supported by ob-fortran" + var)))))) + +(defun ob-fortran-transform-list (val) + "Return a fortran representation of enclose syntactic lists." + (if (listp val) + (concat "(/" (mapconcat #'ob-fortran-transform-list val ", ") "/)") + (format "%S" val))) + +(provide 'ob-fortran) + +;;; ob-fortran.el ends here diff -Nru org-mode-7.7/lisp/ob-gnuplot.el org-mode-7.8.02/lisp/ob-gnuplot.el --- org-mode-7.7/lisp/ob-gnuplot.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/ob-gnuplot.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,11 +1,10 @@ ;;; ob-gnuplot.el --- org-babel functions for gnuplot evaluation -;; Copyright (C) 2009, 2010 Free Software Foundation, Inc. +;; Copyright (C) 2009-2011 Free Software Foundation, Inc. ;; Author: Eric Schulte ;; Keywords: literate programming, reproducible research ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; This file is part of GNU Emacs. @@ -149,7 +148,10 @@ (shell-command-to-string (format "gnuplot \"%s\"" - (org-babel-process-file-name script-file)))) + (org-babel-process-file-name + script-file + (if (member system-type '(cygwin windows-nt ms-dos)) + t nil))))) (message output)) (with-temp-buffer (insert (concat body "\n")) @@ -230,6 +232,6 @@ (provide 'ob-gnuplot) -;; arch-tag: 50490ace-a9e1-4b29-a6e5-0db9f16c610b + ;;; ob-gnuplot.el ends here diff -Nru org-mode-7.7/lisp/ob-haskell.el org-mode-7.8.02/lisp/ob-haskell.el --- org-mode-7.7/lisp/ob-haskell.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/ob-haskell.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,11 +1,10 @@ ;;; ob-haskell.el --- org-babel functions for haskell evaluation -;; Copyright (C) 2009, 2010 Free Software Foundation, Inc. +;; Copyright (C) 2009-2011 Free Software Foundation, Inc. ;; Author: Eric Schulte ;; Keywords: literate programming, reproducible research ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; This file is part of GNU Emacs. @@ -213,6 +212,6 @@ (provide 'ob-haskell) -;; arch-tag: b53f75f3-ba1a-4b05-82d9-a2a0d4e70804 + ;;; ob-haskell.el ends here diff -Nru org-mode-7.7/lisp/ob-java.el org-mode-7.8.02/lisp/ob-java.el --- org-mode-7.7/lisp/ob-java.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/ob-java.el 2011-12-13 00:34:24.000000000 +0000 @@ -5,7 +5,6 @@ ;; Author: Eric Schulte ;; Keywords: literate programming, reproducible research ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; This file is part of GNU Emacs. @@ -46,11 +45,14 @@ "Can't compile a java block without a classname"))) (packagename (file-name-directory classname)) (src-file (concat classname ".java")) + (cmpflag (or (cdr (assoc :cmpflag params)) "")) + (cmdline (or (cdr (assoc :cmdline params)) "")) (full-body (org-babel-expand-body:generic body params)) (compile (progn (with-temp-file src-file (insert full-body)) (org-babel-eval - (concat org-babel-java-compiler " " src-file) "")))) + (concat org-babel-java-compiler + " " cmpflag " " src-file) "")))) ;; created package-name directories if missing (unless (or (not packagename) (file-exists-p packagename)) (make-directory packagename 'parents)) @@ -65,10 +67,11 @@ (cdr (assoc :colname-names params)) (cdr (assoc :colnames params))) (org-babel-pick-name (cdr (assoc :rowname-names params)) (cdr (assoc :rownames params))))) - (org-babel-eval (concat org-babel-java-command " " classname) "")))) + (org-babel-eval (concat org-babel-java-command + " " cmdline " " classname) "")))) (provide 'ob-java) -;; arch-tag: dd1cfb00-7f76-4ecf-922c-f7031b68b85e + ;;; ob-java.el ends here diff -Nru org-mode-7.7/lisp/ob-js.el org-mode-7.8.02/lisp/ob-js.el --- org-mode-7.7/lisp/ob-js.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/ob-js.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,28 +1,25 @@ ;;; ob-js.el --- org-babel functions for Javascript -;; Copyright (C) 2010 Free Software Foundation +;; Copyright (C) 2010-2011 Free Software Foundation ;; Author: Eric Schulte ;; Keywords: literate programming, reproducible research, js ;; Homepage: http://orgmode.org -;; Version: 7.7 -;;; License: +;; This file is part of GNU Emacs. -;; This program is free software; you can redistribute it and/or modify +;; GNU Emacs is free software: you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. -;; -;; This program is distributed in the hope that it will be useful, +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. -;; + ;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs; see the file COPYING. If not, write to the -;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -;; Boston, MA 02110-1301, USA. +;; along with GNU Emacs. If not, see . ;;; Commentary: @@ -35,7 +32,7 @@ ;; - a non-browser javascript engine such as node.js http://nodejs.org/ ;; or mozrepl http://wiki.github.com/bard/mozrepl/ -;; +;; ;; - for session based evaluation mozrepl and moz.el are required see ;; http://wiki.github.com/bard/mozrepl/emacs-integration for ;; configuration instructions @@ -160,6 +157,6 @@ (provide 'ob-js) -;; arch-tag: 84401fb3-b8d9-4bb6-9a90-cbe2d103d494 + ;;; ob-js.el ends here diff -Nru org-mode-7.7/lisp/ob-keys.el org-mode-7.8.02/lisp/ob-keys.el --- org-mode-7.7/lisp/ob-keys.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/ob-keys.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,11 +1,10 @@ ;;; ob-keys.el --- key bindings for org-babel -;; Copyright (C) 2009, 2010 Free Software Foundation, Inc. +;; Copyright (C) 2009-2011 Free Software Foundation, Inc. ;; Author: Eric Schulte ;; Keywords: literate programming, reproducible research ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; This file is part of GNU Emacs. @@ -75,6 +74,8 @@ ("f" . org-babel-tangle-file) ("\C-c" . org-babel-check-src-block) ("c" . org-babel-check-src-block) + ("\C-j" . org-babel-insert-header-arg) + ("j" . org-babel-insert-header-arg) ("\C-l" . org-babel-load-in-session) ("l" . org-babel-load-in-session) ("\C-i" . org-babel-lob-ingest) @@ -97,6 +98,6 @@ (provide 'ob-keys) -;; arch-tag: 01e348ee-4906-46fa-839a-6b7b6f989048 + ;;; ob-keys.el ends here diff -Nru org-mode-7.7/lisp/ob-latex.el org-mode-7.8.02/lisp/ob-latex.el --- org-mode-7.7/lisp/ob-latex.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/ob-latex.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,11 +1,10 @@ ;;; ob-latex.el --- org-babel functions for latex "evaluation" -;; Copyright (C) 2009, 2010 Free Software Foundation, Inc. +;; Copyright (C) 2009-2011 Free Software Foundation, Inc. ;; Author: Eric Schulte ;; Keywords: literate programming, reproducible research ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; This file is part of GNU Emacs. @@ -73,6 +72,10 @@ (let* ((out-file (cdr (assoc :file params))) (tex-file (org-babel-temp-file "latex-" ".tex")) (border (cdr (assoc :border params))) + (imagemagick (cdr (assoc :imagemagick params))) + (im-in-options (cdr (assoc :iminoptions params))) + (im-out-options (cdr (assoc :imoutoptions params))) + (pdfpng (cdr (assoc :pdfpng params))) (fit (or (cdr (assoc :fit params)) border)) (height (and fit (cdr (assoc :pdfheight params)))) (width (and fit (cdr (assoc :pdfwidth params)))) @@ -82,10 +85,10 @@ (append (cdr (assoc :packages params)) org-export-latex-packages-alist))) (cond - ((string-match "\\.png$" out-file) + ((and (string-match "\\.png$" out-file) (not imagemagick)) (org-create-formula-image body out-file org-format-latex-options in-buffer)) - ((string-match "\\.pdf$" out-file) + ((or (string-match "\\.pdf$" out-file) imagemagick) (require 'org-latex) (with-temp-file tex-file (insert @@ -119,13 +122,29 @@ (concat "\n\\begin{document}\n" body "\n\\end{document}\n"))) (org-export-latex-fix-inputenc)) (when (file-exists-p out-file) (delete-file out-file)) - (rename-file (org-babel-latex-tex-to-pdf tex-file) out-file)) + (let ((transient-pdf-file (org-babel-latex-tex-to-pdf tex-file))) + (cond + ((string-match "\\.pdf$" out-file) + (rename-file transient-pdf-file out-file)) + (imagemagick + (convert-pdf + transient-pdf-file out-file im-in-options im-out-options) + (when (file-exists-p transient-pdf-file) + (delete-file transient-pdf-file)))))) ((string-match "\\.\\([^\\.]+\\)$" out-file) - (error "can not create %s files, please specify a .png or .pdf file" + (error "can not create %s files, please specify a .png or .pdf file or try the :imagemagick header arguement" (match-string 1 out-file)))) nil) ;; signal that output has already been written to file body)) + +(defun convert-pdf (pdffile out-file im-in-options im-out-options) + "Generate a file from a pdf file using imagemagick." + (let ((cmd (concat "convert " im-in-options " " pdffile " " + im-out-options " " out-file))) + (message (concat "Converting pdffile file " cmd "...")) + (shell-command cmd))) + (defun org-babel-latex-tex-to-pdf (file) "Generate a pdf file according to the contents FILE. Extracted from `org-export-as-pdf' in org-latex.el." @@ -176,6 +195,6 @@ (provide 'ob-latex) -;; arch-tag: 1f13f7e2-26de-4c24-9274-9f331d4c6ff3 + ;;; ob-latex.el ends here diff -Nru org-mode-7.7/lisp/ob-ledger.el org-mode-7.8.02/lisp/ob-ledger.el --- org-mode-7.7/lisp/ob-ledger.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/ob-ledger.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,11 +1,10 @@ ;;; ob-ledger.el --- org-babel functions for ledger evaluation -;; Copyright (C) 2010 Free Software Foundation, Inc. +;; Copyright (C) 2010-2011 Free Software Foundation, Inc. ;; Author: Eric S Fraga ;; Keywords: literate programming, reproducible research, accounting ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; This file is part of GNU Emacs. @@ -67,6 +66,6 @@ (provide 'ob-ledger) -;; arch-tag: 7bbb529e-95a1-4236-9d29-b0000b918c7c + ;;; ob-ledger.el ends here diff -Nru org-mode-7.7/lisp/ob-lilypond.el org-mode-7.8.02/lisp/ob-lilypond.el --- org-mode-7.7/lisp/ob-lilypond.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/ob-lilypond.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,11 +1,10 @@ ;;; ob-lilypond.el --- org-babel functions for lilypond evaluation -;; Copyright (C) 2010 Free Software Foundation, Inc. +;; Copyright (C) 2010-2011 Free Software Foundation, Inc. ;; Author: Martyn Jago ;; Keywords: babel language, literate programming ;; Homepage: https://github.com/mjago/ob-lilypond -;; Version: 7.7 ;; This file is part of GNU Emacs. @@ -442,6 +441,6 @@ (provide 'ob-lilypond) -;; arch-tag: ac449eea-2cf2-4dc5-ae33-426f57ba4894 + ;;; ob-lilypond.el ends here diff -Nru org-mode-7.7/lisp/ob-lisp.el org-mode-7.8.02/lisp/ob-lisp.el --- org-mode-7.7/lisp/ob-lisp.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/ob-lisp.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,11 +1,12 @@ ;;; ob-lisp.el --- org-babel functions for common lisp evaluation -;; Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc. +;; Copyright (C) 2009-2011 Free Software Foundation, Inc. -;; Author: Joel Boehland, Eric Schulte, David T. O'Toole +;; Author: Joel Boehland +;; Eric Schulte +;; David T. O'Toole ;; Keywords: literate programming, reproducible research ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; This file is part of GNU Emacs. @@ -77,7 +78,7 @@ (if (member "output" (cdr (assoc :result-params params))) (car result) (condition-case nil - (read (org-bable-lisp-vector-to-list (cadr result))) + (read (org-babel-lisp-vector-to-list (cadr result))) (error (cadr result))))) (with-temp-buffer (insert (org-babel-expand-body:lisp body params)) @@ -95,12 +96,12 @@ (org-babel-pick-name (cdr (assoc :rowname-names params)) (cdr (assoc :rownames params))))) -(defun org-bable-lisp-vector-to-list (results) +(defun org-babel-lisp-vector-to-list (results) ;; TODO: better would be to replace #(...) with [...] (replace-regexp-in-string "#(" "(" results)) (provide 'ob-lisp) -;; arch-tag: 18086168-009f-4947-bbb5-3532375d851d + ;;; ob-lisp.el ends here diff -Nru org-mode-7.7/lisp/ob-lob.el org-mode-7.8.02/lisp/ob-lob.el --- org-mode-7.7/lisp/ob-lob.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/ob-lob.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,11 +1,11 @@ ;;; ob-lob.el --- functions supporting the Library of Babel -;; Copyright (C) 2009, 2010 Free Software Foundation, Inc. +;; Copyright (C) 2009-2011 Free Software Foundation, Inc. -;; Author: Eric Schulte, Dan Davison +;; Author: Eric Schulte +;; Dan Davison ;; Keywords: literate programming, reproducible research ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; This file is part of GNU Emacs. @@ -28,6 +28,8 @@ (require 'ob) (require 'ob-table) +(declare-function org-babel-in-example-or-verbatim "ob-exp" nil) + (defvar org-babel-library-of-babel nil "Library of source-code blocks. This is an association list. Populate the library by adding @@ -61,24 +63,15 @@ lob-ingest-count (if (> lob-ingest-count 1) "s" "")) lob-ingest-count)) -(defconst org-babel-lob-call-aliases '("lob" "call") - "Aliases to call a source block function. -If you change the value of this variable then your files may - become unusable by other org-babel users, and vice versa.") - (defconst org-babel-block-lob-one-liner-regexp (concat - "^\\([ \t]*\\)#\\+\\(?:" - (mapconcat #'regexp-quote org-babel-lob-call-aliases "\\|") - "\\):[ \t]+\\([^\(\)\n]+?\\)\\(\\[\\(.*\\)\\]\\|\\(\\)\\)" + "^\\([ \t]*\\)#\\+call:[ \t]+\\([^\(\)\n]+?\\)\\(\\[\\(.*\\)\\]\\|\\(\\)\\)" "\(\\([^\n]*\\)\)\\(\\[.+\\]\\|\\)[ \t]*\\(\\([^\n]*\\)\\)?") "Regexp to match non-inline calls to predefined source block functions.") (defconst org-babel-inline-lob-one-liner-regexp (concat - "\\([^\n]*\\)\\(?:" - (mapconcat #'regexp-quote org-babel-lob-call-aliases "\\|") - "\\)_\\([^\(\)\n]+?\\)\\(\\[\\(.*\\)\\]\\|\\(\\)\\)" + "\\([^\n]*\\)call_\\([^\(\)\n]+?\\)\\(\\[\\(.*\\)\\]\\|\\(\\)\\)" "\(\\([^\n]*\\)\)\\(\\[\\(.*?\\)\\]\\)?") "Regexp to match inline calls to predefined source block functions.") @@ -88,6 +81,30 @@ "Regexp to match calls to predefined source block functions.") ;; functions for executing lob one-liners + +;;;###autoload +(defmacro org-babel-map-call-lines (file &rest body) + "Evaluate BODY forms on each call line in FILE. +If FILE is nil evaluate BODY forms on source blocks in current +buffer." + (declare (indent 1)) + (let ((tempvar (make-symbol "file"))) + `(let* ((,tempvar ,file) + (visited-p (or (null ,tempvar) + (get-file-buffer (expand-file-name ,tempvar)))) + (point (point)) to-be-removed) + (save-window-excursion + (when ,tempvar (find-file ,tempvar)) + (setq to-be-removed (current-buffer)) + (goto-char (point-min)) + (while (re-search-forward org-babel-lob-one-liner-regexp nil t) + (goto-char (match-beginning 1)) + (save-match-data ,@body) + (goto-char (match-end 0)))) + (unless visited-p (kill-buffer to-be-removed)) + (goto-char point)))) +(def-edebug-spec org-babel-map-call-lines (form body)) + ;;;###autoload (defun org-babel-lob-execute-maybe () "Execute a Library of Babel source block, if appropriate. @@ -95,7 +112,9 @@ if so then run the appropriate source block from the Library." (interactive) (let ((info (org-babel-lob-get-info))) - (if (nth 0 info) (progn (org-babel-lob-execute info) t) nil))) + (if (and (nth 0 info) (not (org-babel-in-example-or-verbatim))) + (progn (org-babel-lob-execute info) t) + nil))) ;;;###autoload (defun org-babel-lob-get-info () @@ -125,7 +144,6 @@ (let ((params (org-babel-process-params (org-babel-merge-params org-babel-default-header-args - (org-babel-params-from-buffer) (org-babel-params-from-properties) (org-babel-parse-header-arguments (org-babel-clean-text-properties @@ -136,6 +154,6 @@ (provide 'ob-lob) -;; arch-tag: ce0712c9-2147-4019-ba3f-42341b8b474b + ;;; ob-lob.el ends here diff -Nru org-mode-7.7/lisp/ob-matlab.el org-mode-7.8.02/lisp/ob-matlab.el --- org-mode-7.7/lisp/ob-matlab.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/ob-matlab.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,11 +1,10 @@ ;;; ob-matlab.el --- org-babel support for matlab evaluation -;; Copyright (C) 2010 Free Software Foundation, Inc. +;; Copyright (C) 2010-2011 Free Software Foundation, Inc. ;; Author: Dan Davison ;; Keywords: literate programming, reproducible research ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; This file is part of GNU Emacs. @@ -43,6 +42,6 @@ (provide 'ob-matlab) -;; arch-tag: 6b234299-c1f7-4eb1-ace8-7b93344065ac + ;;; ob-matlab.el ends here diff -Nru org-mode-7.7/lisp/ob-mscgen.el org-mode-7.8.02/lisp/ob-mscgen.el --- org-mode-7.7/lisp/ob-mscgen.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/ob-mscgen.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,11 +1,10 @@ ;;; ob-msc.el --- org-babel functions for mscgen evaluation -;; Copyright (C) 2010 Free Software Foundation, Inc. +;; Copyright (C) 2010-2011 Free Software Foundation, Inc. ;; Author: Juan Pechiar ;; Keywords: literate programming, reproducible research ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; This file is part of GNU Emacs. @@ -81,6 +80,6 @@ (provide 'ob-mscgen) -;; arch-tag: 74695b1e-715f-4b5a-a3a9-d78ee39ba5c8 + ;;; ob-msc.el ends here diff -Nru org-mode-7.7/lisp/ob-ocaml.el org-mode-7.8.02/lisp/ob-ocaml.el --- org-mode-7.7/lisp/ob-ocaml.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/ob-ocaml.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,11 +1,10 @@ ;;; ob-ocaml.el --- org-babel functions for ocaml evaluation -;; Copyright (C) 2009, 2010 Free Software Foundation, Inc. +;; Copyright (C) 2009-2011 Free Software Foundation, Inc. ;; Author: Eric Schulte ;; Keywords: literate programming, reproducible research ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; This file is part of GNU Emacs. @@ -140,6 +139,6 @@ (provide 'ob-ocaml) -;; arch-tag: 2e815f4d-365e-4d69-b1df-dd17fdd7b7b7 + ;;; ob-ocaml.el ends here diff -Nru org-mode-7.7/lisp/ob-octave.el org-mode-7.8.02/lisp/ob-octave.el --- org-mode-7.7/lisp/ob-octave.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/ob-octave.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,11 +1,10 @@ ;;; ob-octave.el --- org-babel functions for octave and matlab evaluation -;; Copyright (C) 2010 Free Software Foundation, Inc. +;; Copyright (C) 2010-2011 Free Software Foundation, Inc. ;; Author: Dan Davison ;; Keywords: literate programming, reproducible research ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; This file is part of GNU Emacs. @@ -118,7 +117,11 @@ (if (listp var) (concat "[" (mapconcat #'org-babel-octave-var-to-octave var (if (listp (car var)) "; " ",")) "]") - (format "%s" (or var "nil")))) + (cond + ((stringp var) + (format "\'%s\'" var)) + (t + (format "%s" var))))) (defun org-babel-prep-session:octave (session params &optional matlabp) "Prepare SESSION according to the header arguments specified in PARAMS." @@ -258,6 +261,6 @@ (provide 'ob-octave) -;; arch-tag: d8e5f68b-ba13-440a-a495-b653e989e704 + ;;; ob-octave.el ends here diff -Nru org-mode-7.7/lisp/ob-org.el org-mode-7.8.02/lisp/ob-org.el --- org-mode-7.7/lisp/ob-org.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/ob-org.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,11 +1,10 @@ ;;; ob-org.el --- org-babel functions for org code block evaluation -;; Copyright (C) 2010 Free Software Foundation, Inc. +;; Copyright (C) 2010-2011 Free Software Foundation, Inc. ;; Author: Eric Schulte ;; Keywords: literate programming, reproducible research ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; This file is part of GNU Emacs. @@ -66,6 +65,6 @@ (provide 'ob-org) -;; arch-tag: 130af5fe-cc56-46bd-9508-fa0ebd94cb1f + ;;; ob-org.el ends here diff -Nru org-mode-7.7/lisp/ob-perl.el org-mode-7.8.02/lisp/ob-perl.el --- org-mode-7.7/lisp/ob-perl.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/ob-perl.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,11 +1,11 @@ ;;; ob-perl.el --- org-babel functions for perl evaluation -;; Copyright (C) 2009, 2010 Free Software Foundation +;; Copyright (C) 2009-2011 Free Software Foundation -;; Author: Dan Davison, Eric Schulte +;; Author: Dan Davison +;; Eric Schulte ;; Keywords: literate programming, reproducible research ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; This file is part of GNU Emacs. @@ -113,6 +113,6 @@ (provide 'ob-perl) -;; arch-tag: 88ef9396-d857-4dc3-8946-5a72bdfa2337 + ;;; ob-perl.el ends here diff -Nru org-mode-7.7/lisp/ob-picolisp.el org-mode-7.8.02/lisp/ob-picolisp.el --- org-mode-7.7/lisp/ob-picolisp.el 1970-01-01 00:00:00.000000000 +0000 +++ org-mode-7.8.02/lisp/ob-picolisp.el 2011-12-13 00:34:24.000000000 +0000 @@ -0,0 +1,192 @@ +;;; ob-picolisp.el --- org-babel functions for picolisp evaluation + +;; Copyright (C) 2010-2011 Free Software Foundation, Inc. + +;; Authors: Thorsten Jolitz and Eric Schulte +;; Keywords: literate programming, reproducible research +;; Homepage: http://orgmode.org + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Commentary: + +;; This library enables the use of PicoLisp in the multi-language +;; programming framework Org-Babel. PicoLisp is a minimal yet +;; fascinating lisp dialect and a highly productive application +;; framework for web-based client-server applications on top of +;; object-oriented databases. A good way to learn PicoLisp is to first +;; read Paul Grahams essay "The hundred year language" +;; (http://www.paulgraham.com/hundred.html) and then study the various +;; documents and essays published in the PicoLisp wiki +;; (http://picolisp.com/5000/-2.html). PicoLisp is included in some +;; GNU/Linux Distributions, and can be downloaded here: +;; http://software-lab.de/down.html. It ships with a picolisp-mode and +;; a inferior-picolisp-mode for Emacs (to be found in the /lib/el/ +;; directory). + +;; Although it might seem more natural to use Emacs Lisp for most +;; Lisp-based programming tasks inside Org-Mode, an Emacs library +;; written in Emacs Lisp, PicoLisp has at least two outstanding +;; features that make it a valuable addition to Org-Babel: + +;; PicoLisp _is_ an object-oriented database with a Prolog-based query +;; language implemented in PicoLisp (Pilog). Database objects are +;; first-class members of the language. + +;; PicoLisp is an extremely productive framework for the development +;; of interactive web-applications (on top of a database). + +;;; Requirements: + +;;; Code: +(require 'ob) +(require 'ob-eval) +(require 'ob-comint) +(require 'comint) +(eval-when-compile (require 'cl)) + +(declare-function run-picolisp "ext:inferior-picolisp" (cmd)) + +;; optionally define a file extension for this language +(add-to-list 'org-babel-tangle-lang-exts '("picolisp" . "l")) + +;;; interferes with settings in org-babel buffer? +;; optionally declare default header arguments for this language +;; (defvar org-babel-default-header-args:picolisp +;; '((:colnames . "no")) +;; "Default arguments for evaluating a picolisp source block.") + +(defvar org-babel-picolisp-eoe "org-babel-picolisp-eoe" + "String to indicate that evaluation has completed.") + +(defcustom org-babel-picolisp-cmd "pil" + "Name of command used to evaluate picolisp blocks." + :group 'org-babel + :type 'string) + +(defun org-babel-expand-body:picolisp (body params &optional processed-params) + "Expand BODY according to PARAMS, return the expanded body." + (let ((vars (mapcar #'cdr (org-babel-get-header params :var))) + (result-params (cdr (assoc :result-params params))) + (print-level nil) (print-length nil)) + (if (> (length vars) 0) + (concat "(prog (let (" + (mapconcat + (lambda (var) + (format "%S '%S)" + (print (car var)) + (print (cdr var)))) + vars "\n ") + " \n" body ") )") + body))) + +(defun org-babel-execute:picolisp (body params) + "Execute a block of Picolisp code with org-babel. This function is + called by `org-babel-execute-src-block'" + (message "executing Picolisp source code block") + (let* ( + ;; name of the session or "none" + (session-name (cdr (assoc :session params))) + ;; set the session if the session variable is non-nil + (session (org-babel-picolisp-initiate-session session-name)) + ;; either OUTPUT or VALUE which should behave as described above + (result-type (cdr (assoc :result-type params))) + (result-params (cdr (assoc :result-params params))) + ;; expand the body with `org-babel-expand-body:picolisp' + (full-body (org-babel-expand-body:picolisp body params)) + ;; wrap body appropriately for the type of evaluation and results + (wrapped-body + (cond + ((or (member "code" result-params) + (member "pp" result-params)) + (format "(pretty (out \"/dev/null\" %s))" full-body)) + ((and (member "value" result-params) (not session)) + (format "(print (out \"/dev/null\" %s))" full-body)) + ((member "value" result-params) + (format "(out \"/dev/null\" %s)" full-body)) + (t full-body)))) + + ((lambda (result) + (if (or (member "verbatim" result-params) + (member "scalar" result-params) + (member "output" result-params) + (member "code" result-params) + (member "pp" result-params) + (= (length result) 0)) + result + (read result))) + (if (not (string= session-name "none")) + ;; session based evaluation + (mapconcat ;; <- joins the list back together into a single string + #'identity + (butlast ;; <- remove the org-babel-picolisp-eoe line + (delq nil + (mapcar + (lambda (line) + (org-babel-chomp ;; remove trailing newlines + (when (> (length line) 0) ;; remove empty lines + (cond + ;; remove leading "-> " from return values + ((and (>= (length line) 3) + (string= "-> " (substring line 0 3))) + (substring line 3)) + ;; remove trailing "-> <>" on the + ;; last line of output + ((and (member "output" result-params) + (string-match-p "->" line)) + (substring line 0 (string-match "->" line))) + (t line) + ) + ;; (if (and (>= (length line) 3) ;; remove leading "<- " + ;; (string= "-> " (substring line 0 3))) + ;; (substring line 3) + ;; line) + ))) + ;; returns a list of the output of each evaluated expression + (org-babel-comint-with-output (session org-babel-picolisp-eoe) + (insert wrapped-body) (comint-send-input) + (insert "'" org-babel-picolisp-eoe) (comint-send-input))))) + "\n") + ;; external evaluation + (let ((script-file (org-babel-temp-file "picolisp-script-"))) + (with-temp-file script-file + (insert (concat wrapped-body "(bye)"))) + (org-babel-eval + (format "%s %s" + org-babel-picolisp-cmd + (org-babel-process-file-name script-file)) + "")))))) + +(defun org-babel-picolisp-initiate-session (&optional session-name) + "If there is not a current inferior-process-buffer in SESSION +then create. Return the initialized session." + (unless (string= session-name "none") + (require 'inferior-picolisp) + ;; provide a reasonable default session name + (let ((session (or session-name "*inferior-picolisp*"))) + ;; check if we already have a live session by this name + (if (org-babel-comint-buffer-livep session) + (get-buffer session) + (save-window-excursion + (run-picolisp org-babel-picolisp-cmd) + (rename-buffer session-name) + (current-buffer)))))) + +(provide 'ob-picolisp) + + + +;;; ob-picolisp.el ends here diff -Nru org-mode-7.7/lisp/ob-plantuml.el org-mode-7.8.02/lisp/ob-plantuml.el --- org-mode-7.7/lisp/ob-plantuml.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/ob-plantuml.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,11 +1,10 @@ ;;; ob-plantuml.el --- org-babel functions for plantuml evaluation -;; Copyright (C) 2010 Free Software Foundation, Inc. +;; Copyright (C) 2010-2011 Free Software Foundation, Inc. ;; Author: Zhang Weize ;; Keywords: literate programming, reproducible research ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; This file is part of GNU Emacs. @@ -80,6 +79,6 @@ (provide 'ob-plantuml) -;; arch-tag: 451f50c5-e779-407e-ad64-70e0e8f161d1 + ;;; ob-plantuml.el ends here diff -Nru org-mode-7.7/lisp/ob-python.el org-mode-7.8.02/lisp/ob-python.el --- org-mode-7.7/lisp/ob-python.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/ob-python.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,11 +1,11 @@ ;;; ob-python.el --- org-babel functions for python evaluation -;; Copyright (C) 2009, 2010 Free Software Foundation +;; Copyright (C) 2009-2011 Free Software Foundation -;; Author: Eric Schulte, Dan Davison +;; Author: Eric Schulte +;; Dan Davison ;; Keywords: literate programming, reproducible research ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; This file is part of GNU Emacs. @@ -294,6 +294,6 @@ (provide 'ob-python) -;; arch-tag: f19b6c3d-dfcb-4a1a-9ce0-45ade1ebc212 + ;;; ob-python.el ends here diff -Nru org-mode-7.7/lisp/ob-ref.el org-mode-7.8.02/lisp/ob-ref.el --- org-mode-7.7/lisp/ob-ref.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/ob-ref.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,11 +1,11 @@ ;;; ob-ref.el --- org-babel functions for referencing external data -;; Copyright (C) 2009, 2010 Free Software Foundation, Inc. +;; Copyright (C) 2009-2011 Free Software Foundation, Inc. -;; Author: Eric Schulte, Dan Davison +;; Author: Eric Schulte +;; Dan Davison ;; Keywords: literate programming, reproducible research ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; This file is part of GNU Emacs. @@ -66,11 +66,14 @@ (defvar org-babel-ref-split-regexp "[ \f\t\n\r\v]*\\(.+?\\)[ \f\t\n\r\v]*=[ \f\t\n\r\v]*\\(.+\\)[ \f\t\n\r\v]*") +(defvar org-babel-update-intermediate nil + "Update the in-buffer results of code blocks executed to resolve references.") + (defun org-babel-ref-parse (assignment) "Parse a variable ASSIGNMENT in a header argument. If the right hand side of the assignment has a literal value return that value, otherwise interpret as a reference to an -external resource and find it's value using +external resource and find its value using `org-babel-ref-resolve'. Return a list with two elements. The first element of the list will be the name of the variable, and the second will be an emacs-lisp representation of the value of @@ -148,21 +151,19 @@ (save-restriction (widen) (goto-char (point-min)) - (if (let* ((rx (regexp-quote ref)) - (res-rx (concat org-babel-result-regexp rx "[ \t]*$")) - (src-rx (concat org-babel-src-name-regexp - rx "\\(\(.*\)\\)?" "[ \t]*$"))) + (if (let ((src-rx (org-babel-named-src-block-regexp-for-name ref)) + (res-rx (org-babel-named-data-regexp-for-name ref))) ;; goto ref in the current buffer - (or (and (not args) - (or (re-search-forward res-rx nil t) - (re-search-backward res-rx nil t))) - (re-search-forward src-rx nil t) - (re-search-backward src-rx nil t) - ;; check for local or global headlines by id - (setq id (org-babel-ref-goto-headline-id ref)) - ;; check the Library of Babel - (setq lob-info (cdr (assoc (intern ref) - org-babel-library-of-babel))))) + (or + ;; check for code blocks + (re-search-forward src-rx nil t) + ;; check for named data + (re-search-forward res-rx nil t) + ;; check for local or global headlines by id + (setq id (org-babel-ref-goto-headline-id ref)) + ;; check the Library of Babel + (setq lob-info (cdr (assoc (intern ref) + org-babel-library-of-babel))))) (unless (or lob-info id) (goto-char (match-beginning 0))) ;; ;; TODO: allow searching for names in other buffers ;; (setq id-loc (org-id-find ref 'marker) @@ -173,6 +174,12 @@ (cond (lob-info (setq type 'lob)) (id (setq type 'id)) + ((and (looking-at org-babel-src-name-regexp) + (save-excursion + (forward-line 1) + (or (looking-at org-babel-src-block-regexp) + (looking-at org-babel-multi-line-header-regexp)))) + (setq type 'source-block)) (t (while (not (setq type (org-babel-ref-at-ref-p))) (forward-line 1) (beginning-of-line) @@ -185,7 +192,9 @@ (table (org-babel-read-table)) (list (org-babel-read-list)) (file (org-babel-read-link)) - (source-block (org-babel-execute-src-block nil nil params)) + (source-block (org-babel-execute-src-block + nil nil (if org-babel-update-intermediate + nil params))) (lob (org-babel-execute-src-block nil lob-info params)) (id (org-babel-ref-headline-body))))) @@ -235,20 +244,7 @@ (defun org-babel-ref-split-args (arg-string) "Split ARG-STRING into top-level arguments of balanced parenthesis." - (let ((index 0) (depth 0) (buffer "") holder return) - ;; crawl along string, splitting at any ","s which are on the top level - (while (< index (length arg-string)) - (setq holder (substring arg-string index (+ 1 index))) - (setq buffer (concat buffer holder)) - (setq index (+ 1 index)) - (cond - ((string= holder ",") - (when (= depth 0) - (setq return (cons (substring buffer 0 -1) return)) - (setq buffer ""))) - ((or (string= holder "(") (string= holder "[")) (setq depth (+ depth 1))) - ((or (string= holder ")") (string= holder "]")) (setq depth (- depth 1))))) - (mapcar #'org-babel-trim (reverse (cons buffer return))))) + (mapcar #'org-babel-trim (org-babel-balanced-split arg-string 44))) (defvar org-bracket-link-regexp) (defun org-babel-ref-at-ref-p () @@ -263,6 +259,6 @@ (provide 'ob-ref) -;; arch-tag: ace4a4f4-ea38-4dac-8fe6-6f52fcc43b6d + ;;; ob-ref.el ends here diff -Nru org-mode-7.7/lisp/ob-R.el org-mode-7.8.02/lisp/ob-R.el --- org-mode-7.7/lisp/ob-R.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/ob-R.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,11 +1,11 @@ ;;; ob-R.el --- org-babel functions for R code evaluation -;; Copyright (C) 2009, 2010 Free Software Foundation, Inc. +;; Copyright (C) 2009-2011 Free Software Foundation, Inc. -;; Author: Eric Schulte, Dan Davison +;; Author: Eric Schulte +;; Dan Davison ;; Keywords: literate programming, reproducible research, R, statistics ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; This file is part of GNU Emacs. @@ -79,7 +79,8 @@ "Execute a block of R code. This function is called by `org-babel-execute-src-block'." (save-excursion - (let* ((result-type (cdr (assoc :result-type params))) + (let* ((result-params (cdr (assoc :result-params params))) + (result-type (cdr (assoc :result-type params))) (session (org-babel-R-initiate-session (cdr (assoc :session params)) params)) (colnames-p (cdr (assoc :colnames params))) @@ -88,7 +89,7 @@ (full-body (org-babel-expand-body:R body params graphics-file)) (result (org-babel-R-evaluate - session full-body result-type + session full-body result-type result-params (or (equal "yes" colnames-p) (org-babel-pick-name (cdr (assoc :colname-names params)) colnames-p)) @@ -196,6 +197,7 @@ '((:bmp . "bmp") (:jpg . "jpeg") (:jpeg . "jpeg") + (:tex . "tikz") (:tiff . "tiff") (:png . "png") (:svg . "svg") @@ -213,7 +215,7 @@ (setq device (or (and device (cdr (assq (intern (concat ":" device)) devices))) "png")) (setq filearg - (if (member device '("pdf" "postscript" "svg")) "file" "filename")) + (if (member device '("pdf" "postscript" "svg" "tikz")) "file" "filename")) (setq args (mapconcat (lambda (pair) (if (member (car pair) allowed-args) @@ -231,16 +233,16 @@ (defvar org-babel-R-write-object-command "{function(object,transfer.file){object;invisible(if(inherits(try({tfile<-tempfile();write.table(object,file=tfile,sep=\"\\t\",na=\"nil\",row.names=%s,col.names=%s,quote=FALSE);file.rename(tfile,transfer.file)},silent=TRUE),\"try-error\")){if(!file.exists(transfer.file))file.create(transfer.file)})}}(object=%s,transfer.file=\"%s\")") (defun org-babel-R-evaluate - (session body result-type column-names-p row-names-p) + (session body result-type result-params column-names-p row-names-p) "Evaluate R code in BODY." (if session (org-babel-R-evaluate-session - session body result-type column-names-p row-names-p) + session body result-type result-params column-names-p row-names-p) (org-babel-R-evaluate-external-process - body result-type column-names-p row-names-p))) + body result-type result-params column-names-p row-names-p))) (defun org-babel-R-evaluate-external-process - (body result-type column-names-p row-names-p) + (body result-type result-params column-names-p row-names-p) "Evaluate BODY in external R process. If RESULT-TYPE equals 'output then return standard output as a string. If RESULT-TYPE equals 'value then return the value of the @@ -257,11 +259,17 @@ (format "{function ()\n{\n%s\n}}()" body) (org-babel-process-file-name tmp-file 'noquote))) (org-babel-R-process-value-result - (org-babel-import-elisp-from-file tmp-file '(16)) column-names-p))) + (if (or (member "scalar" result-params) + (member "verbatim" result-params)) + (with-temp-buffer + (insert-file-contents tmp-file) + (buffer-string)) + (org-babel-import-elisp-from-file tmp-file '(16))) + column-names-p))) (output (org-babel-eval org-babel-R-command body)))) (defun org-babel-R-evaluate-session - (session body result-type column-names-p row-names-p) + (session body result-type result-params column-names-p row-names-p) "Evaluate BODY in SESSION. If RESULT-TYPE equals 'output then return standard output as a string. If RESULT-TYPE equals 'value then return the value of the @@ -283,7 +291,13 @@ "FALSE") ".Last.value" (org-babel-process-file-name tmp-file 'noquote))) (org-babel-R-process-value-result - (org-babel-import-elisp-from-file tmp-file '(16)) column-names-p))) + (if (or (member "scalar" result-params) + (member "verbatim" result-params)) + (with-temp-buffer + (insert-file-contents tmp-file) + (buffer-string)) + (org-babel-import-elisp-from-file tmp-file '(16))) + column-names-p))) (output (mapconcat #'org-babel-chomp @@ -294,7 +308,7 @@ (mapcar (lambda (line) ;; cleanup extra prompts left in output (if (string-match - "^\\([ ]*[>+][ ]?\\)+\\([[0-9]+\\|[ ]\\)" line) + "^\\([ ]*[>+\\.][ ]?\\)+\\([[0-9]+\\|[ ]\\)" line) (substring line (match-end 1)) line)) (org-babel-comint-with-output (session org-babel-R-eoe-output) @@ -312,6 +326,6 @@ (provide 'ob-R) -;; arch-tag: cd4c7298-503b-450f-a3c2-f3e74b630237 + ;;; ob-R.el ends here diff -Nru org-mode-7.7/lisp/ob-ruby.el org-mode-7.8.02/lisp/ob-ruby.el --- org-mode-7.7/lisp/ob-ruby.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/ob-ruby.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,11 +1,10 @@ ;;; ob-ruby.el --- org-babel functions for ruby evaluation -;; Copyright (C) 2009, 2010 Free Software Foundation +;; Copyright (C) 2009-2011 Free Software Foundation ;; Author: Eric Schulte ;; Keywords: literate programming, reproducible research ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; This file is part of GNU Emacs. @@ -129,8 +128,8 @@ "Initiate a ruby session. If there is not a current inferior-process-buffer in SESSION then create one. Return the initialized session." - (require 'inf-ruby) (unless (string= session "none") + (require 'inf-ruby) (let ((session-buffer (save-window-excursion (run-ruby nil session) (current-buffer)))) (if (org-babel-comint-buffer-livep session-buffer) @@ -241,6 +240,6 @@ (provide 'ob-ruby) -;; arch-tag: 3e9726db-4520-49e2-b263-e8f571ac88f5 + ;;; ob-ruby.el ends here diff -Nru org-mode-7.7/lisp/ob-sass.el org-mode-7.8.02/lisp/ob-sass.el --- org-mode-7.7/lisp/ob-sass.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/ob-sass.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,11 +1,10 @@ ;;; ob-sass.el --- org-babel functions for the sass css generation language -;; Copyright (C) 2009, 2010 Free Software Foundation, Inc. +;; Copyright (C) 2009-2011 Free Software Foundation, Inc. ;; Author: Eric Schulte ;; Keywords: literate programming, reproducible research ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; This file is part of GNU Emacs. @@ -68,6 +67,6 @@ (provide 'ob-sass) -;; arch-tag: 2954b169-eef4-45ce-a8e5-3e619f0f07ac + ;;; ob-sass.el ends here diff -Nru org-mode-7.7/lisp/ob-scheme.el org-mode-7.8.02/lisp/ob-scheme.el --- org-mode-7.7/lisp/ob-scheme.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/ob-scheme.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,28 +1,25 @@ ;;; ob-scheme.el --- org-babel functions for Scheme -;; Copyright (C) 2010 Free Software Foundation +;; Copyright (C) 2010-2011 Free Software Foundation ;; Author: Eric Schulte ;; Keywords: literate programming, reproducible research, scheme ;; Homepage: http://orgmode.org -;; Version: 7.7 -;;; License: +;; This file is part of GNU Emacs. -;; This program is free software; you can redistribute it and/or modify +;; GNU Emacs is free software: you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. -;; -;; This program is distributed in the hope that it will be useful, +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. -;; + ;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs; see the file COPYING. If not, write to the -;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -;; Boston, MA 02110-1301, USA. +;; along with GNU Emacs. If not, see . ;;; Commentary: @@ -35,7 +32,7 @@ ;; - 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 @@ -134,6 +131,6 @@ (provide 'ob-scheme) -;; arch-tag: 6b2fe76f-4b25-4e87-ad1c-225b2f282a71 + ;;; ob-scheme.el ends here diff -Nru org-mode-7.7/lisp/ob-screen.el org-mode-7.8.02/lisp/ob-screen.el --- org-mode-7.7/lisp/ob-screen.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/ob-screen.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,11 +1,10 @@ ;;; ob-screen.el --- org-babel support for interactive terminal -;; Copyright (C) 2009, 2010 Free Software Foundation +;; Copyright (C) 2009-2011 Free Software Foundation ;; Author: Benjamin Andresen ;; Keywords: literate programming, interactive shell ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; This file is part of GNU Emacs. @@ -142,6 +141,6 @@ (provide 'ob-screen) -;; arch-tag: 908e5afe-89a0-4f27-b982-23f1f2e3bac9 + ;;; ob-screen.el ends here diff -Nru org-mode-7.7/lisp/ob-sh.el org-mode-7.8.02/lisp/ob-sh.el --- org-mode-7.7/lisp/ob-sh.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/ob-sh.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,11 +1,10 @@ ;;; ob-sh.el --- org-babel functions for shell evaluation -;; Copyright (C) 2009, 2010 Free Software Foundation, Inc. +;; Copyright (C) 2009-2011 Free Software Foundation, Inc. ;; Author: Eric Schulte ;; Keywords: literate programming, reproducible research ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; This file is part of GNU Emacs. @@ -193,6 +192,6 @@ (provide 'ob-sh) -;; arch-tag: 416dd531-c230-4b0a-a5bf-8d948f990f2d + ;;; ob-sh.el ends here diff -Nru org-mode-7.7/lisp/ob-shen.el org-mode-7.8.02/lisp/ob-shen.el --- org-mode-7.7/lisp/ob-shen.el 1970-01-01 00:00:00.000000000 +0000 +++ org-mode-7.8.02/lisp/ob-shen.el 2011-12-13 00:34:24.000000000 +0000 @@ -0,0 +1,79 @@ +;;; ob-shen.el --- org-babel functions for Shen + +;; Copyright (C) 2010-2011 Free Software Foundation + +;; Author: Eric Schulte +;; Keywords: literate programming, reproducible research, shen +;; Homepage: http://orgmode.org + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Commentary: + +;; Currently this only works using session evaluation as there is no +;; defined method for executing shen code outside of a session. + +;;; Requirements: + +;; - shen-mode and inf-shen will soon be available through the GNU +;; elpa, however in the interim they are available at +;; https://github.com/eschulte/shen-mode + +;;; Code: +(require 'ob) + +(declare-function shen-eval-defun "ext:inf-shen" (&optional and-go)) + +(defvar org-babel-default-header-args:shen '() + "Default header arguments for shen code blocks.") + +(defun org-babel-expand-body:shen (body params) + "Expand BODY according to PARAMS, return the expanded body." + (let ((vars (mapcar #'cdr (org-babel-get-header params :var)))) + (if (> (length vars) 0) + (concat "(let " + (mapconcat (lambda (var) + (format "%s %s" (car var) + (org-babel-shen-var-to-shen (cdr var)))) + vars " ") + body ")") + body))) + +(defun org-babel-shen-var-to-shen (var) + "Convert VAR into a shen variable." + (if (listp var) + (concat "[" (mapconcat #'org-babel-ruby-var-to-ruby var " ") "]") + (format "%S" var))) + +(defun org-babel-execute:shen (body params) + "Execute a block of Shen code with org-babel. +This function is called by `org-babel-execute-src-block'" + (require 'inf-shen) + (let* ((result-type (cdr (assoc :result-type params))) + (result-params (cdr (assoc :result-params params))) + (full-body (org-babel-expand-body:shen body params))) + ((lambda (results) + (if (or (member 'scalar result-params) + (member 'verbatim result-params)) + results + (condition-case nil (org-babel-script-escape results) + (error results)))) + (with-temp-buffer + (insert full-body) + (call-interactively #'shen-eval-defun))))) + +(provide 'ob-shen) +;;; ob-shen.el ends here diff -Nru org-mode-7.7/lisp/ob-sql.el org-mode-7.8.02/lisp/ob-sql.el --- org-mode-7.7/lisp/ob-sql.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/ob-sql.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,11 +1,10 @@ ;;; ob-sql.el --- org-babel functions for sql evaluation -;; Copyright (C) 2009, 2010 Free Software Foundation, Inc. +;; Copyright (C) 2009-2011 Free Software Foundation, Inc. ;; Author: Eric Schulte ;; Keywords: literate programming, reproducible research ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; This file is part of GNU Emacs. @@ -51,6 +50,9 @@ (defvar org-babel-default-header-args:sql '()) +(defvar org-babel-header-arg-names:sql + '(engine out-file)) + (defun org-babel-expand-body:sql (body params) "Expand BODY according to the values of PARAMS." (org-babel-sql-expand-vars @@ -85,31 +87,38 @@ (insert (org-babel-expand-body:sql body params))) (message command) (shell-command command) - (with-temp-buffer - ;; need to figure out what the delimiter is for the header row + (if (or (member "scalar" result-params) + (member "verbatim" result-params) + (member "html" result-params) + (member "code" result-params) + (equal (point-min) (point-max))) + (with-temp-buffer + (progn (insert-file-contents-literally out-file) (buffer-string))) (with-temp-buffer - (insert-file-contents out-file) - (goto-char (point-min)) - (when (re-search-forward "^\\(-+\\)[^-]" nil t) - (setq header-delim (match-string-no-properties 1))) - (goto-char (point-max)) - (forward-char -1) - (while (looking-at "\n") - (delete-char 1) - (goto-char (point-max)) - (forward-char -1)) - (write-file out-file)) - (org-table-import out-file '(16)) - (org-babel-reassemble-table - (mapcar (lambda (x) - (if (string= (car x) header-delim) - 'hline - x)) - (org-table-to-lisp)) - (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))))))) + ;; need to figure out what the delimiter is for the header row + (with-temp-buffer + (insert-file-contents out-file) + (goto-char (point-min)) + (when (re-search-forward "^\\(-+\\)[^-]" nil t) + (setq header-delim (match-string-no-properties 1))) + (goto-char (point-max)) + (forward-char -1) + (while (looking-at "\n") + (delete-char 1) + (goto-char (point-max)) + (forward-char -1)) + (write-file out-file)) + (org-table-import out-file '(16)) + (org-babel-reassemble-table + (mapcar (lambda (x) + (if (string= (car x) header-delim) + 'hline + x)) + (org-table-to-lisp)) + (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)))))))) (defun org-babel-sql-expand-vars (body vars) "Expand the variables held in VARS in BODY." @@ -140,6 +149,6 @@ (provide 'ob-sql) -;; arch-tag: a43ff944-6de1-4566-a83c-626814e3dad2 + ;;; ob-sql.el ends here diff -Nru org-mode-7.7/lisp/ob-sqlite.el org-mode-7.8.02/lisp/ob-sqlite.el --- org-mode-7.7/lisp/ob-sqlite.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/ob-sqlite.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,11 +1,10 @@ ;;; ob-sqlite.el --- org-babel functions for sqlite database interaction -;; Copyright (C) 2010 Free Software Foundation +;; Copyright (C) 2010-2011 Free Software Foundation ;; Author: Eric Schulte ;; Keywords: literate programming, reproducible research ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; This file is part of GNU Emacs. @@ -145,6 +144,6 @@ (provide 'ob-sqlite) -;; arch-tag: 5c03d7f2-0f72-48b8-bbd1-35aafea248ac + ;;; ob-sqlite.el ends here diff -Nru org-mode-7.7/lisp/ob-table.el org-mode-7.8.02/lisp/ob-table.el --- org-mode-7.7/lisp/ob-table.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/ob-table.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,11 +1,10 @@ ;;; ob-table.el --- support for calling org-babel functions from tables -;; Copyright (C) 2009, 2010 Free Software Foundation, Inc. +;; Copyright (C) 2009-2011 Free Software Foundation, Inc. ;; Author: Eric Schulte ;; Keywords: literate programming, reproducible research ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; This file is part of GNU Emacs. @@ -31,7 +30,7 @@ ;; (defun fibbd (n) (if (< n 2) 1 (+ (fibbd (- n 1)) (fibbd (- n 2))))) ;; #+end_src -;; #+srcname: fibbd +;; #+name: fibbd ;; #+begin_src emacs-lisp :var n=2 :results silent ;; (fibbd n) ;; #+end_src @@ -78,49 +77,63 @@ references to source-code blocks, to force interpretation of a cell's value as a string, prefix the identifier with two \"$\"s rather than a single \"$\" (i.e. \"$$2\" instead of \"$2\" in the -example above." - (let* (quote - (variables - (mapcar - (lambda (var) - ;; ensure that all cells prefixed with $'s are strings - (cons (car var) - (delq nil (mapcar - (lambda (el) - (if (eq '$ el) - (setq quote t) - (prog1 (if quote - (format "\"%s\"" el) - (org-babel-clean-text-properties el)) - (setq quote nil)))) - (cdr var))))) - variables))) - (unless (stringp source-block) - (setq source-block (symbol-name source-block))) - ((lambda (result) - (org-babel-trim (if (stringp result) result (format "%S" result)))) - (if (and source-block (> (length source-block) 0)) - (let ((params - (eval `(org-babel-parse-header-arguments - (concat ":var results=" - ,source-block - "(" - (mapconcat - (lambda (var-spec) - (if (> (length (cdr var-spec)) 1) - (format "%S='%S" - (car var-spec) - (mapcar #'read (cdr var-spec))) - (format "%S=%s" - (car var-spec) (cadr var-spec)))) - ',variables ", ") - ")"))))) - (org-babel-execute-src-block - nil (list "emacs-lisp" "results" params) '((:results . "silent")))) - "")))) +example above. + +NOTE: it is also possible to pass header arguments to the code +block. In this case a table cell should hold the string value of +the header argument which can then be passed before all variables +as shown in the example below. + +| 1 | 2 | :file nothing.png | nothing.png | +#+TBLFM: @1$4='(sbe test-sbe $3 (x $1) (y $2))" + (let* ((header-args (if (stringp (car variables)) (car variables) "")) + (variables (if (stringp (car variables)) (cdr variables) variables))) + (let* (quote + (variables + (mapcar + (lambda (var) + ;; ensure that all cells prefixed with $'s are strings + (cons (car var) + (delq nil (mapcar + (lambda (el) + (if (eq '$ el) + (setq quote t) + (prog1 (if quote + (format "\"%s\"" el) + (org-babel-clean-text-properties el)) + (setq quote nil)))) + (cdr var))))) + variables))) + (unless (stringp source-block) + (setq source-block (symbol-name source-block))) + ((lambda (result) + (org-babel-trim (if (stringp result) result (format "%S" result)))) + (if (and source-block (> (length source-block) 0)) + (let ((params + (eval `(org-babel-parse-header-arguments + (concat + ":var results=" + ,source-block + "[" ,header-args "]" + "(" + (mapconcat + (lambda (var-spec) + (if (> (length (cdr var-spec)) 1) + (format "%S='%S" + (car var-spec) + (mapcar #'read (cdr var-spec))) + (format "%S=%s" + (car var-spec) (cadr var-spec)))) + ',variables ", ") + ")"))))) + (org-babel-execute-src-block + nil (list "emacs-lisp" "results" params) + '((:results . "silent")))) + ""))))) +(def-edebug-spec sbe (form form)) (provide 'ob-table) -;; arch-tag: 4234cc7c-4fc8-4e92-abb0-2892de1a493b + ;;; ob-table.el ends here diff -Nru org-mode-7.7/lisp/ob-tangle.el org-mode-7.8.02/lisp/ob-tangle.el --- org-mode-7.7/lisp/ob-tangle.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/ob-tangle.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,11 +1,10 @@ ;;; ob-tangle.el --- extract source code from org-mode files -;; Copyright (C) 2009, 2010 Free Software Foundation, Inc. +;; Copyright (C) 2009-2011 Free Software Foundation, Inc. ;; Author: Eric Schulte ;; Keywords: literate programming, reproducible research ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; This file is part of GNU Emacs. @@ -96,6 +95,14 @@ :group 'org-babel :type 'string) +(defcustom org-babel-process-comment-text #'org-babel-trim + "Function called to process raw Org-mode text collected to be +inserted as comments in tangled source-code files. The function +should take a single string argument and return a string +result. The default value is `org-babel-trim'." + :group 'org-babel + :type 'function) + (defun org-babel-find-file-noselect-refresh (file) "Find file ensuring that the latest changes on disk are represented in the file." @@ -119,6 +126,7 @@ (setf ,temp-result (progn ,@body))) (unless ,visited-p (kill-buffer ,temp-file)) ,temp-result))) +(def-edebug-spec org-babel-with-temp-filebuffer (form body)) ;;;###autoload (defun org-babel-load-file (file) @@ -345,16 +353,20 @@ (when (or (string= "both" (cdr (assoc :comments params))) (string= "org" (cdr (assoc :comments params)))) ;; from the previous heading or code-block end - (buffer-substring - (max (condition-case nil - (save-excursion - (org-back-to-heading t) (point)) - (error 0)) - (save-excursion - (re-search-backward - org-babel-src-block-regexp nil t) - (match-end 0))) - (point)))) + (funcall + org-babel-process-comment-text + (buffer-substring + (max (condition-case nil + (save-excursion + (org-back-to-heading t) ; sets match data + (match-end 0)) + (error (point-min))) + (save-excursion + (if (re-search-backward + org-babel-src-block-regexp nil t) + (match-end 0) + (point-min)))) + (point))))) by-lang) ;; add the spec for this block to blocks under it's language (setq by-lang (cdr (assoc src-lang blocks))) @@ -396,12 +408,11 @@ (eval el)))) '(start-line file link source-name)))) (flet ((insert-comment (text) - (let ((text (org-babel-trim text))) - (when (and comments (not (string= comments "no")) - (> (length text) 0)) - (when padline (insert "\n")) - (comment-region (point) (progn (insert text) (point))) - (end-of-line nil) (insert "\n"))))) + (when (and comments (not (string= comments "no")) + (> (length text) 0)) + (when padline (insert "\n")) + (comment-region (point) (progn (insert text) (point))) + (end-of-line nil) (insert "\n")))) (when comment (insert-comment comment)) (when link-p (insert-comment @@ -494,6 +505,6 @@ (provide 'ob-tangle) -;; arch-tag: 413ced93-48f5-4216-86e4-3fc5df8c8f24 + ;;; ob-tangle.el ends here diff -Nru org-mode-7.7/lisp/org-agenda.el org-mode-7.8.02/lisp/org-agenda.el --- org-mode-7.7/lisp/org-agenda.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/org-agenda.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,12 +1,10 @@ ;;; org-agenda.el --- Dynamic task and appointment lists for Org -;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 -;; Free Software Foundation, Inc. +;; Copyright (C) 2004-2011 Free Software Foundation, Inc. ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; ;; This file is part of GNU Emacs. ;; @@ -27,6 +25,23 @@ ;;; Commentary: ;; This file contains the code for creating and using the Agenda for Org-mode. +;; +;; The functions `org-batch-agenda', `org-batch-agenda-csv', and +;; `org-batch-store-agenda-views' are implemented as macros to provide +;; a conveniant way for extracting agenda information from the command +;; line. The Lisp does not evaluate parameters of a macro call; thus +;; it is not necessary to quote the parameters passed to one of those +;; functions. E.g. you can write: +;; +;; emacs -batch -l ~/.emacs -eval '(org-batch-agenda "a" org-agenda-span 7)' +;; +;; To export an agenda spanning 7 days. If `org-batch-agenda' would +;; have been implemented as a regular function you'd have to quote the +;; symbol org-agenda-span. Moreover: To use a symbol as parameter +;; value you would have to double quote the symbol. +;; +;; This is a hack, but it works even when running Org byte-compiled. +;; ;;; Code: @@ -51,6 +66,8 @@ (declare-function calendar-julian-date-string "cal-julian" (&optional date)) (declare-function calendar-mayan-date-string "cal-mayan" (&optional date)) (declare-function calendar-persian-date-string "cal-persia" (&optional date)) +(declare-function calendar-check-holidays "holidays" (date)) + (declare-function org-datetree-find-date-create "org-datetree" (date &optional keep-restriction)) (declare-function org-columns-quit "org-colview" ()) @@ -61,7 +78,7 @@ (declare-function org-is-habit-p "org-habit" (&optional pom)) (declare-function org-habit-parse-todo "org-habit" (&optional pom)) (declare-function org-habit-get-priority "org-habit" (habit &optional moment)) -(declare-function org-pop-to-buffer-same-window "org-compat" +(declare-function org-pop-to-buffer-same-window "org-compat" (&optional buffer-or-name norecord label)) (defvar calendar-mode-map) @@ -333,7 +350,8 @@ `org-agenda-custom-commands'.") -(defcustom org-agenda-custom-commands nil +(defcustom org-agenda-custom-commands '(("n" "Agenda and all TODO's" + ((agenda "") (alltodo)))) "Custom commands for the agenda. These commands will be offered on the splash screen displayed by the agenda dispatcher \\[org-agenda]. Each entry is a list like this: @@ -771,7 +789,7 @@ (const :tag "Remove prewarning if entry is scheduled" t) (integer :tag "Restart prewarning N days before deadline"))) -(defcustom org-agenda-skip-additional-timestamps-same-entry t +(defcustom org-agenda-skip-additional-timestamps-same-entry nil "When nil, multiple same-day timestamps in entry make multiple agenda lines. When non-nil, after the search for timestamps has matched once in an entry, the rest of the entry will not be searched." @@ -803,7 +821,7 @@ :group 'org-agenda-todo-list :type '(choice (const :tag "Do not dim" nil) - (const :tag "Dim to a grey face" t) + (const :tag "Dim to a gray face" t) (const :tag "Make invisible" invisible))) (defcustom org-timeline-show-empty-dates 3 @@ -856,6 +874,12 @@ :group 'org-agenda-startup :type 'boolean) +(defcustom org-agenda-follow-indirect nil + "Non-nil means `org-agenda-follow-mode' displays only the +current item's tree, in an indirect buffer." + :group 'org-agenda + :type 'boolean) + (defcustom org-agenda-show-outline-path t "Non-nil means show outline path in echo area after line motion." :group 'org-agenda-startup @@ -1051,6 +1075,15 @@ (const :tag "Saturday" 6) (const :tag "Sunday" 0))) +(defcustom org-agenda-move-date-from-past-immediately-to-today t + "Non-nil means jumpt to today when moving a past date forward in time. +When using S-right in the agenda to move a a date forward, and the date +stamp currently points to the past, the first key press will move it +to today. WHen nil, just move one day forward even if the date stays +in the past." + :group 'org-agenda-daily/weekly + :type 'boolean) + (defcustom org-agenda-include-diary nil "If non-nil, include in the agenda entries from the Emacs Calendar's diary. Custom commands can set this variable in the options section." @@ -1063,14 +1096,6 @@ :group 'org-agenda-daily/weekly :type 'boolean) -(defcustom org-agenda-include-all-todo nil - "Set means weekly/daily agenda will always contain all TODO entries. -The TODO entries will be listed at the top of the agenda, before -the entries for specific days. -This option is deprecated, it is better to define a block agenda instead." - :group 'org-agenda-daily/weekly - :type 'boolean) - (defcustom org-agenda-repeating-timestamp-show-all t "Non-nil means show all occurrences of a repeating stamp in the agenda. When set to a list of strings, only show occurrences of repeating @@ -1391,14 +1416,15 @@ (tags . " %i %-12:c") (search . " %i %-12:c")) "Format specifications for the prefix of items in the agenda views. -An alist with five entries, each for the different agenda types. The -keys of the sublists are `agenda', `timeline', `todo', `search' and `tags'. +An alist with five entries, each for the different agenda types. The +keys of the sublists are `agenda', `timeline', `todo', `search' and `tags'. The values are format strings. This format works similar to a printf format, with the following meaning: - %c the category of the item, \"Diary\" for entries from the diary, + %c the category of the item, \"Diary\" for entries from the diary, or as given by the CATEGORY keyword or derived from the file name + %e the effort required by the item %i the icon category of the item, see `org-agenda-category-icon-alist' %T the last tag of the item (ignore inherited tags, which come first) %t the HH:MM time-of-day specification if one applies to the entry @@ -1411,10 +1437,10 @@ and a whitespace/punctuation character just before the final letter. If the first character after `%' is a question mark, the entire field -will only be included if the corresponding value applies to the current -entry. This is useful for fields which should have fixed width when -present, but zero width when absent. For example, \"%?-12t\" will -result in a 12 character time field if a time of the day is specified, +will only be included if the corresponding value applies to the current +entry. This is useful for fields which should have fixed width when +present, but zero width when absent. For example, \"%?-12t\" will +result in a 12 character time field if a time of the day is specified, but will completely disappear in entries which do not contain a time. If there is punctuation or whitespace character just before the final @@ -1423,7 +1449,7 @@ \"Diary: \" if the category is \"Diary\". If the category were be empty, no additional colon would be inserted. -The default value for the agenda sublist is \" %-12:c%?-12t% s\", +The default value for the agenda sublist is \" %-12:c%?-12t% s\", which means: - Indent the line with two space characters @@ -1700,7 +1726,7 @@ (?C bulk-cut)) With selected entries in an agenda buffer, `B R' will call -the custom function `set-category' on the selected entries. +the custom function `set-category' on the selected entries. Note that functions in this alist don't need to be quoted." :type 'alist :group 'org-agenda) @@ -1714,12 +1740,14 @@ If STRING is non-nil, the text property will be fetched from position 0 in that string. If STRING is nil, it will be fetched from the beginning of the current line." - `(let ((marker (get-text-property (if string 0 (point-at-bol)) - 'org-hd-marker string))) - (with-current-buffer (marker-buffer marker) - (save-excursion - (goto-char marker) - ,@body)))) + (org-with-gensyms (marker) + `(let ((,marker (get-text-property (if string 0 (point-at-bol)) + 'org-hd-marker ,string))) + (with-current-buffer (marker-buffer ,marker) + (save-excursion + (goto-char ,marker) + ,@body))))) +(def-edebug-spec org-agenda-with-point-at-orig-entry (form body)) (defun org-add-agenda-custom-command (entry) "Replace or add a command in `org-agenda-custom-commands'. @@ -2298,7 +2326,7 @@ nil 'face 'org-warning))))))) t t)) ((equal keys "L") - (unless (org-mode-p) + (unless (eq major-mode 'org-mode) (error "This is not an Org-mode file")) (unless restriction (put 'org-agenda-files 'org-restrict (list bfn)) @@ -2333,7 +2361,7 @@ "The user interface for selecting an agenda command." (catch 'exit (let* ((bfn (buffer-file-name (buffer-base-buffer))) - (restrict-ok (and bfn (org-mode-p))) + (restrict-ok (and bfn (eq major-mode 'org-mode))) (region-p (org-region-active-p)) (custom org-agenda-custom-commands) (selstring "") @@ -2575,15 +2603,13 @@ 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." - (let (pars) - (while parameters - (push (list (pop parameters) (if parameters (pop parameters))) pars)) + (org-eval-in-environment (org-make-parameter-alist parameters) (if (> (length cmd-key) 2) - (eval (list 'let (nreverse pars) - (list 'org-tags-view nil cmd-key))) - (eval (list 'let (nreverse pars) (list 'org-agenda nil cmd-key)))) - (set-buffer org-agenda-buffer-name) - (princ (org-encode-for-stdout (buffer-string))))) + (org-tags-view nil cmd-key) + (org-agenda nil cmd-key))) + (set-buffer org-agenda-buffer-name) + (princ (org-encode-for-stdout (buffer-string)))) +(def-edebug-spec org-batch-agenda (form &rest sexp)) ;(defun org-encode-for-stdout (string) ; (if (fboundp 'encode-coding-string) @@ -2630,30 +2656,27 @@ priority-l The priority letter if any was given priority-n The computed numerical priority agenda-day The day in the agenda where this is listed" - - (let (pars) - (while parameters - (push (list (pop parameters) (if parameters (pop parameters))) pars)) - (push (list 'org-agenda-remove-tags t) pars) + (org-eval-in-environment (append '((org-agenda-remove-tags t)) + (org-make-parameter-alist parameters)) (if (> (length cmd-key) 2) - (eval (list 'let (nreverse pars) - (list 'org-tags-view nil cmd-key))) - (eval (list 'let (nreverse pars) (list 'org-agenda nil cmd-key)))) - (set-buffer org-agenda-buffer-name) - (let* ((lines (org-split-string (buffer-string) "\n")) - line) - (while (setq line (pop lines)) - (catch 'next - (if (not (get-text-property 0 'org-category line)) (throw 'next nil)) - (setq org-agenda-info - (org-fix-agenda-info (text-properties-at 0 line))) - (princ - (org-encode-for-stdout - (mapconcat 'org-agenda-export-csv-mapper - '(org-category txt type todo tags date time extra - priority-letter priority agenda-day) - ","))) - (princ "\n")))))) + (org-tags-view nil cmd-key) + (org-agenda nil cmd-key))) + (set-buffer org-agenda-buffer-name) + (let* ((lines (org-split-string (buffer-string) "\n")) + line) + (while (setq line (pop lines)) + (catch 'next + (if (not (get-text-property 0 'org-category line)) (throw 'next nil)) + (setq org-agenda-info + (org-fix-agenda-info (text-properties-at 0 line))) + (princ + (org-encode-for-stdout + (mapconcat 'org-agenda-export-csv-mapper + '(org-category txt type todo tags date time extra + priority-letter priority agenda-day) + ","))) + (princ "\n"))))) +(def-edebug-spec org-batch-agenda-csv (form &rest sexp)) (defun org-fix-agenda-info (props) "Make sure all properties on an agenda item have a canonical form. @@ -2703,17 +2726,14 @@ (interactive) (eval (list 'org-batch-store-agenda-views))) -;; FIXME, why is this a macro????? ;;;###autoload (defmacro org-batch-store-agenda-views (&rest parameters) "Run all custom agenda commands that have a file argument." (let ((cmds (org-agenda-normalize-custom-commands org-agenda-custom-commands)) (pop-up-frames nil) (dir default-directory) - pars cmd thiscmdkey files opts cmd-or-set) - (while parameters - (push (list (pop parameters) (if parameters (pop parameters))) pars)) - (setq pars (reverse pars)) + (pars (org-make-parameter-alist parameters)) + cmd thiscmdkey files opts cmd-or-set) (save-window-excursion (while cmds (setq cmd (pop cmds) @@ -2723,15 +2743,17 @@ files (nth (if (listp cmd-or-set) 4 5) cmd)) (if (stringp files) (setq files (list files))) (when files - (eval (list 'let (append org-agenda-exporter-settings opts pars) - (list 'org-agenda nil thiscmdkey))) + (org-eval-in-environment (append org-agenda-exporter-settings + opts pars) + (org-agenda nil thiscmdkey)) (set-buffer org-agenda-buffer-name) (while files - (eval (list 'let (append org-agenda-exporter-settings opts pars) - (list 'org-write-agenda - (expand-file-name (pop files) dir) nil t)))) + (org-eval-in-environment (append org-agenda-exporter-settings + opts pars) + (org-write-agenda (expand-file-name (pop files) dir) nil t))) (and (get-buffer org-agenda-buffer-name) (kill-buffer org-agenda-buffer-name))))))) +(def-edebug-spec org-batch-store-agenda-views (&rest sexp)) (defun org-agenda-mark-header-line (pos) "Mark the line at POS as an agenda structure header." @@ -2885,7 +2907,7 @@ (let (txt drawer-re kwd-time-re ind) (save-excursion (with-current-buffer (marker-buffer marker) - (if (not (org-mode-p)) + (if (not (eq major-mode 'org-mode)) (setq txt "") (save-excursion (save-restriction @@ -3001,7 +3023,7 @@ (defun org-check-for-org-mode () "Make sure current buffer is in org-mode. Error if not." - (or (org-mode-p) + (or (eq major-mode 'org-mode) (error "Cannot execute org-mode agenda command on buffer in %s" major-mode))) @@ -3193,17 +3215,9 @@ (setq org-blocked-by-checkboxes nil invis1 invis) (let ((marker (org-get-at-bol 'org-hd-marker))) (when (and marker - (not (with-current-buffer (marker-buffer marker) - (save-excursion - (goto-char marker) - (if (org-entry-get nil "NOBLOCKING") - t ;; Never block this entry - (run-hook-with-args-until-failure - 'org-blocker-hook - (list :type 'todo-state-change - :position marker - :from 'todo - :to 'done))))))) + (with-current-buffer (marker-buffer marker) + (save-excursion (goto-char marker) + (org-entry-blocked-p)))) (if org-blocked-by-checkboxes (setq invis1 nil)) (setq b (if invis1 (max (point-min) (1- (point-at-bol))) @@ -3337,7 +3351,7 @@ (defvar org-agenda-only-exact-dates nil) ; dynamically scoped -(defun org-timeline (&optional include-all) +(defun org-timeline (&optional dotodo) "Show a time-sorted view of the entries in the current org file. Only entries with a time stamp of today or later will be listed. With \\[universal-argument] prefix, all unfinished TODO items will also be shown, @@ -3348,7 +3362,6 @@ (org-compile-prefix-format 'timeline) (org-set-sorting-strategy 'timeline) (let* ((dopast t) - (dotodo include-all) (doclosed org-agenda-show-log) (entry (buffer-file-name (or (buffer-base-buffer (current-buffer)) (current-buffer)))) @@ -3367,7 +3380,7 @@ (setq org-agenda-redo-command (list 'progn (list 'org-switch-to-buffer-other-window (current-buffer)) - (list 'org-timeline (list 'quote include-all)))) + (list 'org-timeline (list 'quote dotodo)))) (if (not dopast) ;; Remove past dates from the list of dates. (setq day-numbers (delq nil (mapcar (lambda(x) @@ -3435,22 +3448,26 @@ (let ((re (concat (if pre-re pre-re "") (if inactive org-ts-regexp-both org-ts-regexp))) - dates dates1 date day day1 day2 ts1 ts2) + dates dates1 date day day1 day2 ts1 ts2 pos) (if force-today (setq dates (list (org-today)))) (save-excursion (goto-char beg) (while (re-search-forward re end t) (setq day (time-to-days (org-time-string-to-time - (substring (match-string 1) 0 10)))) + (substring (match-string 1) 0 10) + (current-buffer) (match-beginning 0)))) (or (memq day dates) (push day dates))) (unless no-ranges (goto-char beg) (while (re-search-forward org-tr-regexp end t) + (setq pos (match-beginning 0)) (setq ts1 (substring (match-string 1) 0 10) ts2 (substring (match-string 2) 0 10) - day1 (time-to-days (org-time-string-to-time ts1)) - day2 (time-to-days (org-time-string-to-time ts2))) + day1 (time-to-days (org-time-string-to-time + ts1 (current-buffer) pos)) + day2 (time-to-days (org-time-string-to-time + ts2 (current-buffer) pos))) (while (< (setq day1 (1+ day1)) day2) (or (memq day1 dates) (push day1 dates))))) (setq dates (sort dates '<)) @@ -3475,7 +3492,7 @@ (defvar org-starting-day nil) ; local variable in the agenda buffer (defvar org-agenda-current-span nil "The current span used in the agenda view.") ; local variable in the agenda buffer -(defvar org-include-all-loc nil) ; local variable +(defvar org-arg-loc nil) ; local variable (defvar org-agenda-entry-types '(:deadline :scheduled :timestamp :sexp) "List of types searched for when creating the daily/weekly agenda. @@ -3511,29 +3528,29 @@ the daily/weekly agenda, see `org-agenda-skip-function'.") ;;;###autoload -(defun org-agenda-list (&optional include-all start-day span) +(defun org-agenda-list (&optional arg start-day span) "Produce a daily/weekly view from all files in variable `org-agenda-files'. The view will be for the current day or week, but from the overview buffer you will be able to go to other days/weeks. With a numeric prefix argument in an interactive call, the agenda will -span INCLUDE-ALL days. Lisp programs should instead specify SPAN to change +span ARG days. Lisp programs should instead specify SPAN to change the number of days. SPAN defaults to `org-agenda-span'. START-DAY defaults to TODAY, or to the most recent match for the weekday given in `org-agenda-start-on-weekday'." (interactive "P") - (if (and (integerp include-all) (> include-all 0)) - (setq span include-all include-all nil)) + (if (and (integerp arg) (> arg 0)) + (setq span arg arg nil)) (setq start-day (or start-day org-agenda-start-day)) (if org-agenda-overriding-arguments - (setq include-all (car org-agenda-overriding-arguments) + (setq arg (car org-agenda-overriding-arguments) start-day (nth 1 org-agenda-overriding-arguments) span (nth 2 org-agenda-overriding-arguments))) (if (stringp start-day) ;; Convert to an absolute day number (setq start-day (time-to-days (org-read-date nil t start-day)))) - (setq org-agenda-last-arguments (list include-all start-day span)) + (setq org-agenda-last-arguments (list arg start-day span)) (org-compile-prefix-format 'agenda) (org-set-sorting-strategy 'agenda) (let* ((span (org-agenda-ndays-to-span @@ -3560,7 +3577,7 @@ s e rtn rtnall file date d start-pos end-pos todayp clocktable-start clocktable-end filter) (setq org-agenda-redo-command - (list 'org-agenda-list (list 'quote include-all) start-day (list 'quote span))) + (list 'org-agenda-list (list 'quote arg) start-day (list 'quote span))) (dotimes (n (1- ndays)) (push (1+ (car day-numbers)) day-numbers)) (setq day-numbers (nreverse day-numbers)) @@ -3568,7 +3585,7 @@ clocktable-end (1+ (or (org-last day-numbers) 0))) (org-prepare-agenda "Day/Week") (org-set-local 'org-starting-day (car day-numbers)) - (org-set-local 'org-include-all-loc include-all) + (org-set-local 'org-arg-loc arg) (org-set-local 'org-agenda-current-span (org-agenda-ndays-to-span span)) (unless org-agenda-compact-blocks (let* ((d1 (car day-numbers)) @@ -3619,7 +3636,7 @@ (setq rtn (apply 'org-agenda-get-day-entries file date org-agenda-entry-types))))) - (setq rtnall (append rtnall rtn)))) + (setq rtnall (append rtnall rtn)))) ;; all entries (if org-agenda-include-diary (let ((org-agenda-search-headline-for-time t)) (require 'diary-lib) @@ -3641,7 +3658,7 @@ (put-text-property s (1- (point)) 'org-day-cnt day-cnt) (when todayp (put-text-property s (1- (point)) 'org-today t)) - (if rtnall (insert + (if rtnall (insert ;; all entries (org-finalize-agenda-entries (org-agenda-add-time-grid-maybe rtnall ndays todayp)) @@ -3789,7 +3806,7 @@ (full-words org-agenda-search-view-force-full-words) (org-agenda-text-search-extra-files org-agenda-text-search-extra-files) regexp rtn rtnall files file pos - marker category tags c neg re boolean + marker category org-category-pos tags c neg re boolean ee txt beg end words regexps+ regexps- hdl-only buffer beg1 str) (unless (and (not edit-at) (stringp string) @@ -3872,7 +3889,7 @@ (if (not regexps+) (setq regexp org-outline-regexp-bol) (setq regexp (pop regexps+)) - (if hdl-only (setq regexp (concat "^" org-outline-regexp ".*?" + (if hdl-only (setq regexp (concat org-outline-regexp-bol ".*?" regexp)))) (setq files (org-agenda-files nil 'ifmode)) (when (eq (car org-agenda-text-search-extra-files) 'agenda-archives) @@ -3893,7 +3910,7 @@ file)))) (with-current-buffer buffer (with-syntax-table (org-search-syntax-table) - (unless (org-mode-p) + (unless (eq major-mode 'org-mode) (error "Agenda file %s is not in `org-mode'" file)) (let ((case-fold-search t)) (save-excursion @@ -3933,8 +3950,9 @@ (goto-char beg) (setq marker (org-agenda-new-marker (point)) category (org-get-category) + org-category-pos (get-text-property (point) 'org-category-position) tags (org-get-tags-at (point)) - txt (org-format-agenda-item + txt (org-agenda-format-item "" (buffer-substring-no-properties beg1 (point-at-eol)) @@ -3944,6 +3962,7 @@ 'org-todo-regexp org-todo-regexp 'org-complex-heading-regexp org-complex-heading-regexp 'priority 1000 'org-category category + 'org-category-position org-category-pos 'type "search") (push txt ee) (goto-char (1- end)))))))))) @@ -4084,7 +4103,7 @@ (format "ORG-AGENDA-ERROR: No such org-file %s" file)) rtnall (append rtnall rtn)) (with-current-buffer buffer - (unless (org-mode-p) + (unless (eq major-mode 'org-mode) (error "Agenda file %s is not in `org-mode'" file)) (save-excursion (save-restriction @@ -4308,8 +4327,8 @@ "\\)\\>")) (tags (nth 2 org-stuck-projects)) (tags-re (if (member "*" tags) - (org-re (concat org-outline-regexp-bol - ".*:[[:alnum:]_@#%]+:[ \t]*$")) + (concat org-outline-regexp-bol + (org-re ".*:[[:alnum:]_@#%]+:[ \t]*$")) (if tags (concat org-outline-regexp-bol ".*:\\(" @@ -4383,7 +4402,7 @@ (setq entries (mapcar (lambda (x) - (setq x (org-format-agenda-item "" x "Diary" nil 'time)) + (setq x (org-agenda-format-item "" x "Diary" nil 'time)) ;; Extend the text properties to the beginning of the line (org-add-props x (text-properties-at (1- (length x)) x) 'type "diary" 'date date 'face 'org-agenda-diary)) @@ -4528,7 +4547,7 @@ ;; If file does not exist, make sure an error message ends up in diary (list (format "ORG-AGENDA-ERROR: No such org-file %s" file)) (with-current-buffer buffer - (unless (org-mode-p) + (unless (eq major-mode 'org-mode) (error "Agenda file %s is not in `org-mode'" file)) (let ((case-fold-search nil)) (save-excursion @@ -4565,6 +4584,7 @@ (setq results (append results rtn)))))))) results)))) +(defvar org-heading-keyword-regexp-format) ; defined in org.el (defun org-agenda-get-todos () "Return the TODO information for agenda display." (let* ((props (list 'face nil @@ -4576,16 +4596,20 @@ 'help-echo (format "mouse-2 or RET jump to org file %s" (abbreviate-file-name buffer-file-name)))) - (regexp (concat "^\\*+[ \t]+\\(" - (if org-select-this-todo-keyword - (if (equal org-select-this-todo-keyword "*") - org-todo-regexp - (concat "\\<\\(" - (mapconcat 'identity (org-split-string org-select-this-todo-keyword "|") "\\|") - "\\)\\>")) - org-not-done-regexp) - "[^\n\r]*\\)")) - marker priority category tags todo-state + (regexp (format org-heading-keyword-regexp-format + (cond + ((and org-select-this-todo-keyword + (equal org-select-this-todo-keyword "*")) + org-todo-regexp) + (org-select-this-todo-keyword + (concat "\\(" + (mapconcat 'identity + (org-split-string + org-select-this-todo-keyword + "|") + "\\|") "\\)")) + (t org-not-done-regexp)))) + marker priority category org-category-pos tags todo-state ee txt beg end) (goto-char (point-min)) (while (re-search-forward regexp nil t) @@ -4598,21 +4622,24 @@ (goto-char (1+ beg)) (or org-agenda-todo-list-sublevels (org-end-of-subtree 'invisible)) (throw :skip nil))) - (goto-char (match-beginning 1)) + (goto-char (match-beginning 2)) (setq marker (org-agenda-new-marker (match-beginning 0)) category (org-get-category) - txt (match-string 1) + org-category-pos (get-text-property (point) 'org-category-position) + txt (org-trim + (buffer-substring (match-beginning 2) (match-end 0))) tags (org-get-tags-at (point)) - txt (org-format-agenda-item "" txt category tags) + txt (org-agenda-format-item "" txt category tags) priority (1+ (org-get-priority txt)) todo-state (org-get-todo-state)) (org-add-props txt props 'org-marker marker 'org-hd-marker marker 'priority priority 'org-category category + 'org-category-position org-category-pos 'type "todo" 'todo-state todo-state) (push txt ee) (if org-agenda-todo-list-sublevels - (goto-char (match-end 1)) + (goto-char (match-end 2)) (org-end-of-subtree 'invisible)))) (nreverse ee))) @@ -4694,7 +4721,7 @@ (defun org-agenda-get-timestamps () "Return the date stamp information for agenda display." - (let* ((props (list 'face nil + (let* ((props (list 'face 'org-agenda-calendar-event 'org-not-done-regexp org-not-done-regexp 'org-todo-regexp org-todo-regexp 'org-complex-heading-regexp org-complex-heading-regexp @@ -4723,8 +4750,8 @@ "\\|\\(<[0-9]+-[0-9]+-[0-9]+[^>\n]+?\\+[0-9]+[dwmy]>\\)" "\\|\\(<%%\\(([^>\n]+)\\)>\\)")) marker hdmarker deadlinep scheduledp clockp closedp inactivep - donep tmp priority category ee txt timestr tags b0 b3 e3 head - todo-state end-of-match show-all) + donep tmp priority category org-category-pos ee txt timestr tags + b0 b3 e3 head todo-state end-of-match show-all) (goto-char (point-min)) (while (setq end-of-match (re-search-forward regexp nil t)) (setq b0 (match-beginning 0) @@ -4738,7 +4765,8 @@ (org-agenda-skip) (if (and (match-end 1) (not (= d1 (org-time-string-to-absolute - (match-string 1) d1 nil show-all)))) + (match-string 1) d1 nil show-all + (current-buffer) b0)))) (throw :skip nil)) (if (and e3 (not (org-diary-sexp-entry (buffer-substring b3 e3) "" date))) @@ -4763,7 +4791,8 @@ ;; substring should only run to end of time stamp (setq timestr (substring timestr 0 (match-end 0)))) (setq marker (org-agenda-new-marker b0) - category (org-get-category b0)) + category (org-get-category b0) + org-category-pos (get-text-property b0 'org-category-position)) (save-excursion (if (not (re-search-backward org-outline-regexp-bol nil t)) (setq txt org-agenda-no-heading-message) @@ -4772,7 +4801,7 @@ tags (org-get-tags-at)) (looking-at "\\*+[ \t]+\\([^\r\n]+\\)") (setq head (or (match-string 1) "")) - (setq txt (org-format-agenda-item + (setq txt (org-agenda-format-item (if inactivep org-agenda-inactive-leader nil) head category tags timestr remove-re))) @@ -4781,6 +4810,7 @@ 'org-marker marker 'org-hd-marker hdmarker) (org-add-props txt nil 'priority priority 'org-category category 'date date + 'org-category-position org-category-pos 'todo-state todo-state 'type "timestamp") (push txt ee)) @@ -4792,13 +4822,14 @@ (defun org-agenda-get-sexps () "Return the sexp information for agenda display." (require 'diary-lib) - (let* ((props (list 'mouse-face 'highlight + (let* ((props (list 'face 'org-agenda-calendar-sexp + 'mouse-face 'highlight 'help-echo (format "mouse-2 or RET jump to org file %s" (abbreviate-file-name buffer-file-name)))) (regexp "^&?%%(") - marker category ee txt tags entry result beg b sexp sexp-entry - todo-state) + marker category org-category-pos ee txt tags entry + result beg b sexp sexp-entry todo-state) (goto-char (point-min)) (while (re-search-forward regexp nil t) (catch :skip @@ -4815,6 +4846,7 @@ (when result (setq marker (org-agenda-new-marker beg) category (org-get-category beg) + org-category-pos (get-text-property beg 'org-category-position) todo-state (org-get-todo-state)) (dolist (r (if (stringp result) @@ -4824,11 +4856,12 @@ (setq txt r) (setq txt "SEXP entry returned empty string")) - (setq txt (org-format-agenda-item + (setq txt (org-agenda-format-item "" txt category tags 'time)) (org-add-props txt props 'org-marker marker) (org-add-props txt nil 'org-category category 'date date 'todo-state todo-state + 'org-category-position org-category-pos 'type "sexp") (push txt ee))))) (nreverse ee))) @@ -4863,9 +4896,11 @@ ;; Define the` org-class' function (defun org-class (y1 m1 d1 y2 m2 d2 dayname &rest skip-weeks) "Entry applies if date is between dates on DAYNAME, but skips SKIP-WEEKS. -DAYNAME is a number between 0 (Sunday) and 6 (Saturday). SKIP-WEEKS -is any number of ISO weeks in the block period for which the item should -be skipped." +DAYNAME is a number between 0 (Sunday) and 6 (Saturday). +SKIP-WEEKS is any number of ISO weeks in the block period for which the +item should be skipped. If any of the SKIP-WEEKS arguments is the symbol +`holidays', then any date that is known by the Emacs calendar to be a +holidy will also be skipped." (let* ((date1 (calendar-absolute-from-gregorian (list m1 d1 y1))) (date2 (calendar-absolute-from-gregorian (list m2 d2 y2))) (d (calendar-absolute-from-gregorian date))) @@ -4877,6 +4912,8 @@ (progn (require 'cal-iso) (not (member (car (calendar-iso-from-absolute d)) skip-weeks)))) + (not (and (memq 'holidays skip-weeks) + (calendar-check-holidays date))) entry))) (defun org-diary-class (m1 d1 y1 m2 d2 y2 dayname &rest skip-weeks) @@ -4897,6 +4934,7 @@ (nth 2 date1) (car date1) (nth 1 date1) (nth 2 date2) (car date2) (nth 1 date2) dayname skip-weeks))) +(make-obsolete 'org-diary-class 'org-class "") (defalias 'org-get-closed 'org-agenda-get-progress) (defun org-agenda-get-progress () @@ -4932,8 +4970,8 @@ (list 0 0 0 (nth 1 date) (car date) (nth 2 date)))) 1 11)))) (org-agenda-search-headline-for-time nil) - marker hdmarker priority category tags closedp statep clockp state - ee txt extra timestr rest clocked) + marker hdmarker priority category org-category-pos tags closedp + statep clockp state ee txt extra timestr rest clocked) (goto-char (point-min)) (while (re-search-forward regexp nil t) (catch :skip @@ -4944,14 +4982,15 @@ clockp (not (or closedp statep)) state (and statep (match-string 2)) category (org-get-category (match-beginning 0)) - timestr (buffer-substring (match-beginning 0) (point-at-eol)) - ) + org-category-pos (get-text-property (match-beginning 0) 'org-category-position) + timestr (buffer-substring (match-beginning 0) (point-at-eol))) (when (string-match "\\]" timestr) ;; substring should only run to end of time stamp (setq rest (substring timestr (match-end 0)) timestr (substring timestr 0 (match-end 0))) (if (and (not closedp) (not statep) - (string-match "\\([0-9]\\{1,2\\}:[0-9]\\{2\\}\\)\\].*?\\([0-9]\\{1,2\\}:[0-9]\\{2\\}\\)" rest)) + (string-match "\\([0-9]\\{1,2\\}:[0-9]\\{2\\}\\)\\].*?\\([0-9]\\{1,2\\}:[0-9]\\{2\\}\\)" + rest)) (progn (setq timestr (concat (substring timestr 0 -1) "-" (match-string 1 rest) "]")) (setq clocked (match-string 2 rest))) @@ -4978,7 +5017,7 @@ (setq txt (concat (substring txt 0 (match-beginning 1)) " - " extra " " (match-string 2 txt))) (setq txt (concat txt " - " extra)))) - (setq txt (org-format-agenda-item + (setq txt (org-agenda-format-item (cond (closedp "Closed: ") (statep (concat "State: (" state ")")) @@ -4988,6 +5027,7 @@ (org-add-props txt props 'org-marker marker 'org-hd-marker hdmarker 'face 'org-agenda-done 'priority priority 'org-category category + 'org-category-position org-category-pos 'type "closed" 'date date 'undone-face 'org-warning 'done-face 'org-agenda-done) (push txt ee)) @@ -5006,9 +5046,9 @@ "\\(-\\{1,3\\}\\(\\[.*?\\]\\)\\)?")) ; group 3 is second (tlstart 0.) (tlend 0.) - (maxtime (org-hh:mm-string-to-minutes + (maxtime (org-hh:mm-string-to-minutes (or (plist-get pl :max-duration) "24:00"))) - (mintime (org-hh:mm-string-to-minutes + (mintime (org-hh:mm-string-to-minutes (or (plist-get pl :min-duration) 0))) (maxgap (org-hh:mm-string-to-minutes ;; default 30:00 means never complain @@ -5125,9 +5165,9 @@ (regexp org-deadline-time-regexp) (todayp (org-agenda-todayp date)) ; DATE bound by calendar (d1 (calendar-absolute-from-gregorian date)) ; DATE bound by calendar - d2 diff dfrac wdays pos pos1 category tags - suppress-prewarning - ee txt head face s todo-state show-all upcomingp donep timestr) + d2 diff dfrac wdays pos pos1 category org-category-pos + tags suppress-prewarning ee txt head face s todo-state + show-all upcomingp donep timestr) (goto-char (point-min)) (while (re-search-forward regexp nil t) (setq suppress-prewarning nil) @@ -5150,13 +5190,14 @@ (member todo-state org-agenda-repeating-timestamp-show-all)) d2 (org-time-string-to-absolute - (match-string 1) d1 'past show-all) + (match-string 1) d1 'past show-all + (current-buffer) pos) diff (- d2 d1) wdays (if suppress-prewarning (let ((org-deadline-warning-days suppress-prewarning)) (org-get-wdays s)) (org-get-wdays s)) - dfrac (/ (* 1.0 (- wdays diff)) (max wdays 1)) + dfrac (- 1 (/ (* 1.0 diff) (max wdays 1))) upcomingp (and todayp (> diff 0))) ;; When to show a deadline in the calendar: ;; If the expiration is within wdays warning time. @@ -5171,7 +5212,8 @@ (or org-agenda-skip-deadline-if-done (not (= diff 0)))) (setq txt nil) - (setq category (org-get-category)) + (setq category (org-get-category) + org-category-pos (get-text-property (point) 'org-category-position)) (if (not (re-search-backward "^\\*+[ \t]+" nil t)) (setq txt org-agenda-no-heading-message) (goto-char (match-end 0)) @@ -5185,7 +5227,7 @@ (setq timestr (concat (substring s (match-beginning 1)) " ")) (setq timestr 'time)) - (setq txt (org-format-agenda-item + (setq txt (org-agenda-format-item (if (= diff 0) (car org-agenda-deadline-leaders) (if (functionp @@ -5198,13 +5240,14 @@ head category tags (if (not (= diff 0)) nil timestr))))) (when txt - (setq face (org-agenda-deadline-face dfrac wdays)) + (setq face (org-agenda-deadline-face dfrac)) (org-add-props txt props 'org-marker (org-agenda-new-marker pos) 'org-hd-marker (org-agenda-new-marker pos1) 'priority (+ (- diff) (org-get-priority txt)) 'org-category category + 'org-category-position org-category-pos 'todo-state todo-state 'type (if upcomingp "upcoming-deadline" "deadline") 'date (if upcomingp date d2) @@ -5213,10 +5256,9 @@ (push txt ee)))))) (nreverse ee))) -(defun org-agenda-deadline-face (fraction &optional wdays) +(defun org-agenda-deadline-face (fraction) "Return the face to displaying a deadline item. FRACTION is what fraction of the head-warning time has passed." - (if (equal wdays 0) (setq fraction 1.)) (let ((faces org-agenda-deadline-faces) f) (catch 'exit (while (setq f (pop faces)) @@ -5241,7 +5283,7 @@ 0 'org-hd-marker a)) (cons (marker-position mm) a))) deadline-results)) - d2 diff pos pos1 category tags donep + d2 diff pos pos1 category org-category-pos tags donep ee txt head pastschedp todo-state face timestr s habitp show-all) (goto-char (point-min)) (while (re-search-forward regexp nil t) @@ -5255,7 +5297,8 @@ (member todo-state org-agenda-repeating-timestamp-show-all)) d2 (org-time-string-to-absolute - (match-string 1) d1 'past show-all) + (match-string 1) d1 'past show-all + (current-buffer) pos) diff (- d2 d1)) (setq pastschedp (and todayp (< diff 0))) ;; When to show a scheduled item in the calendar: @@ -5274,7 +5317,8 @@ (setq txt nil) (setq habitp (and (functionp 'org-is-habit-p) (org-is-habit-p))) - (setq category (org-get-category)) + (setq category (org-get-category) + org-category-pos (get-text-property (point) 'org-category-position)) (if (not (re-search-backward "^\\*+[ \t]+" nil t)) (setq txt org-agenda-no-heading-message) (goto-char (match-end 0)) @@ -5298,7 +5342,7 @@ (setq timestr (concat (substring s (match-beginning 1)) " ")) (setq timestr 'time)) - (setq txt (org-format-agenda-item + (setq txt (org-agenda-format-item (if (= diff 0) (car org-agenda-scheduled-leaders) (format (nth 1 org-agenda-scheduled-leaders) @@ -5325,6 +5369,7 @@ (org-habit-get-priority habitp) (+ 94 (- 5 diff) (org-get-priority txt))) 'org-category category + 'org-category-position org-category-pos 'org-habit-p habitp 'todo-state todo-state) (push txt ee)))))) @@ -5342,8 +5387,8 @@ (abbreviate-file-name buffer-file-name)))) (regexp org-tr-regexp) (d0 (calendar-absolute-from-gregorian date)) - marker hdmarker ee txt d1 d2 s1 s2 category todo-state tags pos - head donep) + marker hdmarker ee txt d1 d2 s1 s2 category org-category-pos + todo-state tags pos head donep) (goto-char (point-min)) (while (re-search-forward regexp nil t) (catch :skip @@ -5353,8 +5398,8 @@ (end-time (match-string 2))) (setq s1 (match-string 1) s2 (match-string 2) - d1 (time-to-days (org-time-string-to-time s1)) - d2 (time-to-days (org-time-string-to-time s2))) + d1 (time-to-days (org-time-string-to-time s1 (current-buffer) pos)) + d2 (time-to-days (org-time-string-to-time s2 (current-buffer) pos))) (if (and (> (- d0 d1) -1) (> (- d2 d0) -1)) ;; Only allow days between the limits, because the normal ;; date stamps will catch the limits. @@ -5364,7 +5409,8 @@ (if (and donep org-agenda-skip-timestamp-if-done) (throw :skip t)) (setq marker (org-agenda-new-marker (point))) - (setq category (org-get-category)) + (setq category (org-get-category) + org-category-pos (get-text-property (point) 'org-category-position)) (if (not (re-search-backward org-outline-regexp-bol nil t)) (setq txt org-agenda-no-heading-message) (goto-char (match-beginning 0)) @@ -5379,13 +5425,15 @@ "--" "<" (regexp-quote s2) ".*?>") nil))) - (setq txt (org-format-agenda-item + (setq txt (org-agenda-format-item (format (nth (if (= d1 d2) 0 1) org-agenda-timerange-leaders) (1+ (- d0 d1)) (1+ (- d2 d1))) head category tags - (cond ((= d1 d0) + (cond ((and (= d1 d0) (= d2 d0)) + (concat "<" start-time ">--<" end-time ">")) + ((= d1 d0) (concat "<" start-time ">")) ((= d2 d0) (concat "<" end-time ">")) @@ -5395,7 +5443,8 @@ 'org-marker marker 'org-hd-marker hdmarker 'type "block" 'date date 'todo-state todo-state - 'priority (org-get-priority txt) 'org-category category) + 'priority (org-get-priority txt) 'org-category category + 'org-category-position org-category-pos) (push txt ee)))) (goto-char pos))) ;; Sort the entries by expiration date. @@ -5425,7 +5474,7 @@ (return (cadr entry)) (return (apply 'create-image (cdr entry))))))) -(defun org-format-agenda-item (extra txt &optional category tags dotime +(defun org-agenda-format-item (extra txt &optional category tags dotime remove-re habitp) "Format TXT to be inserted into the agenda buffer. In particular, it adds the prefix and corresponding text properties. EXTRA @@ -5467,7 +5516,7 @@ (time-of-day (and dotime (org-get-time-of-day ts))) stamp plain s0 s1 s2 rtn srp l duration thecategory) - (and (org-mode-p) buffer-file-name + (and (eq major-mode 'org-mode) buffer-file-name (add-to-list 'org-agenda-contributing-files buffer-file-name)) (when (and dotime time-of-day) ;; Extract starting and ending time and move them to prefix @@ -5515,7 +5564,7 @@ (concat (make-string (max (- 50 (length txt)) 1) ?\ ) (match-string 2 txt)) t t txt)))) - (when (org-mode-p) + (when (eq major-mode 'org-mode) (setq effort (condition-case nil (org-get-effort @@ -5645,14 +5694,14 @@ (while (setq time (pop gridtimes)) (unless (and remove (member time have)) (setq time (replace-regexp-in-string " " "0" (format "%04s" time))) - (push (org-format-agenda-item + (push (org-agenda-format-item nil string "" nil (concat (substring time 0 -2) ":" (substring time -2))) new) (put-text-property 2 (length (car new)) 'face 'org-time-grid (car new)))) (when (and todayp org-agenda-show-current-time-in-grid) - (push (org-format-agenda-item + (push (org-agenda-format-item nil org-agenda-current-time-string "" nil @@ -5670,7 +5719,8 @@ The resulting form is returned and stored in the variable `org-prefix-format-compiled'." (setq org-prefix-has-time nil org-prefix-has-tag nil - org-prefix-category-length nil org-prefix-has-effort nil) + org-prefix-category-length nil + org-prefix-has-effort nil) (let ((s (cond ((stringp org-agenda-prefix-format) org-agenda-prefix-format) @@ -5782,7 +5832,7 @@ (defun org-agenda-highlight-todo (x) (let ((org-done-keywords org-done-keywords-for-agenda) (case-fold-search nil) - re) + re) (if (eq x 'line) (save-excursion (beginning-of-line 1) @@ -5803,13 +5853,13 @@ (add-text-properties (or (match-end 1) (match-end 0)) (match-end 0) (list 'face (org-get-todo-face (match-string 2 x))) - x) + x) (when (match-end 1) (setq x (concat (substring x 0 (match-end 1)) (format org-agenda-todo-keyword-format (match-string 2 x)) - (org-add-props " " (text-properties-at 0 x)) - (substring x (match-end 3))))))) + (org-add-props " " (text-properties-at 0 x)) + (substring x (match-end 3))))))) x))) (defsubst org-cmp-priority (a b) @@ -5821,7 +5871,7 @@ (t nil)))) (defsubst org-cmp-effort (a b) - "Compare the priorities of string A and B." + "Compare the effort values of string A and B." (let* ((def (if org-sort-agenda-noeffort-is-high 32767 -1)) (ea (or (get-text-property 1 'effort-minutes a) def)) (eb (or (get-text-property 1 'effort-minutes b) def))) @@ -6202,8 +6252,8 @@ (org-agenda-filter-apply org-agenda-filter) (setq maybe-refresh t)) (t (error "Invalid tag selection character %c" char))) - (when (or maybe-refresh - (eq org-agenda-clockreport-mode 'with-filter)) + (when (and maybe-refresh + (eq org-agenda-clockreport-mode 'with-filter)) (org-agenda-redo)))) (defun org-agenda-get-represented-tags () @@ -6218,7 +6268,7 @@ tags)) (defun org-agenda-filter-by-tag-refine (strip &optional char) - "Refine the current filter. See `org-agenda-filter-by-tag." + "Refine the current filter. See `org-agenda-filter-by-tag'." (interactive "P") (org-agenda-filter-by-tag strip char 'refine)) @@ -6595,8 +6645,7 @@ (interactive) (setq org-agenda-follow-mode (not org-agenda-follow-mode)) (org-agenda-set-mode-name) - (if (and org-agenda-follow-mode (org-get-at-bol 'org-marker)) - (org-agenda-show)) + (org-agenda-do-context-action) (message "Follow mode is %s" (if org-agenda-follow-mode "on" "off"))) @@ -6717,13 +6766,20 @@ ((eq org-agenda-show-log 'clockcheck) " ClkCk") (org-agenda-show-log " Log") (t "")) + ;; show tags used for filtering in a custom face (if (or org-agenda-filter (get 'org-agenda-filter :preset-filter)) - (concat " {" (mapconcat - 'identity - (append (get 'org-agenda-filter - :preset-filter) - org-agenda-filter) "") "}") + '(:eval (org-propertize + (concat " {" + (mapconcat + 'identity + (append + (get 'org-agenda-filter :preset-filter) + org-agenda-filter) + "") + "}") + 'face 'org-agenda-filter-tags + 'help-echo "Tags used in filtering")) "") (if org-agenda-archives-mode (if (eq org-agenda-archives-mode t) @@ -6757,11 +6813,13 @@ (defun org-agenda-do-context-action () "Show outline path and, maybe, follow mode window." (let ((m (org-get-at-bol 'org-marker))) - (if (and org-agenda-follow-mode m) - (org-agenda-show)) - (if (and m org-agenda-show-outline-path) - (org-with-point-at m - (org-display-outline-path t))))) + (when (and (markerp m) (marker-buffer m)) + (and org-agenda-follow-mode + (if org-agenda-follow-indirect + (org-agenda-tree-to-indirect-buffer) + (org-agenda-show))) + (and org-agenda-show-outline-path + (org-with-point-at m (org-display-outline-path t)))))) (defun org-agenda-show-priority () "Show the priority of the current item. @@ -6791,7 +6849,7 @@ (widen) (push-mark) (goto-char pos) - (when (org-mode-p) + (when (eq major-mode 'org-mode) (org-show-context 'agenda) (save-excursion (and (outline-next-heading) @@ -6820,7 +6878,7 @@ (with-current-buffer buffer (save-excursion (goto-char pos) - (if (and (org-mode-p) (not (member type '("sexp")))) + (if (and (eq major-mode 'org-mode) (not (member type '("sexp")))) (setq dbeg (progn (org-back-to-heading t) (point)) dend (org-end-of-subtree t t)) (setq dbeg (point-at-bol) @@ -6872,7 +6930,7 @@ (pos (marker-position marker))) (org-with-remote-undo buffer (with-current-buffer buffer - (if (org-mode-p) + (if (eq major-mode 'org-mode) (if (and confirm (not (y-or-n-p "Archive this subtree or entry? "))) (error "Abort") @@ -6977,7 +7035,7 @@ (and delete-other-windows (delete-other-windows)) (widen) (goto-char pos) - (when (org-mode-p) + (when (eq major-mode 'org-mode) (org-show-context 'agenda) (save-excursion (and (outline-next-heading) @@ -7141,6 +7199,22 @@ With a \\[universal-argument] prefix, make a separate frame for this tree (i.e. don't use the dedicated frame)." (interactive) + (if (and current-prefix-arg (listp current-prefix-arg)) + (org-agenda-do-tree-to-indirect-buffer) + (let ((agenda-window (selected-window)) + (indirect-window (get-buffer-window org-last-indirect-buffer))) + (save-window-excursion (org-agenda-do-tree-to-indirect-buffer)) + (unwind-protect + (progn + (unless indirect-window + (setq indirect-window (split-window agenda-window))) + (select-window indirect-window) + (switch-to-buffer org-last-indirect-buffer :norecord) + (fit-window-to-buffer indirect-window)) + (select-window agenda-window))))) + +(defun org-agenda-do-tree-to-indirect-buffer () + "Same as `org-agenda-tree-to-indirect-buffer' without saving window." (org-agenda-check-no-diary) (let* ((marker (or (org-get-at-bol 'org-marker) (org-agenda-error))) @@ -7230,7 +7304,7 @@ &optional fixface just-this) "Change all lines in the agenda buffer which match HDMARKER. The new content of the line will be NEWHEAD (as modified by -`org-format-agenda-item'). HDMARKER is checked with +`org-agenda-format-item'). HDMARKER is checked with `equal' against all `org-hd-marker' text properties in the file. If FIXFACE is non-nil, the face of each item is modified according to the new TODO state. @@ -7263,7 +7337,7 @@ (save-excursion (save-restriction (widen) - (org-format-agenda-item (org-get-at-bol 'extra) + (org-agenda-format-item (org-get-at-bol 'extra) newhead cat tags dotime))))) pl (text-property-any (point-at-bol) (point-at-eol) 'org-heading t) undone-face (org-get-at-bol 'undone-face) @@ -7497,15 +7571,33 @@ (let* ((marker (or (org-get-at-bol 'org-marker) (org-agenda-error))) (buffer (marker-buffer marker)) - (pos (marker-position marker))) + (pos (marker-position marker)) + cdate today) (org-with-remote-undo buffer - (with-current-buffer buffer - (widen) - (goto-char pos) - (if (not (org-at-timestamp-p)) - (error "Cannot find time stamp")) - (org-timestamp-change arg (or what 'day))) - (org-agenda-show-new-time marker org-last-changed-timestamp)) + (with-current-buffer buffer + (widen) + (goto-char pos) + (if (not (org-at-timestamp-p)) + (error "Cannot find time stamp")) + (when (and org-agenda-move-date-from-past-immediately-to-today + (equal arg 1) + (or (not what) (eq what 'day)) + (not (save-match-data (org-at-date-range-p)))) + (setq cdate (org-parse-time-string (match-string 0) 'nodefault) + cdate (calendar-absolute-from-gregorian + (list (nth 4 cdate) (nth 3 cdate) (nth 5 cdate))) + today (org-today)) + (if (> today cdate) + ;; immediately shift to today + (setq arg (- today cdate)))) + (org-timestamp-change arg (or what 'day)) + (when (and (org-at-date-range-p) + (re-search-backward org-tr-regexp-both (point-at-bol))) + (let ((end org-last-changed-timestamp)) + (org-timestamp-change arg (or what 'day)) + (setq org-last-changed-timestamp + (concat org-last-changed-timestamp "--" end))))) + (org-agenda-show-new-time marker org-last-changed-timestamp)) (message "Time stamp changed to %s" org-last-changed-timestamp))) (defun org-agenda-date-earlier (arg &optional what) @@ -7846,10 +7938,10 @@ (org-agenda-time-leading-zero t) fmt time time2) (if org-agenda-insert-diary-extract-time - ;; Use org-format-agenda-item to parse text for a time-range and + ;; Use org-agenda-format-item to parse text for a time-range and ;; remove it. FIXME: This is a hack, we should refactor ;; that function to make time extraction available separately - (setq fmt (org-format-agenda-item nil text nil nil t) + (setq fmt (org-agenda-format-item nil text nil nil t) time (get-text-property 0 'time fmt) time2 (if (> (length time) 0) ;; split-string removes trailing ...... if @@ -8302,7 +8394,8 @@ (progn (message "Skipping removed entry at %s" e) (setq cntskip (1+ cntskip))) (goto-char pos) - (eval cmd) + (let (org-loop-over-headlines-in-active-region) + (eval cmd)) (setq org-agenda-bulk-marked-entries (delete e org-agenda-bulk-marked-entries)) (setq cnt (1+ cnt)))) @@ -8368,7 +8461,7 @@ (defvar appt-time-msg-list) ;;;###autoload -(defun org-agenda-to-appt (&optional refresh filter) +(defun org-agenda-to-appt (&optional refresh filter &rest args) "Activate appointments found in `org-agenda-files'. With a \\[universal-argument] prefix, refresh the list of appointments. @@ -8379,6 +8472,10 @@ If FILTER is a string, use this string as a regular expression for filtering entries out. +If FILTER is a function, filter out entries against which +calling the function returns nil. This function takes one +argument: an entry from `org-agenda-get-day-entries'. + FILTER can also be an alist with the car of each cell being either 'headline or 'category. For example: @@ -8386,12 +8483,18 @@ (category \"Work\")) will only add headlines containing IMPORTANT or headlines -belonging to the \"Work\" category." +belonging to the \"Work\" category. + +ARGS are symbols indicating what kind of entries to consider. +By default `org-agenda-to-appt' will use :deadline, :scheduled +and :timestamp entries. See the docstring of `org-diary' for +details and examples." (interactive "P") (if refresh (setq appt-time-msg-list nil)) (if (eq filter t) (setq filter (read-from-minibuffer "Regexp filter: "))) (let* ((cnt 0) ; count added events + (scope (or args '(:deadline :scheduled :timestamp))) (org-agenda-new-buffers nil) (org-deadline-warning-days 0) ;; Do not use `org-today' here because appt only takes @@ -8405,10 +8508,10 @@ (org-prepare-agenda-buffers files) (while (setq file (pop files)) (setq entries - (append entries - (org-agenda-get-day-entries - file today :timestamp :scheduled :deadline)))) - (setq entries (delq nil entries)) + (delq nil + (append entries + (apply 'org-agenda-get-day-entries + file today scope))))) ;; Map thru entries and find if we should filter them out (mapc (lambda(x) @@ -8417,11 +8520,14 @@ (tod (get-text-property 1 'time-of-day x)) (ok (or (null filter) (and (stringp filter) (string-match filter evt)) + (and (functionp filter) (funcall filter x)) (and (listp filter) - (or (string-match - (cadr (assoc 'category filter)) cat) - (string-match - (cadr (assoc 'headline filter)) evt)))))) + (let ((cat-filter (cadr (assoc 'category filter))) + (evt-filter (cadr (assoc 'headline filter)))) + (or (and (stringp cat-filter) + (string-match cat-filter cat)) + (and (stringp evt-filter) + (string-match evt-filter evt)))))))) ;; FIXME: Shall we remove text-properties for the appt text? ;; (setq evt (set-text-properties 0 (length evt) nil evt)) (when (and ok tod) @@ -8444,8 +8550,14 @@ date))) (eq date today))) -(provide 'org-agenda) +(defun org-agenda-todo-yesterday (&optional arg) + "Like `org-agenda-todo' but the time of change will be 23:59 of yesterday" + (interactive "P") + (let* ((hour (third (decode-time + (org-current-time)))) + (org-extend-today-until (1+ hour))) + (org-agenda-todo arg))) -;; arch-tag: 77f7565d-7c4b-44af-a2df-9f6f7070cff1 +(provide 'org-agenda) ;;; org-agenda.el ends here diff -Nru org-mode-7.7/lisp/org-archive.el org-mode-7.8.02/lisp/org-archive.el --- org-mode-7.7/lisp/org-archive.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/org-archive.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,12 +1,10 @@ ;;; org-archive.el --- Archiving for Org-mode -;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 -;; Free Software Foundation, Inc. +;; Copyright (C) 2004-2011 Free Software Foundation, Inc. ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; ;; This file is part of GNU Emacs. ;; @@ -255,7 +253,7 @@ (let (this-command) (org-copy-subtree 1 nil t)) (set-buffer buffer) ;; Enforce org-mode for the archive buffer - (if (not (org-mode-p)) + (if (not (eq major-mode 'org-mode)) ;; Force the mode for future visits. (let ((org-insert-mode-line-in-empty-file t) (org-inhibit-startup t)) @@ -355,7 +353,7 @@ (widen) (let (b e pos leader level) (org-back-to-heading t) - (looking-at outline-regexp) + (looking-at org-outline-regexp) (setq leader (match-string 0) level (funcall outline-level)) (setq pos (point)) @@ -406,7 +404,7 @@ If the cursor is not on a headline, try all level 1 trees. If it is on a headline, try all direct children. When TAG is non-nil, don't move trees, but mark them with the ARCHIVE tag." - (let ((re (concat org-outline-regexp-bol "+" org-not-done-regexp)) re1 + (let ((re org-not-done-heading-regexp) re1 (rea (concat ".*:" org-archive-tag ":")) (begm (make-marker)) (endm (make-marker)) @@ -483,6 +481,4 @@ (provide 'org-archive) -;; arch-tag: 0837f601-9699-43c3-8b90-631572ae6c85 - ;;; org-archive.el ends here diff -Nru org-mode-7.7/lisp/org-ascii.el org-mode-7.8.02/lisp/org-ascii.el --- org-mode-7.7/lisp/org-ascii.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/org-ascii.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,12 +1,10 @@ ;;; org-ascii.el --- ASCII export for Org-mode -;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 -;; Free Software Foundation, Inc. +;; Copyright (C) 2004-2011 Free Software Foundation, Inc. ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; ;; This file is part of GNU Emacs. ;; @@ -146,7 +144,7 @@ (interactive "r") (let (reg ascii buf pop-up-frames) (save-window-excursion - (if (org-mode-p) + (if (eq major-mode 'org-mode) (setq ascii (org-export-region-as-ascii beg end t 'string)) (setq reg (buffer-substring beg end) @@ -285,7 +283,7 @@ "UNTITLED")) (email (plist-get opt-plist :email)) (language (plist-get opt-plist :language)) - (quote-re0 (concat "^[ \t]*" org-quote-string "\\>")) + (quote-re0 (concat "^\\(" org-quote-string "\\)\\( +\\|[ \t]*$\\)")) (todo nil) (lang-words nil) (region @@ -408,7 +406,7 @@ txt)) (setq txt (replace-match "" t t txt))) (if (string-match quote-re0 txt) - (setq txt (replace-match "" t t txt))) + (setq txt (replace-match "" t t txt 1))) (if org-export-with-section-numbers (setq txt (concat (org-section-number level) @@ -726,5 +724,4 @@ (provide 'org-ascii) -;; arch-tag: aa96f882-f477-4e13-86f5-70d43e7adf3c ;;; org-ascii.el ends here diff -Nru org-mode-7.7/lisp/org-attach.el org-mode-7.8.02/lisp/org-attach.el --- org-mode-7.7/lisp/org-attach.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/org-attach.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,10 +1,9 @@ ;;; org-attach.el --- Manage file attachments to org-mode tasks -;; Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. +;; Copyright (C) 2008-2011 Free Software Foundation, Inc. ;; Author: John Wiegley ;; Keywords: org data task -;; Version: 7.7 ;; This file is part of GNU Emacs. ;; @@ -437,5 +436,4 @@ (provide 'org-attach) -;; arch-tag: fce93c2e-fe07-4fa3-a905-e10dcc7a6248 ;;; org-attach.el ends here diff -Nru org-mode-7.7/lisp/org-bbdb.el org-mode-7.8.02/lisp/org-bbdb.el --- org-mode-7.7/lisp/org-bbdb.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/org-bbdb.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,13 +1,11 @@ ;;; org-bbdb.el --- Support for links to BBDB entries from within Org-mode -;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 -;; Free Software Foundation, Inc. +;; Copyright (C) 2004-2011 Free Software Foundation, Inc. ;; Author: Carsten Dominik , ;; Thomas Baumann ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; ;; This file is part of GNU Emacs. ;; @@ -392,6 +390,4 @@ (provide 'org-bbdb) -;; arch-tag: 9e4f275d-d080-48c1-b040-62247f66b5c2 - ;;; org-bbdb.el ends here diff -Nru org-mode-7.7/lisp/org-beamer.el org-mode-7.8.02/lisp/org-beamer.el --- org-mode-7.7/lisp/org-beamer.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/org-beamer.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,8 +1,7 @@ ;;; org-beamer.el --- Beamer-specific LaTeX export for org-mode ;; -;; Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +;; Copyright (C) 2007-2011 Free Software Foundation, Inc. ;; -;; Version: 7.7 ;; Author: Carsten Dominik ;; Maintainer: Carsten Dominik ;; Keywords: org, wp, tex @@ -632,6 +631,4 @@ (provide 'org-beamer) -;; arch-tag: 68bac91a-a946-43a3-8173-a9269306f67c - ;;; org-beamer.el ends here diff -Nru org-mode-7.7/lisp/org-bibtex.el org-mode-7.8.02/lisp/org-bibtex.el --- org-mode-7.7/lisp/org-bibtex.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/org-bibtex.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,12 +1,11 @@ ;;; org-bibtex.el --- Org links to BibTeX entries ;; -;; Copyright (C) 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. +;; Copyright (C) 2007-2011 Free Software Foundation, Inc. ;; ;; Author: Bastien Guerry ;; Carsten Dominik ;; Eric Schulte ;; Keywords: org, wp, remember -;; Version: 7.7 ;; ;; This file is part of GNU Emacs. ;; @@ -215,7 +214,7 @@ "List to hold parsed bibtex entries.") (defcustom org-bibtex-autogen-keys nil - "Set to a truthy value to use `bibtex-generate-autokey' to generate keys." + "Set to a truth value to use `bibtex-generate-autokey' to generate keys." :group 'org-bibtex :type 'boolean) @@ -275,12 +274,20 @@ :group 'org-bibtex :type '(repeat :tag "Tag" (string))) +(defcustom org-bibtex-type-property-name "btype" + "Property in which to store bibtex entry type (e.g., article)." + :group 'org-bibtex + :type 'string) + ;;; Utility functions (defun org-bibtex-get (property) ((lambda (it) (when it (org-babel-trim it))) - (or (org-entry-get (point) (upcase property)) - (org-entry-get (point) (concat org-bibtex-prefix (upcase property)))))) + (let ((org-special-properties + (delete "FILE" (copy-sequence org-special-properties)))) + (or + (org-entry-get (point) (upcase property)) + (org-entry-get (point) (concat org-bibtex-prefix (upcase property))))))) (defun org-bibtex-put (property value) (let ((prop (upcase (if (keywordp property) @@ -303,7 +310,7 @@ lsts)))) (let ((notes (buffer-string)) (id (org-bibtex-get org-bibtex-key-property)) - (type (org-bibtex-get "type")) + (type (org-bibtex-get org-bibtex-type-property-name)) (tags (when org-bibtex-tags-are-keywords (delq nil (mapcar @@ -317,16 +324,20 @@ (let ((entry (format "@%s{%s,\n%s\n}\n" type id (mapconcat - (lambda (pair) (format " %s={%s}" (car pair) (cdr pair))) + (lambda (pair) + (format " %s={%s}" (car pair) (cdr pair))) (remove nil (if (and org-bibtex-export-arbitrary-fields org-bibtex-prefix) (mapcar (lambda (kv) (let ((key (car kv)) (val (cdr kv))) - (when (and (string-match org-bibtex-prefix key) - (not (string= - (downcase (concat org-bibtex-prefix "TYPE")) (downcase key)))) + (when (and + (string-match org-bibtex-prefix key) + (not (string= + (downcase (concat org-bibtex-prefix + org-bibtex-type-property-name)) + (downcase key)))) (cons (downcase (replace-regexp-in-string org-bibtex-prefix "" key)) val)))) @@ -514,9 +525,20 @@ "Bibtex file: " nil nil nil (file-name-nondirectory (concat (file-name-sans-extension (buffer-file-name)) ".bib"))))) - (let ((bibtex-entries (remove nil (org-map-entries #'org-bibtex-headline)))) - (with-temp-file filename - (insert (mapconcat #'identity bibtex-entries "\n"))))) + ((lambda (error-point) + (when error-point + (goto-char error-point) + (message "Bibtex error at %S" (nth 4 (org-heading-components))))) + (catch 'bib + (let ((bibtex-entries (remove nil (org-map-entries + (lambda () + (condition-case foo + (org-bibtex-headline) + (error (throw 'bib (point))))))))) + (with-temp-file filename + (insert (mapconcat #'identity bibtex-entries "\n"))) + (message "Successfully exported %d bibtex entries to %s" + (length bibtex-entries) filename) nil)))) (defun org-bibtex-check (&optional optional) "Check the current headline for required fields. @@ -525,7 +547,7 @@ (save-restriction (org-narrow-to-subtree) (let ((type ((lambda (name) (when name (intern (concat ":" name)))) - (org-bibtex-get "TYPE")))) + (org-bibtex-get org-bibtex-type-property-name)))) (when type (org-bibtex-fleshout type optional))))) (defun org-bibtex-check-all (&optional optional) @@ -542,7 +564,8 @@ "Type: " (mapcar (lambda (type) (substring (symbol-name (car type)) 1)) org-bibtex-types) - nil nil (when nonew (org-bibtex-get "TYPE")))) + nil nil (when nonew + (org-bibtex-get org-bibtex-type-property-name)))) (type (if (keywordp type) type (intern (concat ":" type)))) (org-bibtex-treat-headline-as-title (if nonew nil t))) (unless (assoc type org-bibtex-types) @@ -553,7 +576,8 @@ (let ((title (org-bibtex-ask :title))) (insert title) (org-bibtex-put "TITLE" title))) - (org-bibtex-put "TYPE" (substring (symbol-name type) 1)) + (org-bibtex-put org-bibtex-type-property-name + (substring (symbol-name type) 1)) (org-bibtex-fleshout type arg) (mapc (lambda (tag) (org-toggle-tag tag 'on)) org-bibtex-tags))) @@ -598,7 +622,7 @@ (org-insert-heading) (insert (val :title)) (org-bibtex-put "TITLE" (val :title)) - (org-bibtex-put "TYPE" (downcase (val :type))) + (org-bibtex-put org-bibtex-type-property-name (downcase (val :type))) (dolist (pair entry) (case (car pair) (:title nil) @@ -637,11 +661,10 @@ (let ((org-agenda-overriding-header "Bib search results:") (org-agenda-search-view-always-boolean t)) (org-search-view nil - (format "%s +{:%sTYPE:}" - string org-bibtex-prefix)))) + (format "%s +{:%s%s:}" + string org-bibtex-prefix + org-bibtex-type-property-name)))) (provide 'org-bibtex) -;; arch-tag: 83987d5a-01b8-41c7-85bc-77700f1285f5 - ;;; org-bibtex.el ends here diff -Nru org-mode-7.7/lisp/org-capture.el org-mode-7.8.02/lisp/org-capture.el --- org-mode-7.7/lisp/org-capture.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/org-capture.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,11 +1,10 @@ ;;; org-capture.el --- Fast note taking in Org-mode -;; Copyright (C) 2010 Free Software Foundation, Inc. +;; Copyright (C) 2010-2011 Free Software Foundation, Inc. ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; ;; This file is part of GNU Emacs. ;; @@ -334,7 +333,8 @@ (defcustom org-capture-before-finalize-hook nil "Hook that is run right before a capture process is finalized. -The capture buffer is still current when this hook runs." +The capture buffer is still current when this hook runs and it is +widened to the entire buffer." :group 'org-capture :type 'hook) @@ -486,7 +486,7 @@ (error "Capture template `%s': %s" (org-capture-get :key) (nth 1 error)))) - (if (and (org-mode-p) + (if (and (eq major-mode 'org-mode) (org-capture-get :clock-in)) (condition-case nil (progn @@ -576,7 +576,7 @@ (org-capture-empty-lines-after (or (org-capture-get :empty-lines 'local) 0)))) ;; Postprocessing: Update Statistics cookies, do the sorting - (when (org-mode-p) + (when (eq major-mode 'org-mode) (save-excursion (when (ignore-errors (org-back-to-heading)) (org-update-parent-todo-statistics) @@ -724,7 +724,7 @@ (widen) (let ((hd (nth 2 target))) (goto-char (point-min)) - (unless (org-mode-p) + (unless (eq major-mode 'org-mode) (error "Target buffer \"%s\" for file+headline should be in Org mode" (current-buffer))) @@ -756,7 +756,7 @@ (goto-char (if (org-capture-get :prepend) (match-beginning 0) (match-end 0))) (org-capture-put :exact-position (point)) - (setq target-entry-p (and (org-mode-p) (org-at-heading-p)))) + (setq target-entry-p (and (eq major-mode 'org-mode) (org-at-heading-p)))) (error "No match for target regexp in file %s" (nth 1 target)))) ((memq (car target) '(file+datetree file+datetree+prompt)) @@ -778,7 +778,8 @@ (let ((prompt-time (org-read-date nil t nil "Date for tree entry:" (current-time)))) - (org-capture-put :prompt-time prompt-time) + (org-capture-put :prompt-time prompt-time + :default-time prompt-time) (time-to-days prompt-time))) (t ;; current date, possible corrected for late night workers @@ -790,12 +791,12 @@ (widen) (funcall (nth 2 target)) (org-capture-put :exact-position (point)) - (setq target-entry-p (and (org-mode-p) (org-at-heading-p)))) + (setq target-entry-p (and (eq major-mode 'org-mode) (org-at-heading-p)))) ((eq (car target) 'function) (funcall (nth 1 target)) (org-capture-put :exact-position (point)) - (setq target-entry-p (and (org-mode-p) (org-at-heading-p)))) + (setq target-entry-p (and (eq major-mode 'org-mode) (org-at-heading-p)))) ((eq (car target) 'clock) (if (and (markerp org-clock-hd-marker) @@ -849,6 +850,7 @@ (goto-char (org-capture-get :pos)) (org-set-local 'org-capture-target-marker (move-marker (make-marker) (point))) + (org-set-local 'outline-level 'org-outline-level) (let* ((template (org-capture-get :template)) (type (org-capture-get :type))) (case type @@ -1148,11 +1150,11 @@ (or (bolp) (newline)) (setq beg (point)) (cond - ((and (eq type 'entry) (org-mode-p)) + ((and (eq type 'entry) (eq major-mode 'org-mode)) (org-capture-verify-tree (org-capture-get :template)) (org-paste-subtree nil template t)) ((and (memq type '(item checkitem)) - (org-mode-p) + (eq major-mode 'org-mode) (save-excursion (skip-chars-backward " \t\n") (setq pp (point)) (org-in-item-p))) @@ -1214,8 +1216,10 @@ (setq bname (concat prefix "-" (number-to-string (incf n)) "-" base))) (condition-case nil (make-indirect-buffer buffer bname 'clone) - (error (make-indirect-buffer buffer bname))))) - + (error + (let ((buf (make-indirect-buffer buffer bname))) + (with-current-buffer buf (org-mode)) + buf))))) (defun org-capture-verify-tree (tree) "Throw error if TREE is not a valid tree" @@ -1505,6 +1509,4 @@ (provide 'org-capture) -;; arch-tag: 986bf41b-8ada-4e28-bf20-e8388a7205a0 - ;;; org-capture.el ends here diff -Nru org-mode-7.7/lisp/org-clock.el org-mode-7.8.02/lisp/org-clock.el --- org-mode-7.7/lisp/org-clock.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/org-clock.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,12 +1,10 @@ ;;; org-clock.el --- The time clocking code for Org-mode -;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 -;; Free Software Foundation, Inc. +;; Copyright (C) 2004-2011 Free Software Foundation, Inc. ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; ;; This file is part of GNU Emacs. ;; @@ -660,7 +658,7 @@ (defun org-program-exists (program-name) "Checks whenever we can locate program and launch it." - (if (eq system-type 'gnu/linux) + (if (member system-type '(gnu/linux darwin)) (= 0 (call-process "which" nil nil nil program-name)))) (defvar org-clock-mode-line-entry nil @@ -693,7 +691,7 @@ (goto-char (car ,clock)) (beginning-of-line) ,@forms)))) - +(def-edebug-spec org-with-clock-position (form body)) (put 'org-with-clock-position 'lisp-indent-function 1) (defmacro org-with-clock (clock &rest forms) @@ -709,7 +707,7 @@ (outline-back-to-heading t) (point-marker)))) ,@forms))) - +(def-edebug-spec org-with-clock (form body)) (put 'org-with-clock 'lisp-indent-function 1) (defsubst org-clock-clock-in (clock &optional resume start-time) @@ -1119,7 +1117,7 @@ (looking-at (concat "^[ \t]* " org-clock-string " \\[\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}" - " +\\sw+\.? +[012][0-9]:[0-5][0-9]\\)\\][ \t]*$"))) + " *\\sw+\.? +[012][0-9]:[0-5][0-9]\\)\\][ \t]*$"))) (message "Matched %s" (match-string 1)) (setq ts (concat "[" (match-string 1) "]")) (goto-char (match-end 1)) @@ -1251,7 +1249,7 @@ (re-search-forward (concat "^[ \t]* " org-clock-string " \\[\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}" - " +\\sw+ +[012][0-9]:[0-5][0-9]\\)\\][ \t]*$") + " *\\sw+ +[012][0-9]:[0-5][0-9]\\)\\][ \t]*$") end t)) (beginning-of-line 1) (throw 'exit t)) @@ -1698,7 +1696,9 @@ "Clock out if the current entry contains the running clock. This is used to stop the clock after a TODO entry is marked DONE, and is only done if the variable `org-clock-out-when-done' is not nil." - (when (and org-clock-out-when-done + (when (and (org-clocking-p) + org-clock-out-when-done + (marker-buffer org-clock-marker) (or (and (eq t org-clock-out-when-done) (member state org-done-keywords)) (and (listp org-clock-out-when-done) @@ -1921,7 +1921,7 @@ shiftedm (- 13 (* 3 (nth 1 tmp))) shiftedq (- 5 (nth 1 tmp)))) (setq d 1 h 0 m 0 d1 1 month shiftedm month1 (+ 3 shiftedm) h1 0 m1 0 y shiftedy)) - ((> (+ q shift) 0) ; shift is whitin this year + ((> (+ q shift) 0) ; shift is within this year (setq shiftedq (+ q shift)) (setq shiftedy y) (setq d 1 h 0 m 0 d1 1 month (+ 1 (* 3 (- (+ q shift) 1))) month1 (+ 4 (* 3 (- (+ q shift) 1))) h1 0 m1 0)))) @@ -2000,7 +2000,8 @@ (encode-time 0 0 0 (+ d n) m y)))) ((and wp (string-match "w\\|W" wp) mw (> (length wp) 0)) (require 'cal-iso) - (setq date (calendar-gregorian-from-absolute (calendar-absolute-from-iso (list (+ mw n) 1 y)))) + (setq date (calendar-gregorian-from-absolute + (calendar-absolute-from-iso (list (+ mw n) 1 y)))) (setq ins (format-time-string "%G-W%V" (encode-time 0 0 0 (nth 1 date) (car date) (nth 2 date))))) @@ -2016,7 +2017,8 @@ (setq mw 5 y (- y 1)) ()) - (setq date (calendar-gregorian-from-absolute (calendar-absolute-from-iso (org-quarter-to-date (+ mw n) y)))) + (setq date (calendar-gregorian-from-absolute + (calendar-absolute-from-iso (org-quarter-to-date (+ mw n) y)))) (setq ins (format-time-string (concatenate 'string (number-to-string y) "-Q" (number-to-string (+ mw n))) (encode-time 0 0 0 (nth 1 date) (car date) (nth 2 date))))) @@ -2052,7 +2054,6 @@ 'org-clocktable-write-default)) cc range-text ipos pos one-file-with-archives scope-is-list tbls level) - ;; Check if we need to do steps (when block ;; Get the range text for the header @@ -2640,7 +2641,5 @@ (provide 'org-clock) -;; arch-tag: 7b42c5d4-9b36-48be-97c0-66a869daed4c - ;;; org-clock.el ends here diff -Nru org-mode-7.7/lisp/org-colview.el org-mode-7.8.02/lisp/org-colview.el --- org-mode-7.7/lisp/org-colview.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/org-colview.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,12 +1,10 @@ ;;; org-colview.el --- Column View in Org-mode -;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 -;; Free Software Foundation, Inc. +;; Copyright (C) 2004-2011 Free Software Foundation, Inc. ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; ;; This file is part of GNU Emacs. ;; @@ -188,7 +186,7 @@ (cons "ITEM" ;; When in a buffer, get the whole line, ;; we'll clean it later… - (if (org-mode-p) + (if (eq major-mode 'org-mode) (save-match-data (org-no-properties (org-remove-tabs @@ -210,9 +208,9 @@ (funcall org-columns-modify-value-for-display-function title val)) ((equal property "ITEM") - (if (org-mode-p) - (org-columns-cleanup-item - val org-columns-current-fmt-compiled))) + (org-columns-cleanup-item + val org-columns-current-fmt-compiled + (or org-complex-heading-regexp cphr))) ((and calc (functionp calc) (not (string= val "")) (not (get-text-property 0 'org-computed val))) @@ -342,24 +340,28 @@ (when (local-variable-p 'org-colview-initial-truncate-line-value) (setq truncate-lines org-colview-initial-truncate-line-value))))) -(defun org-columns-cleanup-item (item fmt) - "Remove from ITEM what is a column in the format FMT." - (if (not org-complex-heading-regexp) - item - (when (string-match org-complex-heading-regexp item) - (setq item - (concat - (org-add-props (match-string 1 item) nil - 'org-whitespace (* 2 (1- (org-reduced-level (- (match-end 1) (match-beginning 1)))))) - (and (match-end 2) (not (assoc "TODO" fmt)) (concat " " (match-string 2 item))) - (and (match-end 3) (not (assoc "PRIORITY" fmt)) (concat " " (match-string 3 item))) - " " (save-match-data (org-columns-compact-links (match-string 4 item))) - (and (match-end 5) (not (assoc "TAGS" fmt)) (concat " " (match-string 5 item))))) - (add-text-properties - 0 (1+ (match-end 1)) - (list 'org-whitespace (* 2 (1- (org-reduced-level (- (match-end 1) (match-beginning 1)))))) - item) - item))) +(defun org-columns-cleanup-item (item fmt cphr) + "Remove from ITEM what is a column in the format FMT. +CPHR is the complex heading regexp to use for parsing ITEM." + (let (fixitem) + (if (not cphr) + item + (unless (string-match "^\*+ " item) + (setq item (concat "* " item) fixitem t)) + (if (string-match cphr item) + (setq item + (concat + (org-add-props (match-string 1 item) nil + 'org-whitespace (* 2 (1- (org-reduced-level (- (match-end 1) (match-beginning 1)))))) + (and (match-end 2) (not (assoc "TODO" fmt)) (concat " " (match-string 2 item))) + (and (match-end 3) (not (assoc "PRIORITY" fmt)) (concat " " (match-string 3 item))) + " " (save-match-data (org-columns-compact-links (match-string 4 item))) + (and (match-end 5) (not (assoc "TAGS" fmt)) (concat " " (match-string 5 item))))) + (add-text-properties + 0 (1+ (match-end 1)) + (list 'org-whitespace (* 2 (1- (org-reduced-level (- (match-end 1) (match-beginning 1)))))) + item)) + (if fixitem (replace-regexp-in-string "^\*+ " "" item) item)))) (defun org-columns-compact-links (s) "Replace [[link][desc]] with [desc] or [link]." @@ -475,7 +477,7 @@ ((equal major-mode 'org-agenda-mode) (org-columns-eval eval) ;; The following let preserves the current format, and makes sure - ;; that in only a single file things need to be upated. + ;; that in only a single file things need to be updated. (let* ((org-agenda-overriding-columns-format org-columns-current-fmt) (buffer (marker-buffer pom)) (org-agenda-contributing-files @@ -495,7 +497,7 @@ (org-columns-eval eval)) (org-columns-display-here))) (org-move-to-column col) - (if (and (org-mode-p) + (if (and (eq major-mode 'org-mode) (nth 3 (assoc key org-columns-current-fmt-compiled))) (org-columns-update key))))))) @@ -606,7 +608,7 @@ ((equal major-mode 'org-agenda-mode) (org-columns-eval '(org-entry-put pom key nval)) ;; The following let preserves the current format, and makes sure - ;; that in only a single file things need to be upated. + ;; that in only a single file things need to be updated. (let* ((org-agenda-overriding-columns-format org-columns-current-fmt) (buffer (marker-buffer pom)) (org-agenda-contributing-files @@ -1001,7 +1003,7 @@ (if (marker-position org-columns-begin-marker) (goto-char org-columns-begin-marker)) (org-columns-remove-overlays) - (if (org-mode-p) + (if (eq major-mode 'org-mode) (call-interactively 'org-columns) (org-agenda-redo) (call-interactively 'org-agenda-columns))) @@ -1140,6 +1142,8 @@ ;;; Dynamic block for Column view +(defvar org-heading-regexp) ; defined in org.el +(defvar org-heading-keyword-regexp-format) ; defined in org.el (defun org-columns-capture-view (&optional maxlevel skip-empty-rows) "Get the column view of the current buffer or subtree. The first optional argument MAXLEVEL sets the level limit. A @@ -1150,11 +1154,12 @@ of fields." (save-excursion (let* ((title (mapcar 'cadr org-columns-current-fmt-compiled)) - (re-comment (concat "\\*+[ \t]+" org-comment-string "\\>")) + (re-comment (format org-heading-keyword-regexp-format + org-comment-string)) (re-archive (concat ".*:" org-archive-tag ":")) (n (length title)) row tbl) (goto-char (point-min)) - (while (re-search-forward "^\\(\\*+\\) " nil t) + (while (re-search-forward org-heading-regexp nil t) (catch 'next (when (and (or (null maxlevel) (>= maxlevel @@ -1526,6 +1531,4 @@ (provide 'org-colview) -;; arch-tag: 61f5128d-747c-4983-9479-e3871fa3d73c - ;;; org-colview.el ends here diff -Nru org-mode-7.7/lisp/org-colview-xemacs.el org-mode-7.8.02/lisp/org-colview-xemacs.el --- org-mode-7.7/lisp/org-colview-xemacs.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/org-colview-xemacs.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,12 +1,11 @@ ;;; org-colview-xemacs.el --- Column View in Org-mode, XEmacs-specific version -;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 +;; Copyright (C) 2004-2011 ;; Free Software Foundation, Inc. ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; ;; This file is part of GNU Emacs. ;; @@ -354,7 +353,7 @@ (funcall org-columns-modify-value-for-display-function title val)) ((equal property "ITEM") - (if (org-mode-p) + (if (eq major-mode 'org-mode) (org-columns-cleanup-item val org-columns-current-fmt-compiled))) ((and calc (functionp calc) @@ -658,7 +657,7 @@ (org-columns-eval eval)) (org-columns-display-here))) (org-move-to-column col) - (if (and (org-mode-p) + (if (and (eq major-mode 'org-mode) (nth 3 (assoc key org-columns-current-fmt-compiled))) (org-columns-update key))))))) @@ -1167,7 +1166,7 @@ (if (marker-position org-columns-begin-marker) (goto-char org-columns-begin-marker)) (org-columns-remove-overlays) - (if (org-mode-p) + (if (eq major-mode 'org-mode) (call-interactively 'org-columns) (org-agenda-redo) (call-interactively 'org-agenda-columns))) @@ -1318,12 +1317,13 @@ (if (featurep 'xemacs) (save-excursion (let* ((title (mapcar 'cadr org-columns-current-fmt-compiled)) - (re-comment (concat "\\*+[ \t]+" org-comment-string "\\>")) + (re-comment (format org-heading-keyword-regexp-format + org-comment-string)) (re-archive (concat ".*:" org-archive-tag ":")) (n (length title)) row tbl) (goto-char (point-min)) - (while (re-search-forward "^\\(\\*+\\) " nil t) + (while (re-search-forward org-heading-regexp nil t) (catch 'next (when (and (or (null maxlevel) (>= maxlevel diff -Nru org-mode-7.7/lisp/org-compat.el org-mode-7.8.02/lisp/org-compat.el --- org-mode-7.7/lisp/org-compat.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/org-compat.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,12 +1,10 @@ ;;; org-compat.el --- Compatibility code for Org-mode -;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 -;; Free Software Foundation, Inc. +;; Copyright (C) 2004-2011 Free Software Foundation, Inc. ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; ;; This file is part of GNU Emacs. ;; @@ -253,8 +251,12 @@ (defun org-activate-mark () (when (mark t) (setq mark-active t) - (unless transient-mark-mode - (setq transient-mark-mode 'lambda))))) + (when (and (boundp 'transient-mark-mode) + (not transient-mark-mode)) + (setq transient-mark-mode 'lambda)) + (when (boundp 'zmacs-regions) + (setq zmacs-regions t))))) + ;; Invisibility compatibility @@ -286,6 +288,7 @@ (dolist (ext-inv-spec ext-inv-specs) (set-extent-property (car ext-inv-spec) 'invisible (cadr ext-inv-spec))))) +(def-edebug-spec org-xemacs-without-invisibility (body)) (defun org-indent-to-column (column &optional minimum buffer) "Work around a bug with extents with invisibility in XEmacs." @@ -439,11 +442,9 @@ "Pop to buffer specified by BUFFER-OR-NAME in the selected window." (if (fboundp 'pop-to-buffer-same-window) (funcall - 'pop-to-buffer-same-window buffer-or-name norecord label) + 'pop-to-buffer-same-window buffer-or-name norecord) (funcall 'switch-to-buffer buffer-or-name norecord))) (provide 'org-compat) -;; arch-tag: a0a0579f-e68c-4bdf-9e55-93768b846bbe - ;;; org-compat.el ends here diff -Nru org-mode-7.7/lisp/org-crypt.el org-mode-7.8.02/lisp/org-crypt.el --- org-mode-7.7/lisp/org-crypt.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/org-crypt.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,10 +1,9 @@ ;;; org-crypt.el --- Public key encryption for org-mode entries -;; Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc. +;; Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc. ;; Emacs Lisp Archive Entry ;; Filename: org-crypt.el -;; Version: 7.7 ;; Keywords: org-mode ;; Author: John Wiegley ;; Maintainer: Peter Jones @@ -117,6 +116,35 @@ (const :tag "Ask" ask) (const :tag "Encrypt" encrypt))) +(defun org-crypt-check-auto-save () + "Check whether auto-save-mode is enabled for the current buffer. + +`auto-save-mode' may cause leakage when decrypting entries, so +check whether it's enabled, and decide what to do about it. + +See `org-crypt-disable-auto-save'." + (when buffer-auto-save-file-name + (cond + ((or + (eq org-crypt-disable-auto-save t) + (and + (eq org-crypt-disable-auto-save 'ask) + (y-or-n-p "org-decrypt: auto-save-mode may cause leakage. Disable it for current buffer? "))) + (message (concat "org-decrypt: Disabling auto-save-mode for " (or (buffer-file-name) (current-buffer)))) + ; The argument to auto-save-mode has to be "-1", since + ; giving a "nil" argument toggles instead of disabling. + (auto-save-mode -1)) + ((eq org-crypt-disable-auto-save nil) + (message "org-decrypt: Decrypting entry with auto-save-mode enabled. This may cause leakage.")) + ((eq org-crypt-disable-auto-save 'encrypt) + (message "org-decrypt: Enabling re-encryption on auto-save.") + (add-hook 'auto-save-hook + (lambda () + (message "org-crypt: Re-encrypting all decrypted entries due to auto-save.") + (org-encrypt-entries)) + nil t)) + (t nil)))) + (defun org-crypt-key-for-heading () "Return the encryption key for the current heading." (save-excursion @@ -165,30 +193,6 @@ (defun org-decrypt-entry () "Decrypt the content of the current headline." (interactive) - - ; auto-save-mode may cause leakage, so check whether it's enabled. - (when buffer-auto-save-file-name - (cond - ((or - (eq org-crypt-disable-auto-save t) - (and - (eq org-crypt-disable-auto-save 'ask) - (y-or-n-p "org-decrypt: auto-save-mode may cause leakage. Disable it for current buffer? "))) - (message (concat "org-decrypt: Disabling auto-save-mode for " (or (buffer-file-name) (current-buffer)))) - ; The argument to auto-save-mode has to be "-1", since - ; giving a "nil" argument toggles instead of disabling. - (auto-save-mode -1)) - ((eq org-crypt-disable-auto-save nil) - (message "org-decrypt: Decrypting entry with auto-save-mode enabled. This may cause leakage.")) - ((eq org-crypt-disable-auto-save 'encrypt) - (message "org-decrypt: Enabling re-encryption on auto-save.") - (add-hook 'auto-save-hook - (lambda () - (message "org-crypt: Re-encrypting all decrypted entries due to auto-save.") - (org-encrypt-entries)) - nil t)) - (t nil))) - (require 'epg) (unless (org-before-first-heading-p) (save-excursion @@ -200,6 +204,7 @@ (outline-invisible-p)))) (forward-line) (when (looking-at "-----BEGIN PGP MESSAGE-----") + (org-crypt-check-auto-save) (let* ((end (save-excursion (search-forward "-----END PGP MESSAGE-----") (forward-line) @@ -252,6 +257,4 @@ (provide 'org-crypt) -;; arch-tag: 8202ed2c-221e-4001-9e4b-54674a7e846e - ;;; org-crypt.el ends here diff -Nru org-mode-7.7/lisp/org-ctags.el org-mode-7.8.02/lisp/org-ctags.el --- org-mode-7.7/lisp/org-ctags.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/org-ctags.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,12 +1,11 @@ ;;; org-ctags.el - Integrate Emacs "tags" facility with org mode. ;; -;; Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +;; Copyright (C) 2007-2011 Free Software Foundation, Inc. ;; Author: Paul Sexton -;; Version: 7.7 + ;; Keywords: org, wp -;; Version: 7.7 ;; ;; This file is part of GNU Emacs. ;; @@ -307,7 +306,7 @@ activate compile) "Before trying to find a tag, save our current position on org mark ring." (save-excursion - (if (and (org-mode-p) org-ctags-enabled-p) + (if (and (eq major-mode 'org-mode) org-ctags-enabled-p) (org-mark-ring-push)))) @@ -539,5 +538,4 @@ (provide 'org-ctags) -;; arch-tag: 4b1ddd5a-8529-4b17-bcde-96a922d26343 ;;; org-ctags.el ends here diff -Nru org-mode-7.7/lisp/org-datetree.el org-mode-7.8.02/lisp/org-datetree.el --- org-mode-7.7/lisp/org-datetree.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/org-datetree.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,11 +1,10 @@ ;;; org-datetree.el --- Create date entries in a tree -;; Copyright (C) 2009, 2010 Free Software Foundation, Inc. +;; Copyright (C) 2009-2011 Free Software Foundation, Inc. ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; ;; This file is part of GNU Emacs. ;; @@ -195,6 +194,4 @@ (provide 'org-datetree) -;; arch-tag: 1daea962-fd08-448b-9f98-6e8b511b3601 - ;;; org-datetree.el ends here diff -Nru org-mode-7.7/lisp/org-docbook.el org-mode-7.8.02/lisp/org-docbook.el --- org-mode-7.7/lisp/org-docbook.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/org-docbook.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,10 +1,9 @@ ;;; org-docbook.el --- DocBook exporter for org-mode ;; -;; Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +;; Copyright (C) 2007-2011 Free Software Foundation, Inc. ;; ;; Emacs Lisp Archive Entry ;; Filename: org-docbook.el -;; Version: 7.7 ;; Author: Baoqiu Cui ;; Maintainer: Baoqiu Cui ;; Keywords: org, wp, docbook @@ -294,7 +293,7 @@ (interactive "r") (let (reg docbook buf) (save-window-excursion - (if (org-mode-p) + (if (eq major-mode 'org-mode) (setq docbook (org-export-region-as-docbook beg end t 'string)) (setq reg (buffer-substring beg end) @@ -394,6 +393,8 @@ (org-open-file pdffile) (error "PDF file was not produced")))) +(defvar org-heading-keyword-regexp-format) ; defined in org.el + ;;;###autoload (defun org-export-as-docbook (&optional hidden ext-plist to-buffer body-only pub-dir) @@ -475,9 +476,11 @@ (current-dir (if buffer-file-name (file-name-directory buffer-file-name) default-directory)) + (auto-insert nil); Avoid any auto-insert stuff for the new file (buffer (if to-buffer (cond - ((eq to-buffer 'string) (get-buffer-create "*Org DocBook Export*")) + ((eq to-buffer 'string) + (get-buffer-create "*Org DocBook Export*")) (t (get-buffer-create to-buffer))) (find-file-noselect filename))) ;; org-levels-open is a global variable @@ -499,8 +502,9 @@ ;; We will use HTML table formatter to export tables to DocBook ;; format, so need to set html-table-tag here. (html-table-tag (plist-get opt-plist :html-table-tag)) - (quote-re0 (concat "^[ \t]*" org-quote-string "\\>")) - (quote-re (concat "^\\(\\*+\\)\\([ \t]+" org-quote-string "\\>\\)")) + (quote-re0 (concat "^ *" org-quote-string "\\( +\\|[ \t]*$\\)")) + (quote-re (format org-heading-keyword-regexp-format + org-quote-string)) (inquote nil) (infixed nil) (inverse nil) @@ -970,7 +974,7 @@ (push (cons num 1) footref-seen)))))) (cond - ((string-match "^\\(\\*+\\)[ \t]+\\(.*\\)" line) + ((string-match "^\\(\\*+\\)\\(?: +\\(.*?\\)\\)?[ \t]*$" line) ;; This is a headline (setq level (org-tr-level (- (match-end 1) (match-beginning 1) level-offset)) @@ -1445,5 +1449,4 @@ (provide 'org-docbook) -;; arch-tag: a24a127c-d365-4c2a-9e9b-f7dcb0ebfdc3 ;;; org-docbook.el ends here diff -Nru org-mode-7.7/lisp/org-docview.el org-mode-7.8.02/lisp/org-docview.el --- org-mode-7.7/lisp/org-docview.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/org-docview.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,11 +1,10 @@ ;;; org-docview.el --- support for links to doc-view-mode buffers -;; Copyright (C) 2009, 2010 Free Software Foundation, Inc. +;; Copyright (C) 2009-2011 Free Software Foundation, Inc. ;; Author: Jan Böcker ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; ;; This file is part of GNU Emacs. ;; @@ -88,6 +87,4 @@ (provide 'org-docview) -;; arch-tag: dd147a78-cce1-481b-b40a-15869417debe - ;;; org-docview.el ends here diff -Nru org-mode-7.7/lisp/org.el org-mode-7.8.02/lisp/org.el --- org-mode-7.7/lisp/org.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/org.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,12 +1,12 @@ ;;; org.el --- Outline-based notes management and organizer ;; Carstens outline-mode for keeping track of everything. -;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 -;; Free Software Foundation, Inc. +;; Copyright (C) 2004-2011 Free Software Foundation, Inc. ;; ;; Author: Carsten Dominik +;; Maintainer: Bastien Guerry ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 7.7 +;; Version: 7.8.02 ;; ;; This file is part of GNU Emacs. ;; @@ -164,6 +164,7 @@ (const :tag "Ditaa" ditaa) (const :tag "Dot" dot) (const :tag "Emacs Lisp" emacs-lisp) + (const :tag "Fortran" fortran) (const :tag "Gnuplot" gnuplot) (const :tag "Haskell" haskell) (const :tag "Java" java) @@ -178,6 +179,7 @@ (const :tag "Octave" octave) (const :tag "Org" org) (const :tag "Perl" perl) + (const :tag "Pico Lisp" picolisp) (const :tag "PlantUML" plantuml) (const :tag "Python" python) (const :tag "Ruby" ruby) @@ -185,6 +187,7 @@ (const :tag "Scheme" scheme) (const :tag "Screen" screen) (const :tag "Shell Script" sh) + (const :tag "Shen" shen) (const :tag "Sql" sql) (const :tag "Sqlite" sqlite)) :value-type (boolean :tag "Activate" :value t))) @@ -200,7 +203,7 @@ ;;; Version -(defconst org-version "7.7" +(defconst org-version "7.8.02" "The version number of the file org.el.") (defun org-version (&optional here) @@ -251,6 +254,11 @@ :group 'org :type 'hook) +(defcustom org-log-buffer-setup-hook nil + "Hook that is run after an Org log buffer is created." + :group 'org + :type 'hook) + (defvar org-modules) ; defined below (defvar org-modules-loaded nil "Have the modules been loaded already?") @@ -340,7 +348,6 @@ (const :tag "C mac-link-grabber Grab links and URLs from various Mac applications" org-mac-link-grabber) (const :tag "C man: Support for links to manpages in Org-mode" org-man) (const :tag "C mtags: Support for muse-like tags" org-mtags) - (const :tag "C odt: OpenDocumentText exporter for Org-mode" org-odt) (const :tag "C panel: Simple routines for us with bad memory" org-panel) (const :tag "C registry: A registry for Org-mode links" org-registry) (const :tag "C org2rem: Convert org appointments into reminders" org2rem) @@ -356,12 +363,12 @@ (defcustom org-support-shift-select nil "Non-nil means make shift-cursor commands select text when possible. -In Emacs 23, when `shift-select-mode' is on, shifted cursor keys start -selecting a region, or enlarge regions started in this way. -In Org-mode, in special contexts, these same keys are used for other -purposes, important enough to compete with shift selection. Org tries -to balance these needs by supporting `shift-select-mode' outside these -special contexts, under control of this variable. +In Emacs 23, when `shift-select-mode' is on, shifted cursor keys +start selecting a region, or enlarge regions started in this way. +In Org-mode, in special contexts, these same keys are used for +other purposes, important enough to compete with shift selection. +Org tries to balance these needs by supporting `shift-select-mode' +outside these special contexts, under control of this variable. The default of this variable is nil, to avoid confusing behavior. Shifted cursor keys will then execute Org commands in the following contexts: @@ -372,30 +379,50 @@ - in the BEGIN line of a clock table (changing the time block). Outside these contexts, the commands will throw an error. -When this variable is t and the cursor is not in a special context, -Org-mode will support shift-selection for making and enlarging regions. -To make this more effective, the bullet cycling will no longer happen -anywhere in an item line, but only if the cursor is exactly on the bullet. +When this variable is t and the cursor is not in a special +context, Org-mode will support shift-selection for making and +enlarging regions. To make this more effective, the bullet +cycling will no longer happen anywhere in an item line, but only +if the cursor is exactly on the bullet. If you set this variable to the symbol `always', then the keys -will not be special in headlines, property lines, and item lines, to make -shift selection work there as well. If this is what you want, you can -use the following alternative commands: `C-c C-t' and `C-c ,' to -change TODO state and priority, `C-u C-u C-c C-t' can be used to switch -TODO sets, `C-c -' to cycle item bullet types, and properties can be -edited by hand or in column view. +will not be special in headlines, property lines, and item lines, +to make shift selection work there as well. If this is what you +want, you can use the following alternative commands: `C-c C-t' +and `C-c ,' to change TODO state and priority, `C-u C-u C-c C-t' +can be used to switch TODO sets, `C-c -' to cycle item bullet +types, and properties can be edited by hand or in column view. However, when the cursor is on a timestamp, shift-cursor commands will still edit the time stamp - this is just too good to give up. -XEmacs user should have this variable set to nil, because shift-select-mode -is Emacs 23 only." +XEmacs user should have this variable set to nil, because +`shift-select-mode' is in Emacs 23 or later only." :group 'org :type '(choice (const :tag "Never" nil) (const :tag "When outside special context" t) (const :tag "Everywhere except timestamps" always))) +(defcustom org-loop-over-headlines-in-active-region nil + "Shall some commands act upon headlines in the active region? + +When set to `t', some commands will be performed in all headlines +within the active region. + +When set to a string, those commands will be performed on the +matching headlines within the active region. Such string must be +a tags/property/todo match as it is used in the agenda tags view. + +The list of commands is: +- `org-schedule' +- `org-deadline'" + :type '(choice (const :tag "Don't loop" nil) + (const :tag "All headlines in active region" t) + (string :tag "Tags/Property/Todo matcher")) + :group 'org-todo + :group 'org-archive) + (defgroup org-startup nil "Options concerning startup of Org-mode." :tag "Org Startup" @@ -819,7 +846,7 @@ (const :tag "No limit" nil) (integer :tag "Maximum level"))) -(defcustom org-drawers '("PROPERTIES" "CLOCK" "LOGBOOK") +(defcustom org-drawers '("PROPERTIES" "CLOCK" "LOGBOOK" "RESULTS") "Names of drawers. Drawers are not opened by cycling on the headline above. Drawers only open with a TAB on the drawer line itself. A drawer looks like this: @@ -1039,6 +1066,28 @@ (const :tag "Protect hidden subtrees with a security query" t) (const :tag "Never kill a hidden subtree with C-k" error))) +(defcustom org-catch-invisible-edits nil + "Check if in invisible region before inserting or deleting a character. +Valid values are: + +nil Do not check, so just do invisible edits. +error Throw an error and do nothing. +show Make point visible, and do the requested edit. +show-and-error Make point visible, then throw an error and abort the edit. +smart Make point visible, and do insertion/deletion if it is + adjacent to visible text and the change feels predictable. + Never delete a previously invisible character or add in the + middle or right after an invisible region. Basically, this + allows insertion and backward-delete right before ellipses. + FIXME: maybe in this case we should not even show?" + :group 'org-edit-structure + :type '(choice + (const :tag "Do not check" nil) + (const :tag "Throw error when trying to edit" error) + (const :tag "Unhide, but do not do the edit" show-and-error) + (const :tag "Show invisible part and do the edit" show) + (const :tag "Be smart and do the right thing" smart))) + (defcustom org-yank-folded-subtrees t "Non-nil means when yanking subtrees, fold them. If the kill is a single subtree, or a sequence of subtrees, i.e. if @@ -1262,10 +1311,14 @@ (function))))) (defcustom org-descriptive-links t - "Non-nil means hide link part and only show description of bracket links. -Bracket links are like [[link][description]]. This variable sets the initial -state in new org-mode buffers. The setting can then be toggled on a -per-buffer basis from the Org->Hyperlinks menu." + "Non-nil means Org will display descriptive links. +E.g. [[http://orgmode.org][Org website]] will be displayed as +\"Org Website\", hiding the link itself and just displaying its +description. When set to `nil', Org will display the full links +literally. + +You can interactively set the value of this variable by calling +`org-toggle-link-display' or from the menu Org>Hyperlinks menu." :group 'org-link :type 'boolean) @@ -1403,8 +1456,8 @@ "Non-nil means file links from `org-store-link' contain context. A search string will be added to the file name with :: as separator and used to find the context when the link is activated by the command -`org-open-at-point'. When this option is t, the entire active region -will be placed in the search string of the file link. If set to a +`org-open-at-point'. When this option is t, the entire active region +will be placed in the search string of the file link. If set to a positive integer, only the first n lines of context will be stored. Using a prefix arg to the command \\[org-store-link] (`org-store-link') @@ -1482,9 +1535,9 @@ in the search text." :group 'org-link-follow :type '(choice - (const :tag "Use fuzy text search" nil) + (const :tag "Use fuzzy text search" nil) (const :tag "Match only exact headline" t) - (const :tag "Match extact headline or query to create it" + (const :tag "Match exact headline or query to create it" query-to-create))) (defcustom org-link-frame-setup @@ -1854,7 +1907,7 @@ (defcustom org-refile-targets nil "Targets for refiling entries with \\[org-refile]. -This is list of cons cells. Each cell contains: +This is a list of cons cells. Each cell contains: - a specification of the files to be considered, either a list of files, or a symbol whose function or variable value will be used to retrieve a file name or a list of file names. If you use `org-agenda-files' for @@ -1872,10 +1925,14 @@ - a cons cell (:level . N). Any headline of level N is considered a target. Note that, when `org-odd-levels-only' is set, level corresponds to order in hierarchy, not to the number of stars. - - a cons cell (:maxlevel . N). Any headline with level <= N is a target. + - a cons cell (:maxlevel . N). Any headline with level <= N is a target. Note that, when `org-odd-levels-only' is set, level corresponds to order in hierarchy, not to the number of stars. +Each element of this list generates a set of possible targets. +The union of these sets is presented (with completion) to +the user by `org-refile'. + You can set the variable `org-refile-target-verify-function' to a function to verify each headline found by the simple criteria above. @@ -1965,6 +2022,16 @@ (const :tag "Always" t) (const :tag "Prompt for confirmation" confirm))) +(defcustom org-refile-active-region-within-subtree nil + "Non-nil means also refile active region within a subtree. + +By default `org-refile' doesn't allow refiling regions if they +don't contain a set of subtrees, but it might be convenient to +do so sometimes: in that case, the first line of the region is +converted to a headline before refiling." + :group 'org-refile + :type 'boolean) + (defgroup org-todo nil "Options concerning TODO items in Org-mode." :tag "Org TODO" @@ -2350,6 +2417,8 @@ empty string. %t in the heading will be replaced by a time stamp. %T will be an active time stamp instead the default inactive one +%d will be replaced by a short-format time stamp. +%D will be replaced by an active short-format time stamp. %s will be replaced by the new TODO state, in double quotes. %S will be replaced by the old TODO state, in double quotes. %u will be replaced by the user name. @@ -2446,7 +2515,7 @@ marked DONE. If you are not logging state changes (by adding \"@\" or \"!\" to the TODO keyword definition), or set `org-log-done' to record a closing note, there will be no record of the task moving -through DONE. This variable forces taking a note anyway. +through DONE. This variable forces taking a note anyway. nil Don't force a record time Record a time stamp @@ -2582,7 +2651,7 @@ (defcustom org-time-stamp-custom-formats '("<%m/%d/%y %a>" . "<%m/%d/%y %a %H:%M>") ; american "Custom formats for time stamps. See `format-time-string' for the syntax. -These are overlayed over the default ISO format if the variable +These are overlaid over the default ISO format if the variable `org-display-custom-times' is set. Time like %H:%M should be at the end of the second format. The custom formats are also honored by export commands, if custom time display is turned on at the time of export." @@ -2737,6 +2806,14 @@ :group 'org-time :type 'integer) +(defcustom org-use-effective-time nil + "If non-nil, consider `org-extend-today-until' when creating timestamps. +For example, if `org-extend-today-until' is 8, and it's 4am, then the +\"effective time\" of any timestamps between midnight and 8am will be +23:59 of the previous day." + :group 'boolean + :type 'integer) + (defcustom org-edit-timestamp-down-means-later nil "Non-nil means S-down will increase the time in a time stamp. When nil, S-up will increase." @@ -2851,7 +2928,9 @@ "The column to which tags should be indented in a headline. If this number is positive, it specifies the column. If it is negative, it means that the tags should be flushright to that column. For example, --80 works well for a normal 80 character screen." +-80 works well for a normal 80 character screen. +When 0, place tags directly after headline text, with only one space in +between." :group 'org-tags :type 'integer) @@ -2954,6 +3033,28 @@ :group 'org-properties :type 'string) +(defcustom org-properties-postprocess-alist nil + "Alist of properties and functions to adjust inserted values. +Elements of this alist must be of the form + + ([string] [function]) + +where [string] must be a property name and [function] must be a +lambda expression: this lambda expression must take one argument, +the value to adjust, and return the new value as a string. + +For example, this element will allow the property \"Remaining\" +to be updated wrt the relation between the \"Effort\" property +and the clock summary: + + ((\"Remaining\" (lambda(value) + (let ((clocksum (org-clock-sum-current-item)) + (effort (org-duration-string-to-minutes + (org-entry-get (point) \"Effort\")))) + (org-minutes-to-hh:mm-string (- effort clocksum))))))" + :group 'org-properties + :type 'alist) + (defcustom org-use-property-inheritance nil "Non-nil means properties apply also for sublevels. @@ -3224,6 +3325,46 @@ When nil, just push out a message." :group 'org-latex :type 'boolean) +(defcustom org-latex-to-mathml-jar-file nil + "Value of\"%j\" in `org-latex-to-mathml-convert-command'. +Use this to specify additional executable file say a jar file. + +When using MathToWeb as the converter, specify the full-path to +your mathtoweb.jar file." + :group 'org-latex + :type '(choice + (const :tag "None" nil) + (file :tag "JAR file" :must-match t))) + +(defcustom org-latex-to-mathml-convert-command nil + "Command to convert LaTeX fragments to MathML. +Replace format-specifiers in the command as noted below and use +`shell-command' to convert LaTeX to MathML. +%j: Executable file in fully expanded form as specified by + `org-latex-to-mathml-jar-file'. +%I: Input LaTeX file in fully expanded form +%o: Output MathML file +This command is used by `org-create-math-formula'. + +When using MathToWeb as the converter, set this to +\"java -jar %j -unicode -force -df %o %I\"." + :group 'org-latex + :type '(choice + (const :tag "None" nil) + (string :tag "\nShell command"))) + +(defun org-format-latex-mathml-available-p () + "Return t if `org-latex-to-mathml-convert-command' is usable." + (save-match-data + (when (and (boundp 'org-latex-to-mathml-convert-command) + org-latex-to-mathml-convert-command) + (let ((executable (car (split-string + org-latex-to-mathml-convert-command)))) + (when (executable-find executable) + (if (string-match + "%j" org-latex-to-mathml-convert-command) + (file-readable-p org-latex-to-mathml-jar-file) + t)))))) (defcustom org-format-latex-header "\\documentclass{article} \\usepackage[usenames]{color} @@ -3611,6 +3752,7 @@ (defvar calc-embedded-close-formula) (defvar calc-embedded-open-formula) (declare-function cdlatex-tab "ext:cdlatex" ()) +(declare-function cdlatex-compute-tables "ext:cdlatex" ()) (declare-function dired-get-filename "dired" (&optional localp no-error-if-not-filep)) (defvar font-lock-unfontify-region-function) (declare-function iswitchb-read-buffer "iswitchb" @@ -3620,7 +3762,7 @@ (defvar org-agenda-tags-todo-honor-ignore-options) (declare-function org-agenda-skip "org-agenda" ()) (declare-function - org-format-agenda-item "org-agenda" + org-agenda-format-item "org-agenda" (extra txt &optional category tags dotime noprefix remove-re habitp)) (declare-function org-agenda-new-marker "org-agenda" (&optional pos)) (declare-function org-agenda-change-all-lines "org-agenda" @@ -3988,7 +4130,7 @@ \"~/org/archive.org::\" Archive in file ~/org/archive.org (absolute path), as top-level trees. -\"~/org/archive.org::From %s\" +\"~/org/archive.org::* From %s\" Archive in file ~/org/archive.org (absolute path), under headlines \"From FILENAME\" where file name is the current file name. @@ -4152,20 +4294,14 @@ (make-variable-buffer-local 'org-complex-heading-regexp) (defvar org-complex-heading-regexp-format nil "Printf format to make regexp to match an exact headline. -This regexp will match the headline of any node which hase the exact -headline text that is put into the format, but may have any TODO state, -priority and tags.") +This regexp will match the headline of any node which has the +exact headline text that is put into the format, but may have any +TODO state, priority and tags.") (make-variable-buffer-local 'org-complex-heading-regexp-format) (defvar org-todo-line-tags-regexp nil "Matches a headline and puts TODO state into group 2 if present. Also put tags into group 4 if tags are present.") (make-variable-buffer-local 'org-todo-line-tags-regexp) -(defvar org-nl-done-regexp nil - "Matches newline followed by a headline with the DONE keyword.") -(make-variable-buffer-local 'org-nl-done-regexp) -(defvar org-looking-at-done-regexp nil - "Matches the DONE keyword a point.") -(make-variable-buffer-local 'org-looking-at-done-regexp) (defvar org-ds-keyword-length 12 "Maximum length of the Deadline and SCHEDULED keywords.") (make-variable-buffer-local 'org-ds-keyword-length) @@ -4302,9 +4438,34 @@ set this variable to if the option is found. An optional forth element PUSH means to push this value onto the list in the variable.") +(defun org-update-property-plist (key val props) + "Update PROPS with KEY and VAL." + (if (string= "+" (substring key (- (length key) 1))) + (let* ((key (substring key 0 (- (length key) 1))) + (previous (cdr (assoc key props)))) + (cons (cons key (concat previous " " val)) + (org-remove-if (lambda (p) (string= (car p) key)) props))) + (cons (cons key val) props))) + +(defconst org-block-regexp + "^[ \t]*#\\+begin_?\\([^ \n]+\\)\\(\\([^\n]+\\)\\)?\n\\([^\000]+?\\)#\\+end_?\\1[ \t]*$" + "Regular expression for hiding blocks.") +(defconst org-heading-keyword-regexp-format + "^\\(\\*+\\)\\(?: +%s\\)\\(?: +\\(.*?\\)\\)?[ \t]*$" + "Printf format for a regexp matching an headline with some keyword. +This regexp will match the headline of any node which has the +exact keyword that is put into the format. The keyword isn't in +any group by default, but the stars and the body are.") +(defconst org-heading-keyword-maybe-regexp-format + "^\\(\\*+\\)\\(?: +%s\\)?\\(?: +\\(.*?\\)\\)?[ \t]*$" + "Printf format for a regexp matching an headline, possibly with some keyword. +This regexp can match any headline with the specified keyword, or +without a keyword. The keyword isn't in any group by default, +but the stars and the body are.") + (defun org-set-regexps-and-options () "Precompute regular expressions for current buffer." - (when (org-mode-p) + (when (eq major-mode 'org-mode) (org-set-local 'org-todo-kwd-alist nil) (org-set-local 'org-todo-key-alist nil) (org-set-local 'org-todo-key-trigger nil) @@ -4363,8 +4524,9 @@ (setq prio (org-split-string value " +"))) ((equal key "PROPERTY") (when (string-match "\\(\\S-+\\)\\s-+\\(.*\\)" value) - (push (cons (match-string 1 value) (match-string 2 value)) - props))) + (setq props (org-update-property-plist (match-string 1 value) + (match-string 2 value) + props)))) ((equal key "FILETAGS") (when (string-match "\\S-" value) (setq ftags @@ -4408,8 +4570,17 @@ (setq ext-setup-or-nil (concat (substring ext-setup-or-nil 0 start) "\n" setup-contents "\n" - (substring ext-setup-or-nil start))))) - )))) + (substring ext-setup-or-nil start))))))) + ;; search for property blocks + (goto-char (point-min)) + (while (re-search-forward org-block-regexp nil t) + (when (equal "PROPERTY" (upcase (match-string 1))) + (setq value (replace-regexp-in-string + "[\n\r]" " " (match-string 4))) + (when (string-match "\\(\\S-+\\)\\s-+\\(.*\\)" value) + (setq props (org-update-property-plist (match-string 1 value) + (match-string 2 value) + props))))))) (org-set-local 'org-use-sub-superscripts scripts) (when cat (org-set-local 'org-category (intern cat)) @@ -4500,7 +4671,9 @@ (assoc (car e) org-tag-alist)) (push e org-tag-alist))))) - ;; Compute the regular expressions and other local variables + ;; Compute the regular expressions and other local variables. + ;; Using `org-outline-regexp-bol' would complicate them much, + ;; because of the fixed white space at the end of that string. (if (not org-done-keywords) (setq org-done-keywords (and org-todo-keywords-1 (list (org-last org-todo-keywords-1))))) @@ -4515,47 +4688,42 @@ org-not-done-keywords (org-delete-all org-done-keywords (copy-sequence org-todo-keywords-1)) org-todo-regexp - (concat "\\<\\(" (mapconcat 'regexp-quote org-todo-keywords-1 - "\\|") "\\)\\>") + (concat "\\(" + (mapconcat 'regexp-quote org-todo-keywords-1 "\\|") + "\\)") org-not-done-regexp - (concat "\\<\\(" + (concat "\\(" (mapconcat 'regexp-quote org-not-done-keywords "\\|") - "\\)\\>") + "\\)") org-not-done-heading-regexp - (concat "^\\(\\*+\\)[ \t]+\\(" - (mapconcat 'regexp-quote org-not-done-keywords "\\|") - "\\)\\>") + (format org-heading-keyword-regexp-format org-not-done-regexp) org-todo-line-regexp - (concat "^\\(\\*+\\)[ \t]+\\(?:\\(" - (mapconcat 'regexp-quote org-todo-keywords-1 "\\|") - "\\)\\>\\)?[ \t]*\\(.*\\)") + (format org-heading-keyword-maybe-regexp-format org-todo-regexp) org-complex-heading-regexp - (concat "^\\(\\*+\\)[ \t]+\\(?:\\(" - (mapconcat 'regexp-quote org-todo-keywords-1 "\\|") - "\\)\\>\\)?\\(?:[ \t]*\\(\\[#.\\]\\)\\)?[ \t]*\\(.*?\\)" - "\\(?:[ \t]+\\(:[[:alnum:]_@#%:]+:\\)\\)?[ \t]*$") + (concat "^\\(\\*+\\)" + "\\(?: +" org-todo-regexp "\\)?" + "\\(?: +\\(\\[#.\\]\\)\\)?" + "\\(?: +\\(.*?\\)\\)?" + (org-re "\\(?:[ \t]+\\(:[[:alnum:]_@#%:]+:\\)\\)?") + "[ \t]*$") org-complex-heading-regexp-format - (concat "^\\(\\*+\\)[ \t]+\\(?:\\(" - (mapconcat 'regexp-quote org-todo-keywords-1 "\\|") - "\\)\\>\\)?" - "\\(?:[ \t]*\\(\\[#.\\]\\)\\)?" - "\\(?:[ \t]*\\(?:\\[[0-9%%/]+\\]\\)\\)?" ;; stats cookie - "[ \t]*\\(%s\\)" - "\\(?:[ \t]*\\(?:\\[[0-9%%/]+\\]\\)\\)?" ;; stats cookie - "\\(?:[ \t]+\\(:[[:alnum:]_@#%%:]+:\\)\\)?[ \t]*$") - org-nl-done-regexp - (concat "\n\\*+[ \t]+" - "\\(?:" (mapconcat 'regexp-quote org-done-keywords "\\|") - "\\)" "\\>") + (concat "^\\(\\*+\\)" + "\\(?: +" org-todo-regexp "\\)?" + "\\(?: +\\(\\[#.\\]\\)\\)?" + "\\(?: +" + ;; Stats cookies can be sticked to body. + "\\(?:\\[[0-9%%/]+\\] *\\)?" + "\\(%s\\)" + "\\(?: *\\[[0-9%%/]+\\]\\)?" + "\\)" + (org-re "\\(?:[ \t]+\\(:[[:alnum:]_@#%%:]+:\\)\\)?") + "[ \t]*$") org-todo-line-tags-regexp - (concat "^\\(\\*+\\)[ \t]+\\(?:\\(" - (mapconcat 'regexp-quote org-todo-keywords-1 "\\|") - (org-re - "\\)\\>\\)? *\\(.*?\\([ \t]:[[:alnum:]:_@#%]+:[ \t]*\\)?$\\)")) - org-looking-at-done-regexp - (concat "^" "\\(?:" - (mapconcat 'regexp-quote org-done-keywords "\\|") "\\)" - "\\>") + (concat "^\\(\\*+\\)" + "\\(?: +" org-todo-regexp "\\)?" + "\\(?: +\\(.*?\\)\\)?" + (org-re "\\(?:[ \t]+\\(:[[:alnum:]:_@#%]+:\\)\\)?") + "[ \t]*$") org-deadline-regexp (concat "\\<" org-deadline-string) org-deadline-time-regexp (concat "\\<" org-deadline-string " *<\\([^>]+\\)>") @@ -4584,7 +4752,7 @@ "\\|" org-deadline-string "\\|" org-closed-string "\\|" org-clock-string "\\)\\)?" - " *\\([[<][0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} [^]\r\n>]*?[]>]\\|<%%([^\r\n>]*>\\)") + " *\\([[<][0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} ?[^]\r\n>]*?[]>]\\|<%%([^\r\n>]*>\\)") org-planning-or-clock-line-re (concat "\\(?:^[ \t]*\\(" org-scheduled-string "\\|" org-deadline-string @@ -4700,10 +4868,23 @@ (defvar org-inhibit-blocking nil) ; Dynamically-scoped param. (defvar org-table-buffer-is-an nil) -;; org-outline-regexp ought to be a defconst but is let-binding -;; in some places -- e.g. see the macro org-with-limited-levels -(defvar org-outline-regexp "\\*+ ") -(defconst org-outline-regexp-bol "^\\*+ ") +;; `org-outline-regexp' ought to be a defconst but is let-binding in +;; some places -- e.g. see the macro org-with-limited-levels. +;; +;; In Org buffers, the value of `outline-regexp' is that of +;; `org-outline-regexp'. The only function still directly relying on +;; `outline-regexp' is `org-overview' so that `org-cycle' can do its +;; job when `orgstruct-mode' is active. +(defvar org-outline-regexp "\\*+ " + "Regexp to match Org headlines.") +(defconst org-outline-regexp-bol "^\\*+ " + "Regexp to match Org headlines. +This is similar to `org-outline-regexp' but additionally makes +sure that we are at the beginning of the line.") + +(defconst org-heading-regexp "^\\(\\*+\\)\\(?: +\\(.*?\\)\\)?[ \t]*$" + "Matches an headline, putting stars and text into groups. +Stars are put in group 1 and the trimmed body in group 2.") ;;;###autoload (define-derived-mode org-mode outline-mode "Org" @@ -4750,6 +4931,7 @@ (org-set-local 'line-move-ignore-invisible t)) (org-set-local 'outline-regexp org-outline-regexp) (org-set-local 'outline-level 'org-outline-level) + (setq bidi-paragraph-direction 'left-to-right) (when (and org-ellipsis (fboundp 'set-display-table-slot) (boundp 'buffer-display-table) (fboundp 'make-glyph-code)) @@ -4949,7 +5131,7 @@ (defvar org-match-substring-regexp (concat - "\\([^\\]\\)\\([_^]\\)\\(" + "\\([^\\]\\|^\\)\\([_^]\\)\\(" "\\(" (org-create-multibrace-regexp "{" "}" org-match-sexp-depth) "\\)" "\\|" "\\(" (org-create-multibrace-regexp "(" ")" org-match-sexp-depth) "\\)" @@ -4959,7 +5141,7 @@ (defvar org-match-substring-with-braces-regexp (concat - "\\([^\\]\\)\\([_^]\\)\\(" + "\\([^\\]\\|^\\)\\([_^]\\)\\(" "\\(" (org-create-multibrace-regexp "{" "}" org-match-sexp-depth) "\\)" "\\)") "The regular expression matching a sub- or superscript, forcing braces.") @@ -5023,15 +5205,15 @@ (org-make-link-regexps) -(defconst org-ts-regexp "<\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} [^\r\n>]*?\\)>" +(defconst org-ts-regexp "<\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} ?[^\r\n>]*?\\)>" "Regular expression for fast time stamp matching.") -(defconst org-ts-regexp-both "[[<]\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} [^]\r\n>]*?\\)[]>]" +(defconst org-ts-regexp-both "[[<]\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} ?[^]\r\n>]*?\\)[]>]" "Regular expression for fast time stamp matching.") (defconst org-ts-regexp0 "\\(\\([0-9]\\{4\\}\\)-\\([0-9]\\{2\\}\\)-\\([0-9]\\{2\\}\\) *\\([^]+0-9>\r\n -]*\\)\\( \\([0-9]\\{2\\}\\):\\([0-9]\\{2\\}\\)\\)?\\)" "Regular expression matching time strings for analysis. This one does not require the space after the date, so it can be used on a string that terminates immediately after the date.") -(defconst org-ts-regexp1 "\\(\\([0-9]\\{4\\}\\)-\\([0-9]\\{2\\}\\)-\\([0-9]\\{2\\}\\) +\\([^]+0-9>\r\n -]*\\)\\( \\([0-9]\\{2\\}\\):\\([0-9]\\{2\\}\\)\\)?\\)" +(defconst org-ts-regexp1 "\\(\\([0-9]\\{4\\}\\)-\\([0-9]\\{2\\}\\)-\\([0-9]\\{2\\}\\) *\\([^]+0-9>\r\n -]*\\)\\( \\([0-9]\\{2\\}\\):\\([0-9]\\{2\\}\\)\\)?\\)" "Regular expression matching time strings for analysis.") (defconst org-ts-regexp2 (concat "<" org-ts-regexp1 "[^>\n]\\{0,16\\}>") "Regular expression matching time stamps, with groups.") @@ -5155,7 +5337,7 @@ t))))) (defun org-activate-code (limit) - (if (re-search-forward "^[ \t]*\\(: .*\n?\\)" limit t) + (if (re-search-forward "^[ \t]*\\(:\\(?: .*\\|$\\)\n?\\)" limit t) (progn (org-remove-flyspell-overlays-in (match-beginning 0) (match-end 0)) (remove-text-properties (match-beginning 0) (match-end 0) @@ -5258,9 +5440,8 @@ '(font-lock-fontified t face org-meta-line)) t) ((or (member dc1 '("begin:" "end:" "caption:" "label:" - "orgtbl:" "tblfm:" "tblname:" "result:" - "results:" "source:" "srcname:" "call:" - "data:" "header:" "headers:")) + "orgtbl:" "tblfm:" "tblname:" "results:" + "call:" "header:" "headers:" "name:")) (and (match-end 4) (equal dc3 "attr"))) (add-text-properties beg (match-end 0) @@ -5596,14 +5777,17 @@ (if (memq 'footnote lk) '(org-activate-footnote-links)) '("^&?%%(.*\\|<%%([^>\n]*?>" (0 'org-sexp-date t)) '(org-hide-wide-columns (0 nil append)) - ;; TODO lines - (list (concat "^\\*+[ \t]+" org-todo-regexp "\\([ \t]\\|$\\)") - '(1 (org-get-todo-face 1) t)) + ;; TODO keyword + (list (format org-heading-keyword-regexp-format + org-todo-regexp) + '(2 (org-get-todo-face 2) t)) ;; DONE (if org-fontify-done-headline - (list (concat "^[*]+ +\\<\\(" - (mapconcat 'regexp-quote org-done-keywords "\\|") - "\\)\\(.*\\)") + (list (format org-heading-keyword-regexp-format + (concat + "\\(" + (mapconcat 'regexp-quote org-done-keywords "\\|") + "\\)")) '(2 'org-headline-done t)) nil) ;; Priorities @@ -5641,9 +5825,11 @@ ;; Code '(org-activate-code (1 'org-code t)) ;; COMMENT - (list (concat "^\\*+[ \t]+\\<\\(" org-comment-string - "\\|" org-quote-string "\\)\\>") - '(1 'org-special-keyword t)) + (list (format org-heading-keyword-regexp-format + (concat "\\(" + org-comment-string "\\|" org-quote-string + "\\)")) + '(2 'org-special-keyword t)) '("^#.*" (0 'font-lock-comment-face t)) ;; Blocks and meta lines '(org-fontify-meta-lines-and-blocks) @@ -5674,7 +5860,7 @@ (when org-pretty-entities (catch 'match (while (re-search-forward - "\\\\\\([a-zA-Z][a-zA-Z0-9]*\\)\\($\\|[^[:alnum:]\n]\\)" + "\\\\\\(frac[13][24]\\|[a-zA-Z]+\\)\\($\\|[^[:alpha:]\n]\\)" limit t) (if (and (not (org-in-indented-comment-line)) (setq ee (org-entity-get (match-string 1))) @@ -5769,17 +5955,10 @@ (inhibit-modification-hooks t) deactivate-mark buffer-file-name buffer-file-truename) (org-decompose-region beg end) - (remove-text-properties - beg end - (if org-indent-mode - ;; also remove line-prefix and wrap-prefix properties - '(mouse-face t keymap t org-linked-text t - invisible t intangible t - line-prefix t wrap-prefix t - org-no-flyspell t org-emphasis t) - '(mouse-face t keymap t org-linked-text t - invisible t intangible t - org-no-flyspell t org-emphasis t))) + (remove-text-properties beg end + '(mouse-face t keymap t org-linked-text t + invisible t intangible t + org-no-flyspell t org-emphasis t)) (org-remove-font-lock-display-properties beg end))) (defconst org-script-display '(((raise -0.3) (height 0.7)) @@ -5916,7 +6095,7 @@ (and limit-level (1- (* limit-level 2))) limit-level))) (org-outline-regexp - (if (not (org-mode-p)) + (if (not (eq major-mode 'org-mode)) outline-regexp (concat "\\*" (if nstars (format "\\{1,%d\\} " nstars) "+ ")))) (bob-special (and org-cycle-global-at-bob (not arg) (bobp) @@ -5979,6 +6158,8 @@ (or (bolp) (not (eq org-cycle-emulate-tab 'exc-hl-bol)))) (org-inlinetask-toggle-visibility)) + ((org-try-cdlatex-tab)) + ;; At an item/headline: delegate to `org-cycle-internal-local'. ((and (or (and org-cycle-include-plain-lists (org-at-item-p)) (save-excursion (beginning-of-line 1) @@ -5994,8 +6175,6 @@ ((org-try-structure-completion)) - ((org-try-cdlatex-tab)) - ((run-hook-with-args-until-success 'org-tab-before-tab-emulation-hook)) @@ -6155,7 +6334,7 @@ With a numeric prefix, show all headlines up to that level." (interactive "P") (let ((org-cycle-include-plain-lists - (if (org-mode-p) org-cycle-include-plain-lists nil))) + (if (eq major-mode 'org-mode) org-cycle-include-plain-lists nil))) (cond ((integerp arg) (show-all) @@ -6214,6 +6393,9 @@ (org-cycle-hide-drawers 'all) (org-cycle-show-empty-lines 'all))))) +;; This function uses outline-regexp instead of the more fundamental +;; org-outline-regexp so that org-cycle-global works outside of Org +;; buffers, where outline-regexp is needed. (defun org-overview () "Switch to overview mode, showing only top-level headlines. Really, this shows all headlines with level equal or greater than the level @@ -6223,7 +6405,7 @@ (interactive) (let ((level (save-excursion (goto-char (point-min)) - (if (re-search-forward org-outline-regexp-bol nil t) + (if (re-search-forward (concat "^" outline-regexp) nil t) (progn (goto-char (match-beginning 0)) (funcall outline-level)))))) @@ -6362,7 +6544,7 @@ (let ((files (mapcar 'expand-file-name (org-agenda-files)))) (dolist (buf (buffer-list)) (with-current-buffer buf - (if (and (org-mode-p) (buffer-file-name)) + (if (and (eq major-mode 'org-mode) (buffer-file-name)) (let ((file (expand-file-name (buffer-file-name)))) (unless (member file files) (push file files)))))) @@ -6378,7 +6560,7 @@ (defun org-cycle-hide-drawers (state) "Re-hide all drawers after a visibility state change." - (when (and (org-mode-p) + (when (and (eq major-mode 'org-mode) (not (memq state '(overview folded contents)))) (save-excursion (let* ((globalp (memq state '(contents all))) @@ -6448,16 +6630,11 @@ (widen) (show-all) (mapc (lambda (c) - (setq o (make-overlay (car c) (cdr c))) - (overlay-put o 'invisible 'outline)) + (outline-flag-region (car c) (cdr c) t)) data))))) ;;; Folding of blocks -(defconst org-block-regexp - "^[ \t]*#\\+begin_?\\([^ \n]+\\)\\(\\([^\n]+\\)\\)?\n\\([^\000]+?\\)#\\+end_?\\1[ \t]*$" - "Regular expression for hiding blocks.") - (defvar org-hide-block-overlays nil "Overlays hiding blocks.") (make-variable-buffer-local 'org-hide-block-overlays) @@ -6811,6 +6988,7 @@ (narrow-to-region beg end) (show-all) (goto-char pos) + (run-hook-with-args 'org-cycle-hook 'all) (and (window-live-p cwin) (select-window cwin)))) (defun org-get-indirect-buffer (&optional buffer) @@ -6855,7 +7033,7 @@ (and (not (save-excursion (and (ignore-errors (org-back-to-heading invisible-ok)) (org-on-heading-p)))) - (not (org-in-item-p)))) + (or force-heading (not (org-in-item-p))))) (progn (insert "\n* ") (run-hooks 'org-insert-heading-hook)) @@ -6910,6 +7088,7 @@ (let ((p (point))) (goto-char (point-at-bol)) (and (looking-at org-complex-heading-regexp) + (match-beginning 4) (> p (match-beginning 4))))))) tags pos) (cond @@ -6970,14 +7149,15 @@ (looking-at org-complex-heading-regexp) (match-string 4)) (no-tags - (looking-at "\\*+[ \t]+\\([^\n\r]*?\\)\\([ \t]+:[[:alnum:]:_@#%]+:[ \t]*\\)?$") + (looking-at (concat org-outline-regexp + "\\(.*?\\)" + "\\(?:[ \t]+:[[:alnum:]:_@#%]+:\\)?[ \t]*$")) (match-string 1)) (no-todo - (looking-at (concat "\\*+[ \t]+" org-todo-regexp " +" - "\\([^\n\r]*?[ \t]+:[[:alnum:]:_@#%]+:[ \t]*\\)?$")) - (match-string 2)) - (t (looking-at "\\*+[ \t]+\\([^\r\n]*\\)") - (match-string 1))))) + (looking-at org-todo-line-regexp) + (match-string 3)) + (t (looking-at org-heading-regexp) + (match-string 2))))) (defun org-heading-components () "Return the components of the current heading. @@ -7138,9 +7318,8 @@ The level is the number of stars at the beginning of the headline." (save-excursion (org-with-limited-levels - (ignore-errors - (org-back-to-heading t) - (funcall outline-level))))) + (if (ignore-errors (org-back-to-heading t)) + (funcall outline-level))))) (defun org-get-previous-line-level () "Return the outline depth of the last headline before the current line. @@ -7197,7 +7376,7 @@ after-change-functions)) (up-head (concat (make-string (org-get-valid-level level -1) ?*) " ")) (diff (abs (- level (length up-head) -1)))) - (if (= level 1) (error "Cannot promote to level 0. UNDO to recover if necessary")) + (if (= level 1) (error "Cannot promote to level 0. UNDO to recover if necessary")) (replace-match up-head nil t) ;; Fixup tag positioning (and org-auto-align-tags (org-set-tags nil t)) @@ -7283,6 +7462,7 @@ (not (eobp))) (funcall fun))))) +(defvar org-property-end-re) ; silence byte-compiler (defun org-fixup-indentation (diff) "Change the indentation in the current entry by DIFF. However, if any line in the current entry has no indentation, or if it @@ -7518,15 +7698,15 @@ (org-with-limited-levels (let* ((visp (not (outline-invisible-p))) (txt tree) - (^re_ (concat "\\(\\*+\\)[ \t]*")) + (^re_ "\\(\\*+\\)[ \t]*") (old-level (if (string-match org-outline-regexp-bol txt) (- (match-end 0) (match-beginning 0) 1) -1)) (force-level (cond (level (prefix-numeric-value level)) ((and (looking-at "[ \t]*$") (string-match - ^re_ (buffer-substring - (point-at-bol) (point)))) + "^\\*+$" (buffer-substring + (point-at-bol) (point)))) (- (match-end 1) (match-beginning 1))) ((and (bolp) (looking-at org-outline-regexp)) @@ -7536,7 +7716,7 @@ (condition-case nil (progn (outline-previous-visible-heading 1) - (if (looking-at re) + (if (looking-at ^re_) (- (match-end 0) (match-beginning 0) 1) 1)) (error 1)))) @@ -7545,7 +7725,7 @@ (progn (or (looking-at org-outline-regexp) (outline-next-visible-heading 1)) - (if (looking-at re) + (if (looking-at ^re_) (- (match-end 0) (match-beginning 0) 1) 1)) (error 1)))) @@ -7563,7 +7743,7 @@ (if force-level (delete-region (point-at-bol) (point))) ;; Paste - (beginning-of-line 1) + (beginning-of-line (if (bolp) 1 2)) (unless for-yank (org-back-over-empty-lines)) (setq beg (point)) (and (fboundp 'org-id-paste-tracker) (org-id-paste-tracker txt)) @@ -7670,17 +7850,11 @@ (defun org-narrow-to-block () "Narrow buffer to the current block." (interactive) - (let ((bstart "^[ \t]*#\\+begin") - (bend "[ \t]*#\\+end") - (case-fold-search t) ;; allow #+BEGIN - b_start b_end) - (if (org-in-regexps-block-p bstart bend) - (progn - (save-excursion (re-search-backward bstart nil t) - (setq b_start (match-beginning 0))) - (save-excursion (re-search-forward bend nil t) - (setq b_end (match-end 0))) - (narrow-to-region b_start b_end)) + (let* ((case-fold-search t) + (blockp (org-between-regexps-p "^[ \t]*#\\+begin_.*" + "^[ \t]*#\\+end_.*"))) + (if blockp + (narrow-to-region (car blockp) (cdr blockp)) (error "Not in a block")))) (eval-when-compile @@ -7714,7 +7888,8 @@ and still retain the repeater to cover future instances of the task." (interactive "nNumber of clones to produce: \nsDate shift per clone (e.g. +1w, empty to copy unchanged): ") (let (beg end template task idprop - shift-n shift-what doshift nmin nmax (n-no-remove -1)) + shift-n shift-what doshift nmin nmax (n-no-remove -1) + (drawer-re org-drawer-regexp)) (if (not (and (integerp n) (> n 0))) (error "Invalid number of replications %s" n)) (if (and (setq doshift (and (stringp shift) (string-match "\\S-" shift))) @@ -7735,19 +7910,6 @@ (or (bolp) (insert "\n")) (setq end (point)) (setq template (buffer-substring beg end)) - ;; Remove clocks and empty drawers - (with-temp-buffer - (insert template) - (goto-char (point-min)) - (while (re-search-forward - "^[ \t]*CLOCK:.*$" (save-excursion (org-end-of-subtree t t)) t) - (replace-match "") - (kill-whole-line)) - (goto-char (point-min)) - (while (re-search-forward - (concat "^[ \t]*:" (regexp-opt org-drawers) ":[ \t]*$") nil t) - (mapc (lambda(d) (org-remove-empty-drawer-at d (point))) org-drawers)) - (setq template (buffer-substring (point-min) (point-max)))) (when (and doshift (string-match "<[^<>\n]+ \\+[0-9]+[dwmy][^<>\n]*>" template)) (delete-region beg end) @@ -7760,11 +7922,17 @@ (insert template) (org-mode) (goto-char (point-min)) + (org-show-subtree) (and idprop (if org-clone-delete-id (org-entry-delete nil "ID") (org-id-get-create t))) - (while (re-search-forward org-property-start-re nil t) - (org-remove-empty-drawer-at "PROPERTIES" (point))) + (unless (= n 0) + (while (re-search-forward "^[ \t]*CLOCK:.*$" nil t) + (kill-whole-line)) + (goto-char (point-min)) + (while (re-search-forward drawer-re nil t) + (mapc (lambda (d) + (org-remove-empty-drawer-at d (point))) org-drawers))) (goto-char (point-min)) (when doshift (while (re-search-forward org-ts-regexp-both nil t) @@ -8336,6 +8504,7 @@ (org-back-to-heading t) (setq beg (point) end (org-end-of-subtree t t))) (put-text-property beg end 'org-category cat) + (put-text-property beg end 'org-category-position beg) (goto-char pos))))))) @@ -8526,7 +8695,7 @@ (setq cpltxt (concat "file:" file) link (org-make-link cpltxt)))) - ((and (buffer-file-name (buffer-base-buffer)) (org-mode-p)) + ((and (buffer-file-name (buffer-base-buffer)) (eq major-mode 'org-mode)) (setq custom-id (org-entry-get nil "CUSTOM_ID")) (cond ((org-in-regexp "<<\\(.*?\\)>>") @@ -8776,8 +8945,8 @@ (char-to-string char))) text ""))) (defun org-link-unescape (str) - "Unhex hexified unicode strings as returned from the JavaScript function -encodeURIComponent. E.g. `%C3%B6' is the german Umlaut `ö'." + "Unhex hexified Unicode strings as returned from the JavaScript function +encodeURIComponent. E.g. `%C3%B6' is the german Umlaut `ö'." (unless (and (null str) (string= "" str)) (let ((pos 0) (case-fold-search t) unhexed) (while (setq pos (string-match "\\(%[0-9a-f][0-9a-f]\\)+" str pos)) @@ -8787,7 +8956,7 @@ str) (defun org-link-unescape-compound (hex) - "Unhexify unicode hex-chars. E.g. `%C3%B6' is the German Umlaut `ö'. + "Unhexify Unicode hex-chars. E.g. `%C3%B6' is the German Umlaut `ö'. Note: this function also decodes single byte encodings like `%E1' (\"á\") if not followed by another `%[A-F0-9]{2}' group." (save-match-data @@ -8854,7 +9023,7 @@ (org-load-modules-maybe) (org-run-like-in-org-mode 'org-insert-link)) -(defun org-insert-link (&optional complete-file link-location) +(defun org-insert-link (&optional complete-file link-location default-description) "Insert a link. At the prompt, enter the link. Completion can be used to insert any of the link protocol prefixes like @@ -8872,8 +9041,8 @@ If there is already a link at point, this command will allow you to edit link and description parts. -With a \\[universal-argument] prefix, prompts for a file to link to. The file name can -be selected using completion. The path to the file will be relative to the +With a \\[universal-argument] prefix, prompts for a file to link to. The file name can +be selected using completion. The path to the file will be relative to the current directory if the file is in the current directory or a subdirectory. Otherwise, the link will be the absolute path as completed in the minibuffer \(i.e. normally ~/path/to/file). You can configure this behavior using the @@ -8890,7 +9059,10 @@ link description. If the LINK-LOCATION parameter is non-nil, this value will be -used as the link location instead of reading one interactively." +used as the link location instead of reading one interactively. + +If the DEFAULT-DESCRIPTION parameter is non-nil, this value will +be used as the default description." (interactive "P") (let* ((wcf (current-window-configuration)) (region (if (org-region-active-p) @@ -8931,7 +9103,7 @@ (reverse org-stored-links) "\n")))) (let ((cw (selected-window))) (select-window (get-buffer-window "*Org Links*" 'visible)) - (with-current-buffer "*Org Links*" (setq truncate-lines) t) + (with-current-buffer "*Org Links*" (setq truncate-lines t)) (unless (pos-visible-in-window-p (point-max)) (org-fit-window-to-buffer)) (and (window-live-p cw) (select-window cw))) @@ -9018,7 +9190,8 @@ (setq desc path)))) (if org-make-link-description-function - (setq desc (funcall org-make-link-description-function link desc))) + (setq desc (funcall org-make-link-description-function link desc)) + (if default-description (setq desc default-description))) (setq desc (read-string "Description: " desc)) (unless (string-match "\\S-" desc) (setq desc nil)) @@ -9055,10 +9228,12 @@ (defun org-completing-read (&rest args) "Completing-read with SPACE being a normal character." - (let ((minibuffer-local-completion-map + (let ((enable-recursive-minibuffers t) + (minibuffer-local-completion-map (copy-keymap minibuffer-local-completion-map))) (org-defkey minibuffer-local-completion-map " " 'self-insert-command) (org-defkey minibuffer-local-completion-map "?" 'self-insert-command) + (org-defkey minibuffer-local-completion-map (kbd "C-c !") 'org-time-stamp-inactive) (apply 'org-icompleting-read args))) (defun org-completing-read-no-i (&rest args) @@ -9229,7 +9404,8 @@ (org-open-at-point 'in-emacs)) (defun org-open-at-mouse (ev) - "Open file link or URL at mouse." + "Open file link or URL at mouse. +See the docstring of `org-open-file' for details." (interactive "e") (mouse-set-point ev) (if (eq major-mode 'org-agenda-mode) @@ -9338,7 +9514,8 @@ (save-excursion (when (or (org-in-regexp org-angle-link-re) (org-in-regexp org-plain-link-re)) - (setq type (match-string 1) path (match-string 2)) + (setq type (match-string 1) + path (org-link-unescape (match-string 2))) (throw 'match t))) (save-excursion (when (org-in-regexp (org-re "\\(:[[:alnum:]_@#%:]+\\):[ \t]*$")) @@ -9464,7 +9641,8 @@ ((equal arg '(16)) ''org-occur) (t nil)) ,pos))) - (condition-case nil (eval cmd) + (condition-case nil (let ((org-link-search-inhibit-query t)) + (eval cmd)) (error (progn (widen) (eval cmd)))))) (t @@ -9500,7 +9678,7 @@ ((equal (length links) 1) (setq link (list (car links)))) ((and (integerp nth) (>= (length links) (if have-zero (1+ nth) nth))) - (setq link (nth (if have-zero nth (1- nth)) links))) + (setq link (list (nth (if have-zero nth (1- nth)) links)))) (t ; we have to select a link (save-excursion (save-window-excursion @@ -9608,13 +9786,18 @@ (set-window-configuration org-window-config-before-follow-link)") (defvar org-link-search-inhibit-query nil) ;; dynamically scoped -(defun org-link-search (s &optional type avoid-pos) +(defun org-link-search (s &optional type avoid-pos stealth) "Search for a link search option. If S is surrounded by forward slashes, it is interpreted as a regular expression. In org-mode files, this will create an `org-occur' sparse tree. In ordinary files, `occur' will be used to list matches. If the current buffer is in `dired-mode', grep will be used to search -in all files. If AVOID-POS is given, ignore matches near that position." +in all files. If AVOID-POS is given, ignore matches near that position. + +When optional argument STEALTH is non-nil, do not modify +visibility around point, thus ignoring +`org-show-hierarchy-above', `org-show-following-heading' and +`org-show-siblings' variables." (let ((case-fold-search t) (s0 (mapconcat 'identity (org-split-string s "[ \t\r\n]+") " ")) (markers (concat "\\(?:" (mapconcat (lambda (x) (regexp-quote (car x))) @@ -9665,12 +9848,12 @@ ((string-match "^/\\(.*\\)/$" s) ;; A regular expression (cond - ((org-mode-p) + ((eq major-mode 'org-mode) (org-occur (match-string 1 s))) ;;((eq major-mode 'dired-mode) ;; (grep (concat "grep -n -e '" (match-string 1 s) "' *"))) (t (org-do-occur (match-string 1 s))))) - ((and (org-mode-p) org-link-search-must-match-exact-headline) + ((and (eq major-mode 'org-mode) org-link-search-must-match-exact-headline) (and (equal (string-to-char s) ?*) (setq s (substring s 1))) (goto-char (point-min)) (cond @@ -9738,7 +9921,9 @@ (goto-char (match-beginning 1)) (goto-char pos) (error "No match")))))) - (and (org-mode-p) (org-show-context 'link-search)) + (and (eq major-mode 'org-mode) + (not stealth) + (org-show-context 'link-search)) type)) (defun org-search-not-self (group &rest args) @@ -9892,6 +10077,10 @@ to search for. If LINE or SEARCH is given, the file will be opened in Emacs, unless an entry from org-file-apps that makes use of groups in a regexp matches. + +If you want to change the way frames are used when following a +link, please customize `org-link-frame-setup'. + If the file does not exist, an error is thrown." (let* ((file (if (equal path "") buffer-file-name @@ -9941,8 +10130,8 @@ match) (progn (setq in-emacs (or in-emacs line search)) nil))) ; if we have no match in apps-dlink, - ; always open the file in emacs if line or search - ; is given (for backwards compatibility) + ; always open the file in emacs if line or search + ; is given (for backwards compatibility) (assoc-default dfile (org-apps-regexp-alist apps a-m-a-p) 'string-match) (cdr (assoc ext apps)) @@ -10003,7 +10192,7 @@ (set-match-data link-match-data) (eval cmd)))) (t (funcall (cdr (assq 'file org-link-frame-setup)) file))) - (and (org-mode-p) (eq old-mode 'org-mode) + (and (eq major-mode 'org-mode) (eq old-mode 'org-mode) (or (not (equal old-buffer (current-buffer))) (not (equal old-pos (point)))) (org-mark-ring-push old-pos old-buffer)))) @@ -10326,7 +10515,7 @@ (interactive "P") (let* ((bfn (buffer-file-name (buffer-base-buffer))) (case-fold-search nil) - (path (and (org-mode-p) (org-get-outline-path)))) + (path (and (eq major-mode 'org-mode) (org-get-outline-path)))) (if current (setq path (append path (save-excursion (org-back-to-heading t) @@ -10392,8 +10581,10 @@ (goto-char region-start) (or (bolp) (goto-char (point-at-bol))) (setq region-start (point)) - (unless (org-kill-is-subtree-p - (buffer-substring region-start region-end)) + (unless (or (org-kill-is-subtree-p + (buffer-substring region-start region-end)) + (prog1 org-refile-active-region-within-subtree + (org-toggle-heading))) (error "The region is not a (sequence of) subtree(s)"))) (if (equal goto '(16)) (org-refile-goto-last-stored) @@ -10408,10 +10599,20 @@ (marker-position org-clock-hd-marker))) (setq goto nil))) (setq it (or rfloc - (save-excursion - (org-refile-get-location - (if goto "Goto" "Refile to") default-buffer - org-refile-allow-creating-parent-nodes))))) + (let (heading-text) + (save-excursion + (unless goto + (org-back-to-heading t) + (setq heading-text + (nth 4 (org-heading-components)))) + (org-refile-get-location + (cond (goto "Goto") + (regionp "Refile region to") + (t (concat "Refile subtree \"" + heading-text "\" to"))) + default-buffer + org-refile-allow-creating-parent-nodes + goto)))))) (setq file (nth 1 it) re (nth 2 it) pos (nth 3 it)) @@ -10490,16 +10691,20 @@ (bookmark-jump "org-refile-last-stored") (message "This is the location of the last refile")) -(defun org-refile-get-location (&optional prompt default-buffer new-nodes) +(defun org-refile-get-location (&optional prompt default-buffer new-nodes + no-exclude) "Prompt the user for a refile location, using PROMPT. PROMPT should not be suffixed with a colon and a space, because this function appends the default value from -`org-refile-history' automatically, if that is not empty." +`org-refile-history' automatically, if that is not empty. +When NO-EXCLUDE is set, do not exclude headlines in the current subtree, +this is used for the GOTO interface." (let ((org-refile-targets org-refile-targets) (org-refile-use-outline-path org-refile-use-outline-path) excluded-entries) (when (and (eq major-mode 'org-mode) - (not org-refile-use-cache)) + (not org-refile-use-cache) + (not no-exclude)) (org-map-tree (lambda() (setq excluded-entries @@ -10777,7 +10982,7 @@ "Update all dynamic blocks in the buffer. This function can be used in a hook." (interactive) - (when (org-mode-p) + (when (eq major-mode 'org-mode) (org-map-dblocks 'org-update-dblock))) @@ -10796,10 +11001,8 @@ "BEGIN_CENTER" "END_CENTER" "BEGIN_SRC" "END_SRC" "BEGIN_RESULT" "END_RESULT" - "SOURCE:" "SRCNAME:" "FUNCTION:" - "RESULTS:" "DATA:" + "NAME:" "RESULTS:" "HEADER:" "HEADERS:" - "BABEL:" "CATEGORY:" "COLUMNS:" "PROPERTY:" "CAPTION:" "LABEL:" "SETUPFILE:" @@ -10898,13 +11101,16 @@ (save-excursion (org-back-to-heading) (let (case-fold-search) - (if (looking-at (concat org-outline-regexp - "\\( *\\<" org-comment-string "\\>[ \t]*\\)")) - (replace-match "" t t nil 1) - (if (looking-at org-outline-regexp) - (progn - (goto-char (match-end 0)) - (insert org-comment-string " "))))))) + (cond + ((looking-at (format org-heading-keyword-regexp-format + org-comment-string)) + (goto-char (match-end 1)) + (looking-at (concat " +" org-comment-string)) + (replace-match "" t t) + (when (eolp) (insert " "))) + ((looking-at org-outline-regexp) + (goto-char (match-end 0)) + (insert org-comment-string " ")))))) (defvar org-last-todo-state-is-todo nil "This is non-nil when the last TODO state change led to a TODO state. @@ -10930,26 +11136,21 @@ (let* ((ct (org-current-time)) (dct (decode-time ct)) (ct1 - (if (< (nth 2 dct) org-extend-today-until) + (if (and org-use-effective-time + (< (nth 2 dct) org-extend-today-until)) (encode-time 0 59 23 (1- (nth 3 dct)) (nth 4 dct) (nth 5 dct)) ct))) ct1)) (defun org-todo-yesterday (&optional arg) - "Like `org-todo' but the time of change will be 23:59 of yesterday" - (interactive "P") - (let* ((hour (third (decode-time - (org-current-time)))) - (org-extend-today-until (1+ hour))) - (org-todo arg))) - -(defun org-agenda-todo-yesterday (&optional arg) - "Like `org-agenda-todo' but the time of change will be 23:59 of yesterday" + "Like `org-todo' but the time of change will be 23:59 of yesterday." (interactive "P") - (let* ((hour (third (decode-time - (org-current-time)))) - (org-extend-today-until (1+ hour))) - (org-agenda-todo arg))) + (if (eq major-mode 'org-agenda-mode) + (apply 'org-agenda-todo-yesterday arg) + (let* ((hour (third (decode-time + (org-current-time)))) + (org-extend-today-until (1+ hour))) + (org-todo arg)))) (defun org-todo (&optional arg) "Change the TODO state of an item. @@ -10970,6 +11171,7 @@ With a double \\[universal-argument] prefix, switch to the next set of TODO \ keywords (nextset). With a triple \\[universal-argument] prefix, circumvent any state blocking. +With a numeric prefix arg of 0, inhibit note taking for the change. For calling through lisp, arg is also interpreted in the following way: 'none -> empty state @@ -10993,14 +11195,17 @@ (catch 'exit (org-back-to-heading t) (if (looking-at org-outline-regexp) (goto-char (1- (match-end 0)))) - (or (looking-at (concat " +" org-todo-regexp "\\( +\\|$\\)")) - (looking-at " *")) + (or (looking-at (concat " +" org-todo-regexp "\\( +\\|[ \t]*$\\)")) + (looking-at "\\(?: *\\|[ \t]*$\\)")) (let* ((match-data (match-data)) (startpos (point-at-bol)) (logging (save-match-data (org-entry-get nil "LOGGING" t t))) (org-log-done org-log-done) (org-log-repeat org-log-repeat) (org-todo-log-states org-todo-log-states) + (org-inhibit-logging + (if (equal arg 0) + (progn (setq arg nil) 'note) org-inhibit-logging)) (this (match-string 1)) (hl-pos (match-beginning 0)) (head (org-get-todo-sequence-head this)) @@ -11292,8 +11497,11 @@ (outline-next-heading) (setq end (point)) (goto-char beg) - (if (re-search-forward "^[ \t]*\\([-+*]\\|[0-9]+[.)]\\)[ \t]+\\[[- ]\\]" - end t) + (if (org-list-search-forward + (concat (org-item-beginning-re) + "\\(?:\\[@\\(?:start:\\)?\\([0-9]+\\|[A-Za-z]\\)\\][ \t]*\\)?" + "\\[[- ]\\]") + end t) (progn (if (boundp 'org-blocked-by-checkboxes) (setq org-blocked-by-checkboxes t)) @@ -11725,39 +11933,43 @@ With argument TIME, set the deadline at the corresponding date. TIME can either be an Org date like \"2011-07-24\" or a delta like \"+2d\"." (interactive "P") - (let* ((old-date (org-entry-get nil "DEADLINE")) - (repeater (and old-date - (string-match - "\\([.+-]+[0-9]+[dwmy]\\(?:[/ ][-+]?[0-9]+[dwmy]\\)?\\) ?" - old-date) - (match-string 1 old-date)))) - (if remove - (progn - (when (and old-date org-log-redeadline) - (org-add-log-setup 'deldeadline nil old-date 'findpos - org-log-redeadline)) - (org-remove-timestamp-with-keyword org-deadline-string) - (message "Item no longer has a deadline.")) - (org-add-planning-info 'deadline time 'closed) - (when (and old-date org-log-redeadline - (not (equal old-date - (substring org-last-inserted-timestamp 1 -1)))) - (org-add-log-setup 'redeadline nil old-date 'findpos - org-log-redeadline)) - (when repeater - (save-excursion - (org-back-to-heading t) - (when (re-search-forward (concat org-deadline-string " " - org-last-inserted-timestamp) - (save-excursion - (outline-next-heading) (point)) t) - (goto-char (1- (match-end 0))) - (insert " " repeater) - (setq org-last-inserted-timestamp - (concat (substring org-last-inserted-timestamp 0 -1) - " " repeater - (substring org-last-inserted-timestamp -1)))))) - (message "Deadline on %s" org-last-inserted-timestamp)))) + (if (and (org-region-active-p) org-loop-over-headlines-in-active-region) + (let (org-loop-over-headlines-in-active-region) + (org-map-entries + `(org-deadline ',remove ,time) org-loop-over-headlines-in-active-region 'region (if (outline-invisible-p) (org-end-of-subtree nil t)))) + (let* ((old-date (org-entry-get nil "DEADLINE")) + (repeater (and old-date + (string-match + "\\([.+-]+[0-9]+[dwmy]\\(?:[/ ][-+]?[0-9]+[dwmy]\\)?\\) ?" + old-date) + (match-string 1 old-date)))) + (if remove + (progn + (when (and old-date org-log-redeadline) + (org-add-log-setup 'deldeadline nil old-date 'findpos + org-log-redeadline)) + (org-remove-timestamp-with-keyword org-deadline-string) + (message "Item no longer has a deadline.")) + (org-add-planning-info 'deadline time 'closed) + (when (and old-date org-log-redeadline + (not (equal old-date + (substring org-last-inserted-timestamp 1 -1)))) + (org-add-log-setup 'redeadline nil old-date 'findpos + org-log-redeadline)) + (when repeater + (save-excursion + (org-back-to-heading t) + (when (re-search-forward (concat org-deadline-string " " + org-last-inserted-timestamp) + (save-excursion + (outline-next-heading) (point)) t) + (goto-char (1- (match-end 0))) + (insert " " repeater) + (setq org-last-inserted-timestamp + (concat (substring org-last-inserted-timestamp 0 -1) + " " repeater + (substring org-last-inserted-timestamp -1)))))) + (message "Deadline on %s" org-last-inserted-timestamp))))) (defun org-schedule (&optional remove time) "Insert the SCHEDULED: string with a timestamp to schedule a TODO item. @@ -11765,39 +11977,43 @@ With argument TIME, scheduled at the corresponding date. TIME can either be an Org date like \"2011-07-24\" or a delta like \"+2d\"." (interactive "P") - (let* ((old-date (org-entry-get nil "SCHEDULED")) - (repeater (and old-date - (string-match - "\\([.+-]+[0-9]+[dwmy]\\(?:[/ ][-+]?[0-9]+[dwmy]\\)?\\) ?" - old-date) - (match-string 1 old-date)))) - (if remove - (progn - (when (and old-date org-log-reschedule) - (org-add-log-setup 'delschedule nil old-date 'findpos - org-log-reschedule)) - (org-remove-timestamp-with-keyword org-scheduled-string) - (message "Item is no longer scheduled.")) - (org-add-planning-info 'scheduled time 'closed) - (when (and old-date org-log-reschedule - (not (equal old-date - (substring org-last-inserted-timestamp 1 -1)))) - (org-add-log-setup 'reschedule nil old-date 'findpos - org-log-reschedule)) - (when repeater - (save-excursion - (org-back-to-heading t) - (when (re-search-forward (concat org-scheduled-string " " - org-last-inserted-timestamp) - (save-excursion - (outline-next-heading) (point)) t) - (goto-char (1- (match-end 0))) - (insert " " repeater) - (setq org-last-inserted-timestamp - (concat (substring org-last-inserted-timestamp 0 -1) - " " repeater - (substring org-last-inserted-timestamp -1)))))) - (message "Scheduled to %s" org-last-inserted-timestamp)))) + (if (and (org-region-active-p) org-loop-over-headlines-in-active-region) + (let (org-loop-over-headlines-in-active-region) + (org-map-entries + `(org-schedule ',remove ,time) org-loop-over-headlines-in-active-region 'region (if (outline-invisible-p) (org-end-of-subtree nil t)))) + (let* ((old-date (org-entry-get nil "SCHEDULED")) + (repeater (and old-date + (string-match + "\\([.+-]+[0-9]+[dwmy]\\(?:[/ ][-+]?[0-9]+[dwmy]\\)?\\) ?" + old-date) + (match-string 1 old-date)))) + (if remove + (progn + (when (and old-date org-log-reschedule) + (org-add-log-setup 'delschedule nil old-date 'findpos + org-log-reschedule)) + (org-remove-timestamp-with-keyword org-scheduled-string) + (message "Item is no longer scheduled.")) + (org-add-planning-info 'scheduled time 'closed) + (when (and old-date org-log-reschedule + (not (equal old-date + (substring org-last-inserted-timestamp 1 -1)))) + (org-add-log-setup 'reschedule nil old-date 'findpos + org-log-reschedule)) + (when repeater + (save-excursion + (org-back-to-heading t) + (when (re-search-forward (concat org-scheduled-string " " + org-last-inserted-timestamp) + (save-excursion + (outline-next-heading) (point)) t) + (goto-char (1- (match-end 0))) + (insert " " repeater) + (setq org-last-inserted-timestamp + (concat (substring org-last-inserted-timestamp 0 -1) + " " repeater + (substring org-last-inserted-timestamp -1)))))) + (message "Scheduled to %s" org-last-inserted-timestamp))))) (defun org-get-scheduled-time (pom &optional inherit) "Get the scheduled time as a time tuple, of a format suitable @@ -11862,9 +12078,8 @@ default-input (and ts (org-get-compact-tod ts)))))) (when what (setq time - (if (and (stringp time) - (string-match "^[-+]+[0-9]" time)) - ;; This is a relative time, set the proper date + (if (stringp time) + ;; This is a string (relative or absolute), set proper date (apply 'encode-time (org-read-date-analyze time default-time (decode-time default-time))) @@ -11915,7 +12130,7 @@ (re-search-forward org-closed-time-regexp nil t))) (replace-match "") (if (looking-at "--+<[^>]+>") (replace-match "")))) - (and (looking-at "^[ \t]+") (replace-match "")) + (and (looking-at "[ \t]+") (replace-match "")) (and org-adapt-indentation (bolp) (org-indent-to-column col)) (when what (insert @@ -12072,7 +12287,8 @@ "this entry") (t (error "This should not happen"))))) (if org-log-note-extra (insert org-log-note-extra)) - (org-set-local 'org-finish-function 'org-store-log-note))) + (org-set-local 'org-finish-function 'org-store-log-note) + (run-hooks 'org-log-buffer-setup-hook))) (defvar org-note-abort nil) ; dynamically scoped (defun org-store-log-note () @@ -12098,6 +12314,12 @@ (cons "%T" (format-time-string (org-time-stamp-format 'long nil) org-log-note-effective-time)) + (cons "%d" (format-time-string + (org-time-stamp-format nil 'inactive) + org-log-note-effective-time)) + (cons "%D" (format-time-string + (org-time-stamp-format nil nil) + org-log-note-effective-time)) (cons "%s" (if org-log-note-state (concat "\"" org-log-note-state "\"") "")) @@ -12514,6 +12736,7 @@ 'mouse-face 'highlight 'org-not-done-regexp org-not-done-regexp 'org-todo-regexp org-todo-regexp + 'org-complex-heading-regexp org-complex-heading-regexp 'help-echo (format "mouse-2 or RET jump to org file %s" (abbreviate-file-name @@ -12604,7 +12827,7 @@ (match-beginning 0) (match-beginning 1))) (org-show-context 'tags-tree)) ((eq action 'agenda) - (setq txt (org-format-agenda-item + (setq txt (org-agenda-format-item "" (concat (if (eq org-tags-match-list-sublevels 'indented) @@ -12997,7 +13220,7 @@ (goto-char (match-beginning 1)) (insert " ") (delete-region (point) (1+ (match-beginning 2))) - (setq ncol (max (1+ (current-column)) + (setq ncol (max (current-column) (1+ col) (if (> to-col 0) to-col @@ -13160,7 +13383,7 @@ (interactive (list (region-beginning) (region-end) (let ((org-last-tags-completion-table - (if (org-mode-p) + (if (eq major-mode 'org-mode) (org-get-buffer-tags) (org-global-tags-completion-table)))) (org-icompleting-read @@ -13179,7 +13402,7 @@ (loop for l from l1 to l2 do (org-goto-line l) (setq m (get-text-property (point) 'org-hd-marker)) - (when (or (and (org-mode-p) (org-on-heading-p)) + (when (or (and (eq major-mode 'org-mode) (org-on-heading-p)) (and agendap m)) (setq buf (if agendap (marker-buffer m) (current-buffer)) pos (if agendap m (point))) @@ -13525,61 +13748,67 @@ to t around the call to `org-entry-properties' to get the same speedup. Note that if your function moves around to retrieve tags and properties at a *different* entry, you cannot use these techniques." - (let* ((org-agenda-archives-mode nil) ; just to make sure - (org-agenda-skip-archived-trees (memq 'archive skip)) - (org-agenda-skip-comment-trees (memq 'comment skip)) - (org-agenda-skip-function - (car (org-delete-all '(comment archive) skip))) - (org-tags-match-list-sublevels t) - matcher file res - org-todo-keywords-for-agenda - org-done-keywords-for-agenda - org-todo-keyword-alist-for-agenda - org-drawers-for-agenda - org-tag-alist-for-agenda) + (unless (and (eq scope 'region) (not (org-region-active-p))) + (let* ((org-agenda-archives-mode nil) ; just to make sure + (org-agenda-skip-archived-trees (memq 'archive skip)) + (org-agenda-skip-comment-trees (memq 'comment skip)) + (org-agenda-skip-function + (car (org-delete-all '(comment archive) skip))) + (org-tags-match-list-sublevels t) + matcher file res + org-todo-keywords-for-agenda + org-done-keywords-for-agenda + org-todo-keyword-alist-for-agenda + org-drawers-for-agenda + org-tag-alist-for-agenda) - (cond - ((eq match t) (setq matcher t)) - ((eq match nil) (setq matcher t)) - (t (setq matcher (if match (cdr (org-make-tags-matcher match)) t)))) + (cond + ((eq match t) (setq matcher t)) + ((eq match nil) (setq matcher t)) + (t (setq matcher (if match (cdr (org-make-tags-matcher match)) t)))) - (save-excursion - (save-restriction - (cond ((eq scope 'tree) - (org-back-to-heading t) - (org-narrow-to-subtree) - (setq scope nil)) - ((and (eq scope 'region) (org-region-active-p)) - (narrow-to-region (region-beginning) (region-end)) - (setq scope nil))) + (save-excursion + (save-restriction + (cond ((eq scope 'tree) + (org-back-to-heading t) + (org-narrow-to-subtree) + (setq scope nil)) + ((and (eq scope 'region) (org-region-active-p)) + (narrow-to-region (region-beginning) + (save-excursion + (goto-char (region-end)) + (unless (and (bolp) (org-at-heading-p)) + (outline-next-heading)) + (point))) + (setq scope nil))) - (if (not scope) - (progn - (org-prepare-agenda-buffers - (list (buffer-file-name (current-buffer)))) - (setq res (org-scan-tags func matcher))) - ;; Get the right scope - (cond - ((and scope (listp scope) (symbolp (car scope))) - (setq scope (eval scope))) - ((eq scope 'agenda) - (setq scope (org-agenda-files t))) - ((eq scope 'agenda-with-archives) - (setq scope (org-agenda-files t)) - (setq scope (org-add-archive-files scope))) - ((eq scope 'file) - (setq scope (list (buffer-file-name)))) - ((eq scope 'file-with-archives) - (setq scope (org-add-archive-files (list (buffer-file-name)))))) - (org-prepare-agenda-buffers scope) - (while (setq file (pop scope)) - (with-current-buffer (org-find-base-buffer-visiting file) - (save-excursion - (save-restriction - (widen) - (goto-char (point-min)) - (setq res (append res (org-scan-tags func matcher)))))))))) - res)) + (if (not scope) + (progn + (org-prepare-agenda-buffers + (list (buffer-file-name (current-buffer)))) + (setq res (org-scan-tags func matcher))) + ;; Get the right scope + (cond + ((and scope (listp scope) (symbolp (car scope))) + (setq scope (eval scope))) + ((eq scope 'agenda) + (setq scope (org-agenda-files t))) + ((eq scope 'agenda-with-archives) + (setq scope (org-agenda-files t)) + (setq scope (org-add-archive-files scope))) + ((eq scope 'file) + (setq scope (list (buffer-file-name)))) + ((eq scope 'file-with-archives) + (setq scope (org-add-archive-files (list (buffer-file-name)))))) + (org-prepare-agenda-buffers scope) + (while (setq file (pop scope)) + (with-current-buffer (org-find-base-buffer-visiting file) + (save-excursion + (save-restriction + (widen) + (goto-char (point-min)) + (setq res (append res (org-scan-tags func matcher)))))))))) + res))) ;;;; Properties @@ -13749,7 +13978,7 @@ beg end range props sum-props key key1 value string clocksum) (save-excursion (when (condition-case nil - (and (org-mode-p) (org-back-to-heading t)) + (and (eq major-mode 'org-mode) (org-back-to-heading t)) (error nil)) (setq beg (point)) (setq sum-props (get-text-property (point) 'org-summaries)) @@ -13860,17 +14089,23 @@ (cdr (assoc property (org-entry-properties nil 'special property))) (let ((range (unless (org-before-first-heading-p) (org-get-property-block)))) - (if (and range - (goto-char (car range)) - (re-search-forward - (org-re-property property) - (cdr range) t)) - ;; Found the property, return it. - (if (match-end 1) - (if literal-nil - (org-match-string-no-properties 1) - (org-not-nil (org-match-string-no-properties 1))) - ""))))))) + (when (and range (goto-char (car range))) + ((lambda (val) (when val (if literal-nil val (org-not-nil val)))) + (cond + ((re-search-forward + (org-re-property property) (cdr range) t) + (if (match-end 1) (org-match-string-no-properties 1) "")) + ((re-search-forward + (org-re-property (concat property "+")) (cdr range) t) + (cdr (assoc + property + (org-update-property-plist + (concat property "+") + (if (match-end 1) (org-match-string-no-properties 1) "") + (list (or (assoc property org-file-properties) + (assoc property org-global-properties) + (assoc property org-global-properties-fixed) + )))))))))))))) (defun org-property-or-variable-value (var &optional inherit) "Check if there is a property fixing the value of VAR. @@ -14222,8 +14457,11 @@ in the current file." (interactive (list nil nil)) (let* ((property (or property (org-read-property-name))) - (value (or value (org-read-property-value property)))) + (value (or value (org-read-property-value property))) + (fn (assoc property org-properties-postprocess-alist))) (setq org-last-set-property property) + ;; Possibly postprocess the inserted value: + (when fn (setq value (funcall (cadr fn) value))) (unless (equal (org-entry-get nil property) value) (org-entry-put nil property value)))) @@ -14568,7 +14806,7 @@ which will at least partially be understood by `parse-time-string'. Unrecognized parts of the date will default to the current day, month, year, hour and minute. If this command is called to replace a timestamp at point, -of to enter the second timestamp of a range, the default time is taken +or to enter the second timestamp of a range, the default time is taken from the existing stamp. Furthermore, the command prefers the future, so if you are giving a date where the year is not given, and the day-month combination is already past in the current year, it will assume you @@ -14997,6 +15235,7 @@ N is the number of WHATs to shift. DEF-FLAG is t when a double ++ or -- indicates shift relative to the DEFAULT date rather than TODAY." + (require 'parse-time) (when (and (string-match (concat @@ -15110,7 +15349,7 @@ (org-restart-font-lock) (setq org-table-may-need-update t) (if org-display-custom-times - (message "Time stamps are overlayed with custom format") + (message "Time stamps are overlaid with custom format") (message "Time stamp overlays removed"))) (defun org-display-custom-time (beg end) @@ -15337,12 +15576,19 @@ l (push m l))) (apply 'format fmt (nreverse l)))) -(defun org-time-string-to-time (s) - (apply 'encode-time (org-parse-time-string s))) +(defun org-time-string-to-time (s &optional buffer pos) + (condition-case errdata + (apply 'encode-time (org-parse-time-string s)) + (error (error "Bad timestamp `%s'%s\nError was: %s" + s (if (not (and buffer pos)) + "" + (format " at %d in buffer `%s'" pos buffer)) + (cdr errdata))))) + (defun org-time-string-to-seconds (s) (org-float-time (org-time-string-to-time s))) -(defun org-time-string-to-absolute (s &optional daynr prefer show-all) +(defun org-time-string-to-absolute (s &optional daynr prefer show-all buffer pos) "Convert a time stamp to an absolute day number. If there is a specifier for a cyclic time stamp, get the closest date to DAYNR. @@ -15357,7 +15603,14 @@ (org-closest-date s (if (and (boundp 'daynr) (integerp daynr)) daynr (time-to-days (current-time))) (match-string 0 s) prefer show-all)) - (t (time-to-days (apply 'encode-time (org-parse-time-string s)))))) + (t (time-to-days + (condition-case errdata + (apply 'encode-time (org-parse-time-string s)) + (error (error "Bad timestamp `%s'%s\nError was: %s" + s (if (not (and buffer pos)) + "" + (format " at %d in buffer `%s'" pos buffer)) + (cdr errdata)))))))) (defun org-days-to-iso-week (days) "Return the iso week number." @@ -15582,7 +15835,10 @@ (setq org-ts-what (cond ((= pos (match-beginning 0)) 'bracket) - ((= pos (1- (match-end 0))) 'bracket) + ;; Point is considered to be "on the bracket" whether + ;; it's really on it or right after it. + ((or (= pos (1- (match-end 0))) + (= pos (match-end 0))) 'bracket) ((org-pos-in-match-range pos 2) 'year) ((org-pos-in-match-range pos 3) 'month) ((org-pos-in-match-range pos 7) 'hour) @@ -15858,7 +16114,7 @@ "Save all Org-mode buffers without user confirmation." (interactive) (message "Saving all Org-mode buffers...") - (save-some-buffers t 'org-mode-p) + (save-some-buffers t (lambda () (eq major-mode 'org-mode))) (when (featurep 'org-id) (org-id-locations-save)) (message "Saving all Org-mode buffers... done")) @@ -15882,7 +16138,7 @@ (save-window-excursion (mapc (lambda (b) - (when (and (with-current-buffer b (org-mode-p)) + (when (and (with-current-buffer b (eq major-mode 'org-mode)) (with-current-buffer b buffer-file-name)) (org-pop-to-buffer-same-window b) (revert-buffer t 'no-confirm))) @@ -15895,7 +16151,7 @@ ;;;###autoload (defun org-switchb (&optional arg) "Switch between Org buffers. -With a prefix argument, restrict available to files. +With one prefix argument, restrict available buffers to files. With two prefix arguments, restrict available buffers to agenda files. Defaults to `iswitchb' for buffer name completion. @@ -15934,17 +16190,17 @@ (filter (cond ((eq predicate 'files) - (lambda (b) (with-current-buffer b (org-mode-p)))) + (lambda (b) (with-current-buffer b (eq major-mode 'org-mode)))) ((eq predicate 'export) (lambda (b) (string-match "\*Org .*Export" (buffer-name b)))) ((eq predicate 'agenda) (lambda (b) (with-current-buffer b - (and (org-mode-p) + (and (eq major-mode 'org-mode) (setq bfn (buffer-file-name b)) (member (file-truename bfn) agenda-files))))) (t (lambda (b) (with-current-buffer b - (or (org-mode-p) + (or (eq major-mode 'org-mode) (string-match "\*Org .*Export" (buffer-name b))))))))) (delq nil @@ -16200,7 +16456,8 @@ (if (org-on-heading-p t) (add-text-properties (point-at-bol) (org-end-of-subtree t) pa)))) (goto-char (point-min)) - (setq re (concat org-outline-regexp-bol "+" org-comment-string "\\>")) + (setq re (format org-heading-keyword-regexp-format + org-comment-string)) (while (re-search-forward re nil t) (add-text-properties (match-beginning 0) (org-end-of-subtree t) pc))) @@ -16231,7 +16488,10 @@ in Org-mode. \\{org-cdlatex-mode-map}" nil " OCDL" nil - (when org-cdlatex-mode (require 'cdlatex)) + (when org-cdlatex-mode + (require 'cdlatex) + (run-hooks 'cdlatex-mode-hook) + (cdlatex-compute-tables)) (unless org-cdlatex-texmathp-advice-is-done (setq org-cdlatex-texmathp-advice-is-done t) (defadvice texmathp (around org-math-always-on activate) @@ -16243,7 +16503,7 @@ (interactive) (let (p) (cond - ((not (org-mode-p)) ad-do-it) + ((not (eq major-mode 'org-mode)) ad-do-it) ((eq this-command 'cdlatex-math-symbol) (setq ad-return-value t texmathp-why '("cdlatex-math-symbol in org-mode" . 0))) @@ -16316,14 +16576,16 @@ insert a LaTeX environment." (when org-cdlatex-mode (cond + ;; Before any word on the line: No expansion possible. + ((save-excursion (skip-chars-backward " \t") (bolp)) nil) + ;; Just after first word on the line: Expand it. Make sure it + ;; cannot happen on headlines, though. ((save-excursion (skip-chars-backward "a-zA-Z0-9*") (skip-chars-backward " \t") - (bolp)) + (and (bolp) (not (org-at-heading-p)))) (cdlatex-tab) t) - ((org-inside-LaTeX-fragment-p) - (cdlatex-tab) t) - (t nil)))) + ((org-inside-LaTeX-fragment-p) (cdlatex-tab) t)))) (defun org-cdlatex-underscore-caret (&optional arg) "Execute `cdlatex-sub-superscript' in LaTeX fragments. @@ -16398,8 +16660,8 @@ '(("begin" "^[ \t]*\\(\\\\begin{\\([a-zA-Z0-9\\*]+\\)[^\000]+?\\\\end{\\2}\\)" 1 t) ;; ("$" "\\([ (]\\|^\\)\\(\\(\\([$]\\)\\([^ \r\n,.$].*?\\(\n.*?\\)\\{0,5\\}[^ \r\n,.$]\\)\\4\\)\\)\\([ .,?;:'\")]\\|$\\)" 2 nil) ;; \000 in the following regex is needed for org-inside-LaTeX-fragment-p - ("$1" "\\([^$]\\)\\(\\$[^ \r\n,;.$]\\$\\)\\([- .,?;:'\")\000]\\|$\\)" 2 nil) - ("$" "\\([^$]\\)\\(\\(\\$\\([^ \r\n,;.$][^$\n\r]*?\\(\n[^$\n\r]*?\\)\\{0,2\\}[^ \r\n,.$]\\)\\$\\)\\)\\([- .,?;:'\")\000]\\|$\\)" 2 nil) + ("$1" "\\([^$]\\|^\\)\\(\\$[^ \r\n,;.$]\\$\\)\\([- .,?;:'\")\000]\\|$\\)" 2 nil) + ("$" "\\([^$]\\|^\\)\\(\\(\\$\\([^ \r\n,;.$][^$\n\r]*?\\(\n[^$\n\r]*?\\)\\{0,2\\}[^ \r\n,.$]\\)\\$\\)\\)\\([- .,?;:'\")\000]\\|$\\)" 2 nil) ("\\(" "\\\\([^\000]*?\\\\)" 0 nil) ("\\[" "\\\\\\[[^\000]*?\\\\\\]" 0 nil) ("$$" "\\$\\$[^\000]*?\\$\\$" 0 nil)) @@ -16422,11 +16684,11 @@ (plist-get (org-infile-export-plist) :latex-header-extra)) (cnt 0) txt hash link beg end re e checkdir executables-checked string - m n block linkfile movefile ov) + m n block-type block linkfile movefile ov) ;; Check the different regular expressions (while (setq e (pop re-list)) - (setq m (car e) re (nth 1 e) n (nth 2 e) - block (if (nth 3 e) "\n\n" "")) + (setq m (car e) re (nth 1 e) n (nth 2 e) block-type (nth 3 e) + block (if block-type "\n\n" "")) (when (member m matchers) (goto-char (point-min)) (while (re-search-forward re nil t) @@ -16455,7 +16717,7 @@ '(org-protected t)))) (add-text-properties (match-beginning n) (match-end n) '(org-protected t)))) - ((or (eq processing-type 'dvipng) t) + ((eq processing-type 'dvipng) ;; Process to an image (setq txt (match-string n) beg (match-beginning n) end (match-end n) @@ -16511,7 +16773,115 @@ (insert (org-add-props link (list 'org-latex-src (replace-regexp-in-string - "\"" "" txt))))))))))))) + "\"" "" txt) + 'org-latex-src-embed-type + (if block-type 'paragraph 'character)))))) + ((eq processing-type 'mathml) + ;; Process to MathML + (unless executables-checked + (unless (save-match-data (org-format-latex-mathml-available-p)) + (error "LaTeX to MathML converter not configured")) + (setq executables-checked t)) + (setq txt (match-string n) + beg (match-beginning n) end (match-end n) + cnt (1+ cnt)) + (if msg (message msg cnt)) + (goto-char beg) + (delete-region beg end) + (insert (org-format-latex-as-mathml + txt block-type prefix dir))) + (t + (error "Unknown conversion type %s for latex fragments" + processing-type))))))))) + +(defun org-create-math-formula (latex-frag &optional mathml-file) + "Convert LATEX-FRAG to MathML and store it in MATHML-FILE. +Use `org-latex-to-mathml-convert-command'. If the conversion is +sucessful, return the portion between \" \" +elements otherwise return nil. When MATHML-FILE is specified, +write the results in to that file. When invoked as an +interactive command, prompt for LATEX-FRAG, with initial value +set to the current active region and echo the results for user +inspection." + (interactive (list (let ((frag (when (region-active-p) + (buffer-substring-no-properties + (region-beginning) (region-end))))) + (read-string "LaTeX Fragment: " frag nil frag)))) + (unless latex-frag (error "Invalid latex-frag")) + (let* ((tmp-in-file (file-relative-name + (make-temp-name (expand-file-name "ltxmathml-in")))) + (ignore (write-region latex-frag nil tmp-in-file)) + (tmp-out-file (file-relative-name + (make-temp-name (expand-file-name "ltxmathml-out")))) + (cmd (format-spec + org-latex-to-mathml-convert-command + `((?j . ,(shell-quote-argument + (expand-file-name org-latex-to-mathml-jar-file))) + (?I . ,(shell-quote-argument tmp-in-file)) + (?o . ,(shell-quote-argument tmp-out-file))))) + mathml shell-command-output) + (when (org-called-interactively-p 'any) + (unless (org-format-latex-mathml-available-p) + (error "LaTeX to MathML converter not configured"))) + (message "Running %s" cmd) + (setq shell-command-output (shell-command-to-string cmd)) + (setq mathml + (when (file-readable-p tmp-out-file) + (with-current-buffer (find-file-noselect tmp-out-file t) + (goto-char (point-min)) + (when (re-search-forward + (concat + (regexp-quote + "") + "\\(.\\|\n\\)*" + (regexp-quote "")) nil t) + (prog1 (match-string 0) (kill-buffer)))))) + (cond + (mathml + (setq mathml + (concat "\n" mathml)) + (when mathml-file + (write-region mathml nil mathml-file)) + (when (org-called-interactively-p 'any) + (message mathml))) + ((message "LaTeX to MathML conversion failed") + (message shell-command-output))) + (delete-file tmp-in-file) + (when (file-exists-p tmp-out-file) + (delete-file tmp-out-file)) + mathml)) + +(defun org-format-latex-as-mathml (latex-frag latex-frag-type + prefix &optional dir) + "Use `org-create-math-formula' but check local cache first." + (let* ((absprefix (expand-file-name prefix dir)) + (print-length nil) (print-level nil) + (formula-id (concat + "formula-" + (sha1 + (prin1-to-string + (list latex-frag + org-latex-to-mathml-convert-command))))) + (formula-cache (format "%s-%s.mathml" absprefix formula-id)) + (formula-cache-dir (file-name-directory formula-cache))) + + (unless (file-directory-p formula-cache-dir) + (make-directory formula-cache-dir t)) + + (unless (file-exists-p formula-cache) + (org-create-math-formula latex-frag formula-cache)) + + (if (file-exists-p formula-cache) + ;; Successful conversion. Return the link to MathML file. + (org-add-props + (format "[[file:%s]]" (file-relative-name formula-cache dir)) + (list 'org-latex-src (replace-regexp-in-string "\"" "" latex-frag) + 'org-latex-src-embed-type (if latex-frag-type + 'paragraph 'character))) + ;; Failed conversion. Return the LaTeX fragment verbatim + (add-text-properties + 0 (1- (length latex-frag)) '(org-protected t) latex-frag) + latex-frag))) ;; This function borrows from Ganesh Swami's latex2png.el (defun org-create-formula-image (string tofile options buffer) @@ -16719,6 +17089,44 @@ ;;;; Key bindings +;; Outline functions from `outline-mode-prefix-map' +;; that can be remapped in Org: +(define-key org-mode-map [remap outline-mark-subtree] 'org-mark-subtree) +(define-key org-mode-map [remap show-subtree] 'org-show-subtree) +(define-key org-mode-map [remap outline-forward-same-level] + 'org-forward-same-level) +(define-key org-mode-map [remap outline-backward-same-level] + 'org-backward-same-level) +(define-key org-mode-map [remap show-branches] + 'org-kill-note-or-show-branches) +(define-key org-mode-map [remap outline-promote] 'org-promote-subtree) +(define-key org-mode-map [remap outline-demote] 'org-demote-subtree) +(define-key org-mode-map [remap outline-insert-heading] 'org-ctrl-c-ret) + +;; Outline functions from `outline-mode-prefix-map' +;; that can not be remapped in Org: +;; - the column "key binding" shows whether the Outline function is still +;; available in Org mode on the same key that it has been bound to in +;; Outline mode: +;; - "overridden": key used for a different functionality in Org mode +;; - else: key still bound to the same Outline function in Org mode +;; | Outline function | key binding | Org replacement | +;; |------------------------------------+-------------+-----------------------| +;; | `outline-next-visible-heading' | `C-c C-n' | still same function | +;; | `outline-previous-visible-heading' | `C-c C-p' | still same function | +;; | `show-children' | `C-c C-i' | visibility cycling | +;; | `hide-subtree' | overridden | visibility cycling | +;; | `outline-up-heading' | `C-c C-u' | still same function | +;; | `hide-body' | overridden | no replacement | +;; | `show-all' | overridden | no replacement | +;; | `hide-entry' | overridden | visibility cycling | +;; | `show-entry' | overridden | no replacement | +;; | `hide-leaves' | overridden | no replacement | +;; | `hide-sublevels' | overridden | no replacement | +;; | `hide-other' | overridden | no replacement | +;; | `outline-move-subtree-up' | `C-c C-^' | better: org-shiftup | +;; | `outline-move-subtree-down' | overridden | better: org-shiftdown | + ;; Make `C-c C-x' a prefix key (org-defkey org-mode-map "\C-c\C-x" (make-sparse-keymap)) @@ -17023,8 +17431,8 @@ (defun org-speed-command-default-hook (keys) "Hook for activating single-letter speed commands. -`org-speed-commands-default' specifies a minimal command set. Use -`org-speed-commands-user' for further customization." +`org-speed-commands-default' specifies a minimal command set. +Use `org-speed-commands-user' for further customization." (when (or (and (bolp) (looking-at org-outline-regexp)) (and (functionp org-use-speed-commands) (funcall org-use-speed-commands))) @@ -17046,11 +17454,11 @@ which is also a `self-insert-command' from the global map. Within the hook, examine the cursor position and the command key -and return nil or a valid handler as appropriate. Handler could +and return nil or a valid handler as appropriate. Handler could be one of an interactive command, a function, or a form. Set `org-use-speed-commands' to non-nil value to enable this -hook. The default setting is `org-speed-command-default-hook'." +hook. The default setting is `org-speed-command-default-hook'." :group 'org-structure :type 'hook) @@ -17059,6 +17467,7 @@ If the cursor is in a table looking at whitespace, the whitespace is overwritten, and the table is not marked as requiring realignment." (interactive "p") + (org-check-before-invisible-edit 'insert) (cond ((and org-use-speed-commands (setq org-speed-command @@ -17110,6 +17519,53 @@ (setq org-self-insert-command-undo-counter (1+ org-self-insert-command-undo-counter)))))))) +(defun org-check-before-invisible-edit (kind) + "Check is editing if kind KIND would be dangerous with invisible text around. +The detailed reaction depends on the user option `org-catch-invisible-edits'." + ;; First, try to get out of here as quickly as possible, to reduce overhead + (if (and org-catch-invisible-edits + (or (not (boundp 'visible-mode)) (not visible-mode)) + (or (get-char-property (point) 'invisible) + (get-char-property (max (point-min) (1- (point))) 'invisible))) + ;; OK, we need to take a closer look + (let* ((invisible-at-point (get-char-property (point) 'invisible)) + (invisible-before-point (if (bobp) nil (get-char-property + (1- (point)) 'invisible))) + (border-and-ok-direction + (or + ;; Check if we are acting predictably before invisible text + (and invisible-at-point (not invisible-before-point) + (memq kind '(insert delete-backward))) + ;; Check if we are acting predictably after invisible text + ;; This works not well, and I have turned it off. It seems + ;; better to always show and stop after invisible text. + ;; (and (not invisible-at-point) invisible-before-point + ;; (memq kind '(insert delete))) + ))) + + (when (or (memq invisible-at-point '(outline org-hide-block)) + (memq invisible-before-point '(outline org-hide-block))) + (if (eq org-catch-invisible-edits 'error) + (error "Editing in invisible areas is prohibited - make visible first")) + ;; Make the area visible + (save-excursion + (if invisible-before-point + (goto-char (previous-single-char-property-change + (point) 'invisible))) + (org-cycle)) + (cond + ((eq org-catch-invisible-edits 'show) + ;; That's it, we do the edit after showing + (message + "Unfolding invisible region around point before editing") + (sit-for 1)) + ((and (eq org-catch-invisible-edits 'smart) + border-and-ok-direction) + (message "Unfolding invisible region around point before editing")) + (t + ;; Don't do the edit, make the user repeat it in full visibility + (error "Edit in invisible region aborted, repeat to confirm with text visible"))))))) + (defun org-fix-tags-on-the-fly () (when (and (equal (char-after (point-at-bol)) ?*) (org-on-heading-p)) @@ -17122,6 +17578,7 @@ still be marked for re-alignment if the field did fill the entire column, because, in this case the deletion might narrow the column." (interactive "p") + (org-check-before-invisible-edit 'delete-backward) (if (and (org-table-p) (eq N 1) (string-match "|" (buffer-substring (point-at-bol) (point))) @@ -17148,6 +17605,7 @@ still be marked for re-alignment if the field did fill the entire column, because, in this case the deletion might narrow the column." (interactive "p") + (org-check-before-invisible-edit 'delete) (if (and (org-table-p) (not (bolp)) (not (= (char-after) ?|)) @@ -17687,6 +18145,17 @@ ((org-at-table-p) (call-interactively 'org-table-hline-and-move)) (t (call-interactively 'org-insert-heading)))) +(defun org-find-visible () + (let ((s (point))) + (while (and (not (= (point-max) (setq s (next-overlay-change s)))) + (get-char-property s 'invisible))) + s)) +(defun org-find-invisible () + (let ((s (point))) + (while (and (not (= (point-max) (setq s (next-overlay-change s)))) + (not (get-char-property s 'invisible)))) + s)) + (defun org-copy-visible (beg end) "Copy the visible parts of the region." (interactive "r") @@ -17758,6 +18227,7 @@ (call-interactively 'org-table-edit-formulas)) (t (call-interactively 'ffap)))) +(defvar org-table-coordinate-overlays) ; defined in org-table.el (defun org-ctrl-c-ctrl-c (&optional arg) "Set tags in headline, or update according to changed information at point. @@ -17816,6 +18286,8 @@ (fboundp org-finish-function)) (funcall org-finish-function)) ((run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-hook)) + ((org-in-regexp org-ts-regexp-both) + (org-timestamp-change 0 'day)) ((or (looking-at org-property-start-re) (org-at-property-p)) (call-interactively 'org-property-action)) @@ -17843,7 +18315,6 @@ (struct (org-list-struct)) (old-struct (copy-tree struct)) (parents (org-list-parents-alist struct)) - (prevs (org-list-prevs-alist struct)) (orderedp (org-entry-get nil "ORDERED")) (firstp (= (org-list-get-top-point struct) (point-at-bol))) block-item) @@ -17855,32 +18326,30 @@ ((equal arg '(4)) nil) ((equal "[X]" cbox) "[ ]") (t "[X]"))) - (org-list-struct-fix-ind struct parents) - (org-list-struct-fix-bul struct prevs) - (setq block-item - (org-list-struct-fix-box struct parents prevs orderedp)) + ;; Replicate `org-list-write-struct', while grabbing a return + ;; value from `org-list-struct-fix-box'. + (org-list-struct-fix-ind struct parents 2) + (org-list-struct-fix-item-end struct) + (let ((prevs (org-list-prevs-alist struct))) + (org-list-struct-fix-bul struct prevs) + (org-list-struct-fix-ind struct parents) + (setq block-item + (org-list-struct-fix-box struct parents prevs orderedp))) + (org-list-struct-apply-struct struct old-struct) + (org-update-checkbox-count-maybe) (when block-item (message "Checkboxes were removed due to unchecked box at line %d" (org-current-line block-item))) - (org-list-struct-apply-struct struct old-struct) - (org-update-checkbox-count-maybe) (when firstp (org-list-send-list 'maybe)))) ((org-at-item-p) - ;; Cursor at an item: repair list. Do checkbox related actions - ;; only if function was called with an argument. Send list only + ;; Cursor at an item: repair list. Do checkbox related actions + ;; only if function was called with an argument. Send list only ;; if at top item. (let* ((struct (org-list-struct)) - (old-struct (copy-tree struct)) - (parents (org-list-parents-alist struct)) - (prevs (org-list-prevs-alist struct)) (firstp (= (org-list-get-top-point struct) (point-at-bol)))) - (org-list-struct-fix-ind struct parents) - (org-list-struct-fix-bul struct prevs) - (when arg - (org-list-set-checkbox (point-at-bol) struct "[ ]") - (org-list-struct-fix-box struct parents prevs)) - (org-list-struct-apply-struct struct old-struct) + (when arg (org-list-set-checkbox (point-at-bol) struct "[ ]")) + (org-list-write-struct struct (org-list-parents-alist struct)) (when arg (org-update-checkbox-count-maybe)) (when firstp (org-list-send-list 'maybe)))) ((save-excursion (beginning-of-line 1) (looking-at org-dblock-start-re)) @@ -17901,6 +18370,9 @@ (t (let ((org-inhibit-startup-visibility-stuff t) (org-startup-align-all-tables nil)) + (when (boundp 'org-table-coordinate-overlays) + (mapc 'delete-overlay org-table-coordinate-overlays) + (setq org-table-coordinate-overlays nil)) (org-save-outline-visibility 'use-markers (org-mode-restart))) (message "Local setup has been refreshed")))) ((org-clock-update-time-maybe)) @@ -17940,7 +18412,7 @@ ((and (org-in-item-p) indent) (if (and (org-at-item-p) (>= (point) (match-end 0))) (progn - (newline) + (save-match-data (newline)) (org-indent-line-to (length (match-string 0)))) (let ((ind (org-get-indentation))) (newline) @@ -17948,7 +18420,9 @@ (org-indent-line-function) (org-indent-line-to ind))))) ((and org-return-follows-link - (eq (get-text-property (point) 'face) 'org-link)) + (let ((tprop (get-text-property (point) 'face))) + (or (eq tprop 'org-link) + (and (listp tprop) (memq 'org-link tprop))))) (call-interactively 'org-open-at-point)) ((and (org-at-heading-p) (looking-at @@ -18002,7 +18476,7 @@ If it is an item, convert all items to normal lines. -If it is normal text, change region into an item. With a prefix +If it is normal text, change region into an item. With a prefix argument ARG, change each line in region into an item." (interactive "P") (let ((shift-text @@ -18056,7 +18530,7 @@ (save-excursion (goto-char beg) (cond - ;; Case 1. Start at an item: de-itemize. Note that it only + ;; Case 1. Start at an item: de-itemize. Note that it only ;; happens when a region is active: `org-ctrl-c-minus' ;; would call `org-cycle-list-bullet' otherwise. ((org-at-item-p) @@ -18356,14 +18830,14 @@ ["Previous link" org-previous-link t] "--" ["Descriptive Links" - (progn (add-to-invisibility-spec '(org-link)) (org-restart-font-lock)) + org-toggle-link-display :style radio - :selected (member '(org-link) buffer-invisibility-spec)] + :selected org-descriptive-links + ] ["Literal Links" - (progn - (org-remove-from-invisibility-spec '(org-link)) (org-restart-font-lock)) + org-toggle-link-display :style radio - :selected (not (member '(org-link) buffer-invisibility-spec))]) + :selected (not org-descriptive-links)]) "--" ("TODO Lists" ["TODO/DONE/-" org-todo t] @@ -18558,8 +19032,8 @@ (save-excursion (while bl (set-buffer (pop bl)) - (if (org-mode-p) (setq bl nil))) - (when (org-mode-p) + (if (eq major-mode 'org-mode) (setq bl nil))) + (when (eq major-mode 'org-mode) (easy-menu-change '("Org") "File List for Agenda" (append @@ -18962,7 +19436,7 @@ :target on a <> :radio-target on a <<>> :latex-fragment on a LaTeX fragment -:latex-preview on a LaTeX fragment with overlayed preview image +:latex-preview on a LaTeX fragment with overlaid preview image This function expects the position to be visible because it uses font-lock faces as a help to recognize the following contexts: :table-special, :link, @@ -19067,37 +19541,58 @@ (throw 'exit t))) nil)))) -(defun org-in-regexps-block-p (start-re end-re &optional bound) - "Return t if the current point is between matches of START-RE and END-RE. -This will also return t if point is on one of the two matches or -in an unfinished block. END-RE can be a string or a form -returning a string. +(defun org-between-regexps-p (start-re end-re &optional lim-up lim-down) + "Non-nil when point is between matches of START-RE and END-RE. -An optional third argument bounds the search for START-RE. It -defaults to previous heading or `point-min'." - (let ((pos (point)) - (limit (or bound (save-excursion (outline-previous-heading))))) - (save-excursion - ;; we're on a block when point is on start-re... - (or (org-at-regexp-p start-re) - ;; ... or start-re can be found above... - (and (re-search-backward start-re limit t) - ;; ... but no end-re between start-re and point. - (not (re-search-forward (eval end-re) pos t))))))) +Also return a non-nil value when point is on one of the matches. + +Optional arguments LIM-UP and LIM-DOWN bound the search; they are +buffer positions. Default values are the positions of headlines +surrounding the point. + +The functions returns a cons cell whose car (resp. cdr) is the +position before START-RE (resp. after END-RE)." + (save-match-data + (let ((pos (point)) + (limit-up (or lim-up (save-excursion (outline-previous-heading)))) + (limit-down (or lim-down (save-excursion (outline-next-heading)))) + beg end) + (save-excursion + ;; Point is on a block when on START-RE or if START-RE can be + ;; found before it... + (and (or (org-at-regexp-p start-re) + (re-search-backward start-re limit-up t)) + (setq beg (match-beginning 0)) + ;; ... and END-RE after it... + (goto-char (match-end 0)) + (re-search-forward end-re limit-down t) + (> (setq end (match-end 0)) pos) + ;; ... without another START-RE in-between. + (goto-char (match-beginning 0)) + (not (re-search-backward start-re (1+ beg) t)) + ;; Return value. + (cons beg end)))))) (defun org-in-block-p (names) - "Is point inside any block whose name belongs to NAMES? + "Non-nil when point belongs to a block whose name belongs to NAMES. -NAMES is a list of strings containing names of blocks." +NAMES is a list of strings containing names of blocks. + +Return first block name matched, or nil. Beware that in case of +nested blocks, the returned name may not belong to the closest +block from point." (save-match-data (catch 'exit - (let ((case-fold-search t)) + (let ((case-fold-search t) + (lim-up (save-excursion (outline-previous-heading))) + (lim-down (save-excursion (outline-next-heading)))) (mapc (lambda (name) (let ((n (regexp-quote name))) - (when (org-in-regexps-block-p + (when (org-between-regexps-p (concat "^[ \t]*#\\+begin_" n) - (concat "^[ \t]*#\\+end_" n)) - (throw 'exit t)))) + (concat "^[ \t]*#\\+end_" n) + lim-up lim-down) + (throw 'exit n)))) names)) nil))) @@ -19128,18 +19623,18 @@ ;; Emacs 23 (add-hook 'occur-mode-find-occurrence-hook (lambda () - (when (org-mode-p) + (when (eq major-mode 'org-mode) (org-reveal)))) ;; Emacs 22 (defadvice occur-mode-goto-occurrence (after org-occur-reveal activate) - (and (org-mode-p) (org-reveal))) + (and (eq major-mode 'org-mode) (org-reveal))) (defadvice occur-mode-goto-occurrence-other-window (after org-occur-reveal activate) - (and (org-mode-p) (org-reveal))) + (and (eq major-mode 'org-mode) (org-reveal))) (defadvice occur-mode-display-occurrence (after org-occur-reveal activate) - (when (org-mode-p) + (when (eq major-mode 'org-mode) (let ((pos (occur-mode-find-occurrence))) (with-current-buffer (marker-buffer pos) (save-excursion @@ -19195,13 +19690,26 @@ (if (funcall predicate e) (push e res))) (nreverse res))) +(defun org-reduce (cl-func cl-seq &rest cl-keys) + "Reduce two-argument FUNCTION across SEQ. +Taken from `reduce' in cl-seq.el with all keyword arguments but +\":initial-value\" removed." + (let ((cl-accum (cond ((memq :initial-value cl-keys) + (cadr (memq :initial-value cl-keys))) + (cl-seq (pop cl-seq)) + (t (funcall cl-func))))) + (while cl-seq + (setq cl-accum (funcall cl-func cl-accum (pop cl-seq)))) + cl-accum)) + (defun org-back-over-empty-lines () "Move backwards over whitespace, to the beginning of the first empty line. Returns the number of empty lines passed." (let ((pos (point))) (if (cdr (assoc 'heading org-blank-before-new-entry)) (skip-chars-backward " \t\n\r") - (forward-line -1)) + (unless (eobp) + (forward-line -1))) (beginning-of-line 2) (goto-char (min (point) pos)) (count-lines (point) pos))) @@ -19417,7 +19925,7 @@ ;; Footnote definition ((looking-at org-footnote-definition-re) (setq column 0)) ;; Literal examples - ((looking-at "[ \t]*:[ \t]") + ((looking-at "[ \t]*:\\( \\|$\\)") (setq column (org-get-indentation))) ; do nothing ;; Lists ((ignore-errors (goto-char (org-in-item-p))) @@ -19438,14 +19946,18 @@ (concat "^[ \t]*#\\+begin_" (downcase (match-string 1))) nil t))) (setq column (org-get-indentation (match-string 0)))) ((and (not (looking-at "[ \t]*#\\+begin_")) - (org-in-regexps-block-p "^[ \t]*#\\+begin_" "[ \t]*#\\+end_")) + (org-between-regexps-p "^[ \t]*#\\+begin_" "[ \t]*#\\+end_")) (save-excursion (re-search-backward "^[ \t]*#\\+begin_\\([a-z]+\\)" nil t)) (setq column - (if (equal (downcase (match-string 1)) "src") - ;; src blocks: let `org-edit-src-exit' handle them - (org-get-indentation) - (org-get-indentation (match-string 0))))) + (cond ((equal (downcase (match-string 1)) "src") + ;; src blocks: let `org-edit-src-exit' handle them + (org-get-indentation)) + ((equal (downcase (match-string 1)) "example") + (max (org-get-indentation) + (org-get-indentation (match-string 0)))) + (t + (org-get-indentation (match-string 0)))))) ;; This line has nothing special, look at the previous relevant ;; line to compute indentation (t @@ -19544,10 +20056,11 @@ ;; through to `fill-paragraph' when appropriate. (org-set-local 'fill-paragraph-function 'org-fill-paragraph) ;; Prevent auto-fill from inserting unwanted new items. - (org-set-local 'fill-nobreak-predicate - (if (memq 'org-fill-item-nobreak-p fill-nobreak-predicate) - fill-nobreak-predicate - (cons 'org-fill-item-nobreak-p fill-nobreak-predicate))) + (if (boundp 'fill-nobreak-predicate) + (org-set-local 'fill-nobreak-predicate + (if (memq 'org-fill-item-nobreak-p fill-nobreak-predicate) + fill-nobreak-predicate + (cons 'org-fill-item-nobreak-p fill-nobreak-predicate)))) ;; Adaptive filling: To get full control, first make sure that ;; `adaptive-fill-regexp' never matches. Then install our own matcher. (unless (local-variable-p 'adaptive-fill-regexp (current-buffer)) @@ -19696,7 +20209,7 @@ (end (if regionp (region-end))) (nlines (or arg (if (and beg end) (count-lines beg end) 1))) (case-fold-search nil) - (re "[ \t]*\\(: \\)") + (re "[ \t]*\\(:\\(?: \\|$\\)\\)") off) (if regionp (save-excursion @@ -19718,13 +20231,16 @@ (forward-line 1))) (save-excursion (org-back-to-heading) - (if (looking-at (concat org-outline-regexp - "\\( *\\<" org-quote-string "\\>[ \t]*\\)")) - (replace-match "" t t nil 1) - (if (looking-at org-outline-regexp) - (progn - (goto-char (match-end 0)) - (insert org-quote-string " ")))))))) + (cond + ((looking-at (format org-heading-keyword-regexp-format + org-quote-string)) + (goto-char (match-end 1)) + (looking-at (concat " +" org-quote-string)) + (replace-match "" t t) + (when (eolp) (insert " "))) + ((looking-at org-outline-regexp) + (goto-char (match-end 0)) + (insert org-quote-string " "))))))) (defun org-reftex-citation () "Use reftex-citation to insert a citation into the buffer. @@ -19818,13 +20334,14 @@ (let ((special (if (consp org-special-ctrl-a/e) (cdr org-special-ctrl-a/e) org-special-ctrl-a/e))) - (if (or (not special) - (not (org-on-heading-p)) - arg) - (call-interactively - (cond ((org-bound-and-true-p line-move-visual) 'end-of-visual-line) - ((fboundp 'move-end-of-line) 'move-end-of-line) - (t 'end-of-line))) + (cond + ((or (not special) arg + (not (or (org-on-heading-p) (org-at-item-p)))) + (call-interactively + (cond ((org-bound-and-true-p line-move-visual) 'end-of-visual-line) + ((fboundp 'move-end-of-line) 'move-end-of-line) + (t 'end-of-line)))) + ((org-on-heading-p) (let ((pos (point))) (beginning-of-line 1) (if (looking-at (org-re ".*?\\(?:\\([ \t]*\\)\\(:[[:alnum:]_@#%:]+:\\)?[ \t]*\\)?$")) @@ -19839,6 +20356,8 @@ (call-interactively (if (fboundp 'move-end-of-line) 'move-end-of-line 'end-of-line))))) + ;; At an item: Move before any hidden text. + (t (call-interactively 'end-of-line))) (org-no-warnings (and (featurep 'xemacs) (setq zmacs-region-stays t))))) @@ -19918,7 +20437,7 @@ "Perform some yank-like command. This function implements the behavior described in the `org-yank' -documentation. However, it has been generalized to work for any +documentation. However, it has been generalized to work for any interactive command with similar behavior." ;; pretend to be command COMMAND @@ -20040,8 +20559,9 @@ (save-excursion (beginning-of-line 1) (let ((case-fold-search nil)) - (looking-at (concat "^\\(\\*+\\)[ \t]+\\(" org-todo-regexp - "\\)?[ \t]*$")))))) + (looking-at org-todo-line-regexp))) + (string= (match-string 3) ""))) + (defun org-at-heading-or-item-p () (or (org-on-heading-p) (org-at-item-p))) @@ -20118,7 +20638,7 @@ (defun org-goto-first-child () "Goto the first child, even if it is invisible. -Return t when a child was found. Otherwise don't move point and +Return t when a child was found. Otherwise don't move point and return nil." (let (level (pos (point)) (re org-outline-regexp-bol)) (when (condition-case nil (org-back-to-heading t) (error nil)) @@ -20186,7 +20706,7 @@ (org-back-to-heading invisible-OK) (let ((first t) (level (funcall outline-level))) - (if (and (org-mode-p) (< level 1000)) + (if (and (eq major-mode 'org-mode) (< level 1000)) ;; A true heading (not a plain list item), in Org-mode ;; This means we can easily find the end by looking ;; only for the right number of stars. Using a regexp to do @@ -20211,7 +20731,7 @@ (defadvice outline-end-of-subtree (around prefer-org-version activate compile) "Use Org version in org-mode, for dramatic speed-up." - (if (org-mode-p) + (if (eq major-mode 'org-mode) (progn (org-end-of-subtree nil t) (unless (eobp) (backward-char 1))) @@ -20383,7 +20903,7 @@ '(progn (add-hook 'imenu-after-jump-hook (lambda () - (if (org-mode-p) + (if (eq major-mode 'org-mode) (org-show-context 'org-goto)))))) (defun org-link-display-format (link) @@ -20398,6 +20918,17 @@ nil t link) link))) +(defun org-toggle-link-display () + "Toggle the literal or descriptive display of links." + (interactive) + (if org-descriptive-links + (progn (org-remove-from-invisibility-spec '(org-link)) + (org-restart-font-lock) + (setq org-descriptive-links nil)) + (progn (add-to-invisibility-spec '(org-link)) + (org-restart-font-lock) + (setq org-descriptive-links t)))) + ;; Speedbar support (defvar org-speedbar-restriction-lock-overlay (make-overlay 1 1) @@ -20433,7 +20964,7 @@ (with-current-buffer (find-file-noselect (let ((default-directory dir)) (expand-file-name txt))) - (unless (org-mode-p) + (unless (eq major-mode 'org-mode) (error "Cannot restrict to non-Org-mode file")) (org-agenda-set-restriction-lock 'file))) (t (error "Don't know how to restrict Org-mode's agenda"))) @@ -20450,7 +20981,7 @@ (define-key speedbar-file-key-map ">" 'org-agenda-remove-restriction-lock) (define-key speedbar-file-key-map "\C-c\C-x>" 'org-agenda-remove-restriction-lock) (add-hook 'speedbar-visiting-tag-hook - (lambda () (and (org-mode-p) (org-show-context 'org-goto)))))) + (lambda () (and (eq major-mode 'org-mode) (org-show-context 'org-goto)))))) ;;; Fixes and Hacks for problems with other packages @@ -20493,12 +21024,12 @@ (eval-after-load "ecb" '(defadvice ecb-method-clicked (after esf/org-show-context activate) "Make hierarchy visible when jumping into location from ECB tree buffer." - (if (org-mode-p) + (if (eq major-mode 'org-mode) (org-show-context)))) (defun org-bookmark-jump-unhide () "Unhide the current position, to show the bookmark location." - (and (org-mode-p) + (and (eq major-mode 'org-mode) (or (outline-invisible-p) (save-excursion (goto-char (max (point-min) (1- (point)))) (outline-invisible-p))) @@ -20537,6 +21068,4 @@ (run-hooks 'org-load-hook) -;; arch-tag: e77da1a7-acc7-4336-b19e-efa25af3f9fd - ;;; org.el ends here diff -Nru org-mode-7.7/lisp/org-entities.el org-mode-7.8.02/lisp/org-entities.el --- org-mode-7.7/lisp/org-entities.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/org-entities.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,12 +1,11 @@ ;;; org-entities.el --- Support for special entities in Org-mode -;; Copyright (C) 2010 Free Software Foundation, Inc. +;; Copyright (C) 2010-2011 Free Software Foundation, Inc. ;; Author: Carsten Dominik , ;; Ulf Stegemann ;; Keywords: outlines, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; ;; This file is part of GNU Emacs. ;; @@ -568,6 +567,4 @@ ;; coding: utf-8 ;; End: -;; arch-tag: e6bd163f-7419-4009-9c93-a74623016424 - ;;; org-entities.el ends here diff -Nru org-mode-7.7/lisp/org-exp-blocks.el org-mode-7.8.02/lisp/org-exp-blocks.el --- org-mode-7.7/lisp/org-exp-blocks.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/org-exp-blocks.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,10 +1,8 @@ ;;; org-exp-blocks.el --- pre-process blocks when exporting org files -;; Copyright (C) 2009, 2010 -;; Free Software Foundation, Inc. +;; Copyright (C) 2009-2011 Free Software Foundation, Inc. ;; Author: Eric Schulte -;; Version: 7.7 ;; This file is part of GNU Emacs. ;; @@ -177,10 +175,10 @@ (setq start (point)) (let ((beg-re "^\\([ \t]*\\)#\\+begin_\\(\\S-+\\)[ \t]*\\(.*\\)?[\r\n]")) (while (re-search-forward beg-re nil t) - (let* ((match-start (match-beginning 0)) - (body-start (match-end 0)) + (let* ((match-start (copy-marker (match-beginning 0))) + (body-start (copy-marker (match-end 0))) (indentation (length (match-string 1))) - (inner-re (format "[\r\n]*[ \t]*#\\+\\(begin\\|end\\)_%s" + (inner-re (format "[\r\n][ \t]*#\\+\\(begin\\|end\\)_%s" (regexp-quote (downcase (match-string 2))))) (type (intern (downcase (match-string 2)))) (headers (save-match-data @@ -197,7 +195,7 @@ (when (not (zerop balanced)) (error "unbalanced begin/end_%s blocks with %S" type (buffer-substring match-start (point)))) - (setq match-end (match-end 0)) + (setq match-end (copy-marker (match-end 0))) (unless preserve-indent (setq body (save-match-data (org-remove-indentation (buffer-substring @@ -212,7 +210,11 @@ (delete-region match-start match-end) (goto-char match-start) (insert replacement) (unless preserve-indent - (indent-code-rigidly match-start (point) indentation)))))) + (indent-code-rigidly match-start (point) indentation))))) + ;; cleanup markers + (set-marker match-start nil) + (set-marker body-start nil) + (set-marker match-end nil)) (setq start (point)))) (interblock start (point-max)) (run-hooks 'org-export-blocks-postblock-hook))))) @@ -377,5 +379,4 @@ (provide 'org-exp-blocks) -;; arch-tag: 1c365fe9-8808-4f72-bb15-0b00f36d8024 ;;; org-exp-blocks.el ends here diff -Nru org-mode-7.7/lisp/org-exp.el org-mode-7.8.02/lisp/org-exp.el --- org-mode-7.7/lisp/org-exp.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/org-exp.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,12 +1,10 @@ ;;; org-exp.el --- ASCII, HTML, XOXO and iCalendar export for Org-mode -;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 -;; Free Software Foundation, Inc. +;; Copyright (C) 2004-2011 Free Software Foundation, Inc. ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; ;; This file is part of GNU Emacs. ;; @@ -48,15 +46,15 @@ (declare-function org-inlinetask-remove-END-maybe "org-inlinetask" ()) (declare-function org-table-cookie-line-p "org-table" (line)) (declare-function org-table-colgroup-line-p "org-table" (line)) -(declare-function org-pop-to-buffer-same-window "org-compat" +(declare-function org-pop-to-buffer-same-window "org-compat" (&optional buffer-or-name norecord label)) (autoload 'org-export-generic "org-export-generic" "Export using the generic exporter" t) (autoload 'org-export-as-odt "org-odt" - "Export the outline to a OpenDocumentText file." t) + "Export the outline to a OpenDocument Text file." t) (autoload 'org-export-as-odt-and-open "org-odt" - "Export the outline to a OpenDocumentText file and open it." t) + "Export the outline to a OpenDocument Text file and open it." t) (defgroup org-export nil "Options for exporting org-listings." @@ -739,13 +737,13 @@ '("TITLE" "AUTHOR" "DATE" "EMAIL" "TEXT" "OPTIONS" "LANGUAGE" "MATHJAX" "LINK_UP" "LINK_HOME" "SETUPFILE" "STYLE" - "LATEX_HEADER" "LATEX_CLASS" + "LATEX_HEADER" "LATEX_CLASS" "LATEX_CLASS_OPTIONS" "EXPORT_SELECT_TAGS" "EXPORT_EXCLUDE_TAGS" "KEYWORDS" "DESCRIPTION" "MACRO" "BIND" "XSLT") (mapcar 'car org-export-inbuffer-options-extra)))) (case-fold-search t) p key val text options mathjax a pr style - latex-header latex-class macros letbind + latex-header latex-class latex-class-options macros letbind ext-setup-or-nil setup-file setup-dir setup-contents (start 0)) (while (or (and ext-setup-or-nil (string-match re ext-setup-or-nil start) @@ -772,6 +770,8 @@ (setq latex-header (concat latex-header "\n" val))) ((string-equal key "LATEX_CLASS") (setq latex-class val)) + ((string-equal key "LATEX_CLASS_OPTIONS") + (setq latex-class-options val)) ((string-equal key "TEXT") (setq text (if text (concat text "\n" val) val))) ((string-equal key "OPTIONS") @@ -815,6 +815,8 @@ (setq p (plist-put p :latex-header-extra (substring latex-header 1)))) (when latex-class (setq p (plist-put p :latex-class latex-class))) + (when latex-class-options + (setq p (plist-put p :latex-class-options latex-class-options))) (when options (setq p (org-export-add-options-to-plist p options))) (when mathjax @@ -950,7 +952,7 @@ \[D] export as DocBook [V] export as DocBook, process to PDF, and open -\[o] export as OpenDocumentText [O] ... and open +\[o] export as OpenDocument Text [O] ... and open \[j] export as TaskJuggler [J] ... and open @@ -1014,6 +1016,7 @@ (message "Export buffer: ")) ((not subtree-p) (setq subtree-p t) + (setq bpos (point)) (message "Export subtree: ")))) (when (eq r1 ?\ ) (let ((case-fold-search t) @@ -1030,7 +1033,7 @@ (setq r1 (read-char-exclusive))) (error "No enclosing node with LaTeX_CLASS or EXPORT_TITLE or EXPORT_FILE_NAME") ))))) - (redisplay) + (if (fboundp 'redisplay) (redisplay)) ;; XEmacs does not have/need (redisplay) (and bpos (goto-char bpos)) (setq r2 (if (< r1 27) (+ r1 96) r1)) (unless (setq ass (assq r2 cmds)) @@ -1280,6 +1283,9 @@ ;; Remove #+TBLFM and #+TBLNAME lines (org-export-handle-table-metalines) + ;; Remove #+results and #+name lines + (org-export-res/src-name-cleanup) + ;; Run the final hook (run-hooks 'org-export-preprocess-final-hook) @@ -1441,7 +1447,7 @@ (defvar org-export-format-drawer-function nil "Function to be called to format the contents of a drawer. -The function must accept three parameters: +The function must accept two parameters: NAME the drawer name, like \"PROPERTIES\" CONTENT the content of the drawer. You can check the export backend through `org-export-current-backend'. @@ -1637,9 +1643,11 @@ (org-if-unprotected (replace-match ""))))) +(defvar org-heading-keyword-regexp-format) ; defined in org.el (defun org-export-protect-quoted-subtrees () "Mark quoted subtrees with the protection property." - (let ((org-re-quote (concat "^\\*+[ \t]+" org-quote-string "\\>"))) + (let ((org-re-quote (format org-heading-keyword-regexp-format + org-quote-string))) (goto-char (point-min)) (while (re-search-forward org-re-quote nil t) (goto-char (match-beginning 0)) @@ -1740,8 +1748,14 @@ (save-excursion (save-match-data (goto-char beg-content) - (while (re-search-forward "^[ \t]*\\(,\\)" end-content t) - (replace-match "" nil nil nil 1)))) + (let ((front-line (save-excursion + (re-search-forward + "[^[:space:]]" end-content t) + (goto-char (match-beginning 0)) + (current-column)))) + (while (re-search-forward "^[ \t]*\\(,\\)" end-content t) + (when (= (current-column) front-line) + (replace-match "" nil nil nil 1)))))) (delete-region (match-beginning 0) (match-end 0)) (save-excursion (goto-char beg) @@ -1927,7 +1941,8 @@ (defun org-export-remove-comment-blocks-and-subtrees () "Remove the comment environment, and also commented subtrees." - (let ((re-commented (concat "^\\*+[ \t]+" org-comment-string "\\>")) + (let ((re-commented (format org-heading-keyword-regexp-format + org-comment-string)) case-fold-search) ;; Remove comment environment (goto-char (point-min)) @@ -1980,6 +1995,18 @@ (replace-match "") (goto-char (max (point-min) (1- pos))))))) +(defun org-export-res/src-name-cleanup () + "Clean up #+results and #+name lines for export. +This function should only be called after all block processing +has taken place." + (interactive) + (save-excursion + (goto-char (point-min)) + (let ((case-fold-search t)) + (while (org-re-search-forward-unprotected + "#\\+\\(name\\|results\\(\\[[a-z0-9]+\\]\\)?\\):" nil t) + (delete-region (match-beginning 0) (progn (forward-line) (point))))))) + (defun org-export-mark-radio-links () "Find all matches for radio targets and turn them into internal links." (let ((re-radio (and org-target-link-regexp @@ -1997,23 +2024,28 @@ (defun org-store-forced-table-alignment () "Find table lines which force alignment, store the results in properties." - (let (line cnt aligns) + (let (line cnt cookies) (goto-char (point-min)) - (while (re-search-forward "|[ \t]*<[lrc][0-9]*>[ \t]*|" nil t) + (while (re-search-forward "|[ \t]*<\\([lrc]?[0-9]+\\|[lrc]\\)>[ \t]*|" + nil t) ;; OK, this looks like a table line with an alignment cookie (org-if-unprotected (setq line (buffer-substring (point-at-bol) (point-at-eol))) (when (and (org-at-table-p) (org-table-cookie-line-p line)) - (setq cnt 0 aligns nil) + (setq cnt 0 cookies nil) (mapc (lambda (x) (setq cnt (1+ cnt)) - (if (string-match "\\`<\\([lrc]\\)" x) - (push (cons cnt (downcase (match-string 1 x))) aligns))) + (when (string-match "\\`<\\([lrc]\\)?\\([0-9]+\\)?>\\'" x) + (let ((align (and (match-end 1) + (downcase (match-string 1 x)))) + (width (and (match-end 2) + (string-to-number (match-string 2 x))))) + (push (cons cnt (list align width)) cookies)))) (org-split-string line "[ \t]*|[ \t]*")) (add-text-properties (org-table-begin) (org-table-end) - (list 'org-forced-aligns aligns)))) + (list 'org-col-cookies cookies)))) (goto-char (point-at-eol))))) (defun org-export-remove-special-table-lines () @@ -2051,10 +2083,11 @@ (re-angle-link (concat "\\([^[]\\)" org-angle-link-re)) nodesc) (goto-char (point-min)) + (while (re-search-forward org-bracket-link-regexp nil t) + (put-text-property (match-beginning 0) (match-end 0) 'org-normalized-link t)) + (goto-char (point-min)) (while (re-search-forward re-plain-link nil t) - (unless (org-string-match-p - "\\[\\[\\S-+:\\S-*?\\<" - (buffer-substring (point-at-bol) (match-beginning 0))) + (unless (get-text-property (match-beginning 0) 'org-normalized-link) (goto-char (1- (match-end 0))) (org-if-unprotected-at (1+ (match-beginning 0)) (let* ((s (concat (match-string 1) @@ -2134,24 +2167,31 @@ (save-excursion (outline-next-heading) (point))))) (when (re-search-forward "^[ \t]*[^|# \t\r\n].*\n" end t) ;; Mark the line so that it will not be exported as normal text. - (org-unmodified - (add-text-properties (match-beginning 0) (match-end 0) - (list :org-license-to-kill t))) + (unless (org-in-block-p org-list-forbidden-blocks) + (org-unmodified + (add-text-properties (match-beginning 0) (match-end 0) + (list :org-license-to-kill t)))) ;; Return the title string (org-trim (match-string 0))))))) (defun org-export-get-title-from-subtree () "Return subtree title and exclude it from export." (let ((rbeg (region-beginning)) (rend (region-end)) - (inhibit-read-only t) title) + (inhibit-read-only t) + (tags (plist-get (org-infile-export-plist) :tags)) + title) (save-excursion (goto-char rbeg) (when (and (org-at-heading-p) (>= (org-end-of-subtree t t) rend)) + (when (plist-member org-export-opt-plist :tags) + (setq tags (or (plist-get org-export-opt-plist :tags) tags))) ;; This is a subtree, we take the title from the first heading (goto-char rbeg) - (looking-at org-todo-line-regexp) - (setq title (match-string 3)) + (looking-at org-todo-line-tags-regexp) + (setq title (if (eq tags t) + (format "%s\t%s" (match-string 3) (match-string 4)) + (match-string 3))) (org-unmodified (add-text-properties (point) (1+ (point-at-eol)) (list :org-license-to-kill t))) @@ -2691,11 +2731,11 @@ (format "\\begin{%s}\n%s\\end{%s}\n" custom-environment rtn custom-environment)) (listings-p - (format "\\begin{%s}\n%s\\end{%s}\n" + (format "\\begin{%s}\n%s\\end{%s}" "lstlisting" rtn "lstlisting")) (minted-p (format - "\\begin{minted}[%s]{%s}\n%s\\end{minted}\n" + "\\begin{minted}[%s]{%s}\n%s\\end{minted}" (mapconcat #'make-option-string org-export-latex-minted-options ",") backend-lang rtn))))))) @@ -2720,13 +2760,60 @@ "\n#+BEGIN_" backend-name "\n" (org-add-props rtn '(org-protected t org-example t org-native-text t)) - "\n#+END_" backend-name "\n\n")) + "\n#+END_" backend-name "\n")) (org-add-props rtn nil 'original-indentation indent)))) (defun org-export-number-lines (text &optional skip1 skip2 number cont - replace-labels label-format) + replace-labels label-format preprocess) + "Apply line numbers to literal examples and handle code references. +Handle user-specified options under info node `(org)Literal +examples' and return the modified source block. + +TEXT contains the source or example block. + +SKIP1 and SKIP2 are the number of lines that are to be skipped at +the beginning and end of TEXT. Use these to skip over +backend-specific lines pre-pended or appended to the original +source block. + +NUMBER is non-nil if the literal example specifies \"+n\" or +\"-n\" switch. If NUMBER is non-nil add line numbers. + +CONT is non-nil if the literal example specifies \"+n\" switch. +If CONT is nil, start numbering this block from 1. Otherwise +continue numbering from the last numbered block. + +REPLACE-LABELS is dual-purpose. +1. It controls the retention of labels in the exported block. +2. It specifies in what manner the links (or references) to a + labelled line be formatted. + +REPLACE-LABELS is the symbol `keep' if the literal example +specifies \"-k\" option, is numeric if the literal example +specifies \"-r\" option and is nil otherwise. + +Handle REPLACE-LABELS as below: +- If nil, retain labels in the exported block and use + user-provided labels for referencing the labelled lines. +- If it is a number, remove labels in the exported block and use + one of line numbers or labels for referencing labelled lines based + on NUMBER option. +- If it is a keep, retain labels in the exported block and use + one of line numbers or labels for referencing labelled lines + based on NUMBER option. + +LABEL-FORMAT is the value of \"-l\" switch associated with +literal example. See `org-coderef-label-format'. + +PREPROCESS is intended for backend-agnostic handling of source +block numbering. When non-nil do the following: +- do not number the lines +- always strip the labels from exported block +- do not make the labelled line a target of an incoming link. + Instead mark the labelled line with `org-coderef' property and + store the label in it." (setq skip1 (or skip1 0) skip2 (or skip2 0)) - (if (not cont) (setq org-export-last-code-line-counter-value 0)) + (if (and number (not cont)) (setq org-export-last-code-line-counter-value 0)) (with-temp-buffer (insert text) (goto-char (point-max)) @@ -2763,9 +2850,10 @@ (org-goto-line (1+ skip1)) (while (and (re-search-forward "^" nil t) (not (eobp)) (< n nmax)) - (if number - (insert (format fm (incf n))) - (forward-char 1)) + (when number (incf n)) + (if (or preprocess (not number)) + (forward-char 1) + (insert (format fm n))) (when (looking-at lbl-re) (setq ref (match-string 3)) (cond ((numberp replace-labels) @@ -2778,7 +2866,8 @@ ;; lines are numbered, use labels otherwise (goto-char (match-beginning 2)) (delete-region (match-beginning 2) (match-end 2)) - (insert "(" ref ")") + (unless preprocess + (insert "(" ref ")")) (push (cons ref (if (> n 0) n (concat "(" ref ")"))) org-export-code-refs)) (t @@ -2786,15 +2875,19 @@ ;; references (goto-char (match-beginning 2)) (delete-region (match-beginning 2) (match-end 2)) - (insert "(" ref ")") + (unless preprocess + (insert "(" ref ")")) (push (cons ref (concat "(" ref ")")) org-export-code-refs))) - (when (eq org-export-current-backend 'html) + (when (and (eq org-export-current-backend 'html) (not preprocess)) (save-excursion (beginning-of-line 1) (insert (format "" ref)) (end-of-line 1) - (insert ""))))) + (insert ""))) + (when preprocess + (add-text-properties + (point-at-bol) (point-at-eol) (list 'org-coderef ref))))) (setq org-export-last-code-line-counter-value n) (goto-char (point-max)) (newline) @@ -2896,17 +2989,6 @@ (switch-to-buffer-other-window buffer) (goto-char (point-min))))) -(defun org-find-visible () - (let ((s (point))) - (while (and (not (= (point-max) (setq s (next-overlay-change s)))) - (get-char-property s 'invisible))) - s)) -(defun org-find-invisible () - (let ((s (point))) - (while (and (not (= (point-max) (setq s (next-overlay-change s)))) - (not (get-char-property s 'invisible)))) - s)) - (defvar org-export-htmlized-org-css-url) ;; defined in org-html.el (defun org-export-string (string fmt &optional dir) @@ -3221,7 +3303,7 @@ (defun org-export-push-to-kill-ring (format) "Push buffer content to kill ring. -The depends on the variable `org-export-copy-to-kill'." +The depends on the variable `org-export-copy-to-kill-ring'." (when org-export-copy-to-kill-ring (org-kill-new (buffer-string)) (when (fboundp 'x-set-selection) @@ -3231,6 +3313,4 @@ (provide 'org-exp) -;; arch-tag: 65985fe9-095c-49c7-a7b6-cb4ee15c0a95 - ;;; org-exp.el ends here diff -Nru org-mode-7.7/lisp/org-faces.el org-mode-7.8.02/lisp/org-faces.el --- org-mode-7.7/lisp/org-faces.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/org-faces.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,12 +1,10 @@ ;;; org-faces.el --- Face definitions for Org-mode. -;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 -;; Free Software Foundation, Inc. +;; Copyright (C) 2004-2011 Free Software Foundation, Inc. ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; ;; This file is part of GNU Emacs. ;; @@ -674,6 +672,12 @@ "Face for showing the agenda restriction lock." :group 'org-faces) +(defface org-agenda-filter-tags + (org-compatible-face 'modeline + nil) + "Face for tag(s) in the mode-line when filtering the agenda." + :group 'org-faces) + (defface org-time-grid ;; originally copied from font-lock-variable-name-face (org-compatible-face nil '((((class color) (min-colors 16) (background light)) (:foreground "DarkGoldenrod")) @@ -691,6 +695,18 @@ "Face used for agenda entries that come from the Emacs diary." :group 'org-faces) +(defface org-agenda-calendar-event + (org-compatible-face 'default + nil) + "Face used to show events and appointments in the agenda." + :group 'org-faces) + +(defface org-agenda-calendar-sexp + (org-compatible-face 'default + nil) + "Face used to show events computed from a S-expression." + :group 'org-faces) + (defconst org-level-faces '(org-level-1 org-level-2 org-level-3 org-level-4 org-level-5 org-level-6 org-level-7 org-level-8 @@ -736,6 +752,4 @@ (provide 'org-faces) -;; arch-tag: 9dab5f91-c4b9-4d6f-bac3-1f6211ad0a04 - ;;; org-faces.el ends here diff -Nru org-mode-7.7/lisp/org-feed.el org-mode-7.8.02/lisp/org-feed.el --- org-mode-7.7/lisp/org-feed.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/org-feed.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,11 +1,10 @@ ;;; org-feed.el --- Add RSS feed items to Org files ;; -;; Copyright (C) 2009, 2010 Free Software Foundation, Inc. +;; Copyright (C) 2009-2011 Free Software Foundation, Inc. ;; ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; ;; This file is part of GNU Emacs. ;; @@ -674,5 +673,4 @@ (provide 'org-feed) -;; arch-tag: 0929b557-9bc4-47f4-9633-30a12dbb5ae2 ;;; org-feed.el ends here diff -Nru org-mode-7.7/lisp/org-footnote.el org-mode-7.8.02/lisp/org-footnote.el --- org-mode-7.7/lisp/org-footnote.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/org-footnote.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,11 +1,10 @@ ;;; org-footnote.el --- Footnote support in Org and elsewhere ;; -;; Copyright (C) 2009, 2010 Free Software Foundation, Inc. +;; Copyright (C) 2009-2011 Free Software Foundation, Inc. ;; ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; ;; This file is part of GNU Emacs. ;; @@ -38,28 +37,33 @@ (require 'org-macs) (require 'org-compat) +(declare-function message-point-in-header-p "message" ()) +(declare-function org-back-over-empty-lines "org" ()) +(declare-function org-back-to-heading "org" (&optional invisible-ok)) (declare-function org-combine-plists "org" (&rest plists)) +(declare-function org-end-of-subtree "org" (&optional invisible-ok to-heading)) +(declare-function org-export-preprocess-string "org-exp" + (string &rest parameters)) +(declare-function org-fill-paragraph "org" (&optional justify)) +(declare-function org-icompleting-read "org" (&rest args)) +(declare-function org-id-uuid "org-id" ()) +(declare-function org-in-block-p "org" (names)) (declare-function org-in-commented-line "org" ()) (declare-function org-in-indented-comment-line "org" ()) (declare-function org-in-regexp "org" (re &optional nlines visually)) -(declare-function org-in-block-p "org" (names)) -(declare-function org-mark-ring-push "org" (&optional pos buffer)) -(declare-function outline-next-heading "outline") -(declare-function org-trim "org" (s)) -(declare-function org-show-context "org" (&optional key)) -(declare-function org-back-to-heading "org" (&optional invisible-ok)) -(declare-function org-end-of-subtree "org" (&optional invisible-ok to-heading)) (declare-function org-in-verbatim-emphasis "org" ()) +(declare-function org-inside-LaTeX-fragment-p "org" ()) (declare-function org-inside-latex-macro-p "org" ()) -(declare-function org-id-uuid "org" ()) -(declare-function org-fill-paragraph "org" (&optional justify)) -(declare-function org-export-preprocess-string "org-exp" - (string &rest parameters)) +(declare-function org-mark-ring-push "org" (&optional pos buffer)) +(declare-function org-show-context "org" (&optional key)) +(declare-function org-trim "org" (s)) +(declare-function outline-next-heading "outline") -(defvar org-outline-regexp-bol) ; defined in org.el -(defvar org-odd-levels-only) ;; defined in org.el -(defvar org-bracket-link-regexp) ; defined in org.el -(defvar message-signature-separator) ;; defined in message.el +(defvar org-outline-regexp-bol) ; defined in org.el +(defvar org-odd-levels-only) ; defined in org.el +(defvar org-bracket-link-regexp) ; defined in org.el +(defvar message-cite-prefix-regexp) ; defined in message.el +(defvar message-signature-separator) ; defined in message.el (defconst org-footnote-re ;; Only [1]-like footnotes are closed in this regexp, as footnotes @@ -67,17 +71,17 @@ ;; their definition. ;; ;; `org-re' is used for regexp compatibility with XEmacs. - (org-re (concat "\\[\\(?:" - ;; Match inline footnotes. - "fn:\\([-_[:word:]]+\\)?:\\|" - ;; Match other footnotes. - "\\(?:\\([0-9]+\\)\\]\\)\\|" - "\\(fn:[-_[:word:]]+\\)" - "\\)")) + (concat "\\[\\(?:" + ;; Match inline footnotes. + (org-re "fn:\\([-_[:word:]]+\\)?:\\|") + ;; Match other footnotes. + "\\(?:\\([0-9]+\\)\\]\\)\\|" + (org-re "\\(fn:[-_[:word:]]+\\)") + "\\)") "Regular expression for matching footnotes.") (defconst org-footnote-definition-re - (org-re "^\\(\\[\\([0-9]+\\|fn:[-_[:word:]]+\\)\\]\\)") + (org-re "^\\[\\([0-9]+\\|fn:[-_[:word:]]+\\)\\]") "Regular expression matching the definition of a footnote.") (defvar org-footnote-forbidden-blocks '("example" "verse" "src" "ascii" "beamer" @@ -106,13 +110,17 @@ (defcustom org-footnote-tag-for-non-org-mode-files "Footnotes:" "Tag marking the beginning of footnote section. -The Org-mode footnote engine can be used in arbitrary text files as well -as in Org-mode. Outside Org-mode, new footnotes are always placed at +The Org footnote engine can be used in arbitrary text files as well +as in Org-mode. Outside Org mode, new footnotes are always placed at the end of the file. When you normalize the notes, any line containing only this tag will be removed, a new one will be inserted at the end -of the file, followed by the collected and normalized footnotes." +of the file, followed by the collected and normalized footnotes. + +If you don't want any tag in such buffers, set this variable to nil." :group 'org-footnote - :type 'string) + :type '(choice + (string :tag "Collect footnotes under tag") + (const :tag "Don't use a tag" nil))) (defcustom org-footnote-define-inline nil "Non-nil means define footnotes inline, at reference location. @@ -171,8 +179,11 @@ (save-match-data (not (or (org-in-commented-line) (org-in-indented-comment-line) - (org-in-verbatim-emphasis) + (org-inside-LaTeX-fragment-p) + ;; Avoid protected environments (LaTeX export) + (get-text-property (point) 'org-protected) ;; Avoid literal example. + (org-in-verbatim-emphasis) (save-excursion (beginning-of-line) (looking-at "[ \t]*:[ \t]+")) @@ -194,13 +205,13 @@ (or (looking-at org-footnote-re) (org-in-regexp org-footnote-re) (save-excursion (re-search-backward org-footnote-re nil t))) - ;; Only inline footnotes can start at bol. - (or (eq (char-before (match-end 0)) 58) - (/= (match-beginning 0) (point-at-bol)))) + (/= (match-beginning 0) (point-at-bol))) (let* ((beg (match-beginning 0)) - (label (or (match-string 2) (match-string 3) + (label (or (org-match-string-no-properties 2) + (org-match-string-no-properties 3) ;; Anonymous footnotes don't have labels - (and (match-string 1) (concat "fn:" (match-string 1))))) + (and (match-string 1) + (concat "fn:" (org-match-string-no-properties 1))))) ;; Inline footnotes don't end at (match-end 0) as ;; `org-footnote-re' stops just after the second colon. ;; Find the real ending with `scan-sexps', so Org doesn't @@ -223,12 +234,12 @@ ;; optional argument of the command. Thus, check ;; the `org-protected' property of that command. (or (not (org-inside-latex-macro-p)) - (and (get-text-property (1- beg) 'org-protected) - (not (get-text-property beg 'org-protected))))) + (get-text-property (1- beg) 'org-protected))) (list label beg end ;; Definition: ensure this is an inline footnote first. (and (or (not label) (match-string 1)) - (org-trim (buffer-substring (match-end 0) (1- end))))))))) + (org-trim (buffer-substring-no-properties + (match-end 0) (1- end))))))))) (defun org-footnote-at-definition-p () "Is the cursor at a footnote definition? @@ -239,7 +250,7 @@ The return value will be nil if not at a footnote definition, and a list with label, start, end and definition of the footnote otherwise." - (when (org-footnote-in-valid-context-p) + (when (save-excursion (beginning-of-line) (org-footnote-in-valid-context-p)) (save-excursion (end-of-line) (let ((lim (save-excursion (re-search-backward @@ -247,7 +258,7 @@ "\\|^[ \t]*$") nil t)))) (when (re-search-backward org-footnote-definition-re lim t) (end-of-line) - (list (match-string 2) + (list (org-match-string-no-properties 1) (match-beginning 0) (save-match-data ;; In a message, limit search to signature. @@ -257,15 +268,14 @@ (re-search-backward message-signature-separator nil t))))) (or (and (re-search-forward - (org-re - (concat "^[ \t]*$" "\\|" - org-outline-regexp-bol - "\\|" - "^\\[\\([0-9]+\\|fn:[-_[:word:]]+\\)\\]")) + (concat org-outline-regexp-bol "\\|" + org-footnote-definition-re "\\|" + "^[ \t]*$") bound 'move) (progn (skip-chars-forward " \t\n") (point-at-bol))) (point)))) - (org-trim (buffer-substring (match-end 0) (point))))))))) + (org-trim (buffer-substring-no-properties + (match-end 0) (point))))))))) (defun org-footnote-get-next-reference (&optional label backward limit) "Return complete reference of the next footnote. @@ -295,10 +305,11 @@ Return value is a list like those provided by `org-footnote-at-reference-p' or `org-footnote-at-definition-p'. If no footnote is found, return nil." - (let* (ref) + (let* (ref (origin (point))) (catch 'exit (while t (unless (re-search-forward org-footnote-re limit t) + (goto-char origin) (throw 'exit nil)) ;; Beware: with [1]-like footnotes point will be just after ;; the closing square bracket. @@ -320,19 +331,21 @@ (re (format "^\\[%s\\]\\|.\\[%s:" label label)) pos) (save-excursion - (when (or (re-search-forward re nil t) - (and (goto-char (point-min)) - (re-search-forward re nil t)) - (and (progn (widen) t) - (goto-char (point-min)) - (re-search-forward re nil t))) - (let ((refp (org-footnote-at-reference-p))) - (cond - ((and (nth 3 refp) refp)) - ((org-footnote-at-definition-p)))))))) + (save-restriction + (when (or (re-search-forward re nil t) + (and (goto-char (point-min)) + (re-search-forward re nil t)) + (and (progn (widen) t) + (goto-char (point-min)) + (re-search-forward re nil t))) + (let ((refp (org-footnote-at-reference-p))) + (cond + ((and (nth 3 refp) refp)) + ((org-footnote-at-definition-p))))))))) (defun org-footnote-goto-definition (label) - "Move point to the definition of the footnote LABEL." + "Move point to the definition of the footnote LABEL. +Return a non-nil value when a definition has been found." (interactive "sLabel: ") (org-mark-ring-push) (let ((def (org-footnote-get-definition label))) @@ -342,7 +355,9 @@ (looking-at (format "\\[%s\\]\\|\\[%s:" label label)) (goto-char (match-end 0)) (org-show-context 'link-search) - (message "Edit definition and go back with `C-c &' or, if unique, with `C-c C-c'.")))) + (when (eq major-mode 'org-mode) + (message "Edit definition and go back with `C-c &' or, if unique, with `C-c C-c'.")) + t))) (defun org-footnote-goto-previous-reference (label) "Find the first closest (to point) reference of footnote with label LABEL." @@ -406,7 +421,12 @@ (defun org-footnote-unique-label (&optional current) "Return a new unique footnote label. -The returns the firsts fn:N labels that is currently not used." + +The function returns the first \"fn:N\" or \"N\" label that is +currently not used. + +Optional argument CURRENT is the list of labels active in the +buffer." (unless current (setq current (org-footnote-all-labels))) (let ((fmt (if (eq org-footnote-auto-label 'plain) "%d" "fn:%d")) (cnt 1)) @@ -414,21 +434,17 @@ (incf cnt)) (format fmt cnt))) -(defvar org-footnote-label-history nil - "History of footnote labels entered in current buffer.") -(make-variable-buffer-local 'org-footnote-label-history) - (defun org-footnote-new () "Insert a new footnote. This command prompts for a label. If this is a label referencing an existing label, only insert the label. If the footnote label is empty or new, let the user edit the definition of the footnote." (interactive) - (unless (and (not (bolp)) (org-footnote-in-valid-context-p)) + (unless (org-footnote-in-valid-context-p) (error "Cannot insert a footnote here")) - (let* ((labels (and (not (equal org-footnote-auto-label 'random)) - (org-footnote-all-labels))) - (propose (org-footnote-unique-label labels)) + (let* ((lbls (and (not (equal org-footnote-auto-label 'random)) + (org-footnote-all-labels))) + (propose (org-footnote-unique-label lbls)) (label (org-footnote-normalize-label (cond @@ -438,16 +454,16 @@ (require 'org-id) (substring (org-id-uuid) 0 8)) (t - (completing-read + (org-icompleting-read "Label (leave empty for anonymous): " - (mapcar 'list labels) nil nil - (if (eq org-footnote-auto-label 'confirm) propose nil) - 'org-footnote-label-history)))))) + (mapcar 'list lbls) nil nil + (if (eq org-footnote-auto-label 'confirm) propose nil))))))) (cond + ((bolp) (error "Cannot create a footnote reference at left margin")) ((not label) (insert "[fn:: ]") (backward-char 1)) - ((member label labels) + ((member label lbls) (insert "[" label "]") (message "New reference to existing note")) (org-footnote-define-inline @@ -459,51 +475,78 @@ (org-footnote-create-definition label) (org-footnote-auto-adjust-maybe))))) +(defvar org-blank-before-new-entry nil) ; silence byte-compiler (defun org-footnote-create-definition (label) "Start the definition of a footnote with label LABEL." (interactive "sLabel: ") (let ((label (org-footnote-normalize-label label))) (cond - ((org-mode-p) - ;; No section, put footnote into the current outline node Try to - ;; find or make the special node + ;; In an Org file. + ((eq major-mode 'org-mode) + ;; If `org-footnote-section' is defined, find it, or create it + ;; at the end of the buffer. (when org-footnote-section (goto-char (point-min)) (let ((re (concat "^\\*+[ \t]+" org-footnote-section "[ \t]*$"))) (unless (or (re-search-forward re nil t) (and (progn (widen) t) (re-search-forward re nil t))) - (goto-char (point-max)) - (insert "\n\n* " org-footnote-section "\n")))) - ;; Now go to the end of this entry and insert there. + (goto-char (point-max)) + (skip-chars-backward " \t\r\n") + (unless (bolp) (newline)) + ;; Insert new section. Separate it from the previous one + ;; with a blank line, unless `org-blank-before-new-entry' + ;; explicitly says no. + (when (and (cdr (assq 'heading org-blank-before-new-entry)) + (zerop (save-excursion (org-back-over-empty-lines)))) + (insert "\n")) + (insert "* " org-footnote-section "\n")))) + ;; Move to the end of this entry (which may be + ;; `org-footnote-section' or the current one). (org-footnote-goto-local-insertion-point) (org-show-context 'link-search)) (t ;; In a non-Org file. Search for footnote tag, or create it if - ;; necessary (at the end of buffer, or before a signature if in + ;; specified (at the end of buffer, or before signature if in ;; Message mode). Set point after any definition already there. - (let ((tag (concat "^" org-footnote-tag-for-non-org-mode-files "[ \t]*$")) - (max (save-excursion - (if (and (derived-mode-p 'message-mode) - (re-search-forward - message-signature-separator nil t)) - (copy-marker (point-at-bol) t) - (copy-marker (point-max) t))))) + (let ((tag (and org-footnote-tag-for-non-org-mode-files + (concat "^" (regexp-quote + org-footnote-tag-for-non-org-mode-files) + "[ \t]*$"))) + (max (if (and (derived-mode-p 'message-mode) + (goto-char (point-max)) + (re-search-backward + message-signature-separator nil t)) + (progn + ;; Ensure one blank line separates last + ;; footnote from signature. + (beginning-of-line) + (open-line 2) + (point-marker)) + (point-max-marker)))) + (set-marker-insertion-type max t) (goto-char max) - (unless (re-search-backward tag nil t) + ;; Check if the footnote tag is defined but missing. In this + ;; case, insert it, before any footnote or one blank line + ;; after any previous text. + (when (and tag (not (re-search-backward tag nil t))) (skip-chars-backward " \t\r\n") - (delete-region (point) max) - (insert "\n\n" org-footnote-tag-for-non-org-mode-files "\n")) - ;; Skip existing footnotes. - (while (re-search-forward org-footnote-definition-re max t)) - (let ((def (org-footnote-at-definition-p))) - (when def (goto-char (nth 2 def)))) + (while (re-search-backward org-footnote-definition-re nil t)) + (unless (bolp) (newline 2)) + (insert org-footnote-tag-for-non-org-mode-files "\n\n")) + ;; Remove superfluous white space and clear marker. + (goto-char max) + (skip-chars-backward " \t\r\n") + (delete-region (point) max) + (unless (bolp) (newline)) (set-marker max nil)))) - ;; Insert footnote label, position point and notify user. - (unless (bolp) (insert "\n")) - (insert "\n[" label "] \n") - (backward-char) - (message "Edit definition and go back with `C-c &' or, if unique, with `C-c C-c'."))) + ;; Insert footnote label. + (insert "\n[" label "] ") + ;; Only notify user about next possible action when in an Org + ;; buffer, as the bindings may have different meanings otherwise. + (when (eq major-mode 'org-mode) + (message + "Edit definition and go back with `C-c &' or, if unique, with `C-c C-c'.")))) ;;;###autoload (defun org-footnote-action (&optional special) @@ -570,11 +613,11 @@ export properties of the buffer. When EXPORT-PROPS is non-nil, the default action is to insert -normalized footnotes towards the end of the pre-processing buffer. -Some exporters like docbook, odt, etc. expect that footnote -definitions be available before any references to them. Such -exporters can let bind `org-footnote-insert-pos-for-preprocessor' to -symbol 'point-min to achieve the desired behaviour. +normalized footnotes towards the end of the pre-processing +buffer. Some exporters (docbook, odt...) expect footnote +definitions to be available before any references to them. Such +exporters can let bind `org-footnote-insert-pos-for-preprocessor' +to symbol `point-min' to achieve the desired behaviour. Additional note on `org-footnote-insert-pos-for-preprocessor': 1. This variable has not effect when FOR-PREPROCESSOR is nil. @@ -634,8 +677,8 @@ (and inlinep org-footnote-fill-after-inline-note-extraction (org-fill-paragraph))) - ;; Add label (REF), identifier (MARKER) and definition (DEF) - ;; to REF-TABLE if data was unknown. + ;; Add label (REF), identifier (MARKER), definition (DEF) + ;; and type (INLINEP) to REF-TABLE if data was unknown. (unless a (let ((def (or (nth 3 ref) ; inline (and export-props @@ -646,52 +689,52 @@ ;; through `org-export-preprocess-string' so ;; it is ready to insert in the ;; backend-specific buffer. - (if export-props + (if (and export-props def) (let ((parameters (org-combine-plists export-props '(:todo-keywords t :tags t :priority t)))) (org-export-preprocess-string def parameters)) def) - inlinep) ref-table))) - ;; Remove definition of non-inlined footnotes. - (unless inlinep (org-footnote-delete-definitions lbl)))) + inlinep) ref-table))))) ;; 2. Find and remove the footnote section, if any. Also ;; determine where footnotes shall be inserted (INS-POINT). (goto-char (point-min)) (cond - ((org-mode-p) - (if (and org-footnote-section - (re-search-forward - (concat "^\\*[ \t]+" (regexp-quote org-footnote-section) - "[ \t]*$") - nil t)) - (progn - (setq ins-point (match-beginning 0)) - (delete-region (match-beginning 0) (org-end-of-subtree t))) - (setq ins-point (point-max)))) + ((and org-footnote-section + (eq major-mode 'org-mode) + (re-search-forward + (concat "^\\*[ \t]+" (regexp-quote org-footnote-section) + "[ \t]*$") + nil t)) + (delete-region (match-beginning 0) (org-end-of-subtree t))) + ((eq major-mode 'org-mode) + (goto-char (point-max)) + (unless (bolp) (newline))) (t - (when (re-search-forward - (concat "^" - (regexp-quote org-footnote-tag-for-non-org-mode-files) - "[ \t]*$") - nil t) - (replace-match "")) - ;; In message-mode, ensure footnotes are inserted before the + ;; Remove any left-over tag in the buffer, if one is set up. + (when org-footnote-tag-for-non-org-mode-files + (let ((tag (concat "^" (regexp-quote + org-footnote-tag-for-non-org-mode-files) + "[ \t]*$"))) + (while (re-search-forward tag nil t) + (replace-match "") + (delete-region (point) (progn (forward-line) (point)))))) + ;; In Message mode, ensure footnotes are inserted before the ;; signature. - (let ((pt-max - (or (and (derived-mode-p 'message-mode) - (save-excursion - (goto-char (point-max)) - (re-search-backward - message-signature-separator nil t) - (1- (point)))) - (point-max)))) - (goto-char pt-max) - (skip-chars-backward " \t\n\r") - (forward-line) - (delete-region (point) pt-max)) - (setq ins-point (point)))) + (if (and (derived-mode-p 'message-mode) + (goto-char (point-max)) + (re-search-backward message-signature-separator nil t)) + (beginning-of-line) + (goto-char (point-max))))) + ;; During export, `org-footnote-insert-pos-for-preprocessor' has + ;; precedence over previously found position. + (setq ins-point + (copy-marker + (if (and export-props + (eq org-footnote-insert-pos-for-preprocessor 'point-min)) + (point-min) + (point)))) ;; 3. Clean-up REF-TABLE. (setq ref-table (delq nil @@ -708,34 +751,48 @@ (t x))) ref-table))) (setq ref-table (nreverse ref-table)) - ;; 4. Insert the footnotes again in the buffer, at the + ;; 4. Remove left-over definitions in the buffer. + (mapc (lambda (x) (unless (nth 3 x) + (org-footnote-delete-definitions (car x)))) + ref-table) + ;; 5. Insert the footnotes again in the buffer, at the ;; appropriate spot. - (goto-char (or - (and export-props - (eq org-footnote-insert-pos-for-preprocessor 'point-min) - (point-min)) - ins-point - (point-max))) + (goto-char ins-point) (cond ;; No footnote: exit. ((not ref-table)) ;; Cases when footnotes should be inserted in one place. - ((or (not (org-mode-p)) + ((or (not (eq major-mode 'org-mode)) org-footnote-section (not sort-only)) - ;; Insert again the section title. + ;; Insert again the section title, if any. Ensure that title, + ;; or the subsequent footnotes, will be separated by a blank + ;; lines from the rest of the document. In an Org buffer, + ;; separate section with a blank line, unless explicitly + ;; stated in `org-blank-before-new-entry'. (cond - ((not (org-mode-p)) - (insert "\n\n" org-footnote-tag-for-non-org-mode-files "\n")) + ((not (eq major-mode 'org-mode)) + (skip-chars-backward " \t\n\r") + (delete-region (point) ins-point) + (unless (bolp) (newline)) + ;; Keep one blank line between footnotes and signature. + (when (and (derived-mode-p 'message-mode) + (save-excursion + (re-search-forward message-signature-separator nil t))) + (open-line 1)) + (when org-footnote-tag-for-non-org-mode-files + (insert "\n" org-footnote-tag-for-non-org-mode-files "\n"))) ((and org-footnote-section (not export-props)) - (or (bolp) (insert "\n")) + (when (and (cdr (assq 'heading org-blank-before-new-entry)) + (zerop (save-excursion (org-back-over-empty-lines)))) + (insert "\n")) (insert "* " org-footnote-section "\n"))) - ;; Insert the footnotes. - (insert "\n" - (mapconcat (lambda (x) (format "[%s] %s" + (set-marker ins-point nil) + ;; Insert the footnotes, separated by a blank line. + (insert (mapconcat (lambda (x) (format "\n[%s] %s" (nth (if sort-only 0 1) x) (nth 2 x))) - ref-table "\n\n") - "\n\n") + ref-table "\n")) + (unless (eobp) (insert "\n")) ;; When exporting, add newly inserted markers along with their ;; associated definition to `org-export-footnotes-seen'. (when export-props @@ -831,20 +888,21 @@ (defun org-footnote-renumber-fn:N () "Renumber the simple footnotes like fn:17 into a sequence in the document." (interactive) - (let (map i (n 0)) - (save-excursion - (save-restriction - (widen) - (goto-char (point-min)) - (while (re-search-forward "\\[fn:\\([0-9]+\\)[]:]" nil t) - (setq i (string-to-number (match-string 1))) - (when (and (string-match "\\S-" (buffer-substring - (point-at-bol) (match-beginning 0))) - (not (assq i map))) - (push (cons i (number-to-string (incf n))) map))) - (goto-char (point-min)) - (while (re-search-forward "\\(\\[fn:\\)\\([0-9]+\\)\\([]:]\\)" nil t) - (replace-match (concat "\\1" (cdr (assq (string-to-number (match-string 2)) map)) "\\3"))))))) + (let (map (n 0)) + (org-with-wide-buffer + (goto-char (point-min)) + (while (re-search-forward "\\[fn:\\([0-9]+\\)[]:]" nil t) + (save-excursion + (goto-char (match-beginning 0)) + ;; Ensure match is a footnote reference or definition. + (when (save-match-data (if (bolp) + (org-footnote-at-definition-p) + (org-footnote-at-reference-p))) + (let ((new-val (or (cdr (assoc (match-string 1) map)) + (number-to-string (incf n))))) + (unless (assoc (match-string 1) map) + (push (cons (match-string 1) new-val) map)) + (replace-match new-val nil nil nil 1)))))))) (defun org-footnote-auto-adjust-maybe () "Renumber and/or sort footnotes according to user settings." @@ -862,6 +920,4 @@ (provide 'org-footnote) -;; arch-tag: 1b5954df-fb5d-4da5-8709-78d944dbfc37 - ;;; org-footnote.el ends here diff -Nru org-mode-7.7/lisp/org-freemind.el org-mode-7.8.02/lisp/org-freemind.el --- org-mode-7.7/lisp/org-freemind.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/org-freemind.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,11 +1,10 @@ ;;; org-freemind.el --- Export Org files to freemind -;; Copyright (C) 2009, 2010 Free Software Foundation, Inc. +;; Copyright (C) 2009-2011 Free Software Foundation, Inc. ;; Author: Lennart Borgman (lennart O borgman A gmail O com) ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; ;; This file is part of GNU Emacs. ;; @@ -57,26 +56,6 @@ ;; Added y/n question before showing in FreeMind. ;; 2009-11-04: Added support for #+BEGIN_HTML. ;; -;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; -;; This program is free software; you can redistribute it and/or -;; modify it under the terms of the GNU General Public License as -;; published by the Free Software Foundation; either version 2, or -;; (at your option) any later version. -;; -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. -;; -;; You should have received a copy of the GNU General Public License -;; along with this program; see the file COPYING. If not, write to -;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth -;; Floor, Boston, MA 02110-1301, USA. -;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; ;;; Code: (require 'xml) @@ -680,7 +659,7 @@ (with-current-buffer mm-buffer (erase-buffer) (setq buffer-file-coding-system 'utf-8) - ;; Fix-me: Currentl Freemind (ver 0.9.0 RC9) does not support this: + ;; Fix-me: Currently Freemind (ver 0.9.0 RC9) does not support this: ;;(insert "\n") (insert "\n") (insert "\n")) @@ -1237,7 +1216,8 @@ (provide 'org-freemind) -;; arch-tag: e7b0d776-94fd-404a-b35e-0f855fae3627 + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ;;; org-freemind.el ends here diff -Nru org-mode-7.7/lisp/org-gnus.el org-mode-7.8.02/lisp/org-gnus.el --- org-mode-7.7/lisp/org-gnus.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/org-gnus.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,13 +1,11 @@ ;;; org-gnus.el --- Support for links to Gnus groups and messages from within Org-mode -;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 -;; Free Software Foundation, Inc. +;; Copyright (C) 2004-2011 Free Software Foundation, Inc. ;; Author: Carsten Dominik ;; Tassilo Horn ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; ;; This file is part of GNU Emacs. ;; @@ -291,6 +289,5 @@ (provide 'org-gnus) -;; arch-tag: 512e0840-58fa-45b3-b456-71e10fa2376d ;;; org-gnus.el ends here diff -Nru org-mode-7.7/lisp/org-habit.el org-mode-7.8.02/lisp/org-habit.el --- org-mode-7.7/lisp/org-habit.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/org-habit.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,11 +1,10 @@ ;;; org-habit.el --- The habit tracking code for Org-mode -;; Copyright (C) 2009, 2010 Free Software Foundation, Inc. +;; Copyright (C) 2009-2011 Free Software Foundation, Inc. ;; Author: John Wiegley ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; ;; This file is part of GNU Emacs. ;; @@ -68,6 +67,16 @@ :group 'org-habit :type 'boolean) +(defcustom org-habit-today-glyph ?! + "Glyph character used to identify today." + :group 'org-habit + :type 'character) + +(defcustom org-habit-completed-glyph ?* + "Glyph character used to show completed days on which a task was done." + :group 'org-habit + :type 'character) + (defface org-habit-clear-face '((((background light)) (:background "#8270f9")) (((background dark)) (:background "blue"))) @@ -297,7 +306,7 @@ (days-to-time (- start (time-to-days starting)))))) - (aset graph index ?*) + (aset graph index org-habit-completed-glyph) (setq markedp t) (put-text-property index (1+ index) 'help-echo @@ -307,7 +316,7 @@ (setq last-done-date (car done-dates) done-dates (cdr done-dates)))) (if todayp - (aset graph index ?!))) + (aset graph index org-habit-today-glyph))) (setq face (if (or in-the-past-p todayp) (car faces) (cdr faces))) @@ -358,6 +367,4 @@ (provide 'org-habit) -;; arch-tag: 64e070d9-bd09-4917-bd44-44465f5ed348 - ;;; org-habit.el ends here diff -Nru org-mode-7.7/lisp/org-html.el org-mode-7.8.02/lisp/org-html.el --- org-mode-7.7/lisp/org-html.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/org-html.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,12 +1,10 @@ ;;; org-html.el --- HTML export for Org-mode -;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 -;; Free Software Foundation, Inc. +;; Copyright (C) 2004-2011 Free Software Foundation, Inc. ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; ;; This file is part of GNU Emacs. ;; @@ -35,7 +33,7 @@ (declare-function org-id-find-id-file "org-id" (id)) (declare-function htmlize-region "ext:htmlize" (beg end)) -(declare-function org-pop-to-buffer-same-window +(declare-function org-pop-to-buffer-same-window "org-compat" (&optional buffer-or-name norecord label)) (defgroup org-export-html nil @@ -158,6 +156,12 @@ dt { font-weight: bold; } div.figure { padding: 0.5em; } div.figure p { text-align: center; } + div.inlinetask { + padding:10px; + border:2px solid gray; + margin:10px; + background: #ffffcc; + } textarea { overflow-x: auto; } .linenr { font-size:smaller } .code-highlighted {background-color:#ffff00;} @@ -351,6 +355,14 @@ :group 'org-export-html :type 'string) +(defcustom org-export-html-headline-anchor-format "" + "Format for anchors in HTML headlines. +It requires to %s: both will be replaced by the anchor referring +to the headline (e.g. \"sec-2\"). When set to `nil', don't insert +HTML anchors in headlines." + :group 'org-export-html + :type 'string) + (defcustom org-export-html-preamble t "Non-nil means insert a preamble in HTML export. @@ -358,8 +370,8 @@ strings in `org-export-html-preamble-format'. When set to a string, this string overrides `org-export-html-preamble-format'. When set to a function, apply this function and insert the -returned string. The function takes the property list of export -options as its only argument. +returned string. The function takes no argument, but you can +use `opt-plist' to access the current export options. Setting :html-preamble in publishing projects will take precedence over this variable." @@ -391,8 +403,8 @@ 'auto, discard `org-export-html-postamble-format' and honor `org-export-author/email/creator-info' variables. When set to a function, apply this function and insert the returned string. -The function takes the property list of export options as its -only argument. +The function takes no argument, but you can use `opt-plist' to +access the current export options. Setting :html-postamble in publishing projects will take precedence over this variable." @@ -622,7 +634,10 @@ Please set `org-export-html-divs' instead.") (defcustom org-export-html-divs '("preamble" "content" "postamble") - "The name of the main divs for HTML export." + "The name of the main divs for HTML export. +This is a list of three strings, the first one for the preamble +DIV, the second one for the content DIV and the third one for the +postamble DIV." :group 'org-export-html :type '(list (string :tag " Div for the preamble:") @@ -706,7 +721,7 @@ (interactive "r") (let (reg html buf pop-up-frames) (save-window-excursion - (if (org-mode-p) + (if (eq major-mode 'org-mode) (setq html (org-export-region-as-html beg end t 'string)) (setq reg (buffer-substring beg end) @@ -804,11 +819,11 @@ may-inline-p) "Make an HTML link. OPT-PLIST is an options list. -TYPE is the device-type of the link (THIS://foo.html) -PATH is the path of the link (http://THIS#locationx) -FRAGMENT is the fragment part of the link, if any (foo.html#THIS) +TYPE is the device-type of the link (THIS://foo.html). +PATH is the path of the link (http://THIS#location). +FRAGMENT is the fragment part of the link, if any (foo.html#THIS). DESC is the link description, if any. -ATTR is a string of other attributes of the a element. +ATTR is a string of other attributes of the \"a\" element. MAY-INLINE-P allows inlining it as an image." (declare (special org-par-open)) @@ -899,7 +914,7 @@ (string-match "^\\.\\.?/" path))) "file") (t "internal"))) - (setq path (org-extract-attributes (org-link-unescape path))) + (setq path (org-extract-attributes path)) (setq attr (get-text-property 0 'org-attributes path)) (setq desc1 (if (match-end 5) (match-string 5 line)) desc2 (if (match-end 2) (concat type ":" path) path) @@ -912,7 +927,7 @@ (if (string-match "^file:" desc) (setq desc (substring desc (match-end 0))))) (setq desc (org-add-props - (concat "\""") '(org-protected t)))) (cond @@ -1039,14 +1054,17 @@ (t ;; just publish the path, as default - (setq rpl (concat "@<" type ":" + (setq rpl (concat "<" type ":" (save-match-data (org-link-unescape path)) - ">@")))) + ">")))) (setq line (replace-match rpl t t line) start (+ start (length rpl)))) line)) ;;; org-export-as-html + +(defvar org-heading-keyword-regexp-format) ; defined in org.el + ;;;###autoload (defun org-export-as-html (arg &optional hidden ext-plist to-buffer body-only pub-dir) @@ -1140,14 +1158,15 @@ (current-dir (if buffer-file-name (file-name-directory buffer-file-name) default-directory)) + (auto-insert nil); Avoid any auto-insert stuff for the new file (buffer (if to-buffer (cond ((eq to-buffer 'string) (get-buffer-create "*Org HTML Export*")) (t (get-buffer-create to-buffer))) (find-file-noselect filename))) (org-levels-open (make-vector org-level-max nil)) - (date (plist-get opt-plist :date)) - (author (plist-get opt-plist :author)) + (date (org-html-expand (plist-get opt-plist :date))) + (author (org-html-expand (plist-get opt-plist :author))) (html-validation-link (or org-export-html-validation-link "")) (title (org-html-expand (or (and subtree-p (org-export-get-title-from-subtree)) @@ -1168,15 +1187,16 @@ (plist-get opt-plist :link-home))) (dummy (setq opt-plist (plist-put opt-plist :title title))) (html-table-tag (plist-get opt-plist :html-table-tag)) - (quote-re0 (concat "^[ \t]*" org-quote-string "\\>")) - (quote-re (concat "^\\(\\*+\\)\\([ \t]+" org-quote-string "\\>\\)")) + (quote-re0 (concat "^ *" org-quote-string "\\( +\\|[ \t]*$\\)")) + (quote-re (format org-heading-keyword-regexp-format + org-quote-string)) (inquote nil) (infixed nil) (inverse nil) (email (plist-get opt-plist :email)) (language (plist-get opt-plist :language)) - (keywords (plist-get opt-plist :keywords)) - (description (plist-get opt-plist :description)) + (keywords (org-html-expand (plist-get opt-plist :keywords))) + (description (org-html-expand (plist-get opt-plist :description))) (num (plist-get opt-plist :section-numbers)) (lang-words nil) (head-count 0) cnt @@ -1290,11 +1310,11 @@ "%s - + %s + @@ -1317,7 +1337,7 @@ language language title (or charset "iso-8859-1") - date author description keywords + title date author description keywords style mathjax (if (or link-up link-home) @@ -1330,28 +1350,35 @@ ;; insert html preamble (when (plist-get opt-plist :html-preamble) - (let ((html-pre (plist-get opt-plist :html-preamble))) - (insert "
    \n") + (let ((html-pre (plist-get opt-plist :html-preamble)) + html-pre-real-contents) (cond ((stringp html-pre) - (insert - (format-spec html-pre `((?t . ,title) (?a . ,author) - (?d . ,date) (?e . ,email))))) + (setq html-pre-real-contents + (format-spec html-pre `((?t . ,title) (?a . ,author) + (?d . ,date) (?e . ,email))))) ((functionp html-pre) - (funcall html-pre)) + (insert "
    \n") + (if (stringp (funcall html-pre)) (insert (funcall html-pre))) + (insert "\n
    \n")) (t - (insert + (setq html-pre-real-contents (format-spec (or (cadr (assoc (nth 0 lang-words) org-export-html-preamble-format)) (cadr (assoc "en" org-export-html-preamble-format))) `((?t . ,title) (?a . ,author) (?d . ,date) (?e . ,email)))))) - (insert "\n
    \n"))) + ;; don't output an empty preamble DIV + (unless (and (functionp html-pre) + (equal html-pre-real-contents "")) + (insert "
    \n") + (insert html-pre-real-contents) + (insert "\n
    \n")))) ;; begin wrap around body - (insert (format "\n
    " + (insert (format "\n
    " ;; FIXME org-export-html-content-div is obsolete since 7.7 - (or org-export-html-content-div + (or org-export-html-content-div (nth 1 org-export-html-divs))) ;; FIXME this should go in the preamble but is here so ;; that org-infojs can still find it @@ -1368,7 +1395,7 @@ (push "
    \n" thetoc) (push "
      \n
    • " thetoc) (setq lines - (mapcar + (mapcar #'(lambda (line) (if (and (string-match org-todo-line-regexp line) (not (get-text-property 0 'org-protected line))) @@ -1394,7 +1421,7 @@ line lines level)))) (if (string-match (org-re "[ \t]+:\\([[:alnum:]_@:]+\\):[ \t]*$") txt) - (setq txt (replace-match + (setq txt (replace-match "    \\1" t nil txt))) (if (string-match quote-re0 txt) (setq txt (replace-match "" t t txt))) @@ -1422,7 +1449,7 @@ ;; Check for targets (while (string-match org-any-target-regexp line) (setq line (replace-match - (concat "@" + (concat "@" (match-string 1 line) "@ ") t t line))) (while (string-match "<\\(<\\)+\\|>\\(>\\)+" txt) @@ -1430,8 +1457,8 @@ (setq href (replace-regexp-in-string "\\." "-" (format "sec-%s" snumber))) - (setq href (org-solidify-link-text - (or (cdr (assoc href + (setq href (org-solidify-link-text + (or (cdr (assoc href org-export-preferred-target-alist)) href))) (push (format @@ -1439,7 +1466,7 @@ "
    • \n
    • %s" "
    • \n
    • %s") href txt) thetoc) - + (setq org-last-level level))))) line) lines)) @@ -1448,15 +1475,15 @@ (push "
    • \n
    \n" thetoc)) (push "
    \n" thetoc) (setq thetoc (if have-headings (nreverse thetoc) nil)))) - + (setq head-count 0) (org-init-section-numbers) - + (org-open-par) - + (while (setq line (pop lines) origline line) (catch 'nextline - + ;; end of quote section? (when (and inquote (string-match org-outline-regexp-bol line)) (insert "\n") @@ -1591,7 +1618,8 @@ (setq line (org-html-handle-links line opt-plist)) ;; TODO items - (if (and (string-match org-todo-line-regexp line) + (if (and org-todo-line-regexp + (string-match org-todo-line-regexp line) (match-beginning 2)) (setq line @@ -1600,9 +1628,9 @@ (if (member (match-string 2 line) org-done-keywords) "done" "todo") - " " (match-string 2 line) - "\"> " (org-export-html-get-todo-kwd-class-name - (match-string 2 line)) + " " (org-export-html-get-todo-kwd-class-name + (match-string 2 line)) + "\"> " (match-string 2 line) "" (substring line (match-end 2))))) ;; Does this contain a reference to a footnote? @@ -1639,7 +1667,7 @@ t t line)))))) (cond - ((string-match "^\\(\\*+\\)[ \t]+\\(.*\\)" line) + ((string-match "^\\(\\*+\\)\\(?: +\\(.*?\\)\\)?[ \t]*$" line) ;; This is a headline (setq level (org-tr-level (- (match-end 1) (match-beginning 1) level-offset)) @@ -1788,7 +1816,7 @@ (?d . ,date) (?c . ,creator-info) (?v . ,html-validation-link))))) ((functionp html-post) - (funcall html-post)) + (if (stringp (funcall html-post)) (insert (funcall html-post)))) ((eq html-post 'auto) ;; fall back on default postamble (when (plist-get opt-plist :time-stamp-file) @@ -1811,7 +1839,7 @@ (?d . ,date) (?c . ,creator-info) (?v . ,html-validation-link)))))) (insert "\n
    ")))) - + ;; FIXME `org-export-html-with-timestamp' has been declared ;; obsolete since Org 7.7 -- don't forget to remove this. (if org-export-html-with-timestamp @@ -1944,7 +1972,7 @@ (if (string-match "^[ \t]*|" (car lines)) ;; A normal org table (org-format-org-table-html lines nil no-css) - ;; Table made by table.el + ;; Table made by table.el (or (org-format-table-table-html-using-table-generate-source olines (not org-export-prefer-native-exporter-for-tables)) ;; We are here only when table.el table has NO col or row @@ -1972,8 +2000,8 @@ (let* ((caption (org-find-text-property-in-string 'org-caption (car lines))) (label (org-find-text-property-in-string 'org-label (car lines))) - (forced-aligns (org-find-text-property-in-string 'org-forced-aligns - (car lines))) + (col-cookies (org-find-text-property-in-string 'org-col-cookies + (car lines))) (attributes (org-find-text-property-in-string 'org-attributes (car lines))) (html-table-tag (org-export-splice-attributes @@ -1986,9 +2014,9 @@ tbopen line fields html gr colgropen rowstart rowend ali align aligns n) (setq caption (and caption (org-html-do-expand caption))) - (when (and forced-aligns org-table-clean-did-remove-column) - (setq forced-aligns - (mapcar (lambda (x) (cons (1- (car x)) (cdr x))) forced-aligns))) + (when (and col-cookies org-table-clean-did-remove-column) + (setq col-cookies + (mapcar (lambda (x) (cons (1- (car x)) (cdr x))) col-cookies))) (if splice (setq head nil)) (unless splice (push (if head "
  • " "") html)) (setq tbopen t) @@ -2049,8 +2077,8 @@ (lambda (x) (setq gr (pop org-table-colgroup-info) i (1+ i) - align (if (assoc i forced-aligns) - (cdr (assoc (cdr (assoc i forced-aligns)) + align (if (nth 1 (assoc i col-cookies)) + (cdr (assoc (nth 1 (assoc i col-cookies)) '(("l" . "left") ("r" . "right") ("c" . "center")))) (if (> (/ (float x) nline) @@ -2206,19 +2234,20 @@ "Format time stamps in string S, or remove them." (catch 'exit (let (r b) - (while (string-match org-maybe-keyword-time-regexp s) - (or b (setq b (substring s 0 (match-beginning 0)))) - (setq r (concat - r (substring s 0 (match-beginning 0)) - " @" - (if (match-end 1) - (format "@%s @" - (match-string 1 s))) - (format " @%s@" - (substring - (org-translate-time (match-string 3 s)) 1 -1)) - "@") - s (substring s (match-end 0)))) + (when org-maybe-keyword-time-regexp + (while (string-match org-maybe-keyword-time-regexp s) + (or b (setq b (substring s 0 (match-beginning 0)))) + (setq r (concat + r (substring s 0 (match-beginning 0)) + " @" + (if (match-end 1) + (format "@%s @" + (match-string 1 s))) + (format " @%s@" + (substring + (org-translate-time (match-string 3 s)) 1 -1)) + "@") + s (substring s (match-end 0))))) ;; Line break if line started and ended with time stamp stuff (if (not r) s @@ -2289,18 +2318,20 @@ (defun org-html-expand (string) "Prepare STRING for HTML export. Apply all active conversions. -If there are links in the string, don't modify these." - (let* ((re (concat org-bracket-link-regexp "\\|" - (org-re "[ \t]+\\(:[[:alnum:]_@#%:]+:\\)[ \t]*$"))) - m s l res) - (while (setq m (string-match re string)) - (setq s (substring string 0 m) - l (match-string 0 string) - string (substring string (match-end 0))) - (push (org-html-do-expand s) res) +If there are links in the string, don't modify these. If STRING +is nil, return nil." + (when string + (let* ((re (concat org-bracket-link-regexp "\\|" + (org-re "[ \t]+\\(:[[:alnum:]_@#%:]+:\\)[ \t]*$"))) + m s l res) + (while (setq m (string-match re string)) + (setq s (substring string 0 m) + l (match-string 0 string) + string (substring string (match-end 0))) + (push (org-html-do-expand s) res) (push l res)) - (push (org-html-do-expand string) res) - (apply 'concat (nreverse res)))) + (push (org-html-do-expand string) res) + (apply 'concat (nreverse res))))) (defun org-html-do-expand (s) "Apply all active conversions to translate special ASCII to HTML." @@ -2415,8 +2446,9 @@ (mapconcat (lambda (x) (setq x (org-solidify-link-text (if (org-uuidgen-p x) (concat "ID-" x) x))) - (format "" - x x)) + (if (stringp org-export-html-headline-anchor-format) + (format org-export-html-headline-anchor-format x x) + "")) extra-targets "")) (while (>= l level) @@ -2607,5 +2639,4 @@ (provide 'org-html) -;; arch-tag: 8109d84d-eb8f-460b-b1a8-f45f3a6c7ea1 ;;; org-html.el ends here diff -Nru org-mode-7.7/lisp/org-icalendar.el org-mode-7.8.02/lisp/org-icalendar.el --- org-mode-7.7/lisp/org-icalendar.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/org-icalendar.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,12 +1,10 @@ ;;; org-icalendar.el --- iCalendar export for Org-mode -;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 -;; Free Software Foundation, Inc. +;; Copyright (C) 2004-2011 Free Software Foundation, Inc. ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; ;; This file is part of GNU Emacs. ;; @@ -419,7 +417,7 @@ (let ((t1 (ignore-errors (org-parse-time-string ts 'nodefault)))) (if (and (> org-icalendar-alarm-time 0) (car t1) (nth 1 t1) (nth 2 t1)) - (setq alarm (format "\nBEGIN:VALARM\nACTION:DISPLAY\nDESCRIPTION:%s\nTRIGGER:-P0D0H%dM0S\nEND:VALARM" summary org-icalendar-alarm-time)) + (setq alarm (format "\nBEGIN:VALARM\nACTION:DISPLAY\nDESCRIPTION:%s\nTRIGGER:-P0DT0H%dM0S\nEND:VALARM" summary org-icalendar-alarm-time)) (setq alarm "")) ) (if (string-match org-bracket-link-regexp summary) @@ -685,5 +683,4 @@ (provide 'org-icalendar) -;; arch-tag: 2dee2b6e-9211-4aee-8a47-a3c7e5bc30cf ;;; org-icalendar.el ends here diff -Nru org-mode-7.7/lisp/org-id.el org-mode-7.8.02/lisp/org-id.el --- org-mode-7.7/lisp/org-id.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/org-id.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,11 +1,10 @@ ;;; org-id.el --- Global identifiers for Org-mode entries ;; -;; Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. +;; Copyright (C) 2008-2011 Free Software Foundation, Inc. ;; ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; ;; This file is part of GNU Emacs. ;; @@ -432,7 +431,7 @@ (delq nil (mapcar (lambda (b) (with-current-buffer b - (and (org-mode-p) (buffer-file-name)))) + (and (eq major-mode 'org-mode) (buffer-file-name)))) (buffer-list))) ;; All files known to have IDs org-id-files))) @@ -601,7 +600,7 @@ (defun org-id-store-link () "Store a link to the current entry, using its ID." (interactive) - (when (and (buffer-file-name (buffer-base-buffer)) (org-mode-p)) + (when (and (buffer-file-name (buffer-base-buffer)) (eq major-mode 'org-mode)) (let* ((link (org-make-link "id:" (org-id-get-create))) (case-fold-search nil) (desc (save-excursion @@ -643,6 +642,6 @@ ;;; org-id.el ends here -;; arch-tag: e5abaca4-e16f-4b25-832a-540cfb63a712 + diff -Nru org-mode-7.7/lisp/org-indent.el org-mode-7.8.02/lisp/org-indent.el --- org-mode-7.7/lisp/org-indent.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/org-indent.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,10 +1,9 @@ ;;; org-indent.el --- Dynamic indentation for Org-mode -;; Copyright (C) 2009, 2010 Free Software Foundation, Inc. +;; Copyright (C) 2009-2011 Free Software Foundation, Inc. ;; ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; ;; This file is part of GNU Emacs. ;; @@ -28,7 +27,12 @@ ;; This is an implementation of dynamic virtual indentation. It works ;; by adding text properties to a buffer to make sure lines are ;; indented according to outline structure. - +;; +;; The process is synchronous, toggled at every buffer modification. +;; Though, the initialization (indentation of text already in the +;; buffer), which can take a few seconds in large buffers, happens on +;; idle time. +;; ;;; Code: (require 'org-macs) @@ -38,9 +42,9 @@ (eval-when-compile (require 'cl)) -(defvar org-inlinetask-min-level) (declare-function org-inlinetask-get-task-level "org-inlinetask" ()) (declare-function org-inlinetask-in-task-p "org-inlinetask" ()) +(declare-function org-list-item-body-column "org-list" (item)) (defgroup org-indent nil "Options concerning dynamic virtual outline indentation." @@ -49,8 +53,11 @@ (defconst org-indent-max 40 "Maximum indentation in characters.") -(defconst org-indent-max-levels 40 - "Maximum indentation in characters.") +(defconst org-indent-max-levels 20 + "Maximum added level through virtual indentation, in characters. + +It is computed by multiplying `org-indent-indentation-per-level' +minus one by actual level of the headline minus one.") (defvar org-indent-strings nil "Vector with all indentation strings. @@ -58,8 +65,31 @@ (defvar org-indent-stars nil "Vector with all indentation star strings. It will be set in `org-indent-initialize'.") +(defvar org-indent-inlinetask-first-star (org-add-props "*" '(face org-warning)) + "First star of inline tasks, with correct face.") +(defvar org-indent-agent-timer nil + "Timer running the initialize agent.") +(defvar org-indent-agentized-buffers nil + "List of buffers watched by the initialize agent.") +(defvar org-indent-agent-resume-timer nil + "Timer to reschedule agent after switching to other idle processes.") +(defvar org-indent-agent-active-delay '(0 2 0) + "Time to run agent before switching to other idle processes. +Delay used when the buffer to initialize is current.") +(defvar org-indent-agent-passive-delay '(0 0 400000) + "Time to run agent before switching to other idle processes. +Delay used when the buffer to initialize isn't current.") +(defvar org-indent-agent-resume-delay '(0 0 100000) + "Minimal time for other idle processes before switching back to agent.") +(defvar org-indent-initial-marker nil + "Position of initialization before interrupt. +This is used locally in each buffer being initialized.") (defvar org-hide-leading-stars-before-indent-mode nil "Used locally.") +(defvar org-indent-modified-headline-flag nil + "Non-nil means the last deletion operated on an headline. +It is modified by `org-indent-notify-modified-headline'.") + (defcustom org-indent-boundary-char ?\ ; comment to protect space char "The end of the virtual indentation strings, a single-character string. @@ -90,28 +120,15 @@ :group 'org-indent :type 'integer) -(defcustom org-indent-fix-section-after-idle-time 0.2 - "Seconds of idle time before fixing virtual indentation of section. -The hooking-in of virtual indentation is not yet perfect. Occasionally, -a change does not trigger to proper change of indentation. For this we -have a timer action that fixes indentation in the current section after -a short amount idle time. If we ever get the integration to work perfectly, -this variable can be set to nil to get rid of the timer." - :group 'org-indent - :type '(choice - (const "Do not install idle timer" nil) - (number :tag "Idle time"))) +(defface org-indent + (org-compatible-face nil nil) + "Face for outline indentation. +The default is to make it look like whitespace. But you may find it +useful to make it ever so slightly different." + :group 'org-faces) (defun org-indent-initialize () - "Initialize the indentation strings and set the idle timer." - ;; We use an idle timer to "repair" the current section, because the - ;; redisplay seems to have some problems. - (unless org-indent-strings - (when org-indent-fix-section-after-idle-time - (run-with-idle-timer - org-indent-fix-section-after-idle-time - t 'org-indent-refresh-section))) - ;; Initialize the indentation and star vectors + "Initialize the indentation strings." (setq org-indent-strings (make-vector (1+ org-indent-max) nil)) (setq org-indent-stars (make-vector (1+ org-indent-max) nil)) (aset org-indent-strings 0 nil) @@ -127,14 +144,21 @@ (org-add-props (make-string i ?*) nil 'face 'org-hide)))) +(defsubst org-indent-remove-properties (beg end) + "Remove indentations between BEG and END." + (with-silent-modifications + (remove-text-properties beg end '(line-prefix nil wrap-prefix nil)))) + ;;;###autoload (define-minor-mode org-indent-mode "When active, indent text according to outline structure. -Internally this works by adding `line-prefix' properties to all non-headlines. -These properties are updated locally in idle time. -FIXME: How to update when broken?" - nil " Ind" nil +Internally this works by adding `line-prefix' and `wrap-prefix' +properties, after each buffer modification, on the modified zone. + +The process is synchronous. Though, initial indentation of +buffer, which can take a few seconds on large buffers, is done +during idle time." nil " Ind" nil (cond ((org-bound-and-true-p org-inhibit-startup) (setq org-indent-mode nil)) @@ -151,6 +175,7 @@ ;; mode was turned on. (org-set-local 'indent-tabs-mode nil) (or org-indent-strings (org-indent-initialize)) + (org-set-local 'org-indent-initial-marker (copy-marker 1)) (when org-indent-mode-turns-off-org-adapt-indentation (org-set-local 'org-adapt-indentation nil)) (when org-indent-mode-turns-on-hiding-stars @@ -160,56 +185,49 @@ (make-local-variable 'buffer-substring-filters) (add-to-list 'buffer-substring-filters 'org-indent-remove-properties-from-string) - (org-add-hook 'org-after-demote-entry-hook - 'org-indent-refresh-section nil 'local) - (org-add-hook 'org-after-promote-entry-hook - 'org-indent-refresh-section nil 'local) - (org-add-hook 'org-font-lock-hook - 'org-indent-refresh-to nil 'local) + (org-add-hook 'after-change-functions 'org-indent-refresh-maybe nil 'local) + (org-add-hook 'before-change-functions + 'org-indent-notify-modified-headline nil 'local) (and font-lock-mode (org-restart-font-lock)) - ) + (org-indent-remove-properties (point-min) (point-max)) + ;; Submit current buffer to initialize agent. If it's the first + ;; buffer submitted, also start the agent. Current buffer is + ;; pushed in both cases to avoid a race condition. + (if org-indent-agentized-buffers + (push (current-buffer) org-indent-agentized-buffers) + (push (current-buffer) org-indent-agentized-buffers) + (setq org-indent-agent-timer + (run-with-idle-timer 0.2 t #'org-indent-initialize-agent)))) (t ;; mode was turned off (or we refused to turn it on) - (save-excursion - (save-restriction - (org-indent-remove-properties (point-min) (point-max)) - (kill-local-variable 'org-adapt-indentation) - (when (boundp 'org-hide-leading-stars-before-indent-mode) - (org-set-local 'org-hide-leading-stars - org-hide-leading-stars-before-indent-mode)) - (setq buffer-substring-filters - (delq 'org-indent-remove-properties-from-string - buffer-substring-filters)) - (remove-hook 'org-after-promote-entry-hook - 'org-indent-refresh-section 'local) - (remove-hook 'org-after-demote-entry-hook - 'org-indent-refresh-section 'local) - (and font-lock-mode (org-restart-font-lock)) - (redraw-display)))))) - - -(defface org-indent - (org-compatible-face nil nil) - "Face for outline indentation. -The default is to make it look like whitespace. But you may find it -useful to make it ever so slightly different." - :group 'org-faces) + (kill-local-variable 'org-adapt-indentation) + (setq org-indent-agentized-buffers + (delq (current-buffer) org-indent-agentized-buffers)) + (when (markerp org-indent-initial-marker) + (set-marker org-indent-initial-marker nil)) + (when (boundp 'org-hide-leading-stars-before-indent-mode) + (org-set-local 'org-hide-leading-stars + org-hide-leading-stars-before-indent-mode)) + (setq buffer-substring-filters + (delq 'org-indent-remove-properties-from-string + buffer-substring-filters)) + (remove-hook 'after-change-functions 'org-indent-refresh-maybe 'local) + (remove-hook 'before-change-functions + 'org-indent-notify-modified-headline 'local) + (org-with-wide-buffer + (org-indent-remove-properties (point-min) (point-max))) + (and font-lock-mode (org-restart-font-lock)) + (redraw-display)))) (defun org-indent-indent-buffer () - "Add indentation properties for the whole buffer." + "Add indentation properties to the accessible part of the buffer." (interactive) - (when org-indent-mode - (save-excursion - (save-restriction - (widen) - (org-indent-remove-properties (point-min) (point-max)) - (org-indent-add-properties (point-min) (point-max)))))) - -(defun org-indent-remove-properties (beg end) - "Remove indentations between BEG and END." - (let ((inhibit-modification-hooks t)) - (with-silent-modifications - (remove-text-properties beg end '(line-prefix nil wrap-prefix nil))))) + (if (not (eq major-mode 'org-mode)) + (error "Not in Org mode") + (message "Setting buffer indentation. It may take a few seconds...") + (org-indent-remove-properties (point-min) (point-max)) + (org-indent-add-properties (point-min) (point-max)) + (message "Indentation of buffer set."))) (defun org-indent-remove-properties-from-string (string) "Remove indentation properties from STRING." @@ -217,110 +235,193 @@ '(line-prefix nil wrap-prefix nil) string) string) -(defvar org-indent-outline-re org-outline-regexp-bol - "Outline heading regexp.") +(defun org-indent-initialize-agent () + "Start or resume current buffer initialization. +Only buffers in `org-indent-agentized-buffers' trigger an action. +When no more buffer is being watched, the agent suppress itself." + (when org-indent-agent-resume-timer + (cancel-timer org-indent-agent-resume-timer)) + (setq org-indent-agentized-buffers + (org-remove-if-not #'buffer-live-p org-indent-agentized-buffers)) + (cond + ;; Job done: kill agent. + ((not org-indent-agentized-buffers) (cancel-timer org-indent-agent-timer)) + ;; Current buffer is agentized: start/resume initialization + ;; somewhat aggressively. + ((memq (current-buffer) org-indent-agentized-buffers) + (org-indent-initialize-buffer (current-buffer) + org-indent-agent-active-delay)) + ;; Else, start/resume initialization of the last agentized buffer, + ;; softly. + (t (org-indent-initialize-buffer (car org-indent-agentized-buffers) + org-indent-agent-passive-delay)))) + +(defun org-indent-initialize-buffer (buffer delay) + "Set virtual indentation for the buffer BUFFER, asynchronously. +Give hand to other idle processes if it takes longer than DELAY, +a time value." + (with-current-buffer buffer + (when org-indent-mode + (org-with-wide-buffer + (let ((interruptp + ;; Always nil unless interrupted. + (catch 'interrupt + (and org-indent-initial-marker + (marker-position org-indent-initial-marker) + (org-indent-add-properties org-indent-initial-marker + (point-max) + delay) + nil)))) + (move-marker org-indent-initial-marker interruptp) + ;; Job is complete: un-agentize buffer. + (unless interruptp + (setq org-indent-agentized-buffers + (delq buffer org-indent-agentized-buffers)))))))) + +(defsubst org-indent-set-line-properties (l w h) + "Set prefix properties on current line an move to next one. + +Prefix properties `line-prefix' and `wrap-prefix' in current line +are set to, respectively, length L and W. + +If H is non-nil, `line-prefix' will be starred. If H is +`inline', the first star will have `org-warning' face. + +Assume point is at beginning of line." + (let ((line (cond + ((eq 'inline h) + (let ((stars (aref org-indent-stars + (min l org-indent-max-levels)))) + (and stars + (concat org-indent-inlinetask-first-star + (substring stars 1))))) + (h (aref org-indent-stars + (min l org-indent-max-levels))) + (t (aref org-indent-strings + (min l org-indent-max))))) + (wrap (aref org-indent-strings (min w org-indent-max)))) + ;; Add properties down to the next line to indent empty lines. + (add-text-properties (point) (min (1+ (point-at-eol)) (point-max)) + `(line-prefix ,line wrap-prefix ,wrap))) + (forward-line 1)) -(defun org-indent-add-properties (beg end) +(defun org-indent-add-properties (beg end &optional delay) "Add indentation properties between BEG and END. -Assumes that BEG is at the beginning of a line." - (let* ((inhibit-modification-hooks t) - (inlinetaskp (featurep 'org-inlinetask)) - (get-real-level (lambda (pos lvl) - (save-excursion - (goto-char pos) - (if (and inlinetaskp (org-inlinetask-in-task-p)) - (org-inlinetask-get-task-level) - lvl)))) - (b beg) - (e end) - (level 0) - (n 0) - exit nstars) - (with-silent-modifications - (save-excursion - (goto-char beg) - (while (not exit) - (setq e end) - (if (not (re-search-forward org-indent-outline-re nil t)) - (setq e (point-max) exit t) - (setq e (match-beginning 0)) - (if (>= e end) (setq exit t)) - (unless (and inlinetaskp (org-inlinetask-in-task-p)) - (setq level (- (match-end 0) (match-beginning 0) 1))) - (setq nstars (* (1- (funcall get-real-level e level)) - (1- org-indent-indentation-per-level))) - (add-text-properties - (point-at-bol) (point-at-eol) - (list 'line-prefix - (aref org-indent-stars nstars) - 'wrap-prefix - (aref org-indent-strings - (* (funcall get-real-level e level) - org-indent-indentation-per-level))))) - (when (> e b) - (add-text-properties - b e (list 'line-prefix (aref org-indent-strings n) - 'wrap-prefix (aref org-indent-strings n)))) - (setq b (1+ (point-at-eol)) - n (* (funcall get-real-level b level) - org-indent-indentation-per-level))))))) - -(defvar org-inlinetask-min-level) -(defun org-indent-refresh-section () - "Refresh indentation properties in the current outline section. -Point is assumed to be at the beginning of a headline." - (interactive) - (when org-indent-mode - (let (beg end) - (save-excursion - (when (ignore-errors (let ((org-outline-regexp (format "\\*\\{1,%s\\}[ \t]+" - (if (featurep 'org-inlinetask) - (1- org-inlinetask-min-level) - "")))) - (org-back-to-heading))) - (setq beg (point)) - (setq end (or (save-excursion (or (outline-next-heading) (point))))) - (org-indent-remove-properties beg end) - (org-indent-add-properties beg end)))))) - -(defun org-indent-refresh-to (limit) - "Refresh indentation properties in the current outline section. -Point is assumed to be at the beginning of a headline." - (interactive) - (when org-indent-mode - (let ((beg (point)) (end limit)) - (save-excursion - (and (ignore-errors (let ((org-outline-regexp (format "\\*\\{1,%s\\}[ \t]+" - (if (featurep 'org-inlinetask) - (1- org-inlinetask-min-level) - "")))) - (org-back-to-heading))) - (setq beg (point)))) - (org-indent-remove-properties beg end) - (org-indent-add-properties beg end))) - (goto-char limit)) - -(defun org-indent-refresh-subtree () - "Refresh indentation properties in the current outline subtree. -Point is assumed to be at the beginning of a headline." - (interactive) + +When DELAY is non-nil, it must be a time value. In that case, +the process is asynchronous and can be interrupted, either by +user request, or after DELAY. This is done by throwing the +`interrupt' tag along with the buffer position where the process +stopped." + (save-match-data + (org-with-wide-buffer + (goto-char beg) + (beginning-of-line) + ;; 1. Initialize prefix at BEG. This is done by storing two + ;; variables: INLINE-PF and PF, representing respectively + ;; length of current `line-prefix' when line is inside an + ;; inline task or not. + (let* ((case-fold-search t) + (limited-re (org-get-limited-outline-regexp)) + (added-ind-per-lvl (1- org-indent-indentation-per-level)) + (pf (save-excursion + (and (ignore-errors (let ((outline-regexp limited-re)) + (org-back-to-heading t))) + (+ (* org-indent-indentation-per-level + (- (match-end 0) (match-beginning 0) 2)) 2)))) + (pf-inline (and (featurep 'org-inlinetask) + (org-inlinetask-in-task-p) + (+ (* org-indent-indentation-per-level + (1- (org-inlinetask-get-task-level))) 2))) + (time-limit (and delay (time-add (current-time) delay)))) + ;; 2. For each line, set `line-prefix' and `wrap-prefix' + ;; properties depending on the type of line (headline, + ;; inline task, item or other). + (with-silent-modifications + (while (and (<= (point) end) (not (eobp))) + (cond + ;; When in asynchronous mode, check if interrupt is + ;; required. + ((and delay (input-pending-p)) (throw 'interrupt (point))) + ;; In asynchronous mode, take a break of + ;; `org-indent-agent-resume-delay' every DELAY to avoid + ;; blocking any other idle timer or process output. + ((and delay (time-less-p time-limit (current-time))) + (setq org-indent-agent-resume-timer + (run-with-idle-timer + (time-add (current-idle-time) + org-indent-agent-resume-delay) + nil #'org-indent-initialize-agent)) + (throw 'interrupt (point))) + ;; Headline or inline task. + ((looking-at org-outline-regexp) + (let* ((nstars (- (match-end 0) (match-beginning 0) 1)) + (line (* added-ind-per-lvl (1- nstars))) + (wrap (+ line (1+ nstars)))) + (cond + ;; Headline: new value for PF. + ((looking-at limited-re) + (org-indent-set-line-properties line wrap t) + (setq pf wrap)) + ;; End of inline task: PF-INLINE is now nil. + ((looking-at "\\*+ end[ \t]*$") + (org-indent-set-line-properties line wrap 'inline) + (setq pf-inline nil)) + ;; Start of inline task. Determine if it contains + ;; text, or if it is only one line long. Set + ;; PF-INLINE accordingly. + (t (org-indent-set-line-properties line wrap 'inline) + (setq pf-inline (and (org-inlinetask-in-task-p) wrap)))))) + ;; List item: `wrap-prefix' is set where body starts. + ((org-at-item-p) + (let* ((line (or pf-inline pf 0)) + (wrap (+ (org-list-item-body-column (point)) line))) + (org-indent-set-line-properties line wrap nil))) + ;; Normal line: use PF-INLINE, PF or nil as prefixes. + (t (let* ((line (or pf-inline pf 0)) + (wrap (+ line (org-get-indentation)))) + (org-indent-set-line-properties line wrap nil)))))))))) + +(defun org-indent-notify-modified-headline (beg end) + "Set `org-indent-modified-headline-flag' depending on context. + +BEG and END are the positions of the beginning and end of the +range of deleted text. + +This function is meant to be called by `before-change-functions'. +Flag will be non-nil if command is going to modify or delete an +headline." (when org-indent-mode - (save-excursion - (let (beg end) - (setq beg (point)) - (setq end (save-excursion (org-end-of-subtree t t))) - (org-indent-remove-properties beg end) - (org-indent-add-properties beg end))))) + (setq org-indent-modified-headline-flag + (save-excursion + (goto-char beg) + (save-match-data + (or (and (org-at-heading-p) (< beg (match-end 0))) + (re-search-forward org-outline-regexp-bol end t))))))) + +(defun org-indent-refresh-maybe (beg end dummy) + "Refresh indentation properties in an adequate portion of buffer. +BEG and END are the positions of the beginning and end of the +range of inserted text. DUMMY is an unused argument. -(defun org-indent-refresh-buffer () - "Refresh indentation properties in the current outline subtree. -Point is assumed to be at the beginning of a headline." - (interactive) +This function is meant to be called by `after-change-functions'." (when org-indent-mode - (org-indent-mode -1) - (org-indent-mode 1))) + (save-match-data + ;; If an headline was modified or inserted, set properties until + ;; next headline. + (if (or org-indent-modified-headline-flag + (save-excursion + (goto-char beg) + (re-search-forward org-outline-regexp-bol end t))) + (let ((end (save-excursion + (goto-char end) + (org-with-limited-levels (outline-next-heading)) + (point)))) + (setq org-indent-modified-headline-flag nil) + (org-indent-add-properties beg end)) + ;; Otherwise, only set properties on modified area. + (org-indent-add-properties beg end))))) (provide 'org-indent) -;; arch-tag: b76736bc-9f4a-43cd-977c-ecfd6689846a ;;; org-indent.el ends here diff -Nru org-mode-7.7/lisp/org-info.el org-mode-7.8.02/lisp/org-info.el --- org-mode-7.7/lisp/org-info.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/org-info.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,12 +1,10 @@ ;;; org-info.el --- Support for links to Info nodes from within Org-Mode -;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 -;; Free Software Foundation, Inc. +;; Copyright (C) 2004-2011 Free Software Foundation, Inc. ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; ;; This file is part of GNU Emacs. ;; @@ -78,6 +76,4 @@ (provide 'org-info) -;; arch-tag: 1e289f54-7176-487f-b575-dd4854bab15e - ;;; org-info.el ends here diff -Nru org-mode-7.7/lisp/org-inlinetask.el org-mode-7.8.02/lisp/org-inlinetask.el --- org-mode-7.7/lisp/org-inlinetask.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/org-inlinetask.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,11 +1,10 @@ ;;; org-inlinetask.el --- Tasks independent of outline hierarchy -;; Copyright (C) 2009, 2010 Free Software Foundation, Inc. +;; Copyright (C) 2009-2011 Free Software Foundation, Inc. ;; ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; This file is part of GNU Emacs. @@ -107,11 +106,14 @@ :type 'boolean) (defvar org-inlinetask-export-templates - '((html "
    %s%s
    %s
    " + '((html "
    %s%s
    %s
    " '((unless (eq todo "") (format "%s%s " class todo todo priority)) heading content)) + (odt "%s" '((org-odt-format-inlinetask heading content + todo priority tags))) + (latex "\\begin\{description\}\n\\item[%s%s]~%s\\end\{description\}" '((unless (eq todo "") (format "\\textsc\{%s%s\} " todo priority)) heading content)) @@ -132,9 +134,9 @@ heading content))) "Templates for inline tasks in various exporters. -This variable is an alist in the shape of (BACKEND STRING OBJECTS). +This variable is an alist in the shape of \(BACKEND STRING OBJECTS\). -BACKEND is the name of the backend for the template (ascii, html...). +BACKEND is the name of the backend for the template \(ascii, html...\). STRING is a format control string. @@ -151,14 +153,14 @@ As an example, valid associations are: -(html \"
    • %s

      %s

    \" (heading content)) +\(html \"
    • %s

      %s

    \" \(heading content\)\) or, with the additional package \"todonotes\" for LaTeX, -(latex \"\\todo[inline]{\\textbf{\\textsf{%s %s}}\\linebreak{} %s}\" - '((unless (eq todo \"\") - (format \"\\textsc{%s%s}\" todo priority)) - heading content)))") +\(latex \"\\todo[inline]{\\textbf{\\textsf{%s %s}}\\linebreak{} %s}\" + '\(\(unless \(eq todo \"\"\) + \(format \"\\textsc{%s%s}\" todo priority\)\) + heading content\)\)\)") (defvar org-odd-levels-only) (defvar org-keyword-time-regexp) @@ -179,15 +181,22 @@ "Insert an inline task. If prefix arg NO-STATE is set, ignore `org-inlinetask-default-state'." (interactive "P") + ;; Error when inside an inline task, except if point was at its very + ;; beginning, in which case the new inline task will be inserted + ;; before this one. + (when (and (org-inlinetask-in-task-p) + (not (and (org-inlinetask-at-task-p) (bolp)))) + (error "Cannot nest inline tasks")) (or (bolp) (newline)) - (let ((indent org-inlinetask-min-level)) - (if org-odd-levels-only - (setq indent (- (* 2 indent) 1))) - (insert (make-string indent ?*) - (if (or no-state (not org-inlinetask-default-state)) - " \n" - (concat " " org-inlinetask-default-state " \n")) - (make-string indent ?*) " END\n")) + (let* ((indent (if org-odd-levels-only + (1- (* 2 org-inlinetask-min-level)) + org-inlinetask-min-level)) + (indent-string (concat (make-string indent ?*) " "))) + (insert indent-string + (if (or no-state (not org-inlinetask-default-state)) + "\n" + (concat org-inlinetask-default-state " \n")) + indent-string "END\n")) (end-of-line -1)) (define-key org-mode-map "\C-c\C-xt" 'org-inlinetask-insert-task) @@ -228,21 +237,26 @@ (re-search-backward inlinetask-re nil t)))) (defun org-inlinetask-goto-end () - "Go to the end of the inline task at point." - (beginning-of-line) - (let ((case-fold-search t) - (inlinetask-re (org-inlinetask-outline-regexp))) - (cond - ((org-looking-at-p (concat inlinetask-re "END[ \t]*$")) - (forward-line 1)) - ((org-looking-at-p inlinetask-re) - (forward-line 1) - (when (org-inlinetask-in-task-p) - (re-search-forward inlinetask-re nil t) - (forward-line 1))) - (t - (re-search-forward inlinetask-re nil t) - (forward-line 1))))) + "Go to the end of the inline task at point. +Return point." + (save-match-data + (beginning-of-line) + (let* ((case-fold-search t) + (inlinetask-re (org-inlinetask-outline-regexp)) + (task-end-re (concat inlinetask-re "END[ \t]*$"))) + (cond + ((looking-at task-end-re) (forward-line)) + ((looking-at inlinetask-re) + (forward-line) + (cond + ((looking-at task-end-re) (forward-line)) + ((looking-at inlinetask-re)) + ((org-inlinetask-in-task-p) + (re-search-forward inlinetask-re nil t) + (forward-line)))) + (t (re-search-forward inlinetask-re nil t) + (forward-line))) + (point)))) (defun org-inlinetask-get-task-level () "Get the level of the inline task around. @@ -333,7 +347,9 @@ ;; Remove the task. (goto-char beg) (delete-region beg end) - (when org-inlinetask-export + (when (and org-inlinetask-export + (assq org-export-current-backend + org-inlinetask-export-templates)) ;; Format CONTENT, if appropriate. (setq content (if (not (and content (string-match "\\S-" content))) @@ -341,12 +357,14 @@ ;; Ensure CONTENT has minimal indentation, a single ;; newline character at its boundaries, and isn't ;; protected. - (when (string-match "`\\([ \t]*\n\\)+" content) + (when (string-match "\\`\\([ \t]*\n\\)+" content) (setq content (substring content (match-end 0)))) (when (string-match "[ \t\n]+\\'" content) (setq content (substring content 0 (match-beginning 0)))) - (org-add-props (concat "\n" (org-remove-indentation content) "\n") - '(org-protected nil)))) + (org-add-props + (concat "\n\n" (org-remove-indentation content) "\n\n") + '(org-protected nil org-native-text nil)))) + (when (string-match org-complex-heading-regexp headline) (let* ((nil-to-str (function @@ -363,7 +381,7 @@ (backend-spec (assq org-export-current-backend org-inlinetask-export-templates)) (format-str (org-add-props (nth 1 backend-spec) - '(org-protected t))) + '(org-protected t org-native-text t))) (tokens (cadr (nth 2 backend-spec))) ;; Build export string. Ensure it won't break ;; surrounding lists by giving it arbitrary high @@ -372,6 +390,11 @@ (eval (append '(format format-str) (mapcar nil-to-str tokens))) '(original-indentation 1000)))) + ;; Ensure task starts a new paragraph. + (unless (or (bobp) + (save-excursion (forward-line -1) + (looking-at "[ \t]*$"))) + (insert "\n")) (insert export-str) (unless (bolp) (insert "\n"))))))))) @@ -386,21 +409,34 @@ (goto-char (match-end 0)) (current-column))) +(defvar org-indent-indentation-per-level) ; defined in org-indent.el + +(defface org-inlinetask + (org-compatible-face 'shadow '((t (:bold t)))) + "Face for inlinetask headlines." + :group 'org-faces) + (defun org-inlinetask-fontify (limit) - "Fontify the inline tasks." + "Fontify the inline tasks down to LIMIT." (let* ((nstars (if org-odd-levels-only (1- (* 2 (or org-inlinetask-min-level 200))) (or org-inlinetask-min-level 200))) (re (concat "^\\(\\*\\)\\(\\*\\{" (format "%d" (- nstars 3)) - ",\\}\\)\\(\\*\\* .*\\)"))) + ",\\}\\)\\(\\*\\* .*\\)")) + ;; Virtual indentation will add the warning face on the first + ;; star. Thus, in that case, only hide it. + (start-face (if (and (org-bound-and-true-p org-indent-mode) + (> org-indent-indentation-per-level 1)) + 'org-hide + 'org-warning))) (while (re-search-forward re limit t) (add-text-properties (match-beginning 1) (match-end 1) - '(face org-warning font-lock-fontified t)) + `(face ,start-face font-lock-fontified t)) (add-text-properties (match-beginning 2) (match-end 2) '(face org-hide font-lock-fontified t)) (add-text-properties (match-beginning 3) (match-end 3) - '(face shadow font-lock-fontified t))))) + '(face org-inlinetask font-lock-fontified t))))) (defun org-inlinetask-toggle-visibility () "Toggle visibility of inline task at point." diff -Nru org-mode-7.7/lisp/org-irc.el org-mode-7.8.02/lisp/org-irc.el --- org-mode-7.7/lisp/org-irc.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/org-irc.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,10 +1,9 @@ ;;; org-irc.el --- Store links to IRC sessions ;; -;; Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. +;; Copyright (C) 2008-2011 Free Software Foundation, Inc. ;; ;; Author: Philip Jackson ;; Keywords: erc, irc, link, org -;; Version: 7.7 ;; ;; This file is part of GNU Emacs. ;; @@ -253,6 +252,4 @@ (provide 'org-irc) -;; arch-tag: 018d7dda-53b8-4a35-ba92-6670939e525a - ;;; org-irc.el ends here diff -Nru org-mode-7.7/lisp/org-jsinfo.el org-mode-7.8.02/lisp/org-jsinfo.el --- org-mode-7.7/lisp/org-jsinfo.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/org-jsinfo.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,12 +1,10 @@ ;;; org-jsinfo.el --- Support for org-info.js Javascript in Org HTML export -;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 -;; Free Software Foundation, Inc. +;; Copyright (C) 2004-2011 Free Software Foundation, Inc. ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; ;; This file is part of GNU Emacs. ;; @@ -205,6 +203,4 @@ (provide 'org-infojs) (provide 'org-jsinfo) -;; arch-tag: c71d1d85-3337-4817-a066-725e74ac9eac - ;;; org-jsinfo.el ends here diff -Nru org-mode-7.7/lisp/org-latex.el org-mode-7.8.02/lisp/org-latex.el --- org-mode-7.7/lisp/org-latex.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/org-latex.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,11 +1,10 @@ ;;; org-latex.el --- LaTeX exporter for org-mode ;; -;; Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +;; Copyright (C) 2007-2011 Free Software Foundation, Inc. ;; ;; Emacs Lisp Archive Entry ;; Filename: org-latex.el -;; Version: 7.7 -;; Author: Bastien Guerry +;; Author: Bastien Guerry ;; Maintainer: Carsten Dominik ;; Keywords: org, wp, tex ;; Description: Converts an org-mode buffer into LaTeX @@ -74,7 +73,6 @@ org-deadline-string "\\|" org-closed-string"\\)") "Regexp matching special time planning keywords plus the time after it.") - (defvar org-re-quote) ; dynamically scoped from org.el (defvar org-commentsp) ; dynamically scoped from org.el @@ -359,6 +357,12 @@ :group 'org-export-latex :type 'boolean) +(defcustom org-export-latex-table-caption-above t + "When non-nil, the caption is set above the table. When nil, +the caption is set below the table." + :group 'org-export-latex + :type 'boolean) + (defcustom org-export-latex-tables-column-borders nil "When non-nil, grouping columns can cause outer vertical lines in tables. When nil, grouping causes only separation lines between groups." @@ -402,7 +406,7 @@ :type 'plist) (defcustom org-export-latex-verbatim-wrap - '("\\begin{verbatim}\n" . "\\end{verbatim}\n") + '("\\begin{verbatim}\n" . "\\end{verbatim}") "Environment to be wrapped around a fixed-width section in LaTeX export. This is a cons with two strings, to be added before and after the fixed-with text. @@ -719,7 +723,7 @@ (interactive "r") (let (reg latex buf) (save-window-excursion - (if (org-mode-p) + (if (eq major-mode 'org-mode) (setq latex (org-export-region-as-latex beg end t 'string)) (setq reg (buffer-substring beg end) @@ -865,6 +869,8 @@ (file-truename (or buffer-file-name "dummy.org"))) (concat filename ".tex") filename))) + (auto-insert nil); Avoid any auto-insert stuff for the new file + (TeX-master t) ; Avoid the Query for TeX master from AUCTeX (buffer (if to-buffer (cond ((eq to-buffer 'string) (get-buffer-create @@ -1340,7 +1346,7 @@ (save-restriction (widen) (goto-char (point-min)) - (and (re-search-forward "^#\\+LaTeX_CLASS:[ \t]*\\(-[a-zA-Z]+\\)" nil t) + (and (re-search-forward "^#\\+LaTeX_CLASS:[ \t]*\\([-/a-zA-Z]+\\)" nil t) (match-string 1)))) (plist-get org-export-latex-options-plist :latex-class) org-export-latex-default-class) @@ -1395,7 +1401,11 @@ (email (replace-regexp-in-string "_" "\\\\_" (org-export-apply-macros-in-string - (plist-get opt-plist :email))))) + (plist-get opt-plist :email)))) + (description (org-export-apply-macros-in-string + (plist-get opt-plist :description))) + (keywords (org-export-apply-macros-in-string + (plist-get opt-plist :keywords)))) (concat (if (plist-get opt-plist :time-stamp-file) (format-time-string "%% Created %Y-%m-%d %a %H:%M\n")) @@ -1429,6 +1439,12 @@ (format-time-string (or (plist-get opt-plist :date) org-export-latex-date-format))) + ;; add some hyperref options + ;; FIXME: let's have a defcustom for this? + (format "\\hypersetup{\n pdfkeywords={%s},\n pdfsubject={%s},\n pdfcreator={%s}}\n" + (org-export-latex-fontify-headline keywords) + (org-export-latex-fontify-headline description) + (concat "Emacs Org-mode version " org-version)) ;; beginning of the document "\n\\begin{document}\n\n" ;; insert the title command @@ -1837,7 +1853,7 @@ (replace-match (concat (match-string 1) (match-string 2)) t t) (forward-line)) - (insert "\\end{verbatim}\n\n")) + (insert "\\end{verbatim}\n")) (progn (goto-char (match-beginning 0)) (while (looking-at "^\\([ \t]*\\):\\(\\([ \t]\\|$\\).*\\)$") (replace-match (concat "%" (match-string 1) @@ -1966,13 +1982,13 @@ (concat "\\begin{longtable}{" align "}\n") (if floatp (format "\\begin{%s}%s\n" tblenv placement))) - (if floatp + (if (and floatp org-export-latex-table-caption-above) (format "\\caption%s{%s} %s" (if shortn (concat "[" shortn "]") "") (or caption "") (if label (format "\\label{%s}" label) ""))) - (if (and longtblp caption) "\\\\\n" "\n") + (if (and longtblp caption) "\\\\\n" "\n") (if (and org-export-latex-tables-centered (not longtblp)) "\\begin{center}\n") (if (not longtblp) @@ -1994,6 +2010,12 @@ (if (not longtblp) (format "\n\\end{%s}" tabular-env)) (if longtblp "\n" (if org-export-latex-tables-centered "\n\\end{center}\n" "\n")) + (if (and floatp (not org-export-latex-table-caption-above)) + (format + "\\caption%s{%s} %s" + (if shortn (concat "[" shortn "]") "") + (or caption "") + (if label (format "\\label{%s}" label) ""))) (if longtblp "\\end{longtable}" (if floatp (format "\\end{%s}" tblenv))))) @@ -2043,11 +2065,12 @@ (setq tbl (concat "\\begin{center}\n" tbl "\\end{center}"))) (when floatp (setq tbl (concat "\\begin{table}\n" + (if (not org-export-latex-table-caption-above) tbl) (format "\\caption%s{%s%s}\n" (if shortn (format "[%s]" shortn) "") (if label (format "\\label{%s}" label) "") (or caption "")) - tbl + (if org-export-latex-table-caption-above tbl) "\n\\end{table}\n"))) (insert (org-export-latex-protect-string tbl)))) @@ -2769,6 +2792,4 @@ (provide 'org-export-latex) (provide 'org-latex) -;; arch-tag: 23c2b87d-da04-4c2d-ad2d-1eb6487bc3ad - ;;; org-latex.el ends here diff -Nru org-mode-7.7/lisp/org-list.el org-mode-7.8.02/lisp/org-list.el --- org-mode-7.7/lisp/org-list.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/org-list.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,13 +1,11 @@ ;;; org-list.el --- Plain lists for Org-mode ;; -;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 -;; Free Software Foundation, Inc. +;; Copyright (C) 2004-2011 Free Software Foundation, Inc. ;; ;; Author: Carsten Dominik -;; Bastien Guerry +;; Bastien Guerry ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; ;; This file is part of GNU Emacs. ;; @@ -29,30 +27,31 @@ ;; This file contains the code dealing with plain lists in Org-mode. -;; The fundamental idea behind lists work is to use structures. -;; A structure is a snapshot of the list, in the shape of data tree -;; (see `org-list-struct'). +;; The core concept behind lists is their structure. A structure is +;; a snapshot of the list, in the shape of a data tree (see +;; `org-list-struct'). ;; Once the list structure is stored, it is possible to make changes -;; directly on it or get useful information about the list, with the -;; two helper functions, namely `org-list-parents-alist' and -;; `org-list-prevs-alist', and using accessors or methods. +;; on it that will be mirrored to the real list or to get information +;; about the list, using accessors and methods provided in the +;; library. Most of them require the use of one or two helper +;; functions, namely `org-list-parents-alist' and +;; `org-list-prevs-alist'. ;; Structure is eventually applied to the buffer with ;; `org-list-write-struct'. This function repairs (bullets, -;; indentation, checkboxes) the structure before applying it. It -;; should be called near the end of any function working on -;; structures. +;; indentation, checkboxes) the list in the process. It should be +;; called near the end of any function working on structures. ;; Thus, a function applying to lists should usually follow this ;; template: ;; 1. Verify point is in a list and grab item beginning (with the same ;; function `org-in-item-p'). If the function requires the cursor -;; to be at item's bullet, `org-at-item-p' is more selective. If -;; the cursor is amidst the buffer, it is possible to find the -;; closest item with `org-list-search-backward', or -;; `org-list-search-forward', applied to `org-item-beginning-re'. +;; to be at item's bullet, `org-at-item-p' is more selective. It +;; is also possible to move point to the closest item with +;; `org-list-search-backward', or `org-list-search-forward', +;; applied to the function `org-item-beginning-re'. ;; 2. Get list structure with `org-list-struct'. @@ -63,20 +62,21 @@ ;; 4. Proceed with the modifications, using methods and accessors. ;; 5. Verify and apply structure to buffer, using -;; `org-list-write-struct'. Possibly use -;; `org-update-checkbox-count-maybe' if checkboxes might have been -;; modified. - -;; Computing a list structure can be a costly operation on huge lists -;; (a few thousand lines long). Thus, code should follow the rule : -;; "collect once, use many". As a corollary, it is usally a bad idea +;; `org-list-write-struct'. + +;; 6. If changes made to the list might have modified check-boxes, +;; call `org-update-checkbox-count-maybe'. + +;; Computing a structure can be a costly operation on huge lists (a +;; few thousand lines long). Thus, code should follow the rule: +;; "collect once, use many". As a corollary, it is usually a bad idea ;; to use directly an interactive function inside the code, as those, ;; being independant entities, read the whole list structure another ;; time. ;;; Code: -(eval-when-compile +(eval-when-compile (require 'cl)) (require 'org-macs) (require 'org-compat) @@ -96,7 +96,6 @@ (declare-function org-at-heading-p "org" (&optional ignored)) (declare-function org-before-first-heading-p "org" ()) -(declare-function org-back-over-empty-lines "org" ()) (declare-function org-back-to-heading "org" (&optional invisible-ok)) (declare-function org-combine-plists "org" (&rest plists)) (declare-function org-count "org" (cl-item cl-seq)) @@ -129,6 +128,8 @@ (declare-function outline-next-heading "outline" ()) (declare-function outline-previous-heading "outline" ()) + + ;;; Configuration variables (defgroup org-plain-lists nil @@ -272,7 +273,7 @@ \\[org-meta-return], \\[org-metaright], \\[org-metaleft], \\[org-shiftmetaright], \\[org-shiftmetaleft], \\[org-ctrl-c-minus], \\[org-toggle-checkbox] or - \\[org-insert-todo-heading]. You can disable individually these + \\[org-insert-todo-heading]. You can disable individually these rules by setting them to nil. Valid rules are: bullet when non-nil, cycling bullet do not allow lists at @@ -377,6 +378,7 @@ `org-list-forbidden-blocks'.") + ;;; Predicates and regexps (defconst org-list-end-re (if org-empty-line-terminates-plain-lists @@ -386,9 +388,9 @@ It depends on `org-empty-line-terminates-plain-lists'.") (defconst org-list-full-item-re - (concat "^[ \t]*\\(\\(?:[-+*]\\|\\(?:[0-9]+\\|[A-Za-z]\\)[.)]\\)[ \t]+\\)" + (concat "^[ \t]*\\(\\(?:[-+*]\\|\\(?:[0-9]+\\|[A-Za-z]\\)[.)]\\)\\(?:[ \t]+\\|$\\)\\)" "\\(?:\\[@\\(?:start:\\)?\\([0-9]+\\|[A-Za-z]\\)\\][ \t]*\\)?" - "\\(?:\\(\\[[ X-]\\]\\)[ \t]+\\)?" + "\\(?:\\(\\[[ X-]\\]\\)\\(?:[ \t]+\\|$\\)\\)?" "\\(?:\\(.*\\)[ \t]+::\\(?:[ \t]+\\|$\\)\\)?") "Matches a list item and puts everything into groups: group 1: bullet @@ -536,6 +538,7 @@ (match-string 2))) + ;;; Structures and helper functions (defun org-list-context () @@ -804,21 +807,9 @@ (forward-line 1)))))) (setq struct (append itm-lst (cdr (nreverse itm-lst-2))) end-lst (append end-lst (cdr (nreverse end-lst-2)))) - ;; 3. Correct ill-formed lists by ensuring top item is the least - ;; indented. - (let ((min-ind (nth 1 (car struct)))) - (mapc (lambda (item) - (let ((ind (nth 1 item)) - (bul (nth 2 item))) - (when (< ind min-ind) - (setcar (cdr item) min-ind) - ;; Trim bullet so item will be seen as different - ;; when compared with repaired version. - (setcar (nthcdr 2 item) (org-trim bul))))) - struct)) - ;; 4. Associate each item to its end pos. + ;; 3. Associate each item to its end position. (org-list-struct-assoc-end struct end-lst) - ;; 5. Return STRUCT + ;; 4. Return STRUCT struct))) (defun org-list-struct-assoc-end (struct end-list) @@ -855,8 +846,9 @@ (defun org-list-parents-alist (struct) "Return alist between item and parent in STRUCT." - (let ((ind-to-ori (list (list (nth 1 (car struct))))) - (prev-pos (list (caar struct)))) + (let* ((ind-to-ori (list (list (nth 1 (car struct))))) + (top-item (org-list-get-top-point struct)) + (prev-pos (list top-item))) (cons prev-pos (mapcar (lambda (item) (let ((pos (car item)) @@ -865,17 +857,34 @@ (push pos prev-pos) (cond ((> prev-ind ind) + ;; A sub-list is over. Find the associated + ;; origin in IND-TO-ORI. If it cannot be + ;; found (ill-formed list), set its parent as + ;; the first item less indented. If there is + ;; none, make it a top-level item. (setq ind-to-ori - (member (assq ind ind-to-ori) ind-to-ori)) + (or (member (assq ind ind-to-ori) ind-to-ori) + (catch 'exit + (mapc + (lambda (e) + (when (< (car e) ind) + (throw 'exit (member e ind-to-ori)))) + ind-to-ori) + (list (list ind))))) (cons pos (cdar ind-to-ori))) + ;; A sub-list starts. Every item at IND will + ;; have previous item as its parent. ((< prev-ind ind) (let ((origin (nth 1 prev-pos))) (push (cons ind origin) ind-to-ori) (cons pos origin))) + ;; Another item in the same sub-list: it shares + ;; the same parent as the previous item. (t (cons pos (cdar ind-to-ori)))))) (cdr struct))))) + ;;; Accessors (defsubst org-list-get-nth (n key struct) @@ -993,8 +1002,8 @@ (defun org-list-get-children (item struct parents) "List all children of ITEM, or nil. -STRUCT is the list structure. PARENTS is the alist of parents, as -returned by `org-list-parents-alist'." +STRUCT is the list structure. PARENTS is the alist of parents, +as returned by `org-list-parents-alist'." (let (all child) (while (setq child (car (rassq item parents))) (setq parents (cdr (member (assq child parents) parents))) @@ -1053,6 +1062,7 @@ (t 'unordered)))) + ;;; Searching (defun org-list-search-generic (search re bound noerr) @@ -1085,6 +1095,7 @@ regexp (or bound (point-max)) noerror)) + ;;; Methods on structures (defsubst org-list-bullet-string (bullet) @@ -1169,7 +1180,16 @@ (let ((item (point)) (insert-blank-p (cdr (assq 'plain-list-item org-blank-before-new-entry))) - usr-blank) + usr-blank + (count-blanks + (function + (lambda () + ;; Count blank lines above beginning of line. + (save-excursion + (count-lines (goto-char (point-at-bol)) + (progn (skip-chars-backward " \r\t\n") + (forward-line) + (point)))))))) (cond ;; Trivial cases where there should be none. ((or (and (not (eq org-list-ending-method 'indent)) @@ -1183,16 +1203,15 @@ (cond ;; Is there a next item? (next-p (goto-char next-p) - (org-back-over-empty-lines)) + (funcall count-blanks)) ;; Is there a previous item? ((org-list-get-prev-item item struct prevs) - (org-back-over-empty-lines)) + (funcall count-blanks)) ;; User inserted blank lines, trust him. ((and (> pos (org-list-get-item-end-before-blank item struct)) - (> (save-excursion - (goto-char pos) - (skip-chars-backward " \t") - (setq usr-blank (org-back-over-empty-lines))) 0)) + (> (save-excursion (goto-char pos) + (setq usr-blank (funcall count-blanks))) + 0)) usr-blank) ;; Are there blank lines inside the list so far? ((save-excursion @@ -1365,8 +1384,8 @@ to another item in the same list as ITEM, and will move the latter just before the former. -If DEST is `begin' \(resp. `end'\), ITEM will be moved at the -beginning \(resp. end\) of the list it belongs to. +If DEST is `begin' \(respectively `end'\), ITEM will be moved at +the beginning \(respectively end\) of the list it belongs to. If DEST is a string like \"N\", where N is an integer, ITEM will be moved at the Nth position in the list. @@ -1440,7 +1459,7 @@ ;; 1.1. Remove the item just created in structure. (setq struct (delete (assq new-item struct) struct)) ;; 1.2. Copy ITEM and any of its sub-items at NEW-ITEM. - (setq struct (sort* + (setq struct (sort (append struct (mapcar (lambda (e) @@ -1544,12 +1563,13 @@ (mapcar ind parents))) + ;;; Repairing structures (defun org-list-use-alpha-bul-p (first struct prevs) "Non-nil if list starting at FIRST can have alphabetical bullets. -STRUCT is list structure. PREVS is the alist of previous items, +STRUCT is list structure. PREVS is the alist of previous items, as returned by `org-list-prevs-alist'." (and org-alphabetical-lists (catch 'exit @@ -1747,15 +1767,41 @@ ;; Return blocking item. (nth index all-items))))))) +(defun org-list-struct-fix-item-end (struct) + "Verify and correct each item end position in STRUCT. + +This function modifies STRUCT." + (let (end-list acc-end) + (mapc (lambda (e) + (let* ((pos (car e)) + (ind-pos (org-list-get-ind pos struct)) + (end-pos (org-list-get-item-end pos struct))) + (unless (assq end-pos struct) + ;; To determine real ind of an ending position that is + ;; not at an item, we have to find the item it belongs + ;; to: it is the last item (ITEM-UP), whose ending is + ;; further than the position we're interested in. + (let ((item-up (assoc-default end-pos acc-end '>))) + (push (cons + ;; Else part is for the bottom point. + (if item-up (+ (org-list-get-ind item-up struct) 2) 0) + end-pos) + end-list))) + (push (cons ind-pos pos) end-list) + (push (cons end-pos pos) acc-end))) + struct) + (setq end-list (sort end-list (lambda (e1 e2) (< (cdr e1) (cdr e2))))) + (org-list-struct-assoc-end struct end-list))) + (defun org-list-struct-apply-struct (struct old-struct) - "Apply set-difference between STRUCT and OLD-STRUCT to the buffer. + "Apply set difference between STRUCT and OLD-STRUCT to the buffer. OLD-STRUCT is the structure before any modifications, and STRUCT the structure to be applied. The function will only modify parts of the list which have changed. Initial position of cursor is restored after the changes." - (let* ((origin (copy-marker (point))) + (let* ((origin (point-marker)) (inlinetask-re (and (featurep 'org-inlinetask) (org-inlinetask-outline-regexp))) (item-re (org-item-re)) @@ -1805,13 +1851,11 @@ ((and (match-string 3) new-box) (replace-match new-box nil nil nil 3)) ((match-string 3) - ;; (goto-char (or (match-end 2) (match-end 1))) - ;; (skip-chars-backward " \t") (looking-at ".*?\\([ \t]*\\[[ X-]\\]\\)") (replace-match "" nil nil nil 1)) (t (let ((counterp (match-end 2))) (goto-char (if counterp (1+ counterp) (match-end 1))) - (insert (concat new-box (unless counterp " ")))))) + (insert (concat new-box (unless counterp " ")))))) ;; c. Indent item to appropriate column. (unless (= new-ind old-ind) (delete-region (goto-char (point-at-bol)) @@ -1883,40 +1927,20 @@ ;; 1. Set a temporary, but coherent with PARENTS, indentation in ;; order to get items endings and bullets properly (org-list-struct-fix-ind struct parents 2) - ;; 2. Get pseudo-alist of ending positions and sort it by position. - ;; Then associate them to the structure. - (let (end-list acc-end) - (mapc (lambda (e) - (let* ((pos (car e)) - (ind-pos (org-list-get-ind pos struct)) - (end-pos (org-list-get-item-end pos struct))) - (unless (assq end-pos struct) - ;; To determine real ind of an ending position that is - ;; not at an item, we have to find the item it belongs - ;; to: it is the last item (ITEM-UP), whose ending is - ;; further than the position we're interested in. - (let ((item-up (assoc-default end-pos acc-end '>))) - (push (cons - ;; Else part is for the bottom point. - (if item-up (+ (org-list-get-ind item-up struct) 2) 0) - end-pos) - end-list))) - (push (cons ind-pos pos) end-list) - (push (cons end-pos pos) acc-end))) - struct) - (setq end-list (sort end-list (lambda (e1 e2) (< (cdr e1) (cdr e2))))) - (org-list-struct-assoc-end struct end-list)) - ;; 3. Get bullets right. - (let ((prevs (org-list-prevs-alist struct))) - (org-list-struct-fix-bul struct prevs) - ;; 4. Now get real indentation. - (org-list-struct-fix-ind struct parents) - ;; 5. Eventually fix checkboxes. - (org-list-struct-fix-box struct parents prevs)) - ;; 6. Apply structure modifications to buffer. - (org-list-struct-apply-struct struct old-struct))) + ;; 2. Fix each item end to get correct prevs alist. + (org-list-struct-fix-item-end struct) + ;; 3. Get bullets right. + (let ((prevs (org-list-prevs-alist struct))) + (org-list-struct-fix-bul struct prevs) + ;; 4. Now get real indentation. + (org-list-struct-fix-ind struct parents) + ;; 5. Eventually fix checkboxes. + (org-list-struct-fix-box struct parents prevs)) + ;; 6. Apply structure modifications to buffer. + (org-list-struct-apply-struct struct old-struct))) + ;;; Misc Tools (defun org-apply-on-list (function init-value &rest args) @@ -1948,7 +1972,7 @@ (defun org-list-set-item-visibility (item struct view) "Set visibility of ITEM in STRUCT to VIEW. -Possible values are: `folded', `children' or `subtree'. See +Possible values are: `folded', `children' or `subtree'. See `org-cycle' for more information." (cond ((eq view 'folded) @@ -1984,6 +2008,7 @@ tcol)) + ;;; Interactive functions (defalias 'org-list-get-item-begin 'org-in-item-p) @@ -2275,7 +2300,7 @@ ((org-at-item-p) (setq singlep t) (setq lim-up (point-at-bol) - lim-down (point-at-eol))) + lim-down (copy-marker (point-at-eol)))) (t (error "Not at an item or heading, and no active region")))) ;; Determine the checkbox going to be applied to all items ;; within bounds. @@ -2329,9 +2354,9 @@ "Checkboxes were removed due to unchecked box at line %d" (org-current-line block-item)))) (goto-char bottom) - (move-marker lim-down nil) (move-marker bottom nil) - (org-list-struct-apply-struct struct struct-copy))))) + (org-list-struct-apply-struct struct struct-copy))) + (move-marker lim-down nil))) (org-update-checkbox-count-maybe)) (defun org-reset-checkbox-state-subtree () @@ -2492,7 +2517,8 @@ 'org-checkbox-statistics-todo))) (defun org-update-checkbox-count-maybe (&optional all) - "Update checkbox statistics unless turned off by user." + "Update checkbox statistics unless turned off by user. +With an optional argument ALL, update them in the whole buffer." (when (cdr (assq 'checkbox org-list-automatic-rules)) (org-update-checkbox-count all)) (run-hooks 'org-checkbox-statistics-hook)) @@ -2712,7 +2738,7 @@ If the SORTING-TYPE is ?f or ?F, then GETKEY-FUNC specifies a function to be called with point at the beginning of the record. It must return either a string or a number that should -serve as the sorting key for that record. It will then use +serve as the sorting key for that record. It will then use COMPARE-FUNC to compare entries." (interactive "P") (let* ((case-func (if with-case 'identity 'downcase)) @@ -2787,6 +2813,7 @@ (message "Sorting items...done"))))) + ;;; Send and receive lists (defun org-list-parse-list (&optional delete) @@ -2976,6 +3003,10 @@ (insert txt "\n"))) (message "List converted and installed at receiver location")))) +(defsubst org-list-item-trim-br (item) + "Trim line breaks in a list ITEM." + (setq item (replace-regexp-in-string "\n +" " " item))) + (defun org-list-to-generic (list params) "Convert a LIST parsed through `org-list-parse-list' to other formats. Valid parameters PARAMS are: @@ -3007,6 +3038,8 @@ :cbon String to insert for a checked check-box :cbtrans String to insert for a check-box in transitional state +:nobr Non-nil means remove line breaks in lists items. + Alternatively, each parameter can also be a form returning a string. These sexp can use keywords `counter' and `depth', reprensenting respectively counter associated to the current @@ -3035,6 +3068,7 @@ (cbon (plist-get p :cbon)) (cboff (plist-get p :cboff)) (cbtrans (plist-get p :cbtrans)) + (nobr (plist-get p :nobr)) export-sublist ; for byte-compiler (export-item (function @@ -3066,6 +3100,8 @@ (setq first (replace-match cboff t t first))) ((string-match "\\[CBTRANS\\]" first) (setq first (replace-match cbtrans t t first)))) + ;; Replace line breaks if required + (when nobr (setq first (org-list-item-trim-br first))) ;; Insert descriptive term if TYPE is `descriptive'. (when (eq type 'descriptive) (let* ((complete (string-match "^\\(.*\\)[ \t]+::" first)) @@ -3201,5 +3237,4 @@ (provide 'org-list) -;; arch-tag: 73cf50c1-200f-4d1d-8a53-4e842a5b11c8 ;;; org-list.el ends here diff -Nru org-mode-7.7/lisp/org-lparse.el org-mode-7.8.02/lisp/org-lparse.el --- org-mode-7.7/lisp/org-lparse.el 1970-01-01 00:00:00.000000000 +0000 +++ org-mode-7.8.02/lisp/org-lparse.el 2011-12-13 00:34:24.000000000 +0000 @@ -0,0 +1,2339 @@ +;;; org-lparse.el --- Line-oriented parser-exporter for Org-mode + +;; Copyright (C) 2010-2011 Free Software Foundation, Inc. + +;; Author: Jambunathan K +;; Keywords: outlines, hypermedia, calendar, wp +;; Homepage: http://orgmode.org +;; +;; This file is not (yet) part of GNU Emacs. +;; However, it is distributed under the same license. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;;; Commentary: + +;; `org-lparse' is the entry point for the generic line-oriented +;; exporter. `org-do-lparse' is the genericized version of the +;; original `org-export-as-html' routine. + +;; `org-lparse-native-backends' is a good starting point for +;; exploring the generic exporter. + +;; Following new interactive commands are provided by this library. +;; `org-lparse', `org-lparse-and-open', `org-lparse-to-buffer' +;; `org-replace-region-by', `org-lparse-region'. + +;; Note that the above routines correspond to the following routines +;; in the html exporter `org-export-as-html', +;; `org-export-as-html-and-open', `org-export-as-html-to-buffer', +;; `org-replace-region-by-html' and `org-export-region-as-html'. + +;; The new interactive command `org-lparse-convert' can be used to +;; convert documents between various formats. Use this to command, +;; for example, to convert odt file to doc or pdf format. + +;; See README.org file that comes with this library for answers to +;; FAQs and more information on using this library. + +;;; Code: +(eval-when-compile + (require 'cl)) +(require 'org-exp) +(require 'org-list) +(require 'format-spec) + +;;;###autoload +(defun org-lparse-and-open (target-backend native-backend arg + &optional file-or-buf) + "Export outline to TARGET-BACKEND via NATIVE-BACKEND and open exported file. +If there is an active region, export only the region. The prefix +ARG specifies how many levels of the outline should become +headlines. The default is 3. Lower levels will become bulleted +lists." + (let (f (file-or-buf (or file-or-buf + (org-lparse target-backend native-backend + arg 'hidden)))) + (when file-or-buf + (setq f (cond + ((bufferp file-or-buf) buffer-file-name) + ((file-exists-p file-or-buf) file-or-buf) + (t (error "org-lparse-and-open: This shouldn't happen")))) + (message "Opening file %s" f) + (org-open-file f) + (when org-export-kill-product-buffer-when-displayed + (kill-buffer (current-buffer)))))) + +;;;###autoload +(defun org-lparse-batch (target-backend &optional native-backend) + "Call the function `org-lparse'. +This function can be used in batch processing as: +emacs --batch + --load=$HOME/lib/emacs/org.el + --eval \"(setq org-export-headline-levels 2)\" + --visit=MyFile --funcall org-lparse-batch" + (setq native-backend (or native-backend target-backend)) + (org-lparse target-backend native-backend + org-export-headline-levels 'hidden)) + +;;;###autoload +(defun org-lparse-to-buffer (backend arg) + "Call `org-lparse' with output to a temporary buffer. +No file is created. The prefix ARG is passed through to +`org-lparse'." + (let ((tempbuf (format "*Org %s Export*" (upcase backend)))) + (org-lparse backend backend arg nil nil tempbuf) + (when org-export-show-temporary-export-buffer + (switch-to-buffer-other-window tempbuf)))) + +;;;###autoload +(defun org-replace-region-by (backend beg end) + "Assume the current region has org-mode syntax, and convert it to HTML. +This can be used in any buffer. For example, you could write an +itemized list in org-mode syntax in an HTML buffer and then use +this command to convert it." + (let (reg backend-string buf pop-up-frames) + (save-window-excursion + (if (eq major-mode 'org-mode) + (setq backend-string (org-lparse-region backend beg end t 'string)) + (setq reg (buffer-substring beg end) + buf (get-buffer-create "*Org tmp*")) + (with-current-buffer buf + (erase-buffer) + (insert reg) + (org-mode) + (setq backend-string (org-lparse-region backend (point-min) + (point-max) t 'string))) + (kill-buffer buf))) + (delete-region beg end) + (insert backend-string))) + +;;;###autoload +(defun org-lparse-region (backend beg end &optional body-only buffer) + "Convert region from BEG to END in org-mode buffer to HTML. +If prefix arg BODY-ONLY is set, omit file header, footer, and table of +contents, and only produce the region of converted text, useful for +cut-and-paste operations. +If BUFFER is a buffer or a string, use/create that buffer as a target +of the converted HTML. If BUFFER is the symbol `string', return the +produced HTML as a string and leave not buffer behind. For example, +a Lisp program could call this function in the following way: + + (setq html (org-lparse-region \"html\" beg end t 'string)) + +When called interactively, the output buffer is selected, and shown +in a window. A non-interactive call will only return the buffer." + (let ((transient-mark-mode t) (zmacs-regions t) + ext-plist rtn) + (setq ext-plist (plist-put ext-plist :ignore-subtree-p t)) + (goto-char end) + (set-mark (point)) ;; to activate the region + (goto-char beg) + (setq rtn (org-lparse backend backend nil nil ext-plist buffer body-only)) + (if (fboundp 'deactivate-mark) (deactivate-mark)) + (if (and (org-called-interactively-p 'any) (bufferp rtn)) + (switch-to-buffer-other-window rtn) + rtn))) + +(defvar org-lparse-par-open nil) + +(defun org-lparse-should-inline-p (filename descp) + "Return non-nil if link FILENAME should be inlined. +The decision to inline the FILENAME link is based on the current +settings. DESCP is the boolean of whether there was a link +description. See variables `org-export-html-inline-images' and +`org-export-html-inline-image-extensions'." + (let ((inline-images (org-lparse-get 'INLINE-IMAGES)) + (inline-image-extensions + (org-lparse-get 'INLINE-IMAGE-EXTENSIONS))) + (and (or (eq t inline-images) (and inline-images (not descp))) + (org-file-image-p filename inline-image-extensions)))) + +(defun org-lparse-format-org-link (line opt-plist) + "Return LINE with markup of Org mode links. +OPT-PLIST is the export options list." + (let ((start 0) + (current-dir (if buffer-file-name + (file-name-directory buffer-file-name) + default-directory)) + (link-validate (plist-get opt-plist :link-validation-function)) + type id-file fnc + rpl path attr desc descp desc1 desc2 link + org-lparse-link-description-is-image) + (while (string-match org-bracket-link-analytic-regexp++ line start) + (setq org-lparse-link-description-is-image nil) + (setq start (match-beginning 0)) + (setq path (save-match-data (org-link-unescape + (match-string 3 line)))) + (setq type (cond + ((match-end 2) (match-string 2 line)) + ((save-match-data + (or (file-name-absolute-p path) + (string-match "^\\.\\.?/" path))) + "file") + (t "internal"))) + (setq path (org-extract-attributes path)) + (setq attr (get-text-property 0 'org-attributes path)) + (setq desc1 (if (match-end 5) (match-string 5 line)) + desc2 (if (match-end 2) (concat type ":" path) path) + descp (and desc1 (not (equal desc1 desc2))) + desc (or desc1 desc2)) + ;; Make an image out of the description if that is so wanted + (when (and descp (org-file-image-p + desc (org-lparse-get 'INLINE-IMAGE-EXTENSIONS))) + (setq org-lparse-link-description-is-image t) + (save-match-data + (if (string-match "^file:" desc) + (setq desc (substring desc (match-end 0))))) + (save-match-data + (setq desc (org-add-props + (org-lparse-format 'INLINE-IMAGE desc) + '(org-protected t))))) + (cond + ((equal type "internal") + (let + ((frag-0 + (if (= (string-to-char path) ?#) + (substring path 1) + path))) + (setq rpl + (org-lparse-format + 'ORG-LINK opt-plist "" "" (org-solidify-link-text + (save-match-data + (org-link-unescape frag-0)) + nil) desc attr descp)))) + ((and (equal type "id") + (setq id-file (org-id-find-id-file path))) + ;; This is an id: link to another file (if it was the same file, + ;; it would have become an internal link...) + (save-match-data + (setq id-file (file-relative-name + id-file + (file-name-directory org-current-export-file))) + (setq rpl + (org-lparse-format + 'ORG-LINK opt-plist type id-file + (concat (if (org-uuidgen-p path) "ID-") path) + desc attr descp)))) + ((member type '("http" "https")) + ;; standard URL, can inline as image + (setq rpl + (org-lparse-format + 'ORG-LINK opt-plist type path nil desc attr descp))) + ((member type '("ftp" "mailto" "news")) + ;; standard URL, can't inline as image + (setq rpl + (org-lparse-format + 'ORG-LINK opt-plist type path nil desc attr descp))) + + ((string= type "coderef") + (setq rpl (org-lparse-format + 'ORG-LINK opt-plist type "" path desc nil descp))) + + ((functionp (setq fnc (nth 2 (assoc type org-link-protocols)))) + ;; The link protocol has a function for format the link + (setq rpl (save-match-data + (funcall fnc (org-link-unescape path) + desc1 (and (boundp 'org-lparse-backend) + (case org-lparse-backend + (xhtml 'html) + (t org-lparse-backend))))))) + ((string= type "file") + ;; FILE link + (save-match-data + (let* + ((components + (if + (string-match "::\\(.*\\)" path) + (list + (replace-match "" t nil path) + (match-string 1 path)) + (list path nil))) + + ;;The proper path, without a fragment + (path-1 + (first components)) + + ;;The raw fragment + (fragment-0 + (second components)) + + ;;Check the fragment. If it can't be used as + ;;target fragment we'll pass nil instead. + (fragment-1 + (if + (and fragment-0 + (not (string-match "^[0-9]*$" fragment-0)) + (not (string-match "^\\*" fragment-0)) + (not (string-match "^/.*/$" fragment-0))) + (org-solidify-link-text + (org-link-unescape fragment-0)) + nil)) + (desc-2 + ;;Description minus "file:" and ".org" + (if (string-match "^file:" desc) + (let + ((desc-1 (replace-match "" t t desc))) + (if (string-match "\\.org$" desc-1) + (replace-match "" t t desc-1) + desc-1)) + desc))) + + (setq rpl + (if + (and + (functionp link-validate) + (not (funcall link-validate path-1 current-dir))) + desc + (org-lparse-format + 'ORG-LINK opt-plist "file" path-1 fragment-1 + desc-2 attr descp)))))) + + (t + ;; just publish the path, as default + (setq rpl (concat "<" type ":" + (save-match-data (org-link-unescape path)) + ">")))) + (setq line (replace-match rpl t t line) + start (+ start (length rpl)))) + line)) + +(defvar org-lparse-par-open-stashed) ; bound during `org-do-lparse' +(defun org-lparse-stash-save-paragraph-state () + (assert (zerop org-lparse-par-open-stashed)) + (setq org-lparse-par-open-stashed org-lparse-par-open) + (setq org-lparse-par-open nil)) + +(defun org-lparse-stash-pop-paragraph-state () + (setq org-lparse-par-open org-lparse-par-open-stashed) + (setq org-lparse-par-open-stashed 0)) + +(defmacro with-org-lparse-preserve-paragraph-state (&rest body) + `(let ((org-lparse-do-open-par org-lparse-par-open)) + (org-lparse-end-paragraph) + ,@body + (when org-lparse-do-open-par + (org-lparse-begin-paragraph)))) +(def-edebug-spec with-org-lparse-preserve-paragraph-state (body)) + +(defvar org-lparse-native-backends nil + "List of native backends registered with `org-lparse'. +A backend can use `org-lparse-register-backend' to add itself to +this list. + +All native backends must implement a get routine and a mandatory +set of callback routines. + +The get routine must be named as org--get where backend +is the name of the backend. The exporter uses `org-lparse-get' +and retrieves the backend-specific callback by querying for +ENTITY-CONTROL and ENTITY-FORMAT variables. + +For the sake of illustration, the html backend implements +`org-xhtml-get'. It returns +`org-xhtml-entity-control-callbacks-alist' and +`org-xhtml-entity-format-callbacks-alist' as the values of +ENTITY-CONTROL and ENTITY-FORMAT settings.") + +(defun org-lparse-register-backend (backend) + "Make BACKEND known to `org-lparse' library. +Add BACKEND to `org-lparse-native-backends'." + (when backend + (setq backend (cond + ((symbolp backend) (symbol-name backend)) + ((stringp backend) backend) + (t (error "Error while registering backend: %S" backend)))) + (add-to-list 'org-lparse-native-backends backend))) + +(defun org-lparse-unregister-backend (backend) + (setq org-lparse-native-backends + (remove (cond + ((symbolp backend) (symbol-name backend)) + ((stringp backend) backend)) + org-lparse-native-backends)) + (message "Unregistered backend %S" backend)) + +(defun org-lparse-do-reachable-formats (in-fmt) + "Return verbose info about formats to which IN-FMT can be converted. +Return a list where each element is of the +form (CONVERTER-PROCESS . OUTPUT-FMT-ALIST). See +`org-export-odt-convert-processes' for CONVERTER-PROCESS and see +`org-export-odt-convert-capabilities' for OUTPUT-FMT-ALIST." + (let (reachable-formats) + (dolist (backend org-lparse-native-backends reachable-formats) + (let* ((converter (org-lparse-backend-get + backend 'CONVERT-METHOD)) + (capabilities (org-lparse-backend-get + backend 'CONVERT-CAPABILITIES))) + (when converter + (dolist (c capabilities) + (when (member in-fmt (nth 1 c)) + (push (cons converter (nth 2 c)) reachable-formats)))))))) + +(defun org-lparse-reachable-formats (in-fmt) + "Return list of formats to which IN-FMT can be converted. +The list of the form (OUTPUT-FMT-1 OUTPUT-FMT-2 ...)." + (let (l) + (mapc (lambda (e) (add-to-list 'l e)) + (apply 'append (mapcar + (lambda (e) (mapcar 'car (cdr e))) + (org-lparse-do-reachable-formats in-fmt)))) + l)) + +(defun org-lparse-reachable-p (in-fmt out-fmt) + "Return non-nil if IN-FMT can be converted to OUT-FMT." + (catch 'done + (let ((reachable-formats (org-lparse-do-reachable-formats in-fmt))) + (dolist (e reachable-formats) + (let ((out-fmt-spec (assoc out-fmt (cdr e)))) + (when out-fmt-spec + (throw 'done (cons (car e) out-fmt-spec)))))))) + +(defun org-lparse-backend-is-native-p (backend) + (member backend org-lparse-native-backends)) + +(defun org-lparse (target-backend native-backend arg + &optional hidden ext-plist + to-buffer body-only pub-dir) + "Export the outline to various formats. +If there is an active region, export only the region. The +outline is first exported to NATIVE-BACKEND and optionally +converted to TARGET-BACKEND. See `org-lparse-native-backends' +for list of known native backends. Each native backend can +specify a converter and list of target backends it exports to +using the CONVERT-PROCESS and OTHER-BACKENDS settings of it's get +method. See `org-xhtml-get' for an illustrative example. + +ARG is a prefix argument that specifies how many levels of +outline should become headlines. The default is 3. Lower levels +will become bulleted lists. + +HIDDEN is obsolete and does nothing. + +EXT-PLIST is a property list that controls various aspects of +export. The settings here override org-mode's default settings +and but are inferior to file-local settings. + +TO-BUFFER dumps the exported lines to a buffer or a string +instead of a file. If TO-BUFFER is the symbol `string' return the +exported lines as a string. If TO-BUFFER is non-nil, create a +buffer with that name and export to that buffer. + +BODY-ONLY controls the presence of header and footer lines in +exported text. If BODY-ONLY is non-nil, don't produce the file +header and footer, simply return the content of ..., +without even the body tags themselves. + +PUB-DIR specifies the publishing directory." + (let* ((org-lparse-backend (intern native-backend)) + (org-lparse-other-backend (and target-backend + (intern target-backend)))) + (unless (org-lparse-backend-is-native-p native-backend) + (error "Don't know how to export natively to backend %s" native-backend)) + + (unless (or (equal native-backend target-backend) + (org-lparse-reachable-p native-backend target-backend)) + (error "Don't know how to export to backend %s %s" target-backend + (format "via %s" native-backend))) + (run-hooks 'org-export-first-hook) + (org-do-lparse arg hidden ext-plist to-buffer body-only pub-dir))) + +(defcustom org-lparse-use-flashy-warning nil + "Control flashing of messages logged with `org-lparse-warn'. +When non-nil, messages are fontified with warning face and the +exporter lingers for a while to catch user's attention." + :type 'boolean + :group 'org-lparse) + +(defun org-lparse-convert-read-params () + "Return IN-FILE and OUT-FMT params for `org-lparse-do-convert'. +This is a helper routine for interactive use." + (let* ((input (if (featurep 'ido) 'ido-completing-read 'completing-read)) + (in-file (read-file-name "File to be converted: " + nil buffer-file-name t)) + (in-fmt (file-name-extension in-file)) + (out-fmt-choices (org-lparse-reachable-formats in-fmt)) + (out-fmt + (or (and out-fmt-choices + (funcall input "Output format: " + out-fmt-choices nil nil nil)) + (error + "No known converter or no known output formats for %s files" + in-fmt)))) + (list in-file out-fmt))) + +(eval-when-compile + (require 'browse-url)) + +(defun org-lparse-do-convert (in-file out-fmt &optional prefix-arg) + "Workhorse routine for `org-export-odt-convert'." + (require 'browse-url) + (let* ((in-file (expand-file-name (or in-file buffer-file-name))) + (dummy (or (file-readable-p in-file) + (error "Cannot read %s" in-file))) + (in-fmt (file-name-extension in-file)) + (out-fmt (or out-fmt (error "Output format unspecified"))) + (how (or (org-lparse-reachable-p in-fmt out-fmt) + (error "Cannot convert from %s format to %s format?" + in-fmt out-fmt))) + (convert-process (car how)) + (program (car convert-process)) + (dummy (and (or program (error "Converter not configured")) + (or (executable-find program) + (error "Cannot find converter %s" program)))) + (out-file (concat (file-name-sans-extension in-file) "." + (nth 1 (or (cdr how) out-fmt)))) + (out-dir (file-name-directory in-file)) + (arglist (mapcar (lambda (arg) + (format-spec + arg `((?i . ,in-file) + (?I . ,(browse-url-file-url in-file)) + (?f . ,out-fmt) + (?o . ,out-file) + (?O . ,(browse-url-file-url out-file)) + (?d . ,out-dir) + (?D . ,(browse-url-file-url out-dir))))) + (cdr convert-process)))) + (when (file-exists-p out-file) + (delete-file out-file)) + + (message "Executing %s %s" program (mapconcat 'identity arglist " ")) + (apply 'call-process program nil nil nil arglist) + (cond + ((file-exists-p out-file) + (message "Exported to %s using %s" out-file program) + (when prefix-arg + (message "Opening %s..." out-file) + (org-open-file out-file)) + out-file + ;; (set-buffer (find-file-noselect out-file)) + ) + (t + (message "Export to %s failed" out-file) + nil)))) + +(defvar org-lparse-insert-tag-with-newlines 'both) + +;; Following variables are let-bound during `org-lparse' +(defvar org-lparse-dyn-first-heading-pos) +(defvar org-lparse-toc) +(defvar org-lparse-entity-control-callbacks-alist) +(defvar org-lparse-entity-format-callbacks-alist) +(defvar org-lparse-backend nil + "The native backend to which the document is currently exported. +This variable is let bound during `org-lparse'. Valid values are +one of the symbols corresponding to `org-lparse-native-backends'. + +Compare this variable with `org-export-current-backend' which is +bound only during `org-export-preprocess-string' stage of the +export process. + +See also `org-lparse-other-backend'.") + +(defvar org-lparse-other-backend nil + "The target backend to which the document is currently exported. +This variable is let bound during `org-lparse'. This variable is +set to either `org-lparse-backend' or one of the symbols +corresponding to OTHER-BACKENDS specification of the +org-lparse-backend. + +For example, if a document is exported to \"odt\" then both +org-lparse-backend and org-lparse-other-backend are bound to +'odt. On the other hand, if a document is exported to \"odt\" +and then converted to \"doc\" then org-lparse-backend is set to +'odt and org-lparse-other-backend is set to 'doc.") + +(defvar org-lparse-body-only nil + "Bind this to BODY-ONLY arg of `org-lparse'.") + +(defvar org-lparse-to-buffer nil + "Bind this to TO-BUFFER arg of `org-lparse'.") + +(defun org-lparse-get-block-params (params) + (save-match-data + (when params + (setq params (org-trim params)) + (unless (string-match "\\`(.*)\\'" params) + (setq params (format "(%s)" params))) + (ignore-errors (read params))))) + +(defvar org-heading-keyword-regexp-format) ; defined in org.el +(defvar org-lparse-special-blocks '("list-table" "annotation")) +(defun org-do-lparse (arg &optional hidden ext-plist + to-buffer body-only pub-dir) + "Export the outline to various formats. +See `org-lparse' for more information. This function is a +html-agnostic version of the `org-export-as-html' function in 7.5 +version." + ;; Make sure we have a file name when we need it. + (when (and (not (or to-buffer body-only)) + (not buffer-file-name)) + (if (buffer-base-buffer) + (org-set-local 'buffer-file-name + (with-current-buffer (buffer-base-buffer) + buffer-file-name)) + (error "Need a file name to be able to export"))) + + (org-lparse-warn + (format "Exporting to %s using org-lparse..." + (upcase (symbol-name + (or org-lparse-backend org-lparse-other-backend))))) + + (setq-default org-todo-line-regexp org-todo-line-regexp) + (setq-default org-deadline-line-regexp org-deadline-line-regexp) + (setq-default org-done-keywords org-done-keywords) + (setq-default org-maybe-keyword-time-regexp org-maybe-keyword-time-regexp) + (let* (hfy-user-sheet-assoc ; let `htmlfontify' know that + ; we are interested in + ; collecting styles + org-lparse-encode-pending + org-lparse-par-open + (org-lparse-par-open-stashed 0) + + ;; list related vars + (org-lparse-list-level 0) ; list level starts at 1. A + ; value of 0 implies we are + ; outside of any list + (org-lparse-list-item-count 0) + org-lparse-list-stack + + ;; list-table related vars + org-lparse-list-table-p + org-lparse-list-table:table-cell-open + org-lparse-list-table:table-row + org-lparse-list-table:lines + + org-lparse-outline-text-open + (org-lparse-latex-fragment-fallback ; currently used only by + ; odt exporter + (or (ignore-errors (org-lparse-get 'LATEX-FRAGMENT-FALLBACK)) + (if (and (org-check-external-command "latex" "" t) + (org-check-external-command "dvipng" "" t)) + 'dvipng + 'verbatim))) + (org-lparse-insert-tag-with-newlines 'both) + (org-lparse-to-buffer to-buffer) + (org-lparse-body-only body-only) + (org-lparse-entity-control-callbacks-alist + (org-lparse-get 'ENTITY-CONTROL)) + (org-lparse-entity-format-callbacks-alist + (org-lparse-get 'ENTITY-FORMAT)) + (opt-plist + (org-export-process-option-filters + (org-combine-plists (org-default-export-plist) + ext-plist + (org-infile-export-plist)))) + (body-only (or body-only (plist-get opt-plist :body-only))) + valid org-lparse-dyn-first-heading-pos + (odd org-odd-levels-only) + (region-p (org-region-active-p)) + (rbeg (and region-p (region-beginning))) + (rend (and region-p (region-end))) + (subtree-p + (if (plist-get opt-plist :ignore-subtree-p) + nil + (when region-p + (save-excursion + (goto-char rbeg) + (and (org-at-heading-p) + (>= (org-end-of-subtree t t) rend)))))) + (level-offset (if subtree-p + (save-excursion + (goto-char rbeg) + (+ (funcall outline-level) + (if org-odd-levels-only 1 0))) + 0)) + (opt-plist (setq org-export-opt-plist + (if subtree-p + (org-export-add-subtree-options opt-plist rbeg) + opt-plist))) + ;; The following two are dynamically scoped into other + ;; routines below. + (org-current-export-dir + (or pub-dir (org-lparse-get 'EXPORT-DIR opt-plist))) + (org-current-export-file buffer-file-name) + (level 0) (line "") (origline "") txt todo + (umax nil) + (umax-toc nil) + (filename (if to-buffer nil + (expand-file-name + (concat + (file-name-sans-extension + (or (and subtree-p + (org-entry-get (region-beginning) + "EXPORT_FILE_NAME" t)) + (file-name-nondirectory buffer-file-name))) + "." (org-lparse-get 'FILE-NAME-EXTENSION opt-plist)) + (file-name-as-directory + (or pub-dir (org-lparse-get 'EXPORT-DIR opt-plist)))))) + (current-dir (if buffer-file-name + (file-name-directory buffer-file-name) + default-directory)) + (auto-insert nil) ; Avoid any auto-insert stuff for the new file + (buffer (if to-buffer + (cond + ((eq to-buffer 'string) + (get-buffer-create (org-lparse-get 'EXPORT-BUFFER-NAME))) + (t (get-buffer-create to-buffer))) + (find-file-noselect + (or (let ((f (org-lparse-get 'INIT-METHOD))) + (and f (functionp f) (funcall f filename))) + filename)))) + (org-levels-open (make-vector org-level-max nil)) + (dummy (mapc + (lambda(p) + (let* ((val (plist-get opt-plist p)) + (val (org-xml-encode-org-text-skip-links val))) + (setq opt-plist (plist-put opt-plist p val)))) + '(:date :author :keywords :description))) + (date (plist-get opt-plist :date)) + (date (cond + ((and date (string-match "%" date)) + (format-time-string date)) + (date date) + (t (format-time-string "%Y-%m-%d %T %Z")))) + (dummy (setq opt-plist (plist-put opt-plist :effective-date date))) + (title (org-xml-encode-org-text-skip-links + (or (and subtree-p (org-export-get-title-from-subtree)) + (plist-get opt-plist :title) + (and (not body-only) + (not + (plist-get opt-plist :skip-before-1st-heading)) + (org-export-grab-title-from-buffer)) + (and buffer-file-name + (file-name-sans-extension + (file-name-nondirectory buffer-file-name))) + "UNTITLED"))) + (dummy (setq opt-plist (plist-put opt-plist :title title))) + (html-table-tag (plist-get opt-plist :html-table-tag)) + (quote-re0 (concat "^ *" org-quote-string "\\( +\\|[ \t]*$\\)")) + (quote-re (format org-heading-keyword-regexp-format + org-quote-string)) + (org-lparse-dyn-current-environment nil) + ;; Get the language-dependent settings + (lang-words (or (assoc (plist-get opt-plist :language) + org-export-language-setup) + (assoc "en" org-export-language-setup))) + (dummy (setq opt-plist (plist-put opt-plist :lang-words lang-words))) + (head-count 0) cnt + (start 0) + (coding-system-for-write + (or (ignore-errors (org-lparse-get 'CODING-SYSTEM-FOR-WRITE)) + (and (boundp 'buffer-file-coding-system) + buffer-file-coding-system))) + (save-buffer-coding-system + (or (ignore-errors (org-lparse-get 'CODING-SYSTEM-FOR-SAVE)) + (and (boundp 'buffer-file-coding-system) + buffer-file-coding-system))) + (region + (buffer-substring + (if region-p (region-beginning) (point-min)) + (if region-p (region-end) (point-max)))) + (org-export-have-math nil) + (org-export-footnotes-seen nil) + (org-export-footnotes-data (org-footnote-all-labels 'with-defs)) + (org-footnote-insert-pos-for-preprocessor 'point-min) + (org-lparse-opt-plist opt-plist) + (lines + (org-split-string + (org-export-preprocess-string + region + :emph-multiline t + :for-backend (if (equal org-lparse-backend 'xhtml) ; hack + 'html + org-lparse-backend) + :skip-before-1st-heading + (plist-get opt-plist :skip-before-1st-heading) + :drawers (plist-get opt-plist :drawers) + :todo-keywords (plist-get opt-plist :todo-keywords) + :tasks (plist-get opt-plist :tasks) + :tags (plist-get opt-plist :tags) + :priority (plist-get opt-plist :priority) + :footnotes (plist-get opt-plist :footnotes) + :timestamps (plist-get opt-plist :timestamps) + :archived-trees + (plist-get opt-plist :archived-trees) + :select-tags (plist-get opt-plist :select-tags) + :exclude-tags (plist-get opt-plist :exclude-tags) + :add-text + (plist-get opt-plist :text) + :LaTeX-fragments + (plist-get opt-plist :LaTeX-fragments)) + "[\r\n]")) + table-open + table-buffer table-orig-buffer + ind + rpl path attr desc descp desc1 desc2 link + snumber fnc + footnotes footref-seen + org-lparse-output-buffer + org-lparse-footnote-definitions + org-lparse-footnote-number + ;; collection + org-lparse-collect-buffer + (org-lparse-collect-count 0) ; things will get haywire if + ; collections are chained. Use + ; this variable to assert this + ; pre-requisite + org-lparse-toc + href + ) + + (let ((inhibit-read-only t)) + (org-unmodified + (remove-text-properties (point-min) (point-max) + '(:org-license-to-kill t)))) + + (message "Exporting...") + (org-init-section-numbers) + + ;; Switch to the output buffer + (setq org-lparse-output-buffer buffer) + (set-buffer org-lparse-output-buffer) + (let ((inhibit-read-only t)) (erase-buffer)) + (fundamental-mode) + (org-install-letbind) + + (and (fboundp 'set-buffer-file-coding-system) + (set-buffer-file-coding-system coding-system-for-write)) + + (let ((case-fold-search nil) + (org-odd-levels-only odd)) + ;; create local variables for all options, to make sure all called + ;; functions get the correct information + (mapc (lambda (x) + (set (make-local-variable (nth 2 x)) + (plist-get opt-plist (car x)))) + org-export-plist-vars) + (setq umax (if arg (prefix-numeric-value arg) + org-export-headline-levels)) + (setq umax-toc (if (integerp org-export-with-toc) + (min org-export-with-toc umax) + umax)) + + (when (and org-export-with-toc (not body-only)) + (setq lines (org-lparse-prepare-toc + lines level-offset opt-plist umax-toc))) + + (unless body-only + (org-lparse-begin 'DOCUMENT-CONTENT opt-plist) + (org-lparse-begin 'DOCUMENT-BODY opt-plist)) + + (setq head-count 0) + (org-init-section-numbers) + + (org-lparse-begin-paragraph) + + (while (setq line (pop lines) origline line) + (catch 'nextline + (when (and (org-lparse-current-environment-p 'quote) + (string-match org-outline-regexp-bol line)) + (org-lparse-end-environment 'quote)) + + (when (org-lparse-current-environment-p 'quote) + (org-lparse-insert 'LINE line) + (throw 'nextline nil)) + + ;; Fixed-width, verbatim lines (examples) + (when (and org-export-with-fixed-width + (string-match "^[ \t]*:\\(\\([ \t]\\|$\\)\\(.*\\)\\)" line)) + (when (not (org-lparse-current-environment-p 'fixedwidth)) + (org-lparse-begin-environment 'fixedwidth)) + (org-lparse-insert 'LINE (match-string 3 line)) + (when (or (not lines) + (not (string-match "^[ \t]*:\\(\\([ \t]\\|$\\)\\(.*\\)\\)" + (car lines)))) + (org-lparse-end-environment 'fixedwidth)) + (throw 'nextline nil)) + + ;; Notes: The baseline version of org-html.el (git commit + ;; 3d802e), while encoutering a *line-long* protected text, + ;; does one of the following two things based on the state + ;; of the export buffer. + + ;; 1. If a paragraph element has just been opened and + ;; contains only whitespace as content, insert the + ;; protected text as part of the previous paragraph. + + ;; 2. If the paragraph element has already been opened and + ;; contains some valid content insert the protected text + ;; as part of the current paragraph. + + ;; I think ---> + + ;; Scenario 1 mentioned above kicks in when a block of + ;; protected text has to be inserted enbloc. For example, + ;; this happens, when inserting an source or example block + ;; or preformatted content enclosed in #+backend, + ;; #+begin_bakend ... #+end_backend) + + ;; Scenario 2 mentioned above kicks in when the protected + ;; text is part of a running sentence. For example this + ;; happens in the case of an *multiline* LaTeX equation that + ;; needs to be inserted verbatim. + + ;; org-html.el in the master branch seems to do some + ;; jugglery by moving paragraphs around. Inorder to make + ;; these changes backend-agnostic introduce a new text + ;; property org-native-text and impose the added semantics + ;; that these protected blocks appear outside of a + ;; conventional paragraph element. + ;; + ;; Extra Note: Check whether org-example and org-native-text + ;; are entirely equivalent. + + ;; Fixes bug reported by Christian Moe concerning verbatim + ;; LaTeX fragments. + ;; on git commit 533ba3f90250a1f25f494c390d639ea6274f235c + ;; http://repo.or.cz/w/org-mode/org-jambu.git/shortlog/refs/heads/staging + ;; See http://lists.gnu.org/archive/html/emacs-orgmode/2011-03/msg01379.html + + ;; Native Text + (when (and (get-text-property 0 'org-native-text line) + ;; Make sure it is the entire line that is protected + (not (< (or (next-single-property-change + 0 'org-native-text line) 10000) + (length line)))) + (let ((ind (get-text-property 0 'original-indentation line))) + (org-lparse-begin-environment 'native) + (org-lparse-insert 'LINE line) + (while (and lines + (or (= (length (car lines)) 0) + (not ind) + (equal ind (get-text-property + 0 'original-indentation (car lines)))) + (or (= (length (car lines)) 0) + (get-text-property 0 'org-native-text (car lines)))) + (org-lparse-insert 'LINE (pop lines))) + (org-lparse-end-environment 'native)) + (throw 'nextline nil)) + + ;; Protected HTML + (when (and (get-text-property 0 'org-protected line) + ;; Make sure it is the entire line that is protected + (not (< (or (next-single-property-change + 0 'org-protected line) 10000) + (length line)))) + (let ((ind (get-text-property 0 'original-indentation line))) + (org-lparse-insert 'LINE line) + (while (and lines + (or (= (length (car lines)) 0) + (not ind) + (equal ind (get-text-property + 0 'original-indentation (car lines)))) + (or (= (length (car lines)) 0) + (get-text-property 0 'org-protected (car lines)))) + (org-lparse-insert 'LINE (pop lines)))) + (throw 'nextline nil)) + + ;; Blockquotes, verse, and center + (when (string-match + "^ORG-\\(.+\\)-\\(START\\|END\\)\\([ \t]+.*\\)?$" line) + (let* ((style (intern (downcase (match-string 1 line)))) + (env-options-plist (org-lparse-get-block-params + (match-string 3 line))) + (f (cdr (assoc (match-string 2 line) + '(("START" . org-lparse-begin-environment) + ("END" . org-lparse-end-environment)))))) + (when (memq style + (append + '(blockquote verse center) + (mapcar 'intern org-lparse-special-blocks))) + (funcall f style env-options-plist) + (throw 'nextline nil)))) + + (run-hooks 'org-export-html-after-blockquotes-hook) + (when (org-lparse-current-environment-p 'verse) + (let ((i (org-get-string-indentation line))) + (if (> i 0) + (setq line (concat + (let ((org-lparse-encode-pending t)) + (org-lparse-format 'SPACES (* 2 i))) + " " (org-trim line)))) + (unless (string-match "\\\\\\\\[ \t]*$" line) + (setq line (concat line "\\\\"))))) + + ;; make targets to anchors + (setq start 0) + (while (string-match + "<<]*\\)>>>?\\((INVISIBLE)\\)?[ \t]*\n?" line start) + (cond + ((get-text-property (match-beginning 1) 'org-protected line) + (setq start (match-end 1))) + ((match-end 2) + (setq line (replace-match + (let ((org-lparse-encode-pending t)) + (org-lparse-format + 'ANCHOR "" (org-solidify-link-text + (match-string 1 line)))) + t t line))) + ((and org-export-with-toc (equal (string-to-char line) ?*)) + ;; FIXME: NOT DEPENDENT on TOC????????????????????? + (setq line (replace-match + (let ((org-lparse-encode-pending t)) + (org-lparse-format + 'FONTIFY (match-string 1 line) "target")) + ;; (concat "@" (match-string 1 line) "@ ") + t t line))) + (t + (setq line (replace-match + (concat + (let ((org-lparse-encode-pending t)) + (org-lparse-format + 'ANCHOR (match-string 1 line) + (org-solidify-link-text (match-string 1 line)) + "target")) " ") + t t line))))) + + (let ((org-lparse-encode-pending t)) + (setq line (org-lparse-handle-time-stamps line))) + + ;; replace "&" by "&", "<" and ">" by "<" and ">" + ;; handle @<..> HTML tags (replace "@>..<" by "<..>") + ;; Also handle sub_superscripts and checkboxes + (or (string-match org-table-hline-regexp line) + (string-match "^[ \t]*\\([+]-\\||[ ]\\)[-+ |]*[+|][ \t]*$" line) + (setq line (org-xml-encode-org-text-skip-links line))) + + (setq line (org-lparse-format-org-link line opt-plist)) + + ;; TODO items + (if (and org-todo-line-regexp + (string-match org-todo-line-regexp line) + (match-beginning 2)) + (setq line (concat + (substring line 0 (match-beginning 2)) + (org-lparse-format 'TODO (match-string 2 line)) + (substring line (match-end 2))))) + + ;; Does this contain a reference to a footnote? + (when org-export-with-footnotes + (setq start 0) + (while (string-match "\\([^* \t].*?\\)[ \t]*\\[\\([0-9]+\\)\\]" line start) + ;; Discard protected matches not clearly identified as + ;; footnote markers. + (if (or (get-text-property (match-beginning 2) 'org-protected line) + (not (get-text-property (match-beginning 2) 'org-footnote line))) + (setq start (match-end 2)) + (let ((n (match-string 2 line)) refcnt a) + (if (setq a (assoc n footref-seen)) + (progn + (setcdr a (1+ (cdr a))) + (setq refcnt (cdr a))) + (setq refcnt 1) + (push (cons n 1) footref-seen)) + (setq line + (replace-match + (concat + (or (match-string 1 line) "") + (org-lparse-format + 'FOOTNOTE-REFERENCE + n (cdr (assoc n org-lparse-footnote-definitions)) + refcnt) + ;; If another footnote is following the + ;; current one, add a separator. + (if (save-match-data + (string-match "\\`\\[[0-9]+\\]" + (substring line (match-end 0)))) + (ignore-errors + (org-lparse-get 'FOOTNOTE-SEPARATOR)) + "")) + t t line)))))) + + (cond + ((string-match "^\\(\\*+\\)\\(?: +\\(.*?\\)\\)?[ \t]*$" line) + ;; This is a headline + (setq level (org-tr-level (- (match-end 1) (match-beginning 1) + level-offset)) + txt (match-string 2 line)) + (if (string-match quote-re0 txt) + (setq txt (replace-match "" t t txt))) + (if (<= level (max umax umax-toc)) + (setq head-count (+ head-count 1))) + (unless org-lparse-dyn-first-heading-pos + (setq org-lparse-dyn-first-heading-pos (point))) + (org-lparse-begin-level level txt umax head-count) + + ;; QUOTES + (when (string-match quote-re line) + (org-lparse-begin-environment 'quote))) + + ((and org-export-with-tables + (string-match "^\\([ \t]*\\)\\(|\\|\\+-+\\+\\)" line)) + (when (not table-open) + ;; New table starts + (setq table-open t table-buffer nil table-orig-buffer nil)) + + ;; Accumulate lines + (setq table-buffer (cons line table-buffer) + table-orig-buffer (cons origline table-orig-buffer)) + (when (or (not lines) + (not (string-match "^\\([ \t]*\\)\\(|\\|\\+-+\\+\\)" + (car lines)))) + (setq table-open nil + table-buffer (nreverse table-buffer) + table-orig-buffer (nreverse table-orig-buffer)) + (org-lparse-end-paragraph) + (org-lparse-insert 'TABLE table-buffer table-orig-buffer))) + + ;; Normal lines + + (t + ;; This line either is list item or end a list. + (when (get-text-property 0 'list-item line) + (setq line (org-lparse-export-list-line + line + (get-text-property 0 'list-item line) + (get-text-property 0 'list-struct line) + (get-text-property 0 'list-prevs line)))) + + ;; Horizontal line + (when (string-match "^[ \t]*-\\{5,\\}[ \t]*$" line) + (with-org-lparse-preserve-paragraph-state + (org-lparse-insert 'HORIZONTAL-LINE)) + (throw 'nextline nil)) + + ;; Empty lines start a new paragraph. If hand-formatted lists + ;; are not fully interpreted, lines starting with "-", "+", "*" + ;; also start a new paragraph. + (when (string-match "^ [-+*]-\\|^[ \t]*$" line) + (when org-lparse-footnote-number + (org-lparse-end-footnote-definition org-lparse-footnote-number) + (setq org-lparse-footnote-number nil)) + (org-lparse-begin-paragraph)) + + ;; Is this the start of a footnote? + (when org-export-with-footnotes + (when (and (boundp 'footnote-section-tag-regexp) + (string-match (concat "^" footnote-section-tag-regexp) + line)) + ;; ignore this line + (throw 'nextline nil)) + (when (string-match "^[ \t]*\\[\\([0-9]+\\)\\]" line) + (org-lparse-end-paragraph) + (setq org-lparse-footnote-number (match-string 1 line)) + (setq line (replace-match "" t t line)) + (org-lparse-begin-footnote-definition org-lparse-footnote-number))) + ;; Check if the line break needs to be conserved + (cond + ((string-match "\\\\\\\\[ \t]*$" line) + (setq line (replace-match + (org-lparse-format 'LINE-BREAK) + t t line))) + (org-export-preserve-breaks + (setq line (concat line (org-lparse-format 'LINE-BREAK))))) + + ;; Check if a paragraph should be started + (let ((start 0)) + (while (and org-lparse-par-open + (string-match "\\\\par\\>" line start)) + (error "FIXME") + ;; Leave a space in the

    so that the footnote matcher + ;; does not see this. + (if (not (get-text-property (match-beginning 0) + 'org-protected line)) + (setq line (replace-match "

    " t t line))) + (setq start (match-end 0)))) + + (org-lparse-insert 'LINE line))))) + + ;; Properly close all local lists and other lists + (when (org-lparse-current-environment-p 'quote) + (org-lparse-end-environment 'quote)) + + (org-lparse-end-level 1 umax) + + ;; the to close the last text-... div. + (when (and (> umax 0) org-lparse-dyn-first-heading-pos) + (org-lparse-end-outline-text-or-outline)) + + (org-lparse-end 'DOCUMENT-BODY opt-plist) + (unless body-only + (org-lparse-end 'DOCUMENT-CONTENT)) + + (unless (plist-get opt-plist :buffer-will-be-killed) + (set-auto-mode t)) + + (org-lparse-end 'EXPORT) + + ;; kill collection buffer + (when org-lparse-collect-buffer + (kill-buffer org-lparse-collect-buffer)) + + (goto-char (point-min)) + (or (org-export-push-to-kill-ring + (upcase (symbol-name org-lparse-backend))) + (message "Exporting... done")) + + (cond + ((not to-buffer) + (let ((f (org-lparse-get 'SAVE-METHOD))) + (or (and f (functionp f) (funcall f filename opt-plist)) + (save-buffer))) + (or (and (boundp 'org-lparse-other-backend) + org-lparse-other-backend + (not (equal org-lparse-backend org-lparse-other-backend)) + (org-lparse-do-convert + buffer-file-name (symbol-name org-lparse-other-backend))) + (current-buffer))) + ((eq to-buffer 'string) + (prog1 (buffer-substring (point-min) (point-max)) + (kill-buffer (current-buffer)))) + (t (current-buffer)))))) + +(defun org-lparse-format-table (lines olines) + "Retuns backend-specific code for org-type and table-type tables." + (if (stringp lines) + (setq lines (org-split-string lines "\n"))) + (if (string-match "^[ \t]*|" (car lines)) + ;; A normal org table + (org-lparse-format-org-table lines nil) + ;; Table made by table.el + (or (org-lparse-format-table-table-using-table-generate-source + ;; FIXME: Need to take care of this during merge + (if (eq org-lparse-backend 'xhtml) 'html org-lparse-backend) + olines + (not org-export-prefer-native-exporter-for-tables)) + ;; We are here only when table.el table has NO col or row + ;; spanning and the user prefers using org's own converter for + ;; exporting of such simple table.el tables. + (org-lparse-format-table-table lines)))) + +(defun org-lparse-table-get-colalign-info (lines) + (let ((col-cookies (org-find-text-property-in-string + 'org-col-cookies (car lines)))) + (when (and col-cookies org-table-clean-did-remove-column) + (setq col-cookies + (mapcar (lambda (x) (cons (1- (car x)) (cdr x))) col-cookies))) + col-cookies)) + +(defvar org-lparse-table-style) +(defvar org-lparse-table-ncols) +(defvar org-lparse-table-rownum) +(defvar org-lparse-table-is-styled) +(defvar org-lparse-table-begin-marker) +(defvar org-lparse-table-num-numeric-items-per-column) +(defvar org-lparse-table-colalign-info) +(defvar org-lparse-table-colalign-vector) + +;; Following variables are defined in org-table.el +(defvar org-table-number-fraction) +(defvar org-table-number-regexp) +(defun org-lparse-org-table-to-list-table (lines &optional splice) + "Convert org-table to list-table. +LINES is a list of the form (ROW1 ROW2 ROW3 ...) where each +element is a `string' representing a single row of org-table. +Thus each ROW has vertical separators \"|\" separating the table +fields. A ROW could also be a row-group separator of the form +\"|---...|\". Return a list of the form (ROW1 ROW2 ROW3 +...). ROW could either be symbol `:hrule' or a list of the +form (FIELD1 FIELD2 FIELD3 ...) as appropriate." + (let (line lines-1) + (cond + (splice + (while (setq line (pop lines)) + (unless (string-match "^[ \t]*|-" line) + (push (org-split-string line "[ \t]*|[ \t]*") lines-1)))) + (t + (while (setq line (pop lines)) + (cond + ((string-match "^[ \t]*|-" line) + (when lines + (push :hrule lines-1))) + (t + (push (org-split-string line "[ \t]*|[ \t]*") lines-1)))))) + (nreverse lines-1))) + +(defun org-lparse-insert-org-table (lines &optional splice) + "Format a org-type table into backend-specific code. +LINES is a list of lines. Optional argument SPLICE means, do not +insert header and surrounding

    tags, just format the lines. +Optional argument NO-CSS means use XHTML attributes instead of CSS +for formatting. This is required for the DocBook exporter." + (require 'org-table) + ;; Get rid of hlines at beginning and end + (if (string-match "^[ \t]*|-" (car lines)) (setq lines (cdr lines))) + (setq lines (nreverse lines)) + (if (string-match "^[ \t]*|-" (car lines)) (setq lines (cdr lines))) + (setq lines (nreverse lines)) + (when org-export-table-remove-special-lines + ;; Check if the table has a marking column. If yes remove the + ;; column and the special lines + (setq lines (org-table-clean-before-export lines))) + (let* ((caption (org-find-text-property-in-string 'org-caption (car lines))) + (caption (and caption (org-xml-encode-org-text caption))) + (label (org-find-text-property-in-string 'org-label (car lines))) + (org-lparse-table-colalign-info (org-lparse-table-get-colalign-info lines)) + (attributes (org-find-text-property-in-string 'org-attributes + (car lines))) + (head (and org-export-highlight-first-table-line + (delq nil (mapcar + (lambda (x) (string-match "^[ \t]*|-" x)) + (cdr lines)))))) + (setq lines (org-lparse-org-table-to-list-table lines splice)) + (org-lparse-insert-list-table + lines splice caption label attributes head org-lparse-table-colalign-info))) + +(defun org-lparse-insert-list-table (lines &optional splice + caption label attributes head + org-lparse-table-colalign-info) + (or (featurep 'org-table) ; required for + (require 'org-table)) ; `org-table-number-regexp' + (let* ((org-lparse-table-rownum -1) org-lparse-table-ncols i (cnt 0) + tbopen fields line + org-lparse-table-cur-rowgrp-is-hdr + org-lparse-table-rowgrp-open + org-lparse-table-num-numeric-items-per-column + org-lparse-table-colalign-vector n + org-lparse-table-rowgrp-info + org-lparse-table-begin-marker + (org-lparse-table-style 'org-table) + org-lparse-table-is-styled) + (cond + (splice + (setq org-lparse-table-is-styled nil) + (while (setq line (pop lines)) + (insert (org-lparse-format-table-row line) "\n"))) + (t + (setq org-lparse-table-is-styled t) + (org-lparse-begin 'TABLE caption label attributes) + (setq org-lparse-table-begin-marker (point)) + (org-lparse-begin-table-rowgroup head) + (while (setq line (pop lines)) + (cond + ((equal line :hrule) + (org-lparse-begin-table-rowgroup)) + (t + (insert (org-lparse-format-table-row line) "\n")))) + (org-lparse-end 'TABLE-ROWGROUP) + (org-lparse-end-table))))) + +(defun org-lparse-format-org-table (lines &optional splice) + (with-temp-buffer + (org-lparse-insert-org-table lines splice) + (buffer-substring-no-properties (point-min) (point-max)))) + +(defun org-lparse-format-list-table (lines &optional splice) + (with-temp-buffer + (org-lparse-insert-list-table lines splice) + (buffer-substring-no-properties (point-min) (point-max)))) + +(defun org-lparse-insert-table-table (lines) + "Format a table generated by table.el into backend-specific code. +This conversion does *not* use `table-generate-source' from table.el. +This has the advantage that Org-mode's HTML conversions can be used. +But it has the disadvantage, that no cell- or row-spanning is allowed." + (let (line field-buffer + (org-lparse-table-cur-rowgrp-is-hdr + org-export-highlight-first-table-line) + (caption nil) + (attributes nil) + (label nil) + (org-lparse-table-style 'table-table) + (org-lparse-table-is-styled nil) + fields org-lparse-table-ncols i (org-lparse-table-rownum -1) + (empty (org-lparse-format 'SPACES 1))) + (org-lparse-begin 'TABLE caption label attributes) + (while (setq line (pop lines)) + (cond + ((string-match "^[ \t]*\\+-" line) + (when field-buffer + (let ((org-export-table-row-tags '("" . "")) + ;; (org-export-html-table-use-header-tags-for-first-column nil) + ) + (insert (org-lparse-format-table-row field-buffer empty))) + (setq org-lparse-table-cur-rowgrp-is-hdr nil) + (setq field-buffer nil))) + (t + ;; Break the line into fields and store the fields + (setq fields (org-split-string line "[ \t]*|[ \t]*")) + (if field-buffer + (setq field-buffer (mapcar + (lambda (x) + (concat x (org-lparse-format 'LINE-BREAK) + (pop fields))) + field-buffer)) + (setq field-buffer fields))))) + (org-lparse-end-table))) + +(defun org-lparse-format-table-table (lines) + (with-temp-buffer + (org-lparse-insert-table-table lines) + (buffer-substring-no-properties (point-min) (point-max)))) + +(defvar table-source-languages) ; defined in table.el +(defun org-lparse-format-table-table-using-table-generate-source (backend + lines + &optional + spanned-only) + "Format a table into BACKEND, using `table-generate-source' from table.el. +Use SPANNED-ONLY to suppress exporting of simple table.el tables. + +When SPANNED-ONLY is nil, all table.el tables are exported. When +SPANNED-ONLY is non-nil, only tables with either row or column +spans are exported. + +This routine returns the generated source or nil as appropriate. + +Refer docstring of `org-export-prefer-native-exporter-for-tables' +for further information." + (require 'table) + (with-current-buffer (get-buffer-create " org-tmp1 ") + (erase-buffer) + (insert (mapconcat 'identity lines "\n")) + (goto-char (point-min)) + (if (not (re-search-forward "|[^+]" nil t)) + (error "Error processing table")) + (table-recognize-table) + (when (or (not spanned-only) + (let* ((dim (table-query-dimension)) + (c (nth 4 dim)) (r (nth 5 dim)) (cells (nth 6 dim))) + (not (= (* c r) cells)))) + (with-current-buffer (get-buffer-create " org-tmp2 ") (erase-buffer)) + (cond + ((member backend table-source-languages) + (table-generate-source backend " org-tmp2 ") + (set-buffer " org-tmp2 ") + (buffer-substring (point-min) (point-max))) + (t + ;; table.el doesn't support the given backend. Currently this + ;; happens in case of odt export. Strip the table from the + ;; generated document. A better alternative would be to embed + ;; the table as ascii text in the output document. + (org-lparse-warn + (concat + "Found table.el-type table in the source org file. " + (format "table.el doesn't support %s backend. " + (upcase (symbol-name backend))) + "Skipping ahead ...")) + ""))))) + +(defun org-lparse-handle-time-stamps (s) + "Format time stamps in string S, or remove them." + (catch 'exit + (let (r b) + (when org-maybe-keyword-time-regexp + (while (string-match org-maybe-keyword-time-regexp s) + (or b (setq b (substring s 0 (match-beginning 0)))) + (setq r (concat + r (substring s 0 (match-beginning 0)) " " + (org-lparse-format + 'FONTIFY + (concat + (if (match-end 1) + (org-lparse-format + 'FONTIFY + (match-string 1 s) "timestamp-kwd")) + " " + (org-lparse-format + 'FONTIFY + (substring (org-translate-time (match-string 3 s)) 1 -1) + "timestamp")) + "timestamp-wrapper")) + s (substring s (match-end 0))))) + + ;; Line break if line started and ended with time stamp stuff + (if (not r) + s + (setq r (concat r s)) + (unless (string-match "\\S-" (concat b s)) + (setq r (concat r (org-lparse-format 'LINE-BREAK)))) + r)))) + +(defun org-xml-encode-plain-text (s) + "Convert plain text characters to HTML equivalent. +Possible conversions are set in `org-export-html-protect-char-alist'." + (let ((cl (org-lparse-get 'PLAIN-TEXT-MAP)) c) + (while (setq c (pop cl)) + (let ((start 0)) + (while (string-match (car c) s start) + (setq s (replace-match (cdr c) t t s) + start (1+ (match-beginning 0)))))) + s)) + +(defun org-xml-encode-org-text-skip-links (string) + "Prepare STRING for HTML export. Apply all active conversions. +If there are links in the string, don't modify these. If STRING +is nil, return nil." + (when string + (let* ((re (concat org-bracket-link-regexp "\\|" + (org-re "[ \t]+\\(:[[:alnum:]_@#%:]+:\\)[ \t]*$"))) + m s l res) + (while (setq m (string-match re string)) + (setq s (substring string 0 m) + l (match-string 0 string) + string (substring string (match-end 0))) + (push (org-xml-encode-org-text s) res) + (push l res)) + (push (org-xml-encode-org-text string) res) + (apply 'concat (nreverse res))))) + +(defun org-xml-encode-org-text (s) + "Apply all active conversions to translate special ASCII to HTML." + (setq s (org-xml-encode-plain-text s)) + (if org-export-html-expand + (while (string-match "@<\\([^&]*\\)>" s) + (setq s (replace-match "<\\1>" t nil s)))) + (if org-export-with-emphasize + (setq s (org-lparse-apply-char-styles s))) + (if org-export-with-special-strings + (setq s (org-lparse-convert-special-strings s))) + (if org-export-with-sub-superscripts + (setq s (org-lparse-apply-sub-superscript-styles s))) + (if org-export-with-TeX-macros + (let ((start 0) wd rep) + (while (setq start (string-match "\\\\\\([a-zA-Z]+[0-9]*\\)\\({}\\)?" + s start)) + (if (get-text-property (match-beginning 0) 'org-protected s) + (setq start (match-end 0)) + (setq wd (match-string 1 s)) + (if (setq rep (org-lparse-format 'ORG-ENTITY wd)) + (setq s (replace-match rep t t s)) + (setq start (+ start (length wd)))))))) + s) + +(defun org-lparse-convert-special-strings (string) + "Convert special characters in STRING to HTML." + (let ((all (org-lparse-get 'SPECIAL-STRING-REGEXPS)) + e a re rpl start) + (while (setq a (pop all)) + (setq re (car a) rpl (cdr a) start 0) + (while (string-match re string start) + (if (get-text-property (match-beginning 0) 'org-protected string) + (setq start (match-end 0)) + (setq string (replace-match rpl t nil string))))) + string)) + +(defun org-lparse-apply-sub-superscript-styles (string) + "Apply subscript and superscript styles to STRING. +Use `org-export-with-sub-superscripts' to control application of +sub and superscript styles." + (let (key c (s 0) (requireb (eq org-export-with-sub-superscripts '{}))) + (while (string-match org-match-substring-regexp string s) + (cond + ((and requireb (match-end 8)) (setq s (match-end 2))) + ((get-text-property (match-beginning 2) 'org-protected string) + (setq s (match-end 2))) + (t + (setq s (match-end 1) + key (if (string= (match-string 2 string) "_") + 'subscript 'superscript) + c (or (match-string 8 string) + (match-string 6 string) + (match-string 5 string)) + string (replace-match + (concat (match-string 1 string) + (org-lparse-format 'FONTIFY c key)) + t t string))))) + (while (string-match "\\\\\\([_^]\\)" string) + (setq string (replace-match (match-string 1 string) t t string))) + string)) + +(defvar org-lparse-char-styles + `(("*" bold) + ("/" emphasis) + ("_" underline) + ("=" code) + ("~" verbatim) + ("+" strike)) + "Map Org emphasis markers to char styles. +This is an alist where each element is of the +form (ORG-EMPHASIS-CHAR . CHAR-STYLE).") + +(defun org-lparse-apply-char-styles (string) + "Apply char styles to STRING. +The variable `org-lparse-char-styles' controls how the Org +emphasis markers are interpreted." + (let ((s 0) rpl) + (while (string-match org-emph-re string s) + (if (not (equal + (substring string (match-beginning 3) (1+ (match-beginning 3))) + (substring string (match-beginning 4) (1+ (match-beginning 4))))) + (setq s (match-beginning 0) + rpl + (concat + (match-string 1 string) + (org-lparse-format + 'FONTIFY (match-string 4 string) + (nth 1 (assoc (match-string 3 string) + org-lparse-char-styles))) + (match-string 5 string)) + string (replace-match rpl t t string) + s (+ s (- (length rpl) 2))) + (setq s (1+ s)))) + string)) + +(defun org-lparse-export-list-line (line pos struct prevs) + "Insert list syntax in export buffer. Return LINE, maybe modified. + +POS is the item position or line position the line had before +modifications to buffer. STRUCT is the list structure. PREVS is +the alist of previous items." + (let* ((get-type + (function + ;; Translate type of list containing POS to "d", "o" or + ;; "u". + (lambda (pos struct prevs) + (let ((type (org-list-get-list-type pos struct prevs))) + (cond + ((eq 'ordered type) "o") + ((eq 'descriptive type) "d") + (t "u")))))) + (get-closings + (function + ;; Return list of all items and sublists ending at POS, in + ;; reverse order. + (lambda (pos) + (let (out) + (catch 'exit + (mapc (lambda (e) + (let ((end (nth 6 e)) + (item (car e))) + (cond + ((= end pos) (push item out)) + ((>= item pos) (throw 'exit nil))))) + struct)) + out))))) + ;; First close any previous item, or list, ending at POS. + (mapc (lambda (e) + (let* ((lastp (= (org-list-get-last-item e struct prevs) e)) + (first-item (org-list-get-list-begin e struct prevs)) + (type (funcall get-type first-item struct prevs))) + (org-lparse-end-paragraph) + ;; Ending for every item + (org-lparse-end-list-item-1 type) + ;; We're ending last item of the list: end list. + (when lastp + (org-lparse-end-list type) + (org-lparse-begin-paragraph)))) + (funcall get-closings pos)) + (cond + ;; At an item: insert appropriate tags in export buffer. + ((assq pos struct) + (string-match + (concat "[ \t]*\\(\\S-+[ \t]*\\)" + "\\(?:\\[@\\(?:start:\\)?\\([0-9]+\\|[A-Za-z]\\)\\][ \t]*\\)?" + "\\(?:\\(\\[[ X-]\\]\\)[ \t]+\\)?" + "\\(?:\\(.*\\)[ \t]+::\\(?:[ \t]+\\|$\\)\\)?" + "\\(.*\\)") line) + (let* ((checkbox (match-string 3 line)) + (desc-tag (or (match-string 4 line) "???")) + (body (or (match-string 5 line) "")) + (list-beg (org-list-get-list-begin pos struct prevs)) + (firstp (= list-beg pos)) + ;; Always refer to first item to determine list type, in + ;; case list is ill-formed. + (type (funcall get-type list-beg struct prevs)) + (counter (let ((count-tmp (org-list-get-counter pos struct))) + (cond + ((not count-tmp) nil) + ((string-match "[A-Za-z]" count-tmp) + (- (string-to-char (upcase count-tmp)) 64)) + ((string-match "[0-9]+" count-tmp) + count-tmp))))) + (when firstp + (org-lparse-end-paragraph) + (org-lparse-begin-list type)) + + (let ((arg (cond ((equal type "d") desc-tag) + ((equal type "o") counter)))) + (org-lparse-begin-list-item type arg)) + + ;; If line had a checkbox, some additional modification is required. + (when checkbox + (setq body + (concat + (org-lparse-format + 'FONTIFY (concat + "[" + (cond + ((string-match "X" checkbox) "X") + ((string-match " " checkbox) + (org-lparse-format 'SPACES 1)) + (t "-")) + "]") + 'code) + " " + body))) + ;; Return modified line + body)) + ;; At a list ender: go to next line (side-effects only). + ((equal "ORG-LIST-END-MARKER" line) (throw 'nextline nil)) + ;; Not at an item: return line unchanged (side-effects only). + (t line)))) + +(defun org-lparse-bind-local-variables (opt-plist) + (mapc (lambda (x) + (set (make-local-variable (nth 2 x)) + (plist-get opt-plist (car x)))) + org-export-plist-vars)) + +(defvar org-lparse-table-rowgrp-open) +(defvar org-lparse-table-cur-rowgrp-is-hdr) +(defvar org-lparse-footnote-number) +(defvar org-lparse-footnote-definitions) +(defvar org-lparse-output-buffer nil + "Buffer to which `org-do-lparse' writes to. +This buffer contains the contents of the to-be-created exported +document.") + +(defcustom org-lparse-debug nil + "Enable or Disable logging of `org-lparse' callbacks. +The parameters passed to the backend-registered ENTITY-CONTROL +and ENTITY-FORMAT callbacks are logged as comment strings in the +exported buffer. (org-lparse-format 'COMMENT fmt args) is used +for logging. Customize this variable only if you are an expert +user. Valid values of this variable are: +nil : Disable logging +control : Log all invocations of `org-lparse-begin' and + `org-lparse-end' callbacks. +format : Log invocations of `org-lparse-format' callbacks. +t : Log all invocations of `org-lparse-begin', `org-lparse-end' + and `org-lparse-format' callbacks," + :group 'org-lparse + :type '(choice + (const :tag "Disable" nil) + (const :tag "Format callbacks" format) + (const :tag "Control callbacks" control) + (const :tag "Format and Control callbacks" t))) + +(defun org-lparse-begin (entity &rest args) + "Begin ENTITY in current buffer. ARGS is entity specific. +ENTITY can be one of PARAGRAPH, LIST, LIST-ITEM etc. + +Use (org-lparse-begin 'LIST \"o\") to begin a list in current +buffer. + +See `org-xhtml-entity-control-callbacks-alist' for more +information." + (when (and (member org-lparse-debug '(t control)) + (not (eq entity 'DOCUMENT-CONTENT))) + (insert (org-lparse-format 'COMMENT "%s BEGIN %S" entity args))) + + (let ((f (cadr (assoc entity org-lparse-entity-control-callbacks-alist)))) + (unless f (error "Unknown entity: %s" entity)) + (apply f args))) + +(defun org-lparse-end (entity &rest args) + "Close ENTITY in current buffer. ARGS is entity specific. +ENTITY can be one of PARAGRAPH, LIST, LIST-ITEM +etc. + +Use (org-lparse-end 'LIST \"o\") to close a list in current +buffer. + +See `org-xhtml-entity-control-callbacks-alist' for more +information." + (when (and (member org-lparse-debug '(t control)) + (not (eq entity 'DOCUMENT-CONTENT))) + (insert (org-lparse-format 'COMMENT "%s END %S" entity args))) + + (let ((f (caddr (assoc entity org-lparse-entity-control-callbacks-alist)))) + (unless f (error "Unknown entity: %s" entity)) + (apply f args))) + +(defun org-lparse-begin-paragraph (&optional style) + "Insert

    , but first close previous paragraph if any." + (org-lparse-end-paragraph) + (org-lparse-begin 'PARAGRAPH style) + (setq org-lparse-par-open t)) + +(defun org-lparse-end-paragraph () + "Close paragraph if there is one open." + (when org-lparse-par-open + (org-lparse-end 'PARAGRAPH) + (setq org-lparse-par-open nil))) + +(defun org-lparse-end-list-item-1 (&optional type) + "Close

  • if necessary." + (org-lparse-end-paragraph) + (org-lparse-end-list-item (or type "u"))) + +(defun org-lparse-preprocess-after-blockquote-hook () + "Treat `org-lparse-special-blocks' specially." + (goto-char (point-min)) + (while (re-search-forward + "^[ \t]*#\\+\\(begin\\|end\\)_\\(\\S-+\\)[ \t]*\\(.*\\)$" nil t) + (when (member (downcase (match-string 2)) org-lparse-special-blocks) + (replace-match + (if (equal (downcase (match-string 1)) "begin") + (format "ORG-%s-START %s" (upcase (match-string 2)) + (match-string 3)) + (format "ORG-%s-END %s" (upcase (match-string 2)) + (match-string 3))) t t)))) + +(add-hook 'org-export-preprocess-after-blockquote-hook + 'org-lparse-preprocess-after-blockquote-hook) + +(defun org-lparse-strip-experimental-blocks-maybe-hook () + "Strip \"list-table\" and \"annotation\" blocks. +Stripping happens only when the exported backend is not one of +\"odt\" or \"xhtml\"." + (when (not org-lparse-backend) + (message "Stripping following blocks - %S" org-lparse-special-blocks) + (goto-char (point-min)) + (let ((case-fold-search t)) + (while + (re-search-forward + "^[ \t]*#\\+begin_\\(\\S-+\\)\\([ \t]+.*\\)?\n\\([^\000]*?\\)\n[ \t]*#\\+end_\\1\\>.*" + nil t) + (when (member (match-string 1) org-lparse-special-blocks) + (replace-match "" t t)))))) + +(add-hook 'org-export-preprocess-hook + 'org-lparse-strip-experimental-blocks-maybe-hook) + +(defvar org-lparse-list-table-p nil + "Non-nil if `org-do-lparse' is within a list-table.") + +(defvar org-lparse-dyn-current-environment nil) +(defun org-lparse-begin-environment (style &optional env-options-plist) + (case style + (list-table + (setq org-lparse-list-table-p t)) + (t (setq org-lparse-dyn-current-environment style) + (org-lparse-begin 'ENVIRONMENT style env-options-plist)))) + +(defun org-lparse-end-environment (style &optional env-options-plist) + (case style + (list-table + (setq org-lparse-list-table-p nil)) + (t (org-lparse-end 'ENVIRONMENT style env-options-plist) + (setq org-lparse-dyn-current-environment nil)))) + +(defun org-lparse-current-environment-p (style) + (eq org-lparse-dyn-current-environment style)) + +(defun org-lparse-begin-footnote-definition (n) + (org-lparse-begin-collect) + (setq org-lparse-insert-tag-with-newlines nil) + (org-lparse-begin 'FOOTNOTE-DEFINITION n)) + +(defun org-lparse-end-footnote-definition (n) + (org-lparse-end 'FOOTNOTE-DEFINITION n) + (setq org-lparse-insert-tag-with-newlines 'both) + (let ((footnote-def (org-lparse-end-collect))) + (push (cons n footnote-def) org-lparse-footnote-definitions))) + +(defvar org-lparse-collect-buffer nil + "An auxiliary buffer named \"*Org Lparse Collect*\". +`org-do-lparse' uses this as output buffer while collecting +footnote definitions and table-cell contents of list-tables. See +`org-lparse-begin-collect' and `org-lparse-end-collect'.") + +(defvar org-lparse-collect-count nil + "Count number of calls to `org-lparse-begin-collect'. +Use this counter to catch chained collections if they ever +happen.") + +(defun org-lparse-begin-collect () + "Temporarily switch to `org-lparse-collect-buffer'. +Also erase it's contents." + (unless (zerop org-lparse-collect-count) + (error "FIXME (org-lparse.el): Encountered chained collections")) + (incf org-lparse-collect-count) + (unless org-lparse-collect-buffer + (setq org-lparse-collect-buffer + (get-buffer-create "*Org Lparse Collect*"))) + (set-buffer org-lparse-collect-buffer) + (erase-buffer)) + +(defun org-lparse-end-collect () + "Switch to `org-lparse-output-buffer'. +Return contents of `org-lparse-collect-buffer' as a `string'." + (assert (> org-lparse-collect-count 0)) + (decf org-lparse-collect-count) + (prog1 (buffer-string) + (erase-buffer) + (set-buffer org-lparse-output-buffer))) + +(defun org-lparse-format (entity &rest args) + "Format ENTITY in backend-specific way and return it. +ARGS is specific to entity being formatted. + +Use (org-lparse-format 'HEADING \"text\" 1) to format text as +level 1 heading. + +See `org-xhtml-entity-format-callbacks-alist' for more information." + (when (and (member org-lparse-debug '(t format)) + (not (equal entity 'COMMENT))) + (insert (org-lparse-format 'COMMENT "%s: %S" entity args))) + (cond + ((consp entity) + (let ((text (pop args))) + (apply 'org-lparse-format 'TAGS entity text args))) + (t + (let ((f (cdr (assoc entity org-lparse-entity-format-callbacks-alist)))) + (unless f (error "Unknown entity: %s" entity)) + (apply f args))))) + +(defun org-lparse-insert (entity &rest args) + (insert (apply 'org-lparse-format entity args))) + +(defun org-lparse-prepare-toc (lines level-offset opt-plist umax-toc) + (let* ((quote-re0 (concat "^[ \t]*" org-quote-string "\\>")) + (org-min-level (org-get-min-level lines level-offset)) + (org-last-level org-min-level) + level) + (with-temp-buffer + (org-lparse-bind-local-variables opt-plist) + (erase-buffer) + (org-lparse-begin 'TOC (nth 3 (plist-get opt-plist :lang-words)) umax-toc) + (setq + lines + (mapcar + #'(lambda (line) + (when (and (string-match org-todo-line-regexp line) + (not (get-text-property 0 'org-protected line)) + (<= (setq level (org-tr-level + (- (match-end 1) (match-beginning 1) + level-offset))) + umax-toc)) + (let ((txt (save-match-data + (org-xml-encode-org-text-skip-links + (org-export-cleanup-toc-line + (match-string 3 line))))) + (todo (and + org-export-mark-todo-in-toc + (or (and (match-beginning 2) + (not (member (match-string 2 line) + org-done-keywords))) + (and (= level umax-toc) + (org-search-todo-below + line lines level))))) + tags) + ;; Check for targets + (while (string-match org-any-target-regexp line) + (setq line + (replace-match + (let ((org-lparse-encode-pending t)) + (org-lparse-format 'FONTIFY + (match-string 1 line) "target")) + t t line))) + (when (string-match + (org-re "[ \t]+:\\([[:alnum:]_@:]+\\):[ \t]*$") txt) + (setq tags (match-string 1 txt) + txt (replace-match "" t nil txt))) + (when (string-match quote-re0 txt) + (setq txt (replace-match "" t t txt))) + (while (string-match "<\\(<\\)+\\|>\\(>\\)+" txt) + (setq txt (replace-match "" t t txt))) + (org-lparse-format + 'TOC-ITEM + (let* ((snumber (org-section-number level)) + (href (replace-regexp-in-string + "\\." "-" (format "sec-%s" snumber))) + (href + (or + (cdr (assoc + href org-export-preferred-target-alist)) + href)) + (href (org-solidify-link-text href))) + (org-lparse-format 'TOC-ENTRY snumber todo txt tags href)) + level org-last-level) + (setq org-last-level level))) + line) + lines)) + (org-lparse-end 'TOC) + (setq org-lparse-toc (buffer-string)))) + lines) + +(defun org-lparse-format-table-row (fields &optional text-for-empty-fields) + (if org-lparse-table-ncols + ;; second and subsequent rows of the table + (when (and org-lparse-list-table-p + (> (length fields) org-lparse-table-ncols)) + (error "Table row has %d columns but header row claims %d columns" + (length fields) org-lparse-table-ncols)) + ;; first row of the table + (setq org-lparse-table-ncols (length fields)) + (when org-lparse-table-is-styled + (setq org-lparse-table-num-numeric-items-per-column + (make-vector org-lparse-table-ncols 0)) + (setq org-lparse-table-colalign-vector + (make-vector org-lparse-table-ncols nil)) + (let ((c -1)) + (while (< (incf c) org-lparse-table-ncols) + (let* ((col-cookie (cdr (assoc (1+ c) org-lparse-table-colalign-info))) + (align (nth 0 col-cookie))) + (setf (aref org-lparse-table-colalign-vector c) + (cond + ((string= align "l") "left") + ((string= align "r") "right") + ((string= align "c") "center") + (t nil)))))))) + (incf org-lparse-table-rownum) + (let ((i -1)) + (org-lparse-format + 'TABLE-ROW + (mapconcat + (lambda (x) + (when (and (string= x "") text-for-empty-fields) + (setq x text-for-empty-fields)) + (incf i) + (let (col-cookie horiz-span) + (when org-lparse-table-is-styled + (when (and (< i org-lparse-table-ncols) + (string-match org-table-number-regexp x)) + (incf (aref org-lparse-table-num-numeric-items-per-column i))) + (setq col-cookie (cdr (assoc (1+ i) org-lparse-table-colalign-info)) + horiz-span (nth 1 col-cookie))) + (org-lparse-format + 'TABLE-CELL x org-lparse-table-rownum i (or horiz-span 0)))) + fields "\n")))) + +(defun org-lparse-get (what &optional opt-plist) + "Query for value of WHAT for the current backend `org-lparse-backend'. +See also `org-lparse-backend-get'." + (if (boundp 'org-lparse-backend) + (org-lparse-backend-get (symbol-name org-lparse-backend) what opt-plist) + (error "org-lparse-backend is not bound yet"))) + +(defun org-lparse-backend-get (backend what &optional opt-plist) + "Query BACKEND for value of WHAT. +Dispatch the call to `org--user-get'. If that throws an +error, dispatch the call to `org--get'. See +`org-xhtml-get' for all known settings queried for by +`org-lparse' during the course of export." + (assert (stringp backend) t) + (unless (org-lparse-backend-is-native-p backend) + (error "Unknown native backend %s" backend)) + (let ((backend-get-method (intern (format "org-%s-get" backend))) + (backend-user-get-method (intern (format "org-%s-user-get" backend)))) + (cond + ((functionp backend-get-method) + (condition-case nil + (funcall backend-user-get-method what opt-plist) + (error (funcall backend-get-method what opt-plist)))) + (t + (error "Native backend %s doesn't define %s" backend backend-get-method))))) + +(defun org-lparse-insert-tag (tag &rest args) + (when (member org-lparse-insert-tag-with-newlines '(lead both)) + (insert "\n")) + (insert (apply 'format tag args)) + (when (member org-lparse-insert-tag-with-newlines '(trail both)) + (insert "\n"))) + +(defun org-lparse-get-targets-from-title (title) + (let* ((target (org-get-text-property-any 0 'target title)) + (extra-targets (assoc target org-export-target-aliases)) + (target (or (cdr (assoc target org-export-preferred-target-alist)) + target))) + (cons target (remove target extra-targets)))) + +(defun org-lparse-suffix-from-snumber (snumber) + (let* ((snu (replace-regexp-in-string "\\." "-" snumber)) + (href (cdr (assoc (concat "sec-" snu) + org-export-preferred-target-alist)))) + (org-solidify-link-text (or href snu)))) + +(defun org-lparse-begin-level (level title umax head-count) + "Insert a new LEVEL in HTML export. +When TITLE is nil, just close all open levels." + (org-lparse-end-level level umax) + (unless title (error "Why is heading nil")) + (let* ((targets (org-lparse-get-targets-from-title title)) + (target (car targets)) (extra-targets (cdr targets)) + (target (and target (org-solidify-link-text target))) + (extra-class (org-get-text-property-any 0 'html-container-class title)) + snumber tags level1 class) + (when (string-match (org-re "\\(:[[:alnum:]_@#%:]+:\\)[ \t]*$") title) + (setq tags (and org-export-with-tags (match-string 1 title))) + (setq title (replace-match "" t t title))) + (if (> level umax) + (progn + (if (aref org-levels-open (1- level)) + (org-lparse-end-list-item-1) + (aset org-levels-open (1- level) t) + (org-lparse-end-paragraph) + (org-lparse-begin-list 'unordered)) + (org-lparse-begin-list-item + 'unordered target (org-lparse-format + 'HEADLINE title extra-targets tags))) + (aset org-levels-open (1- level) t) + (setq snumber (org-section-number level)) + (setq level1 (+ level (or (org-lparse-get 'TOPLEVEL-HLEVEL) 1) -1)) + (unless (= head-count 1) + (org-lparse-end-outline-text-or-outline)) + (org-lparse-begin-outline-and-outline-text + level1 snumber title tags target extra-targets extra-class) + (org-lparse-begin-paragraph)))) + +(defun org-lparse-end-level (level umax) + (org-lparse-end-paragraph) + (loop for l from org-level-max downto level + do (when (aref org-levels-open (1- l)) + ;; Terminate one level in HTML export + (if (<= l umax) + (org-lparse-end-outline-text-or-outline) + (org-lparse-end-list-item-1) + (org-lparse-end-list 'unordered)) + (aset org-levels-open (1- l) nil)))) + +(defvar org-lparse-outline-text-open) +(defun org-lparse-begin-outline-and-outline-text (level1 snumber title tags + target extra-targets + extra-class) + (org-lparse-begin + 'OUTLINE level1 snumber title tags target extra-targets extra-class) + (org-lparse-begin-outline-text level1 snumber extra-class)) + +(defun org-lparse-end-outline-text-or-outline () + (cond + (org-lparse-outline-text-open + (org-lparse-end 'OUTLINE-TEXT) + (setq org-lparse-outline-text-open nil)) + (t (org-lparse-end 'OUTLINE)))) + +(defun org-lparse-begin-outline-text (level1 snumber extra-class) + (assert (not org-lparse-outline-text-open) t) + (setq org-lparse-outline-text-open t) + (org-lparse-begin 'OUTLINE-TEXT level1 snumber extra-class)) + +(defun org-lparse-html-list-type-to-canonical-list-type (ltype) + (cdr (assoc ltype '(("o" . ordered) + ("u" . unordered) + ("d" . description))))) + +;; following vars are bound during `org-do-lparse' +(defvar org-lparse-list-level) +(defvar org-lparse-list-item-count) +(defvar org-lparse-list-stack) +(defvar org-lparse-list-table:table-row) +(defvar org-lparse-list-table:lines) + +;; Notes on LIST-TABLES +;; ==================== +;; Lists withing "list-table" blocks (as shown below) +;; +;; #+begin_list-table +;; - Row 1 +;; - 1.1 +;; - 1.2 +;; - 1.3 +;; - Row 2 +;; - 2.1 +;; - 2.2 +;; - 2.3 +;; #+end_list-table +;; +;; will be exported as though it were a table as shown below. +;; +;; | Row 1 | 1.1 | 1.2 | 1.3 | +;; | Row 2 | 2.1 | 2.2 | 2.3 | +;; +;; Note that org-tables are NOT multi-line and each line is mapped to +;; a unique row in the exported document. So if an exported table +;; needs to contain a single paragraph (with copious text) it needs to +;; be typed up in a single line. Editing such long lines using the +;; table editor will be a cumbersome task. Furthermore inclusion of +;; multi-paragraph text in a table cell is well-nigh impossible. +;; +;; LIST-TABLEs are meant to circumvent the above problems with +;; org-tables. +;; +;; Note that in the example above the list items could be paragraphs +;; themselves and the list can be arbitrarily deep. +;; +;; Inspired by following thread: +;; https://lists.gnu.org/archive/html/emacs-orgmode/2011-03/msg01101.html + +(defun org-lparse-begin-list (ltype) + (incf org-lparse-list-level) + (push org-lparse-list-item-count org-lparse-list-stack) + (setq org-lparse-list-item-count 0) + (cond + ((not org-lparse-list-table-p) + (org-lparse-begin 'LIST ltype)) + ;; process LIST-TABLE + ((= 1 org-lparse-list-level) + ;; begin LIST-TABLE + (setq org-lparse-list-table:lines nil) + (setq org-lparse-list-table:table-row nil)) + ((= 2 org-lparse-list-level) + (ignore)) + (t + (org-lparse-begin 'LIST ltype)))) + +(defun org-lparse-end-list (ltype) + (setq org-lparse-list-item-count (pop org-lparse-list-stack)) + (decf org-lparse-list-level) + (cond + ((not org-lparse-list-table-p) + (org-lparse-end 'LIST ltype)) + ;; process LIST-TABLE + ((= 0 org-lparse-list-level) + ;; end LIST-TABLE + (insert (org-lparse-format-list-table + (nreverse org-lparse-list-table:lines)))) + ((= 1 org-lparse-list-level) + (ignore)) + (t + (org-lparse-end 'LIST ltype)))) + +(defun org-lparse-begin-list-item (ltype &optional arg headline) + (incf org-lparse-list-item-count) + (cond + ((not org-lparse-list-table-p) + (org-lparse-begin 'LIST-ITEM ltype arg headline)) + ;; process LIST-TABLE + ((and (= 1 org-lparse-list-level) + (= 1 org-lparse-list-item-count)) + ;; begin TABLE-ROW for LIST-TABLE + (setq org-lparse-list-table:table-row nil) + (org-lparse-begin-list-table:table-cell)) + ((and (= 2 org-lparse-list-level) + (= 1 org-lparse-list-item-count)) + ;; begin TABLE-CELL for LIST-TABLE + (org-lparse-begin-list-table:table-cell)) + (t + (org-lparse-begin 'LIST-ITEM ltype arg headline)))) + +(defun org-lparse-end-list-item (ltype) + (decf org-lparse-list-item-count) + (cond + ((not org-lparse-list-table-p) + (org-lparse-end 'LIST-ITEM ltype)) + ;; process LIST-TABLE + ((and (= 1 org-lparse-list-level) + (= 0 org-lparse-list-item-count)) + ;; end TABLE-ROW for LIST-TABLE + (org-lparse-end-list-table:table-cell) + (push (nreverse org-lparse-list-table:table-row) + org-lparse-list-table:lines)) + ((= 2 org-lparse-list-level) + ;; end TABLE-CELL for LIST-TABLE + (org-lparse-end-list-table:table-cell)) + (t + (org-lparse-end 'LIST-ITEM ltype)))) + +(defvar org-lparse-list-table:table-cell-open) +(defun org-lparse-begin-list-table:table-cell () + (org-lparse-end-list-table:table-cell) + (setq org-lparse-list-table:table-cell-open t) + (org-lparse-begin-collect) + (org-lparse-begin-paragraph)) + +(defun org-lparse-end-list-table:table-cell () + (when org-lparse-list-table:table-cell-open + (setq org-lparse-list-table:table-cell-open nil) + (org-lparse-end-paragraph) + (push (org-lparse-end-collect) + org-lparse-list-table:table-row))) + +(defvar org-lparse-table-rowgrp-info) +(defun org-lparse-begin-table-rowgroup (&optional is-header-row) + (push (cons (1+ org-lparse-table-rownum) :start) org-lparse-table-rowgrp-info) + (org-lparse-begin 'TABLE-ROWGROUP is-header-row)) + +(defun org-lparse-end-table () + (when org-lparse-table-is-styled + ;; column groups + (unless (car org-table-colgroup-info) + (setq org-table-colgroup-info + (cons :start (cdr org-table-colgroup-info)))) + + ;; column alignment + (let ((c -1)) + (mapc + (lambda (x) + (incf c) + (setf (aref org-lparse-table-colalign-vector c) + (or (aref org-lparse-table-colalign-vector c) + (if (> (/ (float x) (1+ org-lparse-table-rownum)) + org-table-number-fraction) + "right" "left")))) + org-lparse-table-num-numeric-items-per-column))) + (org-lparse-end 'TABLE)) + +(defvar org-lparse-encode-pending nil) + +(defun org-lparse-format-tags (tag text prefix suffix &rest args) + (cond + ((consp tag) + (concat prefix (apply 'format (car tag) args) text suffix + (format (cdr tag)))) + ((stringp tag) ; singleton tag + (concat prefix (apply 'format tag args) text)))) + +(defun org-xml-fix-class-name (kwd) ; audit callers of this function + "Turn todo keyword into a valid class name. +Replaces invalid characters with \"_\"." + (save-match-data + (while (string-match "[^a-zA-Z0-9_]" kwd) + (setq kwd (replace-match "_" t t kwd)))) + kwd) + +(defun org-lparse-format-todo (todo) + (org-lparse-format 'FONTIFY + (concat + (ignore-errors (org-lparse-get 'TODO-KWD-CLASS-PREFIX)) + (org-xml-fix-class-name todo)) + (list (if (member todo org-done-keywords) "done" "todo") + todo))) + +(defun org-lparse-format-extra-targets (extra-targets) + (if (not extra-targets) "" + (mapconcat (lambda (x) + (setq x (org-solidify-link-text + (if (org-uuidgen-p x) (concat "ID-" x) x))) + (org-lparse-format 'ANCHOR "" x)) + extra-targets ""))) + +(defun org-lparse-format-org-tags (tags) + (if (not tags) "" + (org-lparse-format + 'FONTIFY (mapconcat + (lambda (x) + (org-lparse-format + 'FONTIFY x + (concat + (ignore-errors (org-lparse-get 'TAG-CLASS-PREFIX)) + (org-xml-fix-class-name x)))) + (org-split-string tags ":") + (org-lparse-format 'SPACES 1)) "tag"))) + +(defun org-lparse-format-section-number (&optional snumber level) + (and org-export-with-section-numbers + (not org-lparse-body-only) snumber level + (org-lparse-format 'FONTIFY snumber (format "section-number-%d" level)))) + +(defun org-lparse-warn (msg) + (if (not org-lparse-use-flashy-warning) + (message msg) + (put-text-property 0 (length msg) 'face 'font-lock-warning-face msg) + (message msg) + (sleep-for 3))) + +(defun org-xml-format-href (s) + "Make sure the S is valid as a href reference in an XHTML document." + (save-match-data + (let ((start 0)) + (while (string-match "&" s start) + (setq start (+ (match-beginning 0) 3) + s (replace-match "&" t t s))))) + s) + +(defun org-xml-format-desc (s) + "Make sure the S is valid as a description in a link." + (if (and s (not (get-text-property 1 'org-protected s))) + (save-match-data + (org-xml-encode-org-text s)) + s)) + +(provide 'org-lparse) + +;;; org-lparse.el ends here diff -Nru org-mode-7.7/lisp/org-mac-message.el org-mode-7.8.02/lisp/org-mac-message.el --- org-mode-7.7/lisp/org-mac-message.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/org-mac-message.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,11 +1,10 @@ ;;; org-mac-message.el --- Links to Apple Mail.app messages from within Org-mode -;; Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. +;; Copyright (C) 2008-2011 Free Software Foundation, Inc. ;; Author: John Wiegley ;; Christopher Suckling -;; Version: 7.7 ;; Keywords: outlines, hypermedia, calendar, wp ;; This file is part of GNU Emacs. @@ -214,6 +213,4 @@ (provide 'org-mac-message) -;; arch-tag: 3806d0c1-abe1-4db6-9c31-f3ed7d4a9b32 - ;;; org-mac-message.el ends here diff -Nru org-mode-7.7/lisp/org-macs.el org-mode-7.8.02/lisp/org-macs.el --- org-mode-7.7/lisp/org-macs.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/org-macs.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,12 +1,10 @@ ;;; org-macs.el --- Top-level definitions for Org-mode -;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 -;; Free Software Foundation, Inc. +;; Copyright (C) 2004-2011 Free Software Foundation, Inc. ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; ;; This file is part of GNU Emacs. ;; @@ -47,6 +45,13 @@ (declare-function org-add-props "org-compat" (string plist &rest props)) (declare-function org-string-match-p "org-compat" (&rest args)) +(defmacro org-with-gensyms (symbols &rest body) + `(let ,(mapcar (lambda (s) + `(,s (make-symbol (concat "--" (symbol-name ',s))))) symbols) + ,@body)) +(def-edebug-spec org-with-gensyms (sexp body)) +(put 'org-with-gensyms 'lisp-indent-function 1) + (defmacro org-called-interactively-p (&optional kind) (if (featurep 'xemacs) `(interactive-p) @@ -55,17 +60,20 @@ (>= emacs-minor-version 2))) `(with-no-warnings (called-interactively-p ,kind)) ;; defined with no argument in <=23.1 `(interactive-p)))) +(def-edebug-spec org-called-interactively-p (&optional ("quote" symbolp))) -(if (and (not (fboundp 'with-silent-modifications)) +(when (and (not (fboundp 'with-silent-modifications)) (or (< emacs-major-version 23) (and (= emacs-major-version 23) (< emacs-minor-version 2)))) (defmacro with-silent-modifications (&rest body) - `(org-unmodified ,@body))) + `(org-unmodified ,@body)) + (def-edebug-spec with-silent-modifications (body))) (defmacro org-bound-and-true-p (var) "Return the value of symbol VAR if it is bound, else nil." `(and (boundp (quote ,var)) ,var)) +(def-edebug-spec org-bound-and-true-p (symbolp)) (defun org-string-nw-p (s) "Is S a string with a non-white character?" @@ -86,30 +94,36 @@ (let ((buffer-undo-list t) before-change-functions after-change-functions) ,@body)))) +(def-edebug-spec org-unmodified (body)) + +(defun org-substitute-posix-classes (re) + "Substitute posix classes in regular expression RE." + (let ((ss re)) + (save-match-data + (while (string-match "\\[:alnum:\\]" ss) + (setq ss (replace-match "a-zA-Z0-9" t t ss))) + (while (string-match "\\[:word:\\]" ss) + (setq ss (replace-match "a-zA-Z0-9" t t ss))) + (while (string-match "\\[:alpha:\\]" ss) + (setq ss (replace-match "a-zA-Z" t t ss))) + (while (string-match "\\[:punct:\\]" ss) + (setq ss (replace-match "\001-@[-`{-~" t t ss))) + ss))) (defmacro org-re (s) "Replace posix classes in regular expression." - (if (featurep 'xemacs) - (let ((ss s)) - (save-match-data - (while (string-match "\\[:alnum:\\]" ss) - (setq ss (replace-match "a-zA-Z0-9" t t ss))) - (while (string-match "\\[:word:\\]" ss) - (setq ss (replace-match "a-zA-Z0-9" t t ss))) - (while (string-match "\\[:alpha:\\]" ss) - (setq ss (replace-match "a-zA-Z" t t ss))) - (while (string-match "\\[:punct:\\]" ss) - (setq ss (replace-match "\001-@[-`{-~" t t ss))) - ss)) - s)) + (if (featurep 'xemacs) `(org-substitute-posix-classes ,s) s)) +(def-edebug-spec org-re (form)) (defmacro org-preserve-lc (&rest body) - `(let ((_line (org-current-line)) - (_col (current-column))) - (unwind-protect - (progn ,@body) - (org-goto-line _line) - (org-move-to-column _col)))) + (org-with-gensyms (line col) + `(let ((,line (org-current-line)) + (,col (current-column))) + (unwind-protect + (progn ,@body) + (org-goto-line ,line) + (org-move-to-column ,col))))) +(def-edebug-spec org-preserve-lc (body)) (defmacro org-without-partial-completion (&rest body) `(if (and (boundp 'partial-completion-mode) @@ -121,7 +135,9 @@ ,@body) (partial-completion-mode 1)) ,@body)) +(def-edebug-spec org-without-partial-completion (body)) +;; FIXME: Slated for removal. Current Org mode does not support Emacs < 22 (defmacro org-maybe-intangible (props) "Add '(intangible t) to PROPS if Emacs version is earlier than Emacs 22. In Emacs 21, invisible text is not avoided by the command loop, so the @@ -136,31 +152,37 @@ (defmacro org-with-point-at (pom &rest body) "Move to buffer and point of point-or-marker POM for the duration of BODY." - `(let ((pom ,pom)) - (save-excursion - (if (markerp pom) (set-buffer (marker-buffer pom))) + (org-with-gensyms (mpom) + `(let ((,mpom ,pom)) (save-excursion - (goto-char (or pom (point))) - ,@body)))) + (if (markerp ,mpom) (set-buffer (marker-buffer ,mpom))) + (save-excursion + (goto-char (or ,mpom (point))) + ,@body))))) +(def-edebug-spec org-with-point-at (form body)) (put 'org-with-point-at 'lisp-indent-function 1) (defmacro org-no-warnings (&rest body) (cons (if (fboundp 'with-no-warnings) 'with-no-warnings 'progn) body)) +(def-edebug-spec org-no-warnings (body)) (defmacro org-if-unprotected (&rest body) "Execute BODY if there is no `org-protected' text property at point." `(unless (get-text-property (point) 'org-protected) ,@body)) +(def-edebug-spec org-if-unprotected (body)) (defmacro org-if-unprotected-1 (&rest body) "Execute BODY if there is no `org-protected' text property at point-1." `(unless (get-text-property (1- (point)) 'org-protected) ,@body)) +(def-edebug-spec org-if-unprotected-1 (body)) (defmacro org-if-unprotected-at (pos &rest body) "Execute BODY if there is no `org-protected' text property at POS." `(unless (get-text-property ,pos 'org-protected) ,@body)) +(def-edebug-spec org-if-unprotected-at (form body)) (put 'org-if-unprotected-at 'lisp-indent-function 1) (defun org-re-search-forward-unprotected (&rest args) @@ -172,33 +194,37 @@ (unless (get-text-property (match-beginning 0) 'org-protected) (throw 'exit (point)))))) +;; FIXME: Normalize argument names (defmacro org-with-remote-undo (_buffer &rest _body) "Execute BODY while recording undo information in two buffers." - `(let ((_cline (org-current-line)) - (_cmd this-command) - (_buf1 (current-buffer)) - (_buf2 ,_buffer) - (_undo1 buffer-undo-list) - (_undo2 (with-current-buffer ,_buffer buffer-undo-list)) - _c1 _c2) - ,@_body - (when org-agenda-allow-remote-undo - (setq _c1 (org-verify-change-for-undo - _undo1 (with-current-buffer _buf1 buffer-undo-list)) - _c2 (org-verify-change-for-undo - _undo2 (with-current-buffer _buf2 buffer-undo-list))) - (when (or _c1 _c2) - ;; make sure there are undo boundaries - (and _c1 (with-current-buffer _buf1 (undo-boundary))) - (and _c2 (with-current-buffer _buf2 (undo-boundary))) - ;; remember which buffer to undo - (push (list _cmd _cline _buf1 _c1 _buf2 _c2) - org-agenda-undo-list))))) + (org-with-gensyms (cline cmd buf1 buf2 undo1 undo2 c1 c2) + `(let ((,cline (org-current-line)) + (,cmd this-command) + (,buf1 (current-buffer)) + (,buf2 ,_buffer) + (,undo1 buffer-undo-list) + (,undo2 (with-current-buffer ,_buffer buffer-undo-list)) + ,c1 ,c2) + ,@_body + (when org-agenda-allow-remote-undo + (setq ,c1 (org-verify-change-for-undo + ,undo1 (with-current-buffer ,buf1 buffer-undo-list)) + ,c2 (org-verify-change-for-undo + ,undo2 (with-current-buffer ,buf2 buffer-undo-list))) + (when (or ,c1 ,c2) + ;; make sure there are undo boundaries + (and ,c1 (with-current-buffer ,buf1 (undo-boundary))) + (and ,c2 (with-current-buffer ,buf2 (undo-boundary))) + ;; remember which buffer to undo + (push (list ,cmd ,cline ,buf1 ,c1 ,buf2 ,c2) + org-agenda-undo-list)))))) +(def-edebug-spec org-with-remote-undo (form body)) (put 'org-with-remote-undo 'lisp-indent-function 1) (defmacro org-no-read-only (&rest body) "Inhibit read-only for BODY." `(let ((inhibit-read-only t)) ,@body)) +(def-edebug-spec org-no-read-only (body)) (defconst org-rm-props '(invisible t face t keymap t intangible t mouse-face t rear-nonsticky t mouse-map t fontified t @@ -246,10 +272,6 @@ "Make VAR local in current buffer and set it to VALUE." (set (make-local-variable var) value)) -(defsubst org-mode-p () - "Check if the current buffer is in Org-mode." - (eq major-mode 'org-mode)) - (defsubst org-last (list) "Return the last element of LIST." (car (last list))) @@ -325,18 +347,20 @@ during the operation, because otherwise all these markers will point nowhere." (declare (indent 1)) - `(let ((data (org-outline-overlay-data ,use-markers)) - rtn) - (unwind-protect - (progn - (setq rtn (progn ,@body)) - (org-set-outline-overlay-data data)) - (when ,use-markers - (mapc (lambda (c) - (and (markerp (car c)) (move-marker (car c) nil)) - (and (markerp (cdr c)) (move-marker (cdr c) nil))) - data))) - rtn)) + (org-with-gensyms (data rtn) + `(let ((,data (org-outline-overlay-data ,use-markers)) + ,rtn) + (unwind-protect + (progn + (setq ,rtn (progn ,@body)) + (org-set-outline-overlay-data ,data)) + (when ,use-markers + (mapc (lambda (c) + (and (markerp (car c)) (move-marker (car c) nil)) + (and (markerp (cdr c)) (move-marker (cdr c) nil))) + ,data))) + ,rtn))) +(def-edebug-spec org-save-outline-visibility (form body)) (defmacro org-with-wide-buffer (&rest body) "Execute body while temporarily widening the buffer." @@ -344,6 +368,7 @@ (save-restriction (widen) ,@body))) +(def-edebug-spec org-with-wide-buffer (body)) (defmacro org-with-limited-levels (&rest body) "Execute BODY with limited number of outline levels." @@ -351,6 +376,7 @@ (outline-regexp org-outline-regexp) (org-outline-regexp-at-bol (concat "^" org-outline-regexp))) ,@body)) +(def-edebug-spec org-with-limited-levels (body)) (defvar org-outline-regexp) ; defined in org.el (defvar org-odd-levels-only) ; defined in org.el @@ -358,7 +384,7 @@ (defun org-get-limited-outline-regexp () "Return outline-regexp with limited number of levels. The number of levels is controlled by `org-inlinetask-min-level'" - (if (or (not (org-mode-p)) (not (featurep 'org-inlinetask))) + (if (or (not (eq major-mode 'org-mode)) (not (featurep 'org-inlinetask))) org-outline-regexp (let* ((limit-level (1- org-inlinetask-min-level)) (nstars (if org-odd-levels-only (1- (* limit-level 2)) limit-level))) @@ -370,8 +396,20 @@ (format-seconds string seconds) (format-time-string string (seconds-to-time seconds)))) -(provide 'org-macs) +(defmacro org-eval-in-environment (environment form) + `(eval (list 'let ,environment ',form))) +(def-edebug-spec org-eval-in-environment (form form)) +(put 'org-eval-in-environment 'lisp-indent-function 1) + +(defun org-make-parameter-alist (flat) + "Return alist based on FLAT. +FLAT is a list with alternating symbol names and values. The +returned alist is a list of lists with the symbol name in car and +the value in cdr." + (when flat + (cons (list (car flat) (cadr flat)) + (org-make-parameter-alist (cddr flat))))) -;; arch-tag: 7e6a73ce-aac9-4fc0-9b30-ce6f89dc6668 +(provide 'org-macs) ;;; org-macs.el ends here diff -Nru org-mode-7.7/lisp/org-mew.el org-mode-7.8.02/lisp/org-mew.el --- org-mode-7.7/lisp/org-mew.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/org-mew.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,11 +1,10 @@ ;;; org-mew.el --- Support for links to Mew messages from within Org-mode -;; Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. +;; Copyright (C) 2008-2011 Free Software Foundation, Inc. ;; Author: Tokuya Kameshima ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; This file is part of GNU Emacs. @@ -135,6 +134,4 @@ (provide 'org-mew) -;; arch-tag: 07ccdca7-6020-4941-a593-588a1e51b870 - ;;; org-mew.el ends here diff -Nru org-mode-7.7/lisp/org-mhe.el org-mode-7.8.02/lisp/org-mhe.el --- org-mode-7.7/lisp/org-mhe.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/org-mhe.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,12 +1,10 @@ ;;; org-mhe.el --- Support for links to MH-E messages from within Org-mode -;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 -;; Free Software Foundation, Inc. +;; Copyright (C) 2004-2011 Free Software Foundation, Inc. ;; Author: Thomas Baumann ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; ;; This file is part of GNU Emacs. ;; @@ -226,6 +224,4 @@ (provide 'org-mhe) -;; arch-tag: dcb05484-8627-491d-a8c1-01dbd2bde4ae - ;;; org-mhe.el ends here diff -Nru org-mode-7.7/lisp/org-mks.el org-mode-7.8.02/lisp/org-mks.el --- org-mode-7.7/lisp/org-mks.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/org-mks.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,11 +1,10 @@ ;;; org-mks.el --- Multi-key-selection for Org-mode -;; Copyright (C) 2010 Free Software Foundation, Inc. +;; Copyright (C) 2010-2011 Free Software Foundation, Inc. ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; ;; This file is part of GNU Emacs. ;; @@ -132,6 +131,4 @@ (provide 'org-mks) -;; arch-tag: 4ea90d0e-c6e4-4684-bd61-baf878712f9f - ;;; org-mks.el ends here diff -Nru org-mode-7.7/lisp/org-mobile.el org-mode-7.8.02/lisp/org-mobile.el --- org-mode-7.7/lisp/org-mobile.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/org-mobile.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,10 +1,9 @@ ;;; org-mobile.el --- Code for asymmetric sync with a mobile device -;; Copyright (C) 2009, 2010 Free Software Foundation, Inc. +;; Copyright (C) 2009-2011 Free Software Foundation, Inc. ;; ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; ;; This file is part of GNU Emacs. ;; @@ -1099,7 +1098,5 @@ (provide 'org-mobile) -;; arch-tag: ace0e26c-58f2-4309-8a61-05ec1535f658 - ;;; org-mobile.el ends here diff -Nru org-mode-7.7/lisp/org-mouse.el org-mode-7.8.02/lisp/org-mouse.el --- org-mode-7.7/lisp/org-mouse.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/org-mouse.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,10 +1,10 @@ ;;; org-mouse.el --- Better mouse support for org-mode -;; Copyright (C) 2006, 2007, 2008, 2009, 2010 Free Software Foundation +;; Copyright (C) 2006-2011 Free Software Foundation ;; ;; Author: Piotr Zielinski ;; Maintainer: Carsten Dominik -;; Version: 7.7 + ;; ;; This file is part of GNU Emacs. ;; @@ -70,8 +70,7 @@ ;; ;; Since version 5.10: Changes are listed in the general org-mode docs. ;; -;; Version 5.09 -;; + Version number synchronization with Org-mode. +;; Version 5.09;; + Version number synchronization with Org-mode. ;; ;; Version 0.25 ;; + made compatible with org-mode 4.70 (thanks to Carsten for the patch) @@ -616,12 +615,12 @@ (beginning-of-line)) (defadvice dnd-insert-text (around org-mouse-dnd-insert-text activate) - (if (org-mode-p) + (if (eq major-mode 'org-mode) (org-mouse-insert-item text) ad-do-it)) (defadvice dnd-open-file (around org-mouse-dnd-open-file activate) - (if (org-mode-p) + (if (eq major-mode 'org-mode) (org-mouse-insert-item uri) ad-do-it)) @@ -632,13 +631,6 @@ (set-match-data ',match) (apply ',function rest))))) -(defun org-mouse-match-todo-keyword () - (save-excursion - (org-back-to-heading) - (if (looking-at org-outline-regexp) (goto-char (match-end 0))) - (or (looking-at (concat " +" org-todo-regexp " *")) - (looking-at " \\( *\\)")))) - (defun org-mouse-yank-link (click) (interactive "e") ;; Give temporary modes such as isearch a chance to turn off. @@ -1146,6 +1138,4 @@ (provide 'org-mouse) -;; arch-tag: ff1ae557-3529-41a3-95c6-baaebdcc280f - ;;; org-mouse.el ends here diff -Nru org-mode-7.7/lisp/org-odt.el org-mode-7.8.02/lisp/org-odt.el --- org-mode-7.7/lisp/org-odt.el 1970-01-01 00:00:00.000000000 +0000 +++ org-mode-7.8.02/lisp/org-odt.el 2011-12-13 00:34:24.000000000 +0000 @@ -0,0 +1,2461 @@ +;;; org-odt.el --- OpenDocumentText export for Org-mode + +;; Copyright (C) 2010-2011 Free Software Foundation, Inc. + +;; Author: Jambunathan K +;; Keywords: outlines, hypermedia, calendar, wp +;; Homepage: http://orgmode.org +;; +;; This file is not (yet) part of GNU Emacs. +;; However, it is distributed under the same license. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;;; Commentary: + +;;; Code: +(eval-when-compile + (require 'cl) + ;; htmlfontify.el was introduce in Emacs 23.2 + (when (>= (string-to-number emacs-version) 23.2) + (require 'htmlfontify))) +(require 'org-lparse) + +(defgroup org-export-odt nil + "Options specific for ODT export of Org-mode files." + :tag "Org Export ODT" + :group 'org-export) + +(defun org-odt-end-export () + (org-odt-fixup-label-references) + + ;; remove empty paragraphs + (goto-char (point-min)) + (while (re-search-forward + "[ \r\n\t]*" + nil t) + (replace-match "")) + (goto-char (point-min)) + + ;; Convert whitespace place holders + (goto-char (point-min)) + (let (beg end n) + (while (setq beg (next-single-property-change (point) 'org-whitespace)) + (setq n (get-text-property beg 'org-whitespace) + end (next-single-property-change beg 'org-whitespace)) + (goto-char beg) + (delete-region beg end) + (insert (format "%s" + (make-string n ?x))))) + + ;; Remove empty lines at the beginning of the file. + (goto-char (point-min)) + (when (looking-at "\\s-+\n") (replace-match "")) + + ;; Remove display properties + (remove-text-properties (point-min) (point-max) '(display t))) + +(defvar org-odt-suppress-xref nil) +(defconst org-export-odt-special-string-regexps + '(("\\\\-" . "­\\1") ; shy + ("---\\([^-]\\)" . "—\\1") ; mdash + ("--\\([^-]\\)" . "–\\1") ; ndash + ("\\.\\.\\." . "…")) ; hellip + "Regular expressions for special string conversion.") + +(defconst org-odt-lib-dir (file-name-directory load-file-name)) +(defconst org-odt-styles-dir + (let* ((styles-dir1 (expand-file-name "../etc/styles/" org-odt-lib-dir)) + (styles-dir2 (expand-file-name "./etc/styles/" org-odt-lib-dir)) + (styles-dir + (catch 'styles-dir + (mapc (lambda (styles-dir) + (when (and (file-readable-p + (expand-file-name + "OrgOdtContentTemplate.xml" styles-dir)) + (file-readable-p + (expand-file-name + "OrgOdtStyles.xml" styles-dir))) + (throw 'styles-dir styles-dir))) + (list styles-dir1 styles-dir2)) + nil))) + (unless styles-dir + (error "Cannot find factory styles file. Check package dir layout")) + styles-dir) + "Directory that holds auxiliary XML files used by the ODT exporter. + +This directory contains the following XML files - + \"OrgOdtStyles.xml\" and \"OrgOdtContentTemplate.xml\". These + XML files are used as the default values of + `org-export-odt-styles-file' and + `org-export-odt-content-template-file'.") + +(defcustom org-export-odt-schema-dir + (let ((schema-dir (expand-file-name + "../contrib/odt/etc/schema/" org-odt-lib-dir))) + (if (and (file-readable-p + (expand-file-name "od-manifest-schema-v1.2-cs01.rnc" schema-dir)) + (file-readable-p + (expand-file-name "od-schema-v1.2-cs01.rnc" schema-dir)) + (file-readable-p + (expand-file-name "schemas.xml" schema-dir))) + schema-dir + (prog1 nil (message "Unable to locate OpenDocument schema files.")))) + "Directory that contains OpenDocument schema files. + +This directory contains rnc files for OpenDocument schema. It +also contains a \"schemas.xml\" that can be added to +`rng-schema-locating-files' for auto validation of OpenDocument +XML files. See also `rng-nxml-auto-validate-flag'." + :type '(choice + (const :tag "Not set" nil) + (directory :tag "Schema directory")) + :group 'org-export-odt + :set + (lambda (var value) + "Set `org-export-odt-schema-dir'. +Also add it to `rng-schema-locating-files'." + (let ((schema-dir value)) + (set var + (if (and + (file-readable-p + (expand-file-name "od-manifest-schema-v1.2-cs01.rnc" schema-dir)) + (file-readable-p + (expand-file-name "od-schema-v1.2-cs01.rnc" schema-dir)) + (file-readable-p + (expand-file-name "schemas.xml" schema-dir))) + schema-dir + (prog1 nil + (message "Warning (org-odt): Unable to locate OpenDocument schema files."))))) + (when org-export-odt-schema-dir + (eval-after-load 'rng-loc + '(add-to-list 'rng-schema-locating-files + (expand-file-name "schemas.xml" + org-export-odt-schema-dir)))))) + +(defvar org-odt-file-extensions + '(("odt" . "OpenDocument Text") + ("ott" . "OpenDocument Text Template") + ("odm" . "OpenDocument Master Document") + ("ods" . "OpenDocument Spreadsheet") + ("ots" . "OpenDocument Spreadsheet Template") + ("odg" . "OpenDocument Drawing (Graphics)") + ("otg" . "OpenDocument Drawing Template") + ("odp" . "OpenDocument Presentation") + ("otp" . "OpenDocument Presentation Template") + ("odi" . "OpenDocument Image") + ("odf" . "OpenDocument Formula") + ("odc" . "OpenDocument Chart"))) + +(mapc + (lambda (desc) + ;; Let Org open all OpenDocument files using system-registered app + (add-to-list 'org-file-apps + (cons (concat "\\." (car desc) "\\'") 'system)) + ;; Let Emacs open all OpenDocument files in archive mode + (add-to-list 'auto-mode-alist + (cons (concat "\\." (car desc) "\\'") 'archive-mode))) + org-odt-file-extensions) + +;; register the odt exporter with the pre-processor +(add-to-list 'org-export-backends 'odt) + +;; register the odt exporter with org-lparse library +(org-lparse-register-backend 'odt) + +(defun org-odt-unload-function () + (org-lparse-unregister-backend 'odt) + (remove-hook 'org-export-preprocess-after-blockquote-hook + 'org-export-odt-preprocess-latex-fragments) + nil) + +(defcustom org-export-odt-content-template-file nil + "Template file for \"content.xml\". +The exporter embeds the exported content just before +\"\" element. + +If unspecified, the file named \"OrgOdtContentTemplate.xml\" +under `org-odt-styles-dir' is used." + :type 'file + :group 'org-export-odt) + +(defcustom org-export-odt-styles-file nil + "Default styles file for use with ODT export. +Valid values are one of: +1. nil +2. path to a styles.xml file +3. path to a *.odt or a *.ott file +4. list of the form (ODT-OR-OTT-FILE (FILE-MEMBER-1 FILE-MEMBER-2 +...)) + +In case of option 1, an in-built styles.xml is used. See +`org-odt-styles-dir' for more information. + +In case of option 3, the specified file is unzipped and the +styles.xml embedded therein is used. + +In case of option 4, the specified ODT-OR-OTT-FILE is unzipped +and FILE-MEMBER-1, FILE-MEMBER-2 etc are copied in to the +generated odt file. Use relative path for specifying the +FILE-MEMBERS. styles.xml must be specified as one of the +FILE-MEMBERS. + +Use options 1, 2 or 3 only if styles.xml alone suffices for +achieving the desired formatting. Use option 4, if the styles.xml +references additional files like header and footer images for +achieving the desired formattting. + +Use \"#+ODT_STYLES_FILE: ...\" directive to set this variable on +a per-file basis. For example, + +#+ODT_STYLES_FILE: \"/path/to/styles.xml\" or +#+ODT_STYLES_FILE: (\"/path/to/file.ott\" (\"styles.xml\" \"image/hdr.png\"))." + :group 'org-export-odt + :type + '(choice + (const :tag "Factory settings" nil) + (file :must-match t :tag "styles.xml") + (file :must-match t :tag "ODT or OTT file") + (list :tag "ODT or OTT file + Members" + (file :must-match t :tag "ODF Text or Text Template file") + (cons :tag "Members" + (file :tag " Member" "styles.xml") + (repeat (file :tag "Member")))))) + +(eval-after-load 'org-exp + '(add-to-list 'org-export-inbuffer-options-extra + '("ODT_STYLES_FILE" :odt-styles-file))) + +(defconst org-export-odt-tmpdir-prefix "%s-") +(defconst org-export-odt-bookmark-prefix "OrgXref.") + +(defvar org-export-odt-embed-images t + "Should the images be copied in to the odt file or just linked?") + +(defvar org-export-odt-inline-images 'maybe) ; counterpart of + ; `org-export-html-inline-images' + +(defcustom org-export-odt-inline-image-extensions + '("png" "jpeg" "jpg" "gif") + "Extensions of image files that can be inlined into HTML." + :type '(repeat (string :tag "Extension")) + :group 'org-export-odt) + +(defcustom org-export-odt-pixels-per-inch display-pixels-per-inch + ;; FIXME add docstring + "" + :type 'float + :group 'org-export-odt) + +(defcustom org-export-odt-create-custom-styles-for-srcblocks t + "Whether custom styles for colorized source blocks be automatically created. +When this option is turned on, the exporter creates custom styles +for source blocks based on the advice of `htmlfontify'. Creation +of custom styles happen as part of `org-odt-hfy-face-to-css'. + +When this option is turned off exporter does not create such +styles. + +Use the latter option if you do not want the custom styles to be +based on your current display settings. It is necessary that the +styles.xml already contains needed styles for colorizing to work. + +This variable is effective only if +`org-export-odt-fontify-srcblocks' is turned on." + :group 'org-export-odt + :type 'boolean) + +(defvar org-export-odt-default-org-styles-alist + '((paragraph . ((default . "Text_20_body") + (fixedwidth . "OrgFixedWidthBlock") + (verse . "OrgVerse") + (quote . "Quotations") + (blockquote . "Quotations") + (center . "OrgCenter") + (left . "OrgLeft") + (right . "OrgRight") + (title . "Heading_20_1.title") + (footnote . "Footnote") + (src . "OrgSrcBlock") + (illustration . "Illustration") + (table . "Table") + (definition-term . "Text_20_body_20_bold") + (horizontal-line . "Horizontal_20_Line"))) + (character . ((bold . "Bold") + (emphasis . "Emphasis") + (code . "OrgCode") + (verbatim . "OrgCode") + (strike . "Strikethrough") + (underline . "Underline") + (subscript . "OrgSubscript") + (superscript . "OrgSuperscript"))) + (list . ((ordered . "OrgNumberedList") + (unordered . "OrgBulletedList") + (description . "OrgDescriptionList")))) + "Default styles for various entities.") + +(defvar org-export-odt-org-styles-alist org-export-odt-default-org-styles-alist) +(defun org-odt-get-style-name-for-entity (category &optional entity) + (let ((entity (or entity 'default))) + (or + (cdr (assoc entity (cdr (assoc category + org-export-odt-org-styles-alist)))) + (cdr (assoc entity (cdr (assoc category + org-export-odt-default-org-styles-alist)))) + (error "Cannot determine style name for entity %s of type %s" + entity category)))) + +(defcustom org-export-odt-preferred-output-format nil + "Automatically post-process to this format after exporting to \"odt\". +Interactive commands `org-export-as-odt' and +`org-export-as-odt-and-open' export first to \"odt\" format and +then use `org-export-odt-convert-process' to convert the +resulting document to this format. During customization of this +variable, the list of valid values are populated based on +`org-export-odt-convert-capabilities'." + :group 'org-export-odt + :type '(choice :convert-widget + (lambda (w) + (apply 'widget-convert (widget-type w) + (eval (car (widget-get w :args))))) + `((const :tag "None" nil) + ,@(mapcar (lambda (c) + `(const :tag ,c ,c)) + (org-lparse-reachable-formats "odt"))))) + +;;;###autoload +(defun org-export-as-odt-and-open (arg) + "Export the outline as ODT and immediately open it with a browser. +If there is an active region, export only the region. +The prefix ARG specifies how many levels of the outline should become +headlines. The default is 3. Lower levels will become bulleted lists." + (interactive "P") + (org-lparse-and-open + (or org-export-odt-preferred-output-format "odt") "odt" arg)) + +;;;###autoload +(defun org-export-as-odt-batch () + "Call the function `org-lparse-batch'. +This function can be used in batch processing as: +emacs --batch + --load=$HOME/lib/emacs/org.el + --eval \"(setq org-export-headline-levels 2)\" + --visit=MyFile --funcall org-export-as-odt-batch" + (org-lparse-batch "odt")) + +;;;###autoload +(defun org-export-as-odt-to-buffer (arg) + "Call `org-lparse-odt` with output to a temporary buffer. +No file is created. The prefix ARG is passed through to `org-lparse-to-buffer'." + (interactive "P") + (org-lparse-to-buffer "odt" arg)) + +;;;###autoload +(defun org-replace-region-by-odt (beg end) + "Assume the current region has org-mode syntax, and convert it to ODT. +This can be used in any buffer. For example, you could write an +itemized list in org-mode syntax in an ODT buffer and then use this +command to convert it." + (interactive "r") + (org-replace-region-by "odt" beg end)) + +;;;###autoload +(defun org-export-region-as-odt (beg end &optional body-only buffer) + "Convert region from BEG to END in org-mode buffer to ODT. +If prefix arg BODY-ONLY is set, omit file header, footer, and table of +contents, and only produce the region of converted text, useful for +cut-and-paste operations. +If BUFFER is a buffer or a string, use/create that buffer as a target +of the converted ODT. If BUFFER is the symbol `string', return the +produced ODT as a string and leave not buffer behind. For example, +a Lisp program could call this function in the following way: + + (setq odt (org-export-region-as-odt beg end t 'string)) + +When called interactively, the output buffer is selected, and shown +in a window. A non-interactive call will only return the buffer." + (interactive "r\nP") + (org-lparse-region "odt" beg end body-only buffer)) + +;;; org-export-as-odt +;;;###autoload +(defun org-export-as-odt (arg &optional hidden ext-plist + to-buffer body-only pub-dir) + "Export the outline as a OpenDocumentText file. +If there is an active region, export only the region. The prefix +ARG specifies how many levels of the outline should become +headlines. The default is 3. Lower levels will become bulleted +lists. HIDDEN is obsolete and does nothing. +EXT-PLIST is a property list with external parameters overriding +org-mode's default settings, but still inferior to file-local +settings. When TO-BUFFER is non-nil, create a buffer with that +name and export to that buffer. If TO-BUFFER is the symbol +`string', don't leave any buffer behind but just return the +resulting XML as a string. When BODY-ONLY is set, don't produce +the file header and footer, simply return the content of +..., without even the body tags themselves. When +PUB-DIR is set, use this as the publishing directory." + (interactive "P") + (org-lparse (or org-export-odt-preferred-output-format "odt") + "odt" arg hidden ext-plist to-buffer body-only pub-dir)) + +(defvar org-odt-entity-control-callbacks-alist + `((EXPORT + . (org-odt-begin-export org-odt-end-export)) + (DOCUMENT-CONTENT + . (org-odt-begin-document-content org-odt-end-document-content)) + (DOCUMENT-BODY + . (org-odt-begin-document-body org-odt-end-document-body)) + (TOC + . (org-odt-begin-toc org-odt-end-toc)) + (ENVIRONMENT + . (org-odt-begin-environment org-odt-end-environment)) + (FOOTNOTE-DEFINITION + . (org-odt-begin-footnote-definition org-odt-end-footnote-definition)) + (TABLE + . (org-odt-begin-table org-odt-end-table)) + (TABLE-ROWGROUP + . (org-odt-begin-table-rowgroup org-odt-end-table-rowgroup)) + (LIST + . (org-odt-begin-list org-odt-end-list)) + (LIST-ITEM + . (org-odt-begin-list-item org-odt-end-list-item)) + (OUTLINE + . (org-odt-begin-outline org-odt-end-outline)) + (OUTLINE-TEXT + . (org-odt-begin-outline-text org-odt-end-outline-text)) + (PARAGRAPH + . (org-odt-begin-paragraph org-odt-end-paragraph))) + "") + +(defvar org-odt-entity-format-callbacks-alist + `((EXTRA-TARGETS . org-lparse-format-extra-targets) + (ORG-TAGS . org-lparse-format-org-tags) + (SECTION-NUMBER . org-lparse-format-section-number) + (HEADLINE . org-odt-format-headline) + (TOC-ENTRY . org-odt-format-toc-entry) + (TOC-ITEM . org-odt-format-toc-item) + (TAGS . org-odt-format-tags) + (SPACES . org-odt-format-spaces) + (TABS . org-odt-format-tabs) + (LINE-BREAK . org-odt-format-line-break) + (FONTIFY . org-odt-format-fontify) + (TODO . org-lparse-format-todo) + (LINK . org-odt-format-link) + (INLINE-IMAGE . org-odt-format-inline-image) + (ORG-LINK . org-odt-format-org-link) + (HEADING . org-odt-format-heading) + (ANCHOR . org-odt-format-anchor) + (TABLE . org-lparse-format-table) + (TABLE-ROW . org-odt-format-table-row) + (TABLE-CELL . org-odt-format-table-cell) + (FOOTNOTES-SECTION . ignore) + (FOOTNOTE-REFERENCE . org-odt-format-footnote-reference) + (HORIZONTAL-LINE . org-odt-format-horizontal-line) + (COMMENT . org-odt-format-comment) + (LINE . org-odt-format-line) + (ORG-ENTITY . org-odt-format-org-entity)) + "") + +;;;_. callbacks +;;;_. control callbacks +;;;_ , document body +(defun org-odt-begin-office-body () + ;; automatic styles + (insert-file-contents + (or org-export-odt-content-template-file + (expand-file-name "OrgOdtContentTemplate.xml" + org-odt-styles-dir))) + (goto-char (point-min)) + (re-search-forward "" nil nil) + (delete-region (match-beginning 0) (point-max))) + +;; Following variable is let bound when `org-do-lparse' is in +;; progress. See org-html.el. +(defvar org-lparse-toc) +(defun org-odt-begin-document-body (opt-plist) + (org-odt-begin-office-body) + (let ((title (plist-get opt-plist :title))) + (when title + (insert + (org-odt-format-stylized-paragraph 'title title)))) + + ;; insert toc + (when org-lparse-toc + (insert "\n" org-lparse-toc "\n"))) + +(defvar org-lparse-body-only) ; let bound during org-do-lparse +(defvar org-lparse-to-buffer) ; let bound during org-do-lparse +(defun org-odt-end-document-body (opt-plist) + (unless org-lparse-body-only + (org-lparse-insert-tag "") + (org-lparse-insert-tag ""))) + +(defun org-odt-begin-document-content (opt-plist) + (ignore)) + +(defun org-odt-end-document-content () + (org-lparse-insert-tag "")) + +(defun org-odt-begin-outline (level1 snumber title tags + target extra-targets class) + (org-lparse-insert + 'HEADING (org-lparse-format + 'HEADLINE title extra-targets tags snumber level1) + level1 target)) + +(defun org-odt-end-outline () + (ignore)) + +(defun org-odt-begin-outline-text (level1 snumber class) + (ignore)) + +(defun org-odt-end-outline-text () + (ignore)) + +(defun org-odt-begin-paragraph (&optional style) + (org-lparse-insert-tag + "" (org-odt-get-extra-attrs-for-paragraph-style style))) + +(defun org-odt-end-paragraph () + (org-lparse-insert-tag "")) + +(defun org-odt-get-extra-attrs-for-paragraph-style (style) + (let (style-name) + (setq style-name + (cond + ((stringp style) style) + ((symbolp style) (org-odt-get-style-name-for-entity + 'paragraph style)))) + (unless style-name + (error "Don't know how to handle paragraph style %s" style)) + (format " text:style-name=\"%s\"" style-name))) + +(defun org-odt-format-stylized-paragraph (style text) + (org-odt-format-tags + '("" . "") text + (org-odt-get-extra-attrs-for-paragraph-style style))) + +(defvar org-lparse-opt-plist) ; bound during org-do-lparse +(defun org-odt-format-author (&optional author) + (when (setq author (or author (plist-get org-lparse-opt-plist :author))) + (org-odt-format-tags '("" . "") author))) + +(defun org-odt-iso-date-from-org-timestamp (&optional org-ts) + (save-match-data + (let* ((time + (and (stringp org-ts) + (string-match org-ts-regexp0 org-ts) + (apply 'encode-time + (org-fix-decoded-time + (org-parse-time-string (match-string 0 org-ts) t))))) + (date (format-time-string "%Y-%m-%dT%H:%M:%S%z" time))) + (format "%s:%s" (substring date 0 -2) (substring date -2))))) + +(defun org-odt-begin-annotation (&optional author date) + (org-lparse-insert-tag "") + (when (setq author (org-odt-format-author author)) + (insert author)) + (insert (org-odt-format-tags + '("" . "") + (org-odt-iso-date-from-org-timestamp + (or date (plist-get org-lparse-opt-plist :date))))) + (org-lparse-begin-paragraph)) + +(defun org-odt-end-annotation () + (org-lparse-insert-tag "")) + +(defun org-odt-begin-environment (style env-options-plist) + (case style + (annotation + (org-lparse-stash-save-paragraph-state) + (org-odt-begin-annotation (plist-get env-options-plist 'author) + (plist-get env-options-plist 'date))) + ((blockquote verse center quote) + (org-lparse-begin-paragraph style) + (list)) + ((fixedwidth native) + (org-lparse-end-paragraph) + (list)) + (t (error "Unknown environment %s" style)))) + +(defun org-odt-end-environment (style env-options-plist) + (case style + (annotation + (org-lparse-end-paragraph) + (org-odt-end-annotation) + (org-lparse-stash-pop-paragraph-state)) + ((blockquote verse center quote) + (org-lparse-end-paragraph) + (list)) + ((fixedwidth native) + (org-lparse-begin-paragraph) + (list)) + (t (error "Unknown environment %s" style)))) + +(defvar org-lparse-list-level) ; dynamically bound in org-do-lparse +(defun org-odt-begin-list (ltype) + (setq ltype (or (org-lparse-html-list-type-to-canonical-list-type ltype) + ltype)) + (let* ((style-name (org-odt-get-style-name-for-entity 'list ltype)) + (extra (concat (when (= org-lparse-list-level 1) + " text:continue-numbering=\"false\"") + (when style-name + (format " text:style-name=\"%s\"" style-name))))) + (case ltype + ((ordered unordered description) + (org-lparse-end-paragraph) + (org-lparse-insert-tag "" extra)) + (t (error "Unknown list type: %s" ltype))))) + +(defun org-odt-end-list (ltype) + (setq ltype (or (org-lparse-html-list-type-to-canonical-list-type ltype) + ltype)) + (if ltype + (org-lparse-insert-tag "") + (error "Unknown list type: %s" ltype))) + +(defun org-odt-begin-list-item (ltype &optional arg headline) + (setq ltype (or (org-lparse-html-list-type-to-canonical-list-type ltype) + ltype)) + (case ltype + (ordered + (assert (not headline) t) + (let* ((counter arg) (extra "")) + (org-lparse-insert-tag "") + (org-lparse-begin-paragraph))) + (unordered + (let* ((id arg) (extra "")) + (org-lparse-insert-tag "") + (org-lparse-begin-paragraph) + (insert (if headline (org-odt-format-target headline id) + (org-odt-format-bookmark "" id))))) + (description + (assert (not headline) t) + (let ((term (or arg "(no term)"))) + (insert + (org-odt-format-tags + '("" . "") + (org-odt-format-stylized-paragraph 'definition-term term))) + (org-lparse-begin-list-item 'unordered) + (org-lparse-begin-list 'description) + (org-lparse-begin-list-item 'unordered))) + (t (error "Unknown list type")))) + +(defun org-odt-end-list-item (ltype) + (setq ltype (or (org-lparse-html-list-type-to-canonical-list-type ltype) + ltype)) + (case ltype + ((ordered unordered) + (org-lparse-insert-tag "")) + (description + (org-lparse-end-list-item-1) + (org-lparse-end-list 'description) + (org-lparse-end-list-item-1)) + (t (error "Unknown list type")))) + +;; Following variables are let bound when table emission is in +;; progress. See org-lparse.el. +(defvar org-lparse-table-begin-marker) +(defvar org-lparse-table-ncols) +(defvar org-lparse-table-rowgrp-open) +(defvar org-lparse-table-rownum) +(defvar org-lparse-table-cur-rowgrp-is-hdr) +(defvar org-lparse-table-is-styled) +(defvar org-lparse-table-rowgrp-info) +(defvar org-lparse-table-colalign-vector) + +(defvar org-odt-table-style nil + "Table style specified by \"#+ATTR_ODT: \" line. +This is set during `org-odt-begin-table'.") + +(defvar org-odt-table-style-spec nil + "Entry for `org-odt-table-style' in `org-export-odt-table-styles'.") + +(defcustom org-export-odt-table-styles + '(("OrgEquation" "OrgEquation" + ((use-first-column-styles . t) + (use-last-column-styles . t)))) + "Specify how Table Styles should be derived from a Table Template. +This is a list where each element is of the +form (TABLE-STYLE-NAME TABLE-TEMPLATE-NAME TABLE-CELL-OPTIONS). + +TABLE-STYLE-NAME is the style associated with the table through +`org-odt-table-style'. + +TABLE-TEMPLATE-NAME is a set of - upto 9 - automatic +TABLE-CELL-STYLE-NAMEs and PARAGRAPH-STYLE-NAMEs (as defined +below) that is included in +`org-export-odt-content-template-file'. + +TABLE-CELL-STYLE-NAME := TABLE-TEMPLATE-NAME + TABLE-CELL-TYPE + + \"TableCell\" +PARAGRAPH-STYLE-NAME := TABLE-TEMPLATE-NAME + TABLE-CELL-TYPE + + \"TableParagraph\" +TABLE-CELL-TYPE := \"FirstRow\" | \"LastColumn\" | + \"FirstRow\" | \"LastRow\" | + \"EvenRow\" | \"OddRow\" | + \"EvenColumn\" | \"OddColumn\" | \"\" +where \"+\" above denotes string concatenation. + +TABLE-CELL-OPTIONS is an alist where each element is of the +form (TABLE-CELL-STYLE-SELECTOR . ON-OR-OFF). +TABLE-CELL-STYLE-SELECTOR := `use-first-row-styles' | + `use-last-row-styles' | + `use-first-column-styles' | + `use-last-column-styles' | + `use-banding-rows-styles' | + `use-banding-columns-styles' | + `use-first-row-styles' +ON-OR-OFF := `t' | `nil' + +For example, with the following configuration + +\(setq org-export-odt-table-styles + '\(\(\"TableWithHeaderRowsAndColumns\" \"Custom\" + \(\(use-first-row-styles . t\) + \(use-first-column-styles . t\)\)\) + \(\"TableWithHeaderColumns\" \"Custom\" + \(\(use-first-column-styles . t\)\)\)\)\) + +1. A table associated with \"TableWithHeaderRowsAndColumns\" + style will use the following table-cell styles - + \"CustomFirstRowTableCell\", \"CustomFirstColumnTableCell\", + \"CustomTableCell\" and the following paragraph styles + \"CustomFirstRowTableParagraph\", + \"CustomFirstColumnTableParagraph\", \"CustomTableParagraph\" + as appropriate. + +2. A table associated with \"TableWithHeaderColumns\" style will + use the following table-cell styles - + \"CustomFirstColumnTableCell\", \"CustomTableCell\" and the + following paragraph styles + \"CustomFirstColumnTableParagraph\", \"CustomTableParagraph\" + as appropriate.. + +Note that TABLE-TEMPLATE-NAME corresponds to the +\"\" elements contained within +\"\". The entries (TABLE-STYLE-NAME +TABLE-TEMPLATE-NAME TABLE-CELL-OPTIONS) correspond to +\"table:template-name\" and \"table:use-first-row-styles\" etc +attributes of \"\" element. Refer ODF-1.2 +specification for more information. Also consult the +implementation filed under `org-odt-get-table-cell-styles'. + +The TABLE-STYLE-NAME \"OrgEquation\" is used internally for +formatting of numbered display equations. Do not delete this +style from the list." + :group 'org-export-odt + :type '(choice + (const :tag "None" nil) + (repeat :tag "Table Styles" + (list :tag "Table Style Specification" + (string :tag "Table Style Name") + (string :tag "Table Template Name") + (alist :options (use-first-row-styles + use-last-row-styles + use-first-column-styles + use-last-column-styles + use-banding-rows-styles + use-banding-columns-styles) + :key-type symbol + :value-type (const :tag "True" t)))))) + +(defun org-odt-begin-table (caption label attributes) + (setq org-odt-table-style attributes) + (setq org-odt-table-style-spec + (assoc org-odt-table-style org-export-odt-table-styles)) + (when label + (insert + (org-odt-format-stylized-paragraph + 'table (org-odt-format-entity-caption label caption "__Table__")))) + (org-lparse-insert-tag + "" + (or label "") (or (nth 1 org-odt-table-style-spec) "OrgTable")) + (setq org-lparse-table-begin-marker (point))) + +(defvar org-lparse-table-colalign-info) +(defun org-odt-end-table () + (goto-char org-lparse-table-begin-marker) + (loop for level from 0 below org-lparse-table-ncols + do (let* ((col-cookie (and org-lparse-table-is-styled + (cdr (assoc (1+ level) + org-lparse-table-colalign-info)))) + (extra-columns (or (nth 1 col-cookie) 0))) + (dotimes (i (1+ extra-columns)) + (insert + (org-odt-format-tags + "" + "" (or (nth 1 org-odt-table-style-spec) "OrgTable")))) + (insert "\n"))) + ;; fill style attributes for table cells + (when org-lparse-table-is-styled + (while (re-search-forward "@@\\(table-cell:p\\|table-cell:style-name\\)@@\\([0-9]+\\)@@\\([0-9]+\\)@@" nil t) + (let* ((spec (match-string 1)) + (r (string-to-number (match-string 2))) + (c (string-to-number (match-string 3))) + (cell-styles (org-odt-get-table-cell-styles + r c org-odt-table-style-spec)) + (table-cell-style (car cell-styles)) + (table-cell-paragraph-style (cdr cell-styles))) + (cond + ((equal spec "table-cell:p") + (replace-match table-cell-paragraph-style t t)) + ((equal spec "table-cell:style-name") + (replace-match table-cell-style t t)))))) + (goto-char (point-max)) + (org-lparse-insert-tag "")) + +(defun org-odt-begin-table-rowgroup (&optional is-header-row) + (when org-lparse-table-rowgrp-open + (org-lparse-end 'TABLE-ROWGROUP)) + (org-lparse-insert-tag (if is-header-row + "" + "")) + (setq org-lparse-table-rowgrp-open t) + (setq org-lparse-table-cur-rowgrp-is-hdr is-header-row)) + +(defun org-odt-end-table-rowgroup () + (when org-lparse-table-rowgrp-open + (setq org-lparse-table-rowgrp-open nil) + (org-lparse-insert-tag + (if org-lparse-table-cur-rowgrp-is-hdr + "" "")))) + +(defun org-odt-format-table-row (row) + (org-odt-format-tags + '("" . "") row)) + +(defun org-odt-get-table-cell-styles (r c &optional style-spec) + "Retrieve styles applicable to a table cell. +R and C are (zero-based) row and column numbers of the table +cell. STYLE-SPEC is an entry in `org-export-odt-table-styles' +applicable to the current table. It is `nil' if the table is not +associated with any style attributes. + +Return a cons of (TABLE-CELL-STYLE-NAME . PARAGRAPH-STYLE-NAME). + +When STYLE-SPEC is nil, style the table cell the conventional way +- choose cell borders based on row and column groupings and +choose paragraph alignment based on `org-col-cookies' text +property. See also +`org-odt-get-paragraph-style-cookie-for-table-cell'. + +When STYLE-SPEC is non-nil, ignore the above cookie and return +styles congruent with the ODF-1.2 specification." + (cond + (style-spec + + ;; LibreOffice - particularly the Writer - honors neither table + ;; templates nor custom table-cell styles. Inorder to retain + ;; inter-operability with LibreOffice, only automatic styles are + ;; used for styling of table-cells. The current implementation is + ;; congruent with ODF-1.2 specification and hence is + ;; future-compatible. + + ;; Additional Note: LibreOffice's AutoFormat facility for tables - + ;; which recognizes as many as 16 different cell types - is much + ;; richer. Unfortunately it is NOT amenable to easy configuration + ;; by hand. + + (let* ((template-name (nth 1 style-spec)) + (cell-style-selectors (nth 2 style-spec)) + (cell-type + (cond + ((and (cdr (assoc 'use-first-column-styles cell-style-selectors)) + (= c 0)) "FirstColumn") + ((and (cdr (assoc 'use-last-column-styles cell-style-selectors)) + (= c (1- org-lparse-table-ncols))) "LastColumn") + ((and (cdr (assoc 'use-first-row-styles cell-style-selectors)) + (= r 0)) "FirstRow") + ((and (cdr (assoc 'use-last-row-styles cell-style-selectors)) + (= r org-lparse-table-rownum)) + "LastRow") + ((and (cdr (assoc 'use-banding-rows-styles cell-style-selectors)) + (= (% r 2) 1)) "EvenRow") + ((and (cdr (assoc 'use-banding-rows-styles cell-style-selectors)) + (= (% r 2) 0)) "OddRow") + ((and (cdr (assoc 'use-banding-columns-styles cell-style-selectors)) + (= (% c 2) 1)) "EvenColumn") + ((and (cdr (assoc 'use-banding-columns-styles cell-style-selectors)) + (= (% c 2) 0)) "OddColumn") + (t "")))) + (cons + (concat template-name cell-type "TableCell") + (concat template-name cell-type "TableParagraph")))) + (t + (cons + (concat + "OrgTblCell" + (cond + ((= r 0) "T") + ((eq (cdr (assoc r org-lparse-table-rowgrp-info)) :start) "T") + (t "")) + (when (= r org-lparse-table-rownum) "B") + (cond + ((= c 0) "") + ((or (memq (nth c org-table-colgroup-info) '(:start :startend)) + (memq (nth (1- c) org-table-colgroup-info) '(:end :startend))) "L") + (t ""))) + (capitalize (aref org-lparse-table-colalign-vector c)))))) + +(defun org-odt-get-paragraph-style-cookie-for-table-cell (r c) + (concat + (and (not org-odt-table-style-spec) + (cond + (org-lparse-table-cur-rowgrp-is-hdr "OrgTableHeading") + ((and (= c 0) (org-lparse-get 'TABLE-FIRST-COLUMN-AS-LABELS)) + "OrgTableHeading") + (t "OrgTableContents"))) + (and org-lparse-table-is-styled + (format "@@table-cell:p@@%03d@@%03d@@" r c)))) + +(defun org-odt-get-style-name-cookie-for-table-cell (r c) + (when org-lparse-table-is-styled + (format "@@table-cell:style-name@@%03d@@%03d@@" r c))) + +(defun org-odt-format-table-cell (data r c horiz-span) + (concat + (let* ((paragraph-style-cookie + (org-odt-get-paragraph-style-cookie-for-table-cell r c)) + (style-name-cookie + (org-odt-get-style-name-cookie-for-table-cell r c)) + (extra (and style-name-cookie + (format " table:style-name=\"%s\"" style-name-cookie))) + (extra (concat extra + (and (> horiz-span 0) + (format " table:number-columns-spanned=\"%d\"" + (1+ horiz-span)))))) + (org-odt-format-tags + '("" . "") + (if org-lparse-list-table-p data + (org-odt-format-stylized-paragraph paragraph-style-cookie data)) extra)) + (let (s) + (dotimes (i horiz-span) + (setq s (concat s "\n"))) s) + "\n")) + +(defun org-odt-begin-footnote-definition (n) + (org-lparse-begin-paragraph 'footnote)) + +(defun org-odt-end-footnote-definition (n) + (org-lparse-end-paragraph)) + +(defun org-odt-begin-toc (lang-specific-heading max-level) + (insert + (format " + + + %s +" max-level lang-specific-heading)) + (loop for level from 1 upto 10 + do (insert (format + " + + + + + + +" level level))) + + (insert + (format " + + + + + %s + +" lang-specific-heading))) + +(defun org-odt-end-toc () + (insert " + + +")) + +(defun org-odt-format-toc-entry (snumber todo headline tags href) + (setq headline (concat + (and org-export-with-section-numbers + (concat snumber ". ")) + headline + (and tags + (concat + (org-lparse-format 'SPACES 3) + (org-lparse-format 'FONTIFY tags "tag"))))) + (when todo + (setq headline (org-lparse-format 'FONTIFY headline "todo"))) + + (let ((org-odt-suppress-xref t)) + (org-odt-format-link headline (concat "#" href)))) + +(defun org-odt-format-toc-item (toc-entry level org-last-level) + (let ((style (format "Contents_20_%d" + (+ level (or (org-lparse-get 'TOPLEVEL-HLEVEL) 1) -1)))) + (insert "\n" (org-odt-format-stylized-paragraph style toc-entry) "\n"))) + +;; Following variable is let bound during 'ORG-LINK callback. See +;; org-html.el +(defvar org-lparse-link-description-is-image nil) +(defun org-odt-format-link (desc href &optional attr) + (cond + ((and (= (string-to-char href) ?#) (not org-odt-suppress-xref)) + (setq href (concat org-export-odt-bookmark-prefix (substring href 1))) + (let ((xref-format "text")) + (when (numberp desc) + (setq desc (format "%d" desc) xref-format "number")) + (org-odt-format-tags + '("" . + "") + desc xref-format href))) + (org-lparse-link-description-is-image + (org-odt-format-tags + '("" . "") + desc href (or attr ""))) + (t + (org-odt-format-tags + '("" . "") + desc href (or attr ""))))) + +(defun org-odt-format-spaces (n) + (cond + ((= n 1) " ") + ((> n 1) (concat + " " (org-odt-format-tags "" "" (1- n)))) + (t ""))) + +(defun org-odt-format-tabs (&optional n) + (let ((tab "") + (n (or n 1))) + (insert tab))) + +(defun org-odt-format-line-break () + (org-odt-format-tags "" "")) + +(defun org-odt-format-horizontal-line () + (org-odt-format-stylized-paragraph 'horizontal-line "")) + +(defun org-odt-encode-plain-text (line &optional no-whitespace-filling) + (setq line (org-xml-encode-plain-text line)) + (if no-whitespace-filling line + (org-odt-fill-tabs-and-spaces line))) + +(defun org-odt-format-line (line) + (case org-lparse-dyn-current-environment + (fixedwidth (concat + (org-odt-format-stylized-paragraph + 'fixedwidth (org-odt-encode-plain-text line)) "\n")) + (t (concat line "\n")))) + +(defun org-odt-format-comment (fmt &rest args) + (let ((comment (apply 'format fmt args))) + (format "\n\n" comment))) + +(defun org-odt-format-org-entity (wd) + (org-entity-get-representation wd 'utf8)) + +(defun org-odt-fill-tabs-and-spaces (line) + (replace-regexp-in-string + "\\([\t]\\|\\([ ]+\\)\\)" (lambda (s) + (cond + ((string= s "\t") (org-odt-format-tabs)) + (t (org-odt-format-spaces (length s))))) line)) + +(defcustom org-export-odt-fontify-srcblocks t + "Specify whether or not source blocks need to be fontified. +Turn this option on if you want to colorize the source code +blocks in the exported file. For colorization to work, you need +to make available an enhanced version of `htmlfontify' library." + :type 'boolean + :group 'org-export-odt) + +(defun org-odt-format-source-line-with-line-number-and-label + (line rpllbl num fontifier par-style) + + (let ((keep-label (not (numberp rpllbl))) + (ref (org-find-text-property-in-string 'org-coderef line))) + (setq line (concat line (and keep-label ref (format "(%s)" ref)))) + (setq line (funcall fontifier line)) + (when ref + (setq line (org-odt-format-target line (concat "coderef-" ref)))) + (setq line (org-odt-format-stylized-paragraph par-style line)) + (if (not num) line + (org-odt-format-tags '("" . "") line)))) + +(defun org-odt-format-source-code-or-example-plain + (lines lang caption textareap cols rows num cont rpllbl fmt) + "Format source or example blocks much like fixedwidth blocks. +Use this when `org-export-odt-fontify-srcblocks' option is turned +off." + (let* ((lines (org-split-string lines "[\r\n]")) + (line-count (length lines)) + (i 0)) + (mapconcat + (lambda (line) + (incf i) + (org-odt-format-source-line-with-line-number-and-label + line rpllbl num 'org-odt-encode-plain-text + (if (= i line-count) "OrgFixedWidthBlockLastLine" + "OrgFixedWidthBlock"))) + lines "\n"))) + +(defvar org-src-block-paragraph-format + " + + + + + " + "Custom paragraph style for colorized source and example blocks. +This style is much the same as that of \"OrgFixedWidthBlock\" +except that the foreground and background colors are set +according to the default face identified by the `htmlfontify'.") + +(defun org-odt-hfy-face-to-css (fn) + "Create custom style for face FN. +When FN is the default face, use it's foreground and background +properties to create \"OrgSrcBlock\" paragraph style. Otherwise +use it's color attribute to create a character style whose name +is obtained from FN. Currently all attributes of FN other than +color are ignored. + +The style name for a face FN is derived using the following +operations on the face name in that order - de-dash, CamelCase +and prefix with \"OrgSrc\". For example, +`font-lock-function-name-face' is associated with +\"OrgSrcFontLockFunctionNameFace\"." + (let* ((css-list (hfy-face-to-style fn)) + (style-name ((lambda (fn) + (concat "OrgSrc" + (mapconcat + 'capitalize (split-string + (hfy-face-or-def-to-name fn) "-") + ""))) fn)) + (color-val (cdr (assoc "color" css-list))) + (background-color-val (cdr (assoc "background" css-list))) + (style (and org-export-odt-create-custom-styles-for-srcblocks + (cond + ((eq fn 'default) + (format org-src-block-paragraph-format + background-color-val color-val)) + (t + (format + " + + + " style-name color-val)))))) + (cons style-name style))) + +(defun org-odt-insert-custom-styles-for-srcblocks (styles) + "Save STYLES used for colorizing of source blocks. +Update styles.xml with styles that were collected as part of +`org-odt-hfy-face-to-css' callbacks." + (when styles + (with-current-buffer + (find-file-noselect (expand-file-name "styles.xml") t) + (goto-char (point-min)) + (when (re-search-forward "" nil t) + (goto-char (match-beginning 0)) + (insert "\n\n" styles "\n"))))) + +(defun org-odt-format-source-code-or-example-colored + (lines lang caption textareap cols rows num cont rpllbl fmt) + "Format source or example blocks using `htmlfontify-string'. +Use this routine when `org-export-odt-fontify-srcblocks' option +is turned on." + (let* ((lang-m (and lang (or (cdr (assoc lang org-src-lang-modes)) lang))) + (mode (and lang-m (intern (concat (if (symbolp lang-m) + (symbol-name lang-m) + lang-m) "-mode")))) + (org-inhibit-startup t) + (org-startup-folded nil) + (lines (with-temp-buffer + (insert lines) + (if (functionp mode) (funcall mode) (fundamental-mode)) + (font-lock-fontify-buffer) + (buffer-string))) + (hfy-html-quote-regex "\\([<\"&> ]\\)") + (hfy-html-quote-map '(("\"" """) + ("<" "<") + ("&" "&") + (">" ">") + (" " "") + (" " ""))) + (hfy-face-to-css 'org-odt-hfy-face-to-css) + (hfy-optimisations-1 (copy-seq hfy-optimisations)) + (hfy-optimisations (add-to-list 'hfy-optimisations-1 + 'body-text-only)) + (hfy-begin-span-handler + (lambda (style text-block text-id text-begins-block-p) + (insert (format "" style)))) + (hfy-end-span-handler (lambda nil (insert "")))) + (when (fboundp 'htmlfontify-string) + (let* ((lines (org-split-string lines "[\r\n]")) + (line-count (length lines)) + (i 0)) + (mapconcat + (lambda (line) + (incf i) + (org-odt-format-source-line-with-line-number-and-label + line rpllbl num 'htmlfontify-string + (if (= i line-count) "OrgSrcBlockLastLine" "OrgSrcBlock"))) + lines "\n"))))) + +(defun org-odt-format-source-code-or-example (lines lang caption textareap + cols rows num cont + rpllbl fmt) + "Format source or example blocks for export. +Use `org-odt-format-source-code-or-example-plain' or +`org-odt-format-source-code-or-example-colored' depending on the +value of `org-export-odt-fontify-srcblocks." + (setq lines (org-export-number-lines + lines 0 0 num cont rpllbl fmt 'preprocess) + lines (funcall + (or (and org-export-odt-fontify-srcblocks + (or (featurep 'htmlfontify) + (require 'htmlfontify nil t)) + (fboundp 'htmlfontify-string) + 'org-odt-format-source-code-or-example-colored) + 'org-odt-format-source-code-or-example-plain) + lines lang caption textareap cols rows num cont rpllbl fmt)) + (if (not num) lines + (let ((extra (format " text:continue-numbering=\"%s\"" + (if cont "true" "false")))) + (org-odt-format-tags + '("" + . "") lines extra)))) + +(defun org-odt-remap-stylenames (style-name) + (or + (cdr (assoc style-name '(("timestamp-wrapper" . "OrgTimestampWrapper") + ("timestamp" . "OrgTimestamp") + ("timestamp-kwd" . "OrgTimestampKeyword") + ("tag" . "OrgTag") + ("todo" . "OrgTodo") + ("done" . "OrgDone") + ("target" . "OrgTarget")))) + style-name)) + +(defun org-odt-format-fontify (text style &optional id) + (let* ((style-name + (cond + ((stringp style) + (org-odt-remap-stylenames style)) + ((symbolp style) + (org-odt-get-style-name-for-entity 'character style)) + ((listp style) + (assert (< 1 (length style))) + (let ((parent-style (pop style))) + (mapconcat (lambda (s) + ;; (assert (stringp s) t) + (org-odt-remap-stylenames s)) style "") + (org-odt-remap-stylenames parent-style))) + (t (error "Don't how to handle style %s" style))))) + (org-odt-format-tags + '("" . "") + text style-name))) + +(defun org-odt-relocate-relative-path (path dir) + (if (file-name-absolute-p path) path + (file-relative-name (expand-file-name path dir) + (expand-file-name "eyecandy" dir)))) + +(defun org-odt-format-inline-image (thefile) + (let* ((thelink (if (file-name-absolute-p thefile) thefile + (org-xml-format-href + (org-odt-relocate-relative-path + thefile org-current-export-file)))) + (href + (org-odt-format-tags + "" "" + (if org-export-odt-embed-images + (org-odt-copy-image-file thefile) thelink)))) + (org-export-odt-format-image thefile href))) + +(defun org-export-odt-format-formula (src href &optional embed-as) + "Create image tag with source and attributes." + (save-match-data + (let* ((caption (org-find-text-property-in-string 'org-caption src)) + (caption (and caption (org-xml-format-desc caption))) + (label (org-find-text-property-in-string 'org-label src)) + (latex-frag (org-find-text-property-in-string 'org-latex-src src)) + (embed-as (or embed-as + (and latex-frag + (org-find-text-property-in-string + 'org-latex-src-embed-type src)) + (if (or caption label) 'paragraph 'character))) + width height) + (when latex-frag + (setq href (org-propertize href :title "LaTeX Fragment" + :description latex-frag))) + (cond + ((eq embed-as 'character) + (org-odt-format-entity "InlineFormula" href width height)) + (t + (org-lparse-end-paragraph) + (org-lparse-insert-list-table + `((,(org-odt-format-entity + (if caption "CaptionedDisplayFormula" "DisplayFormula") + href width height caption nil) + ,(if (not label) "" + (org-odt-format-entity-caption label nil "__MathFormula__")))) + nil nil nil "OrgEquation" nil '((1 "c" 8) (2 "c" 1))) + (throw 'nextline nil)))))) + +(defvar org-odt-embedded-formulas-count 0) +(defun org-odt-copy-formula-file (path) + "Returns the internal name of the file" + (let* ((src-file (expand-file-name + path (file-name-directory org-current-export-file))) + (target-dir (format "Formula-%04d/" + (incf org-odt-embedded-formulas-count))) + (target-file (concat target-dir "content.xml"))) + (when (not org-lparse-to-buffer) + (message "Embedding %s as %s ..." + (substring-no-properties path) target-file) + + (make-directory target-dir) + (org-odt-create-manifest-file-entry + "application/vnd.oasis.opendocument.formula" target-dir "1.2") + + (case (org-odt-is-formula-link-p src-file) + (mathml + (copy-file src-file target-file 'overwrite)) + (odf + (org-odt-zip-extract-one src-file "content.xml" target-dir)) + (t + (error "%s is not a formula file" src-file))) + + (org-odt-create-manifest-file-entry "text/xml" target-file)) + target-file)) + +(defun org-odt-format-inline-formula (thefile) + (let* ((thelink (if (file-name-absolute-p thefile) thefile + (org-xml-format-href + (org-odt-relocate-relative-path + thefile org-current-export-file)))) + (href + (org-odt-format-tags + "" "" + (file-name-directory (org-odt-copy-formula-file thefile))))) + (org-export-odt-format-formula thefile href))) + +(defun org-odt-is-formula-link-p (file) + (let ((case-fold-search nil)) + (cond + ((string-match "\\.\\(mathml\\|mml\\)\\'" file) + 'mathml) + ((string-match "\\.odf\\'" file) + 'odf)))) + +(defun org-odt-format-org-link (opt-plist type-1 path fragment desc attr + descp) + "Make a OpenDocument link. +OPT-PLIST is an options list. +TYPE-1 is the device-type of the link (THIS://foo.html). +PATH is the path of the link (http://THIS#location). +FRAGMENT is the fragment part of the link, if any (foo.html#THIS). +DESC is the link description, if any. +ATTR is a string of other attributes of the a element." + (declare (special org-lparse-par-open)) + (save-match-data + (let* ((may-inline-p + (and (member type-1 '("http" "https" "file")) + (org-lparse-should-inline-p path descp) + (not fragment))) + (type (if (equal type-1 "id") "file" type-1)) + (filename path) + (thefile path)) + (cond + ;; check for inlined images + ((and (member type '("file")) + (not fragment) + (org-file-image-p + filename org-export-odt-inline-image-extensions) + (or (eq t org-export-odt-inline-images) + (and org-export-odt-inline-images (not descp)))) + (org-odt-format-inline-image thefile)) + ;; check for embedded formulas + ((and (member type '("file")) + (not fragment) + (org-odt-is-formula-link-p filename) + (or (not descp))) + (org-odt-format-inline-formula thefile)) + ((string= type "coderef") + (let* ((ref fragment) + (lineno-or-ref (cdr (assoc ref org-export-code-refs))) + (desc (and descp desc)) + (org-odt-suppress-xref nil) + (href (org-xml-format-href (concat "#coderef-" ref)))) + (cond + ((and (numberp lineno-or-ref) (not desc)) + (org-odt-format-link lineno-or-ref href)) + ((and (numberp lineno-or-ref) desc + (string-match (regexp-quote (concat "(" ref ")")) desc)) + (format (replace-match "%s" t t desc) + (org-odt-format-link lineno-or-ref href))) + (t + (setq desc (format + (if (and desc (string-match + (regexp-quote (concat "(" ref ")")) + desc)) + (replace-match "%s" t t desc) + (or desc "%s")) + lineno-or-ref)) + (org-odt-format-link (org-xml-format-desc desc) href))))) + (t + (when (string= type "file") + (setq thefile + (cond + ((file-name-absolute-p path) + (concat "file://" (expand-file-name path))) + (t (org-odt-relocate-relative-path + thefile org-current-export-file))))) + + (when (and (member type '("" "http" "https" "file")) fragment) + (setq thefile (concat thefile "#" fragment))) + + (setq thefile (org-xml-format-href thefile)) + + (when (not (member type '("" "file"))) + (setq thefile (concat type ":" thefile))) + + (let ((org-odt-suppress-xref nil)) + (org-odt-format-link + (org-xml-format-desc desc) thefile attr))))))) + +(defun org-odt-format-heading (text level &optional id) + (let* ((text (if id (org-odt-format-target text id) text))) + (org-odt-format-tags + '("" . + "") text level level))) + +(defun org-odt-format-headline (title extra-targets tags + &optional snumber level) + (concat + (org-lparse-format 'EXTRA-TARGETS extra-targets) + + ;; No need to generate section numbers. They are auto-generated by + ;; the application + + ;; (concat (org-lparse-format 'SECTION-NUMBER snumber level) " ") + title + (and tags (concat (org-lparse-format 'SPACES 3) + (org-lparse-format 'ORG-TAGS tags))))) + +(defun org-odt-format-anchor (text name &optional class) + (org-odt-format-target text name)) + +(defun org-odt-format-bookmark (text id) + (if id + (org-odt-format-tags "" text id) + text)) + +(defun org-odt-format-target (text id) + (let ((name (concat org-export-odt-bookmark-prefix id))) + (concat + (and id (org-odt-format-tags + "" "" name)) + (org-odt-format-bookmark text id) + (and id (org-odt-format-tags + "" "" name))))) + +(defun org-odt-format-footnote (n def) + (let ((id (concat "fn" n)) + (note-class "footnote") + (par-style "Footnote")) + (org-odt-format-tags + '("" . + "") + (concat + (org-odt-format-tags + '("" . "") + n) + (org-odt-format-tags + '("" . "") + def)) + id note-class))) + +(defun org-odt-format-footnote-reference (n def refcnt) + (if (= refcnt 1) + (org-odt-format-footnote n def) + (org-odt-format-footnote-ref n))) + +(defun org-odt-format-footnote-ref (n) + (let ((note-class "footnote") + (ref-format "text") + (ref-name (concat "fn" n))) + (org-odt-format-tags + '("" . "") + (org-odt-format-tags + '("" . "") + n note-class ref-format ref-name) + "OrgSuperscript"))) + +(defun org-odt-get-image-name (file-name) + (require 'sha1) + (file-relative-name + (expand-file-name + (concat (sha1 file-name) "." (file-name-extension file-name)) "Pictures"))) + +(defun org-export-odt-format-image (src href &optional embed-as) + "Create image tag with source and attributes." + (save-match-data + (let* ((caption (org-find-text-property-in-string 'org-caption src)) + (caption (and caption (org-xml-format-desc caption))) + (attr (org-find-text-property-in-string 'org-attributes src)) + (label (org-find-text-property-in-string 'org-label src)) + (latex-frag (org-find-text-property-in-string + 'org-latex-src src)) + (category (and latex-frag "__DvipngImage__")) + (embed-as (or embed-as + (if latex-frag + (or (org-find-text-property-in-string + 'org-latex-src-embed-type src) 'character) + 'paragraph))) + (attr-plist (org-lparse-get-block-params attr)) + (size (org-odt-image-size-from-file + src (plist-get attr-plist :width) + (plist-get attr-plist :height) + (plist-get attr-plist :scale) nil embed-as)) + (width (car size)) (height (cdr size))) + (when latex-frag + (setq href (org-propertize href :title "LaTeX Fragment" + :description latex-frag))) + (cond + ((not (or caption label)) + (case embed-as + (paragraph (org-odt-format-entity "DisplayImage" href width height)) + (character (org-odt-format-entity "InlineImage" href width height)) + (t (error "Unknown value for embed-as %S" embed-as)))) + (t + (org-odt-format-entity + "CaptionedDisplayImage" href width height caption label category)))))) + +(defun org-odt-format-object-description (title description) + (concat (and title (org-odt-format-tags + '("" . "") + (org-odt-encode-plain-text title t))) + (and description (org-odt-format-tags + '("" . "") + (org-odt-encode-plain-text description t))))) + +(defun org-odt-format-frame (text width height style &optional + extra anchor-type) + (let ((frame-attrs + (concat + (if width (format " svg:width=\"%0.2fcm\"" width) "") + (if height (format " svg:height=\"%0.2fcm\"" height) "") + extra + (format " text:anchor-type=\"%s\"" (or anchor-type "paragraph"))))) + (org-odt-format-tags + '("" . "") + (concat text (org-odt-format-object-description + (get-text-property 0 :title text) + (get-text-property 0 :description text))) + style frame-attrs))) + +(defun org-odt-format-textbox (text width height style &optional + extra anchor-type) + (org-odt-format-frame + (org-odt-format-tags + '("" . "") + text (concat (format " fo:min-height=\"%0.2fcm\"" (or height .2)) + (format " fo:min-width=\"%0.2fcm\"" (or width .2)))) + width nil style extra anchor-type)) + +(defun org-odt-format-inlinetask (heading content + &optional todo priority tags) + (org-odt-format-stylized-paragraph + nil (org-odt-format-textbox + (concat (org-odt-format-stylized-paragraph + "OrgInlineTaskHeading" + (org-lparse-format + 'HEADLINE (concat (org-lparse-format-todo todo) " " heading) + nil tags)) + content) nil nil "OrgInlineTaskFrame" " style:rel-width=\"100%\""))) + +(defvar org-odt-entity-frame-styles + '(("InlineImage" "__Figure__" ("OrgInlineImage" nil "as-char")) + ("DisplayImage" "__Figure__" ("OrgDisplayImage" nil "paragraph")) + ("CaptionedDisplayImage" "__Figure__" + ("OrgCaptionedImage" + " style:rel-width=\"100%\" style:rel-height=\"scale\"" "paragraph") + ("OrgImageCaptionFrame")) + ("InlineFormula" "__MathFormula__" ("OrgInlineFormula" nil "as-char")) + ("DisplayFormula" "__MathFormula__" ("OrgDisplayFormula" nil "as-char")) + ("CaptionedDisplayFormula" "__MathFormula__" + ("OrgCaptionedFormula" nil "paragraph") + ("OrgFormulaCaptionFrame" nil "as-char")))) + +(defun org-odt-format-entity (entity href width height + &optional caption label category) + (let* ((entity-style (assoc entity org-odt-entity-frame-styles)) + (entity-frame (apply 'org-odt-format-frame + href width height (nth 2 entity-style)))) + (if (not (or caption label)) entity-frame + (apply 'org-odt-format-textbox + (org-odt-format-stylized-paragraph + 'illustration + (concat entity-frame + (org-odt-format-entity-caption + label caption (or category (nth 1 entity-style))))) + width height (nth 3 entity-style))))) + +(defvar org-odt-embedded-images-count 0) +(defun org-odt-copy-image-file (path) + "Returns the internal name of the file" + (let* ((image-type (file-name-extension path)) + (media-type (format "image/%s" image-type)) + (src-file (expand-file-name + path (file-name-directory org-current-export-file))) + (target-dir "Images/") + (target-file + (format "%s%04d.%s" target-dir + (incf org-odt-embedded-images-count) image-type))) + (when (not org-lparse-to-buffer) + (message "Embedding %s as %s ..." + (substring-no-properties path) target-file) + + (when (= 1 org-odt-embedded-images-count) + (make-directory target-dir) + (org-odt-create-manifest-file-entry "" target-dir)) + + (copy-file src-file target-file 'overwrite) + (org-odt-create-manifest-file-entry media-type target-file)) + target-file)) + +(defvar org-export-odt-image-size-probe-method + '(emacs imagemagick force) + "Ordered list of methods by for determining size of an embedded + image.") + +(defvar org-export-odt-default-image-sizes-alist + '(("character" . (5 . 0.4)) + ("paragraph" . (5 . 5))) + "Hardcoded image dimensions one for each of the anchor + methods.") + +;; A4 page size is 21.0 by 29.7 cms +;; The default page settings has 2cm margin on each of the sides. So +;; the effective text area is 17.0 by 25.7 cm +(defvar org-export-odt-max-image-size '(17.0 . 20.0) + "Limiting dimensions for an embedded image.") + +(defun org-odt-do-image-size (probe-method file &optional dpi anchor-type) + (setq dpi (or dpi org-export-odt-pixels-per-inch)) + (setq anchor-type (or anchor-type "paragraph")) + (flet ((size-in-cms (size-in-pixels) + (flet ((pixels-to-cms (pixels) + (let* ((cms-per-inch 2.54) + (inches (/ pixels dpi))) + (* cms-per-inch inches)))) + (and size-in-pixels + (cons (pixels-to-cms (car size-in-pixels)) + (pixels-to-cms (cdr size-in-pixels))))))) + (case probe-method + (emacs + (size-in-cms (ignore-errors (image-size (create-image file) 'pixels)))) + (imagemagick + (size-in-cms + (let ((dim (shell-command-to-string + (format "identify -format \"%%w:%%h\" \"%s\"" file)))) + (when (string-match "\\([0-9]+\\):\\([0-9]+\\)" dim) + (cons (string-to-number (match-string 1 dim)) + (string-to-number (match-string 2 dim))))))) + (t + (cdr (assoc-string anchor-type + org-export-odt-default-image-sizes-alist)))))) + +(defun org-odt-image-size-from-file (file &optional user-width + user-height scale dpi embed-as) + (unless (file-name-absolute-p file) + (setq file (expand-file-name + file (file-name-directory org-current-export-file)))) + (let* (size width height) + (unless (and user-height user-width) + (loop for probe-method in org-export-odt-image-size-probe-method + until size + do (setq size (org-odt-do-image-size + probe-method file dpi embed-as))) + (or size (error "Cannot determine Image size. Aborting ...")) + (setq width (car size) height (cdr size))) + (cond + (scale + (setq width (* width scale) height (* height scale))) + ((and user-height user-width) + (setq width user-width height user-height)) + (user-height + (setq width (* user-height (/ width height)) height user-height)) + (user-width + (setq height (* user-width (/ height width)) width user-width)) + (t (ignore))) + ;; ensure that an embedded image fits comfortably within a page + (let ((max-width (car org-export-odt-max-image-size)) + (max-height (cdr org-export-odt-max-image-size))) + (when (or (> width max-width) (> height max-height)) + (let* ((scale1 (/ max-width width)) + (scale2 (/ max-height height)) + (scale (min scale1 scale2))) + (setq width (* scale width) height (* scale height))))) + (cons width height))) + +(defvar org-odt-entity-labels-alist nil + "Associate Labels with the Labelled entities. +Each element of the alist is of the form (LABEL-NAME +CATEGORY-NAME SEQNO LABEL-STYLE-NAME). LABEL-NAME is same as +that specified by \"#+LABEL: ...\" line. CATEGORY-NAME is the +type of the entity that LABEL-NAME is attached to. CATEGORY-NAME +can be one of \"Table\", \"Figure\" or \"Equation\". SEQNO is +the unique number assigned to the referenced entity on a +per-CATEGORY basis. It is generated sequentially and is 1-based. +LABEL-STYLE-NAME is a key `org-odt-label-styles'. + +See `org-odt-add-label-definition' and +`org-odt-fixup-label-references'.") + +(defvar org-odt-entity-counts-plist nil + "Plist of running counters of SEQNOs for each of the CATEGORY-NAMEs. +See `org-odt-entity-labels-alist' for known CATEGORY-NAMEs.") + +(defvar org-odt-label-styles + '(("text" "(%n)" "text" "(%n)") + ("category-and-value" "%e %n%c" "category-and-value" "%e %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 +\" SEQNO \". %c is replaced +with CAPTION. See `org-odt-format-label-definition'. + +LABEL-REF-MODE and LABEL-REF-FMT controls how label references +are generated. The following XML is generated for a label +reference - \" LABEL-REF-FMT +\". LABEL-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'.") + +(defvar org-odt-category-map-alist + '(("__Table__" "Table" "category-and-value") + ("__Figure__" "Figure" "category-and-value") + ("__MathFormula__" "Equation" "text") + ("__DvipngImage__" "Equation" "category-and-value")) + "Map a CATEGORY-HANDLE to CATEGORY-NAME and LABEL-STYLE. +This is an alist where each element is of the form +\\(CATEGORY-HANDLE CATEGORY-NAME LABEL-STYLE\\). CATEGORY_HANDLE +could either be one of the internal handles (as seen above) or be +derived from the \"#+LABEL:\" specification. See +`org-export-odt-get-category-from-label'. CATEGORY-NAME and +LABEL-STYLE are used for generating ODT labels. See +`org-odt-label-styles'.") + +(defvar org-export-odt-user-categories + '("Illustration" "Table" "Text" "Drawing" "Equation" "Figure")) + +(defvar org-export-odt-get-category-from-label nil + "Should category of label be inferred from label itself. +When this option is non-nil, a label is parsed in to two +component parts delimited by a \":\" (colon) as shown here - +#+LABEL:[CATEGORY-HANDLE:]EXTRA. The CATEGORY-HANDLE is mapped +to a CATEGORY-NAME and LABEL-STYLE using +`org-odt-category-map-alist'. (If no such map is provided and +CATEGORY-NAME is set to CATEGORY-HANDLE and LABEL-STYLE is set to +\"category-and-value\"). If CATEGORY-NAME so obtained is listed +under `org-export-odt-user-categories' then the user specified +styles are used. Otherwise styles as determined by the internal +CATEGORY-HANDLE is used. See +`org-odt-get-label-category-and-style' for details.") + +(defun org-odt-get-label-category-and-style (label default-category) + "See `org-export-odt-get-category-from-label'." + (let ((default-category-map + (assoc default-category org-odt-category-map-alist)) + user-category user-category-map category) + (cond + ((not org-export-odt-get-category-from-label) + default-category-map) + ((not (setq user-category + (save-match-data + (and (string-match "\\`\\(.*\\):.+" label) + (match-string 1 label))))) + default-category-map) + (t + (setq user-category-map + (or (assoc user-category org-odt-category-map-alist) + (list nil user-category "category-and-value")) + category (nth 1 user-category-map)) + (if (member category org-export-odt-user-categories) + user-category-map + default-category-map))))) + +(defun org-odt-add-label-definition (label default-category) + "Create an entry in `org-odt-entity-labels-alist' and return it." + (setq label (substring-no-properties label)) + (let* ((label-props (org-odt-get-label-category-and-style + label default-category)) + (category (nth 1 label-props)) + (counter category) + (label-style (nth 2 label-props)) + (sequence-var (intern (mapconcat + 'downcase + (org-split-string counter) "-"))) + (seqno (1+ (or (plist-get org-odt-entity-counts-plist sequence-var) + 0))) + (label-props (list label category seqno label-style))) + (setq org-odt-entity-counts-plist + (plist-put org-odt-entity-counts-plist sequence-var seqno)) + (push label-props org-odt-entity-labels-alist) + label-props)) + +(defun org-odt-format-label-definition (caption label category seqno label-style) + (assert label) + (format-spec + (cadr (assoc-string label-style org-odt-label-styles t)) + `((?e . ,category) + (?n . ,(org-odt-format-tags + '("" . "") + (format "%d" seqno) label category category)) + (?c . ,(or (and caption (concat ": " caption)) ""))))) + +(defun org-odt-format-label-reference (label category seqno label-style) + (assert label) + (save-match-data + (let* ((fmt (cddr (assoc-string label-style org-odt-label-styles t))) + (fmt1 (car fmt)) + (fmt2 (cadr fmt))) + (org-odt-format-tags + '("" + . "") + (format-spec fmt2 `((?e . ,category) + (?n . ,(format "%d" seqno)))) fmt1 label)))) + +(defun org-odt-fixup-label-references () + (goto-char (point-min)) + (while (re-search-forward + "[ \t\n]*" + nil t) + (let* ((label (match-string 1)) + (label-def (assoc label org-odt-entity-labels-alist)) + (rpl (and label-def + (apply 'org-odt-format-label-reference label-def)))) + (if rpl (replace-match rpl t t) + (org-lparse-warn + (format "Unable to resolve reference to label \"%s\"" label)))))) + +(defun org-odt-format-entity-caption (label caption category) + (or (and label + (apply 'org-odt-format-label-definition + caption (org-odt-add-label-definition label category))) + caption "")) + +(defun org-odt-format-tags (tag text &rest args) + (let ((prefix (when org-lparse-encode-pending "@")) + (suffix (when org-lparse-encode-pending "@"))) + (apply 'org-lparse-format-tags tag text prefix suffix args))) + +(defvar org-odt-manifest-file-entries nil) +(defun org-odt-init-outfile (filename) + (unless (executable-find "zip") + ;; Not at all OSes ship with zip by default + (error "Executable \"zip\" needed for creating OpenDocument files")) + + (let* ((outdir (make-temp-file + (format org-export-odt-tmpdir-prefix org-lparse-backend) t)) + (content-file (expand-file-name "content.xml" outdir))) + + ;; init conten.xml + (with-current-buffer (find-file-noselect content-file t)) + + ;; reset variables + (setq org-odt-manifest-file-entries nil + org-odt-embedded-images-count 0 + org-odt-embedded-formulas-count 0 + org-odt-entity-labels-alist nil + org-odt-entity-counts-plist nil) + content-file)) + +(defcustom org-export-odt-prettify-xml nil + "Specify whether or not the xml output should be prettified. +When this option is turned on, `indent-region' is run on all +component xml buffers before they are saved. Turn this off for +regular use. Turn this on if you need to examine the xml +visually." + :group 'org-export-odt + :type 'boolean) + +(defvar hfy-user-sheet-assoc) ; bound during org-do-lparse +(defun org-odt-save-as-outfile (target opt-plist) + ;; write meta file + (org-odt-update-meta-file opt-plist) + + ;; write styles file + (when (equal org-lparse-backend 'odt) + (org-odt-update-styles-file opt-plist)) + + ;; create mimetype file + (let ((mimetype (org-odt-write-mimetype-file org-lparse-backend))) + (org-odt-create-manifest-file-entry mimetype "/" "1.2")) + + ;; create a manifest entry for content.xml + (org-odt-create-manifest-file-entry "text/xml" "content.xml") + + ;; write out the manifest entries before zipping + (org-odt-write-manifest-file) + + (let ((xml-files '("mimetype" "META-INF/manifest.xml" "content.xml" + "meta.xml")) + (zipdir default-directory)) + (when (equal org-lparse-backend 'odt) + (push "styles.xml" xml-files)) + (message "Switching to directory %s" (expand-file-name zipdir)) + + ;; save all xml files + (mapc (lambda (file) + (with-current-buffer + (find-file-noselect (expand-file-name file) t) + ;; prettify output if needed + (when org-export-odt-prettify-xml + (indent-region (point-min) (point-max))) + (save-buffer 0))) + xml-files) + + (let* ((target-name (file-name-nondirectory target)) + (target-dir (file-name-directory target)) + (cmds `(("zip" "-mX0" ,target-name "mimetype") + ("zip" "-rmTq" ,target-name ".")))) + (when (file-exists-p target) + ;; FIXME: If the file is locked this throws a cryptic error + (delete-file target)) + + (let ((coding-system-for-write 'no-conversion) exitcode err-string) + (message "Creating odt file...") + (mapc + (lambda (cmd) + (message "Running %s" (mapconcat 'identity cmd " ")) + (setq err-string + (with-output-to-string + (setq exitcode + (apply 'call-process (car cmd) + nil standard-output nil (cdr cmd))))) + (or (zerop exitcode) + (ignore (message "%s" err-string)) + (error "Unable to create odt file (%S)" exitcode))) + cmds)) + + ;; move the file from outdir to target-dir + (rename-file target-name target-dir) + + ;; kill all xml buffers + (mapc (lambda (file) + (kill-buffer + (find-file-noselect (expand-file-name file zipdir) t))) + xml-files) + + (delete-directory zipdir))) + (message "Created %s" target) + (set-buffer (find-file-noselect target t))) + +(defconst org-odt-manifest-file-entry-tag + " +") + +(defun org-odt-create-manifest-file-entry (&rest args) + (push args org-odt-manifest-file-entries)) + +(defun org-odt-write-manifest-file () + (make-directory "META-INF") + (let ((manifest-file (expand-file-name "META-INF/manifest.xml"))) + (with-current-buffer + (find-file-noselect manifest-file t) + (insert + " + \n") + (mapc + (lambda (file-entry) + (let* ((version (nth 2 file-entry)) + (extra (if version + (format " manifest:version=\"%s\"" version) + ""))) + (insert + (format org-odt-manifest-file-entry-tag + (nth 0 file-entry) (nth 1 file-entry) extra)))) + org-odt-manifest-file-entries) + (insert "\n")))) + +(defun org-odt-update-meta-file (opt-plist) + (let ((date (org-odt-iso-date-from-org-timestamp + (plist-get opt-plist :date))) + (author (or (plist-get opt-plist :author) "")) + (email (plist-get opt-plist :email)) + (keywords (plist-get opt-plist :keywords)) + (description (plist-get opt-plist :description)) + (title (plist-get opt-plist :title))) + (write-region + (concat + " + + " "\n" + (org-odt-format-author) + (org-odt-format-tags + '("\n" . "") author) + (org-odt-format-tags '("\n" . "") date) + (org-odt-format-tags + '("\n" . "") date) + (org-odt-format-tags '("\n" . "") + (when org-export-creator-info + (format "Org-%s/Emacs-%s" + org-version emacs-version))) + (org-odt-format-tags '("\n" . "") keywords) + (org-odt-format-tags '("\n" . "") description) + (org-odt-format-tags '("\n" . "") title) + "\n" + " " "") + nil (expand-file-name "meta.xml"))) + + ;; create a manifest entry for meta.xml + (org-odt-create-manifest-file-entry "text/xml" "meta.xml")) + +(defun org-odt-update-styles-file (opt-plist) + ;; write styles file + (let ((styles-file (plist-get opt-plist :odt-styles-file))) + (org-odt-copy-styles-file (and styles-file + (read (org-trim styles-file))))) + + ;; Update styles.xml - take care of outline numbering + (with-current-buffer + (find-file-noselect (expand-file-name "styles.xml") t) + ;; Don't make automatic backup of styles.xml file. This setting + ;; prevents the backedup styles.xml file from being zipped in to + ;; odt file. This is more of a hackish fix. Better alternative + ;; would be to fix the zip command so that the output odt file + ;; includes only the needed files and excludes any auto-generated + ;; extra files like backups and auto-saves etc etc. Note that + ;; currently the zip command zips up the entire temp directory so + ;; that any auto-generated files created under the hood ends up in + ;; the resulting odt file. + (set (make-local-variable 'backup-inhibited) t) + + ;; Import local setting of `org-export-with-section-numbers' + (org-lparse-bind-local-variables opt-plist) + (org-odt-configure-outline-numbering + (if org-export-with-section-numbers org-export-headline-levels 0))) + + ;; Write custom stlyes for source blocks + (org-odt-insert-custom-styles-for-srcblocks + (mapconcat + (lambda (style) + (format " %s\n" (cddr style))) + hfy-user-sheet-assoc ""))) + +(defun org-odt-write-mimetype-file (format) + ;; create mimetype file + (let ((mimetype + (case format + (odt "application/vnd.oasis.opendocument.text") + (odf "application/vnd.oasis.opendocument.formula") + (t (error "Unknown OpenDocument backend %S" org-lparse-backend))))) + (write-region mimetype nil (expand-file-name "mimetype")) + mimetype)) + +(defun org-odt-finalize-outfile () + (org-odt-delete-empty-paragraphs)) + +(defun org-odt-delete-empty-paragraphs () + (goto-char (point-min)) + (let ((open "]*>") + (close "")) + (while (re-search-forward (format "%s[ \r\n\t]*%s" open close) nil t) + (replace-match "")))) + +(defcustom org-export-odt-convert-processes + '(("BasicODConverter" + ("soffice" "-norestore" "-invisible" "-headless" + "\"macro:///BasicODConverter.Main.Convert(%I,%f,%O)\"")) + ("unoconv" + ("unoconv" "-f" "%f" "-o" "%d" "%i"))) + "Specify a list of document converters and their usage. +The converters in this list are offered as choices while +customizing `org-export-odt-convert-process'. + +This variable is an alist where each element is of the +form (CONVERTER-NAME CONVERTER-PROCESS). CONVERTER-NAME is name +of the converter. CONVERTER-PROCESS specifies the command-line +syntax of the converter and is of the form (CONVERTER-PROGRAM +ARG1 ARG2 ...). CONVERTER-PROGRAM is the name of the executable. +ARG1, ARG2 etc are command line options that are passed to +CONVERTER-PROGRAM. Format specifiers can be used in the ARGs and +they are interpreted as below: + +%i input file name in full +%I input file name as a URL +%f format of the output file +%o output file name in full +%O output file name as a URL +%d output dir in full +%D output dir as a URL." + :group 'org-export-odt + :type + '(choice + (const :tag "None" nil) + (alist :tag "Converters" + :key-type (string :tag "Converter Name") + :value-type (group (cons (string :tag "Executable") + (repeat (string :tag "Command line args"))))))) + +(defcustom org-export-odt-convert-process nil + "Use this converter to convert from \"odt\" format to other formats. +During customization, the list of converter names are populated +from `org-export-odt-convert-processes'." + :group 'org-export-odt + :type '(choice :convert-widget + (lambda (w) + (apply 'widget-convert (widget-type w) + (eval (car (widget-get w :args))))) + `((const :tag "None" nil) + ,@(mapcar (lambda (c) + `(const :tag ,(car c) ,(car c))) + org-export-odt-convert-processes)))) + +(defcustom org-export-odt-convert-capabilities + '(("Text" + ("odt" "ott" "doc" "rtf") + (("pdf" "pdf") ("odt" "odt") ("xhtml" "html") ("rtf" "rtf") + ("ott" "ott") ("doc" "doc") ("ooxml" "xml") ("html" "html"))) + ("Web" + ("html" "xhtml") (("pdf" "pdf") ("odt" "txt") ("html" "html"))) + ("Spreadsheet" + ("ods" "ots" "xls" "csv") + (("pdf" "pdf") ("ots" "ots") ("html" "html") ("csv" "csv") + ("ods" "ods") ("xls" "xls") ("xhtml" "xhtml") ("ooxml" "xml"))) + ("Presentation" + ("odp" "otp" "ppt") + (("pdf" "pdf") ("swf" "swf") ("odp" "odp") ("xhtml" "xml") + ("otp" "otp") ("ppt" "ppt") ("odg" "odg") ("html" "html")))) + "Specify input and output formats of `org-export-odt-convert-process'. +More correctly, specify the set of input and output formats that +the user is actually interested in. + +This variable is an alist where each element is of the +form (DOCUMENT-CLASS INPUT-FMT-LIST OUTPUT-FMT-ALIST). +INPUT-FMT-LIST is a list of INPUT-FMTs. OUTPUT-FMT-ALIST is an +alist where each element is of the form (OUTPUT-FMT +OUTPUT-FILE-EXTENSION). + +The variable is interpreted as follows: +`org-export-odt-convert-process' can take any document that is in +INPUT-FMT-LIST and produce any document that is in the +OUTPUT-FMT-LIST. A document converted to OUTPUT-FMT will have +OUTPUT-FILE-EXTENSION as the file name extension. OUTPUT-FMT +serves dual purposes: +- It is used for populating completion candidates during + `org-export-odt-convert' commands. +- It is used as the value of \"%f\" specifier in + `org-export-odt-convert-process'. + +DOCUMENT-CLASS is used to group a set of file formats in +INPUT-FMT-LIST in to a single class. + +Note that this variable inherently captures how LibreOffice based +converters work. LibreOffice maps documents of various formats +to classes like Text, Web, Spreadsheet, Presentation etc and +allow document of a given class (irrespective of it's source +format) to be converted to any of the export formats associated +with that class. + +See default setting of this variable for an typical +configuration." + :group 'org-export-odt + :type + '(choice + (const :tag "None" nil) + (alist :key-type (string :tag "Document Class") + :value-type + (group (repeat :tag "Input formats" (string :tag "Input format")) + (alist :tag "Output formats" + :key-type (string :tag "Output format") + :value-type + (group (string :tag "Output file extension"))))))) + +(declare-function org-create-math-formula "org" + (latex-frag &optional mathml-file)) + +;;;###autoload +(defun org-export-odt-convert (&optional in-file out-fmt prefix-arg) + "Convert IN-FILE to format OUT-FMT using a command line converter. +IN-FILE is the file to be converted. If unspecified, it defaults +to variable `buffer-file-name'. OUT-FMT is the desired output +format. Use `org-export-odt-convert-process' as the converter. +If PREFIX-ARG is non-nil then the newly converted file is opened +using `org-open-file'." + (interactive + (append (org-lparse-convert-read-params) current-prefix-arg)) + (org-lparse-do-convert in-file out-fmt prefix-arg)) + +(defun org-odt-get (what &optional opt-plist) + (case what + (BACKEND 'odt) + (EXPORT-DIR (org-export-directory :html opt-plist)) + (FILE-NAME-EXTENSION "odt") + (EXPORT-BUFFER-NAME "*Org ODT Export*") + (ENTITY-CONTROL org-odt-entity-control-callbacks-alist) + (ENTITY-FORMAT org-odt-entity-format-callbacks-alist) + (INIT-METHOD 'org-odt-init-outfile) + (FINAL-METHOD 'org-odt-finalize-outfile) + (SAVE-METHOD 'org-odt-save-as-outfile) + (CONVERT-METHOD + (and org-export-odt-convert-process + (cadr (assoc-string org-export-odt-convert-process + org-export-odt-convert-processes t)))) + (CONVERT-CAPABILITIES + (and org-export-odt-convert-process + (cadr (assoc-string org-export-odt-convert-process + org-export-odt-convert-processes t)) + org-export-odt-convert-capabilities)) + (TOPLEVEL-HLEVEL 1) + (SPECIAL-STRING-REGEXPS org-export-odt-special-string-regexps) + (INLINE-IMAGES 'maybe) + (INLINE-IMAGE-EXTENSIONS '("png" "jpeg" "jpg" "gif" "svg")) + (PLAIN-TEXT-MAP '(("&" . "&") ("<" . "<") (">" . ">"))) + (TABLE-FIRST-COLUMN-AS-LABELS nil) + (FOOTNOTE-SEPARATOR (org-lparse-format 'FONTIFY "," 'superscript)) + (CODING-SYSTEM-FOR-WRITE 'utf-8) + (CODING-SYSTEM-FOR-SAVE 'utf-8) + (t (error "Unknown property: %s" what)))) + +(defvar org-lparse-latex-fragment-fallback) ; set by org-do-lparse +(defun org-export-odt-do-preprocess-latex-fragments () + "Convert LaTeX fragments to images." + (let* ((latex-frag-opt (plist-get org-lparse-opt-plist :LaTeX-fragments)) + (latex-frag-opt ; massage the options + (or (and (member latex-frag-opt '(mathjax t)) + (not (and (fboundp 'org-format-latex-mathml-available-p) + (org-format-latex-mathml-available-p))) + (prog1 org-lparse-latex-fragment-fallback + (org-lparse-warn + (concat + "LaTeX to MathML converter not available. " + (format "Using %S instead." + org-lparse-latex-fragment-fallback))))) + latex-frag-opt)) + cache-dir display-msg) + (cond + ((eq latex-frag-opt 'dvipng) + (setq cache-dir "ltxpng/") + (setq display-msg "Creating LaTeX image %s")) + ((member latex-frag-opt '(mathjax t)) + (setq latex-frag-opt 'mathml) + (setq cache-dir "ltxmathml/") + (setq display-msg "Creating MathML formula %s"))) + (when (and org-current-export-file) + (org-format-latex + (concat cache-dir (file-name-sans-extension + (file-name-nondirectory org-current-export-file))) + org-current-export-dir nil display-msg + nil nil latex-frag-opt)))) + +(defadvice org-format-latex-as-mathml + (after org-odt-protect-latex-fragment activate) + "Encode LaTeX fragment as XML. +Do this when translation to MathML fails." + (when (or (not (> (length ad-return-value) 0)) + (get-text-property 0 'org-protected ad-return-value)) + (setq ad-return-value + (org-propertize (org-odt-encode-plain-text (ad-get-arg 0)) + 'org-protected t)))) + +(defun org-export-odt-preprocess-latex-fragments () + (when (equal org-export-current-backend 'odt) + (org-export-odt-do-preprocess-latex-fragments))) + +(defun org-export-odt-preprocess-label-references () + (goto-char (point-min)) + (let (label label-components category value pretty-label) + (while (re-search-forward "\\\\ref{\\([^{}\n]+\\)}" nil t) + (org-if-unprotected-at (match-beginning 1) + (replace-match + (let ((org-lparse-encode-pending t) + (label (match-string 1))) + ;; markup generated below is mostly an eye-candy. At + ;; pre-processing stage, there is no information on which + ;; entity a label reference points to. The actual markup + ;; is generated as part of `org-odt-fixup-label-references' + ;; which gets called at the fag end of export. By this + ;; time we would have seen and collected all the label + ;; definitions in `org-odt-entity-labels-alist'. + (org-odt-format-tags + '("" . + "") + "" (org-add-props label '(org-protected t)))) t t))))) + +;; process latex fragments as part of +;; `org-export-preprocess-after-blockquote-hook'. Note that this hook +;; is the one that is closest and well before the call to +;; `org-export-attach-captions-and-attributes' in +;; `org-export-preprocess-stirng'. The above arrangement permits +;; captions, labels and attributes to be attached to png images +;; generated out of latex equations. +(add-hook 'org-export-preprocess-after-blockquote-hook + 'org-export-odt-preprocess-latex-fragments) + +(defun org-export-odt-preprocess (parameters) + (org-export-odt-preprocess-label-references)) + +(declare-function archive-zip-extract "arc-mode.el" (archive name)) +(defun org-odt-zip-extract-one (archive member &optional target) + (require 'arc-mode) + (let* ((target (or target default-directory)) + (archive (expand-file-name archive)) + (archive-zip-extract + (list "unzip" "-qq" "-o" "-d" target)) + exit-code command-output) + (setq command-output + (with-temp-buffer + (setq exit-code (archive-zip-extract archive member)) + (buffer-string))) + (unless (zerop exit-code) + (message command-output) + (error "Extraction failed")))) + +(defun org-odt-zip-extract (archive members &optional target) + (when (atom members) (setq members (list members))) + (mapc (lambda (member) + (org-odt-zip-extract-one archive member target)) + members)) + +(defun org-odt-copy-styles-file (&optional styles-file) + ;; Non-availability of styles.xml is not a critical error. For now + ;; throw an error purely for aesthetic reasons. + (setq styles-file (or styles-file + org-export-odt-styles-file + (expand-file-name "OrgOdtStyles.xml" + org-odt-styles-dir) + (error "org-odt: Missing styles file?"))) + (cond + ((listp styles-file) + (let ((archive (nth 0 styles-file)) + (members (nth 1 styles-file))) + (org-odt-zip-extract archive members) + (mapc + (lambda (member) + (when (org-file-image-p member) + (let* ((image-type (file-name-extension member)) + (media-type (format "image/%s" image-type))) + (org-odt-create-manifest-file-entry media-type member)))) + members))) + ((and (stringp styles-file) (file-exists-p styles-file)) + (let ((styles-file-type (file-name-extension styles-file))) + (cond + ((string= styles-file-type "xml") + (copy-file styles-file "styles.xml" t)) + ((member styles-file-type '("odt" "ott")) + (org-odt-zip-extract styles-file "styles.xml"))))) + (t + (error (format "Invalid specification of styles.xml file: %S" + org-export-odt-styles-file)))) + + ;; create a manifest entry for styles.xml + (org-odt-create-manifest-file-entry "text/xml" "styles.xml")) + +(defvar org-export-odt-factory-settings + "d4328fb9d1b6cb211d4320ff546829f26700dc5e" + "SHA1 hash of OrgOdtStyles.xml.") + +(defun org-odt-configure-outline-numbering (level) + "Outline numbering is retained only upto LEVEL. +To disable outline numbering pass a LEVEL of 0." + (goto-char (point-min)) + (let ((regex + "]*\\)text:level=\"\\([^\"]*\\)\"\\([^>]*\\)>") + (replacement + "")) + (while (re-search-forward regex nil t) + (when (> (string-to-number (match-string 2)) level) + (replace-match replacement t nil)))) + (save-buffer 0)) + +;;;###autoload +(defun org-export-as-odf (latex-frag &optional odf-file) + "Export LATEX-FRAG as OpenDocument formula file ODF-FILE. +Use `org-create-math-formula' to convert LATEX-FRAG first to +MathML. When invoked as an interactive command, use +`org-latex-regexps' to infer LATEX-FRAG from currently active +region. If no LaTeX fragments are found, prompt for it. Push +MathML source to kill ring, if `org-export-copy-to-kill-ring' is +non-nil." + (interactive + `(,(let (frag) + (setq frag (and (setq frag (and (region-active-p) + (buffer-substring (region-beginning) + (region-end)))) + (loop for e in org-latex-regexps + thereis (when (string-match (nth 1 e) frag) + (match-string (nth 2 e) frag))))) + (read-string "LaTeX Fragment: " frag nil frag)) + ,(let ((odf-filename (expand-file-name + (concat + (file-name-sans-extension + (or (file-name-nondirectory buffer-file-name))) + "." "odf") + (file-name-directory buffer-file-name)))) + (message "default val is %s" odf-filename) + (read-file-name "ODF filename: " nil odf-filename nil + (file-name-nondirectory odf-filename))))) + (let* ((org-lparse-backend 'odf) + org-lparse-opt-plist + (filename (or odf-file + (expand-file-name + (concat + (file-name-sans-extension + (or (file-name-nondirectory buffer-file-name))) + "." "odf") + (file-name-directory buffer-file-name)))) + (buffer (find-file-noselect (org-odt-init-outfile filename))) + (coding-system-for-write 'utf-8) + (save-buffer-coding-system 'utf-8)) + (set-buffer buffer) + (set-buffer-file-coding-system coding-system-for-write) + (let ((mathml (org-create-math-formula latex-frag))) + (unless mathml (error "No Math formula created")) + (insert mathml) + (or (org-export-push-to-kill-ring + (upcase (symbol-name org-lparse-backend))) + (message "Exporting... done"))) + (org-odt-save-as-outfile filename nil))) + +;;;###autoload +(defun org-export-as-odf-and-open () + "Export LaTeX fragment as OpenDocument formula and immediately open it. +Use `org-export-as-odf' to read LaTeX fragment and OpenDocument +formula file." + (interactive) + (org-lparse-and-open + nil nil nil (call-interactively 'org-export-as-odf))) + +(provide 'org-odt) + +;;; org-odt.el ends here diff -Nru org-mode-7.7/lisp/org-pcomplete.el org-mode-7.8.02/lisp/org-pcomplete.el --- org-mode-7.7/lisp/org-pcomplete.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/org-pcomplete.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,13 +1,11 @@ ;;; org-pcomplete.el --- In-buffer completion code -;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 -;; Free Software Foundation, Inc. +;; Copyright (C) 2004-2011 Free Software Foundation, Inc. ;; ;; Author: Carsten Dominik ;; John Wiegley ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; ;; This file is part of GNU Emacs. ;; @@ -277,6 +275,4 @@ (provide 'org-pcomplete) -;; arch-tag: - ;;; org-pcomplete.el ends here diff -Nru org-mode-7.7/lisp/org-plot.el org-mode-7.8.02/lisp/org-plot.el --- org-mode-7.7/lisp/org-plot.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/org-plot.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,11 +1,10 @@ ;;; org-plot.el --- Support for plotting from Org-mode -;; Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. +;; Copyright (C) 2008-2011 Free Software Foundation, Inc. ;; ;; Author: Eric Schulte ;; Keywords: tables, plotting ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; ;; This file is part of GNU Emacs. ;; @@ -350,5 +349,4 @@ (provide 'org-plot) -;; arch-tag: 5763f7c6-0c75-416d-b070-398ee4ec0eca ;;; org-plot.el ends here diff -Nru org-mode-7.7/lisp/org-protocol.el org-mode-7.8.02/lisp/org-protocol.el --- org-mode-7.7/lisp/org-protocol.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/org-protocol.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,15 +1,14 @@ ;;; org-protocol.el --- Intercept calls from emacsclient to trigger custom actions. ;; -;; Copyright (C) 2008, 2009, 2010 +;; Copyright (C) 2008-2011 ;; Free Software Foundation, Inc. ;; -;; Author: Bastien Guerry +;; Author: Bastien Guerry ;; Author: Daniel M German ;; Author: Sebastian Rose ;; Author: Ross Patterson ;; Maintainer: Sebastian Rose ;; Keywords: org, emacsclient, wp -;; Version: 7.7 ;; This file is part of GNU Emacs. ;; @@ -645,5 +644,4 @@ (provide 'org-protocol) -;; arch-tag: b5c5c2ac-77cf-4a94-a649-2163dff95846 ;;; org-protocol.el ends here diff -Nru org-mode-7.7/lisp/org-publish.el org-mode-7.8.02/lisp/org-publish.el --- org-mode-7.7/lisp/org-publish.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/org-publish.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,11 +1,9 @@ ;;; org-publish.el --- publish related org-mode files as a website -;; Copyright (C) 2006, 2007, 2008, 2009, 2010 -;; Free Software Foundation, Inc. +;; Copyright (C) 2006-2011 Free Software Foundation, Inc. ;; Author: David O'Toole ;; Maintainer: Carsten Dominik ;; Keywords: hypermedia, outlines, wp -;; Version: 7.7 ;; This file is part of GNU Emacs. ;; @@ -602,6 +600,7 @@ org-export-preprocess-after-headline-targets-hook) org-export-preprocess-after-headline-targets-hook))) ,@body)) +(def-edebug-spec org-publish-with-aux-preprocess-maybe (body)) (defvar project-plist) (defun org-publish-org-to-latex (plist filename pub-dir) @@ -685,7 +684,7 @@ (pub-dir (file-name-as-directory (file-truename - (or (plist-get project-plist :publishing-directory) + (or (eval (plist-get project-plist :publishing-directory)) (error "Project %s does not have :publishing-directory defined" (car project)))))) tmp-pub-dir) @@ -718,7 +717,7 @@ If :makeindex is set, also produce a file theindex.org." (mapc (lambda (project) - ;; Each project uses it's own cache file: + ;; Each project uses its own cache file: (org-publish-initialize-cache (car project)) (let* ((project-plist (cdr project)) @@ -1106,7 +1105,7 @@ (setq buf (find-file (expand-file-name filename))) (with-current-buffer buf (goto-char (point-min)) - (while (re-search-forward "^#\\+INCLUDE:[ \t]+\"?\\([^ \t\"]*\\)\"?[ \t]*.*$" nil t) + (while (re-search-forward "^#\\+INCLUDE:[ \t]+\"?\\([^ \t\n\r\"]*\\)\"?[ \t]*.*$" nil t) (let* ((included-file (expand-file-name (match-string 1)))) (add-to-list 'included-files-ctime (org-publish-cache-ctime-of-src included-file) t)))) @@ -1183,6 +1182,4 @@ (provide 'org-publish) -;; arch-tag: 72807f3c-8af0-4a6b-8dca-c3376eb25adb - ;;; org-publish.el ends here diff -Nru org-mode-7.7/lisp/org-remember.el org-mode-7.8.02/lisp/org-remember.el --- org-mode-7.7/lisp/org-remember.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/org-remember.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,12 +1,10 @@ ;;; org-remember.el --- Fast note taking in Org-mode -;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 -;; Free Software Foundation, Inc. +;; Copyright (C) 2004-2011 Free Software Foundation, Inc. ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; ;; This file is part of GNU Emacs. ;; @@ -945,7 +943,7 @@ (throw 'quit t)) ;; Find the file (with-current-buffer (or visiting (find-file-noselect file)) - (unless (or (org-mode-p) (member heading '(top bottom))) + (unless (or (eq major-mode 'org-mode) (member heading '(top bottom))) (error "Target files for notes must be in Org-mode if not filing to top/bottom")) (save-excursion (save-restriction @@ -955,7 +953,7 @@ ;; Find the default location (when heading (cond - ((not (org-mode-p)) + ((not (eq major-mode 'org-mode)) (if (eq heading 'top) (goto-char (point-min)) (goto-char (point-max)) @@ -1153,7 +1151,5 @@ (provide 'org-remember) -;; arch-tag: 497f30d0-4bc3-4097-8622-2d27ac5f2698 - ;;; org-remember.el ends here diff -Nru org-mode-7.7/lisp/org-rmail.el org-mode-7.8.02/lisp/org-rmail.el --- org-mode-7.7/lisp/org-rmail.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/org-rmail.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,12 +1,10 @@ ;;; org-rmail.el --- Support for links to Rmail messages from within Org-mode -;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 -;; Free Software Foundation, Inc. +;; Copyright (C) 2004-2011 Free Software Foundation, Inc. ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; ;; This file is part of GNU Emacs. ;; @@ -115,6 +113,4 @@ (provide 'org-rmail) -;; arch-tag: c6cf4a8b-6639-4b7f-821f-bdf10746b173 - ;;; org-rmail.el ends here diff -Nru org-mode-7.7/lisp/org-special-blocks.el org-mode-7.8.02/lisp/org-special-blocks.el --- org-mode-7.7/lisp/org-special-blocks.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/org-special-blocks.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,25 +1,21 @@ -;;; org-special-blocks.el --- Turn blocks into LaTeX envs and HTML divs - -;; Copyright (C) 2009 Chris Gray +;; Copyright (C) 2009-2011 Free Software Foundation, Inc. ;; Author: Chris Gray -;; This file is not currently part of GNU Emacs. +;; This file is part of GNU Emacs. -;; This program is free software; you can redistribute it and/or -;; modify it under the terms of the GNU General Public License as -;; published by the Free Software Foundation; either version 2, or (at -;; your option) any later version. - -;; This program is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License -;; along with this program ; see the file COPYING. If not, write to -;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -;; Boston, MA 02111-1307, USA. +;; along with GNU Emacs. If not, see . ;;; Commentary: ;; @@ -40,8 +36,12 @@ ;; user to add this class to his or her stylesheet if this div is to ;; mean anything. +(require 'org-html) (require 'org-compat) +(declare-function org-open-par "org-html" ()) +(declare-function org-close-par-maybe "org-html" ()) + (defvar org-special-blocks-ignore-regexp "^\\(LaTeX\\|HTML\\)$" "A regexp indicating the names of blocks that should be ignored by org-special-blocks. These blocks will presumably be @@ -84,11 +84,15 @@ "Converts the special cookies into div blocks." ;; Uses the dynamically-bound variable `line'. (when (string-match "^ORG-\\(.*\\)-\\(START\\|END\\)$" line) -; (org-close-par-maybe) (message "%s" (match-string 1)) - (if (equal (match-string 2 line) "START") - (insert "
    \n") - (insert "
    \n")) + (when (equal (match-string 2 line) "START") + (org-close-par-maybe) + (insert "\n
    ") + (org-open-par)) + (when (equal (match-string 2 line) "END") + (org-close-par-maybe) + (insert "\n
    ") + (org-open-par)) (throw 'nextline nil))) (add-hook 'org-export-html-after-blockquotes-hook diff -Nru org-mode-7.7/lisp/org-src.el org-mode-7.8.02/lisp/org-src.el --- org-mode-7.7/lisp/org-src.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/org-src.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,14 +1,12 @@ ;;; org-src.el --- Source code examples in Org ;; -;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 -;; Free Software Foundation, Inc. +;; Copyright (C) 2004-2011 Free Software Foundation, Inc. ;; ;; Author: Carsten Dominik -;; Bastien Guerry +;; Bastien Guerry ;; Dan Davison ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; ;; This file is part of GNU Emacs. ;; @@ -155,7 +153,7 @@ (defcustom org-src-lang-modes '(("ocaml" . tuareg) ("elisp" . emacs-lisp) ("ditaa" . artist) ("asymptote" . asy) ("dot" . fundamental) ("sqlite" . sql) - ("calc" . fundamental) ("C" . c)) + ("calc" . fundamental) ("C" . c) ("cpp" . c++)) "Alist mapping languages to their major mode. The key is the language name, the value is the string that should be inserted as the name of the major mode. For many languages this is @@ -217,7 +215,7 @@ (case-fold-search t) (info (org-edit-src-find-region-and-lang)) (full-info (org-babel-get-src-block-info)) - (org-mode-p (or (org-mode-p) (derived-mode-p 'org-mode))) + (org-mode-p (derived-mode-p 'org-mode)) ;; derived-mode-p is reflexive (beg (make-marker)) (end (make-marker)) (allow-write-back-p (null code)) @@ -308,7 +306,7 @@ (error "Language mode `%s' fails with: %S" lang-f (nth 1 e))))) (dolist (pair transmitted-variables) (org-set-local (car pair) (cadr pair))) - (when org-mode-p + (when (eq major-mode 'org-mode) (goto-char (point-min)) (while (re-search-forward "^," nil t) (if (eq (org-current-line) line) (setq total-nindent (1+ total-nindent))) @@ -400,7 +398,7 @@ (case-fold-search t) (msg (substitute-command-keys "Edit, then exit with C-c ' (C-c and single quote)")) - (org-mode-p (org-mode-p)) + (org-mode-p (eq major-mode 'org-mode)) (beg (make-marker)) (end (make-marker)) (preserve-indentation org-src-preserve-indentation) @@ -619,7 +617,7 @@ (when (org-bound-and-true-p org-edit-src-from-org-mode) (goto-char (point-min)) (while (re-search-forward - (if (org-mode-p) "^\\(.\\)" "^\\([*]\\|[ \t]*#\\+\\)") nil t) + (if (eq major-mode 'org-mode) "^\\(.\\)" "^\\([*]\\|[ \t]*#\\+\\)") nil t) (if (eq (org-current-line) line) (setq delta (1+ delta))) (replace-match ",\\1"))) (when (org-bound-and-true-p org-edit-src-picture) @@ -718,6 +716,7 @@ (with-current-buffer (marker-buffer beg-marker) (goto-char (marker-position beg-marker)) ,@body)))) +(def-edebug-spec org-src-do-at-code-block (body)) (defun org-src-do-key-sequence-at-code-block (&optional key) "Execute key sequence at code block in the source Org buffer. @@ -814,5 +813,4 @@ (provide 'org-src) -;; arch-tag: 6a1fc84f-dec7-47be-a416-64be56bea5d8 ;;; org-src.el ends here diff -Nru org-mode-7.7/lisp/org-table.el org-mode-7.8.02/lisp/org-table.el --- org-mode-7.7/lisp/org-table.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/org-table.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,12 +1,10 @@ ;;; org-table.el --- The table editor for Org-mode -;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 -;; Free Software Foundation, Inc. +;; Copyright (C) 2004-2011 Free Software Foundation, Inc. ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; ;; This file is part of GNU Emacs. ;; @@ -243,6 +241,14 @@ (symbol :tag "Hours " 'hours) (symbol :tag "Days " 'days))) +(defcustom org-table-formula-field-format "%s" + "Format for fields which contain the result of a formula. +For example, using \"~%s~\" will display the result within tilde +characters. Beware that modifying the display can prevent the +field from being used in another formula." + :group 'org-table-settings + :type 'string) + (defcustom org-table-formula-evaluate-inline t "Non-nil means TAB and RET evaluate a formula in current table field. If the current field starts with an equal sign, it is assumed to be a formula @@ -817,23 +823,13 @@ (append (pop fields) emptystrings)) hfmt)) lines "")) - (if (equal (char-before) ?\n) - ;; This hack is for org-indent, to force redisplay of the - ;; line prefix of the first line. Apparently the redisplay - ;; is tied to the newline, which is, I think, a bug. - ;; To force this redisplay, we remove and re-insert the - ;; newline, so that the redisplay engine thinks it belongs - ;; to the changed text. - (progn - (backward-delete-char 1) - (insert "\n"))) (move-marker org-table-aligned-begin-marker (point)) (insert new) ;; Replace the old one (delete-region (point) end) (move-marker end nil) (move-marker org-table-aligned-end-marker (point)) - (when (and orgtbl-mode (not (org-mode-p))) + (when (and orgtbl-mode (not (eq major-mode 'org-mode))) (goto-char org-table-aligned-begin-marker) (while (org-hide-wide-columns org-table-aligned-end-marker))) ;; Try to move to the old location @@ -1730,6 +1726,34 @@ (replace-match "-+")) (goto-char beg))))) +(defun org-table-transpose-table-at-point () + "Transpose orgmode table at point and eliminate hlines. +So a table like + +| 1 | 2 | 4 | 5 | +|---+---+---+---| +| a | b | c | d | +| e | f | g | h | + +will be transposed as + +| 1 | a | e | +| 2 | b | f | +| 4 | c | g | +| 5 | d | h | + +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)))))) + (delete-region (org-table-begin) (org-table-end)) + (insert (mapconcat (lambda(x) (concat "| " (mapconcat 'identity x " | " ) " |\n" )) + contents "")) + (org-table-align))) + (defun org-table-wrap-region (arg) "Wrap several fields in a column like a paragraph. This is useful if you'd like to spread the contents of a field over several @@ -2148,7 +2172,10 @@ (when remove (while (re-search-forward re2 (point-at-eol) t) (unless (save-match-data (org-in-regexp "remote([^)]+?)")) - (replace-match "")))) + (if (equal (char-before (match-beginning 0)) ?.) + (error "Change makes TBLFM term %s invalid. Use undo to recover." + (match-string 0)) + (replace-match ""))))) (while (re-search-forward re (point-at-eol) t) (unless (save-match-data (org-in-regexp "remote([^)]+?)")) (setq s (match-string 1) n (string-to-number s)) @@ -2178,7 +2205,7 @@ cnt 1) (while (setq name (pop names)) (setq cnt (1+ cnt)) - (if (string-match "^[a-zA-Z][a-zA-Z0-9]*$" name) + (if (string-match "^[a-zA-Z][_a-zA-Z0-9]*$" name) (push (cons name (int-to-string cnt)) org-table-column-names)))) (setq org-table-column-names (nreverse org-table-column-names)) (setq org-table-column-name-regexp @@ -2202,7 +2229,7 @@ (while (and fields1 (setq field (pop fields))) (setq v (pop fields1) col (1+ col)) (when (and (stringp field) (stringp v) - (string-match "^[a-zA-Z][a-zA-Z0-9]*$" field)) + (string-match "^[a-zA-Z][_a-zA-Z0-9]*$" field)) (push (cons field v) org-table-local-parameters) (push (list field line col) org-table-named-field-locations)))) ;; Analyse the line types @@ -2409,7 +2436,8 @@ (modes (copy-sequence org-calc-default-modes)) (numbers nil) ; was a variable, now fixed default (keep-empty nil) - n form form0 formrpl formrg bw fmt x ev orig c lispp literal duration) + n form form0 formrpl formrg bw fmt x ev orig c lispp literal + duration duration-output-format) ;; Parse the format string. Since we have a lot of modes, this is ;; a lot of work. However, I think calc still uses most of the time. (if (string-match ";" formula) @@ -2580,7 +2608,8 @@ (message ""))) (if (listp ev) (setq fmt nil ev "#ERROR")) (org-table-justify-field-maybe - (if fmt (format fmt (string-to-number ev)) ev)) + (format org-table-formula-field-format + (if fmt (format fmt (string-to-number ev)) ev))) (if (and down (> ndown 0) (looking-at ".*\n[ \t]*|[^-]")) (call-interactively 'org-return) (setq ndown 0))) @@ -2963,7 +2992,7 @@ ((string-match "^@-?[-+I0-9]+\\$-?[0-9]+$" lhs) ;; This just refers to one fixed field (push e res)) - ((string-match "^[a-zA-Z][a-zA-Z0-9]*$" lhs) + ((string-match "^[a-zA-Z][_a-zA-Z0-9]*$" lhs) ;; This just refers to one fixed named field (push e res)) ((string-match "^@[0-9]+$" lhs) @@ -2994,20 +3023,24 @@ formulas that use a range of rows or columns, it may often be better to anchor the formula with \"I\" row markers, or to offset from the borders of the table using the @< @> $< $> makers." - (let (n nmax len char) - (while (string-match "\\([@$]\\)\\(<+\\|>+\\)" s) - (setq nmax (if (equal (match-string 1 s) "@") - (1- (length org-table-dlines)) - org-table-current-ncol) - len (- (match-end 2) (match-beginning 2)) - char (string-to-char (match-string 2 s)) - n (if (= char ?<) - len - (- nmax len -1))) - (if (or (< n 1) (> n nmax)) - (error "Reference \"%s\" in expression \"%s\" points outside table" - (match-string 0 s) s)) - (setq s (replace-match (format "%s%d" (match-string 1 s) n) t t s)))) + (let (n nmax len char (start 0)) + (while (string-match "\\([@$]\\)\\(<+\\|>+\\)\\|\\(remote([^\)]+)\\)" + s start) + (if (match-end 3) + (setq start (match-end 3)) + (setq nmax (if (equal (match-string 1 s) "@") + (1- (length org-table-dlines)) + org-table-current-ncol) + len (- (match-end 2) (match-beginning 2)) + char (string-to-char (match-string 2 s)) + n (if (= char ?<) + len + (- nmax len -1))) + (if (or (< n 1) (> n nmax)) + (error "Reference \"%s\" in expression \"%s\" points outside table" + (match-string 0 s) s)) + (setq start (match-beginning 0)) + (setq s (replace-match (format "%s%d" (match-string 1 s) n) t t s))))) s) (defun org-table-formula-substitute-names (f) @@ -3242,7 +3275,7 @@ "Convert a time string into numerical duration in seconds. S can be a string matching either -?HH:MM:SS or -?HH:MM. If S is a string representing a number, keep this number." - (let (hour min sec res) + (let (hour minus min sec res) (cond ((and (string-match "\\(-?\\)\\([0-9]+\\):\\([0-9]+\\):\\([0-9]+\\)" s)) (setq minus (< 0 (length (match-string 1 s))) @@ -3807,7 +3840,7 @@ :lighter " OrgTbl" :keymap orgtbl-mode-map (org-load-modules-maybe) (cond - ((org-mode-p) + ((eq major-mode 'org-mode) ;; Exit without error, in case some hook functions calls this ;; by accident in org-mode. (message "Orgtbl-mode is not useful in org-mode, command ignored")) @@ -3902,6 +3935,7 @@ ("\C-c\C-w" org-table-cut-region) ("\C-c\M-w" org-table-copy-region) ("\C-c\C-y" org-table-paste-rectangle) + ("\C-c\C-w" org-table-wrap-region) ("\C-c-" org-table-insert-hline) ("\C-c}" org-table-toggle-coordinate-overlays) ("\C-c{" org-table-toggle-formula-debugger) @@ -4676,6 +4710,8 @@ list of the fields in the rectangle ." (save-match-data (let ((id-loc nil) + ;; Protect a bunch of variables from being overwritten + ;; by the context of the remote table org-table-column-names org-table-column-name-regexp org-table-local-parameters org-table-named-field-locations org-table-current-line-types org-table-current-begin-line @@ -4712,7 +4748,8 @@ (error "Cannot find a table at NAME or ID %s" name-or-id)) (setq tbeg (point-at-bol)) (org-table-get-specials) - (setq form (org-table-formula-substitute-names form)) + (setq form (org-table-formula-substitute-names + (org-table-formula-handle-first/last-rc form))) (if (and (string-match org-table-range-regexp form) (> (length (match-string 0 form)) 1)) (save-match-data @@ -4721,7 +4758,5 @@ (provide 'org-table) -;; arch-tag: 4d21cfdd-0268-440a-84b0-09237a0fe0ef - ;;; org-table.el ends here diff -Nru org-mode-7.7/lisp/org-taskjuggler.el org-mode-7.8.02/lisp/org-taskjuggler.el --- org-mode-7.7/lisp/org-taskjuggler.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/org-taskjuggler.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,10 +1,9 @@ ;;; org-taskjuggler.el --- TaskJuggler exporter for org-mode ;; -;; Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +;; Copyright (C) 2007-2011 Free Software Foundation, Inc. ;; ;; Emacs Lisp Archive Entry ;; Filename: org-taskjuggler.el -;; Version: 7.7 ;; Author: Christian Egli ;; Maintainer: Christian Egli ;; Keywords: org, taskjuggler, project planning @@ -278,6 +277,7 @@ (file-name-nondirectory buffer-file-name)) org-export-taskjuggler-extension))) (buffer (find-file-noselect filename)) + (old-buffer (current-buffer)) (org-export-taskjuggler-old-level 0) task resource) (unless tasks @@ -305,6 +305,7 @@ (setcar tasks (push (cons "version" version) task)))) (with-current-buffer buffer (erase-buffer) + (org-clone-local-variables old-buffer "^org-") (org-taskjuggler-open-project (car tasks)) (insert org-export-taskjuggler-default-global-properties) (insert "\n") diff -Nru org-mode-7.7/lisp/org-timer.el org-mode-7.8.02/lisp/org-timer.el --- org-mode-7.7/lisp/org-timer.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/org-timer.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,11 +1,10 @@ ;;; org-timer.el --- The relative timer code for Org-mode -;; Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. +;; Copyright (C) 2008-2011 Free Software Foundation, Inc. ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; ;; This file is part of GNU Emacs. ;; @@ -373,7 +372,7 @@ (org-show-entry) (or (ignore-errors (org-get-heading)) (concat "File:" (file-name-nondirectory (buffer-file-name))))))) - ((org-mode-p) + ((eq major-mode 'org-mode) (or (ignore-errors (org-get-heading)) (concat "File:" (file-name-nondirectory (buffer-file-name))))) (t (error "Not in an Org buffer")))) @@ -403,6 +402,4 @@ (provide 'org-timer) -;; arch-tag: 97538f8c-3871-4509-8f23-1e7b3ff3d107 - ;;; org-timer.el ends here diff -Nru org-mode-7.7/lisp/org-vm.el org-mode-7.8.02/lisp/org-vm.el --- org-mode-7.7/lisp/org-vm.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/org-vm.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,12 +1,10 @@ ;;; org-vm.el --- Support for links to VM messages from within Org-mode -;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 -;; Free Software Foundation, Inc. +;; Copyright (C) 2004-2011 Free Software Foundation, Inc. ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; ;; This file is part of GNU Emacs. ;; @@ -140,6 +138,4 @@ (provide 'org-vm) -;; arch-tag: cbc3047b-935e-4d2a-96e7-c5b0117aaa6d - ;;; org-vm.el ends here diff -Nru org-mode-7.7/lisp/org-w3m.el org-mode-7.8.02/lisp/org-w3m.el --- org-mode-7.7/lisp/org-w3m.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/org-w3m.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,11 +1,10 @@ ;;; org-w3m.el --- Support from copy and paste from w3m to Org-mode -;; Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. +;; Copyright (C) 2008-2011 Free Software Foundation, Inc. ;; Author: Andy Stewart ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; ;; This file is part of GNU Emacs. ;; @@ -168,6 +167,4 @@ (provide 'org-w3m) -;; arch-tag: 851d7447-488d-49f0-a14d-46c092e84352 - ;;; org-w3m.el ends here diff -Nru org-mode-7.7/lisp/org-wl.el org-mode-7.8.02/lisp/org-wl.el --- org-mode-7.7/lisp/org-wl.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/org-wl.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,13 +1,11 @@ ;;; org-wl.el --- Support for links to Wanderlust messages from within Org-mode -;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 -;; Free Software Foundation, Inc. +;; Copyright (C) 2004-2011 Free Software Foundation, Inc. ;; Author: Tokuya Kameshima ;; David Maus ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; ;; This file is part of GNU Emacs. ;; @@ -310,6 +308,4 @@ (provide 'org-wl) -;; arch-tag: 29b75a0f-ef2e-430b-8abc-acff75bde54a - ;;; org-wl.el ends here diff -Nru org-mode-7.7/lisp/org-xoxo.el org-mode-7.8.02/lisp/org-xoxo.el --- org-mode-7.7/lisp/org-xoxo.el 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/lisp/org-xoxo.el 2011-12-13 00:34:24.000000000 +0000 @@ -1,12 +1,10 @@ ;;; org-xoxo.el --- XOXO export for Org-mode -;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 -;; Free Software Foundation, Inc. +;; Copyright (C) 2004-2011 Free Software Foundation, Inc. ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; ;; This file is part of GNU Emacs. ;; @@ -124,5 +122,4 @@ (provide 'org-xoxo) -;; arch-tag: 16e6a31f-f4f5-46f1-af18-48dc89faa702 ;;; org-xoxo.el ends here diff -Nru org-mode-7.7/Makefile org-mode-7.8.02/Makefile --- org-mode-7.7/Makefile 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/Makefile 2011-12-13 00:34:24.000000000 +0000 @@ -96,6 +96,7 @@ org-irc.el \ org-latex.el \ org-list.el \ + org-lparse.el \ org-mac-message.el \ org-macs.el \ org-mew.el \ @@ -103,6 +104,7 @@ org-mks.el \ org-mobile.el \ org-mouse.el \ + org-odt.el \ org-publish.el \ org-plot.el \ org-protocol.el \ @@ -158,7 +160,10 @@ ob-js.el \ ob-scheme.el \ ob-lilypond.el \ - ob-java.el + ob-java.el \ + ob-shen.el \ + ob-fortran.el \ + ob-picolisp.el LISPFILES0 = $(LISPF:%=lisp/%) LISPFILES = $(LISPFILES0) lisp/org-install.el @@ -183,13 +188,14 @@ doc/orgguide.pdf \ doc/orgcard.tex \ doc/orgcard.pdf \ - doc/orgcard_letter.pdf + doc/orgcard_letter.pdf \ + etc/ .SUFFIXES: .el .elc .texi SHELL = /bin/sh # Additional distribution files -DISTFILES_extra= Makefile request-assign-future.txt contrib +DISTFILES_extra= Makefile request-assign-future.txt contrib etc default: $(ELCFILES) $(ELCBFILES) @@ -490,6 +496,7 @@ lisp/org-irc.elc: lisp/org.el lisp/org-jsinfo.elc: lisp/org.el lisp/org-exp.el lisp/org-list.elc: lisp/org-macs.el lisp/org-compat.el +lisp/org-lparse.elc: lisp/org-exp.el lisp/org-mac-message.elc: lisp/org.el lisp/org-macs.elc: lisp/org-mew.elc: lisp/org.el @@ -497,6 +504,7 @@ lisp/org-mks.elc: lisp/org-mobile.elc: lisp/org.el lisp/org-mouse.elc: lisp/org.el +lisp/org-odt.elc: lisp/org-lparse.el lisp/org-plot.elc: lisp/org.el lisp/org-exp.el lisp/org-table.el lisp/org-publish.elc: lisp/org-protocol.elc: lisp/org.el diff -Nru org-mode-7.7/README org-mode-7.8.02/README --- org-mode-7.7/README 2011-07-28 10:35:40.000000000 +0000 +++ org-mode-7.8.02/README 2011-12-13 00:34:24.000000000 +0000 @@ -1,7 +1,7 @@ The is a distribution of Org, a plain text notes and project planning tool for Emacs. -The version of this release is: 7.7 +The version of this release is: 7.8.02 The homepage of Org is at http://orgmode.org