From 52fbfeb04b10aa78f24f339a352fe1161c0b37e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Delafond?= Date: Sun, 13 Jul 2014 13:35:31 +0200 Subject: Imported Upstream version 8.2.4 --- contrib/lisp/org-colview-xemacs.el | 4 + contrib/lisp/org-drill.el | 16 +- contrib/lisp/org-registry.el | 4 +- contrib/lisp/org-toc.el | 2 +- contrib/lisp/org-track.el | 2 +- contrib/lisp/ox-freemind.el | 2 +- contrib/lisp/ox-rss.el | 6 +- contrib/lisp/ox-taskjuggler.el | 4 +- etc/ORG-NEWS | 16 +- lisp/ob-C.el | 29 +-- lisp/ob-R.el | 33 +-- lisp/ob-awk.el | 33 ++- lisp/ob-calc.el | 43 ++-- lisp/ob-clojure.el | 34 +-- lisp/ob-core.el | 302 ++++++++++++------------ lisp/ob-ditaa.el | 9 +- lisp/ob-emacs-lisp.el | 39 ++-- lisp/ob-exp.el | 4 +- lisp/ob-fortran.el | 28 +-- lisp/ob-haskell.el | 13 +- lisp/ob-io.el | 11 +- lisp/ob-java.el | 25 +- lisp/ob-latex.el | 6 +- lisp/ob-lilypond.el | 1 - lisp/ob-lisp.el | 35 +-- lisp/ob-makefile.el | 2 +- lisp/ob-maxima.el | 28 +-- lisp/ob-perl.el | 30 +-- lisp/ob-picolisp.el | 105 ++++----- lisp/ob-plantuml.el | 4 +- lisp/ob-python.el | 143 ++++++------ lisp/ob-ruby.el | 28 +-- lisp/ob-scala.el | 11 +- lisp/ob-sh.el | 131 +++++------ lisp/ob-shen.el | 16 +- lisp/ob-sql.el | 24 +- lisp/ob-sqlite.el | 25 +- lisp/ob-table.el | 53 ++--- lisp/ob-tangle.el | 90 ++++---- lisp/org-agenda.el | 60 +++-- lisp/org-archive.el | 1 + lisp/org-bibtex.el | 54 ++--- lisp/org-capture.el | 29 ++- lisp/org-clock.el | 19 +- lisp/org-colview.el | 13 +- lisp/org-compat.el | 16 +- lisp/org-crypt.el | 10 +- lisp/org-docview.el | 8 +- lisp/org-element.el | 172 +++++++------- lisp/org-id.el | 4 + lisp/org-inlinetask.el | 3 +- lisp/org-list.el | 5 +- lisp/org-loaddefs.el | 206 +++++++++++++---- lisp/org-macro.el | 2 + lisp/org-macs.el | 8 - lisp/org-protocol.el | 2 +- lisp/org-src.el | 14 +- lisp/org-table.el | 9 +- lisp/org-version.el | 4 +- lisp/org.el | 456 ++++++++++++++++++------------------- lisp/ox-ascii.el | 185 ++++++--------- lisp/ox-beamer.el | 117 +++------- lisp/ox-html.el | 136 +++++++---- lisp/ox-icalendar.el | 22 +- lisp/ox-latex.el | 52 ++--- lisp/ox-md.el | 13 +- lisp/ox-odt.el | 91 ++++---- lisp/ox-org.el | 8 +- lisp/ox-publish.el | 14 +- lisp/ox-texinfo.el | 68 +++--- lisp/ox.el | 87 +++---- mk/version.mk | 4 +- 72 files changed, 1693 insertions(+), 1590 deletions(-) diff --git a/contrib/lisp/org-colview-xemacs.el b/contrib/lisp/org-colview-xemacs.el index 63c0238..f9b35d3 100644 --- a/contrib/lisp/org-colview-xemacs.el +++ b/contrib/lisp/org-colview-xemacs.el @@ -477,6 +477,7 @@ This is the compiled version of the format.") (defvar org-colview-initial-truncate-line-value nil "Remember the value of `truncate-lines' across colview.") +;;;###autoload (defun org-columns-remove-overlays () "Remove all currently active column overlays." (interactive) @@ -820,6 +821,7 @@ around it." (let ((value (get-char-property (point) 'org-columns-value))) (org-open-link-from-string value arg))) +;;;###autoload (defun org-columns-get-format-and-top-level () (let (fmt) (when (condition-case nil (org-back-to-heading) (error nil)) @@ -1091,6 +1093,7 @@ Don't set this, this is meant for dynamic scoping.") (org-overlay-display ov (format fmt val)))))) org-columns-overlays)))) +;;;###autoload (defun org-columns-compute (property) "Sum the values of property PROPERTY hierarchically, for the entire buffer." (interactive) @@ -1187,6 +1190,7 @@ Don't set this, this is meant for dynamic scoping.") (setq sum (+ (string-to-number (pop l)) (/ sum 60)))) sum))) +;;;###autoload (defun org-columns-number-to-string (n fmt &optional printf) "Convert a computed column number to a string value, according to FMT." (cond diff --git a/contrib/lisp/org-drill.el b/contrib/lisp/org-drill.el index 5bf6dd4..4387161 100644 --- a/contrib/lisp/org-drill.el +++ b/contrib/lisp/org-drill.el @@ -104,7 +104,7 @@ Possible values: but a warning message is printed when each leech item is presented." :group 'org-drill - :type '(choice (const 'warn) (const 'skip) (const nil))) + :type '(choice (const warn) (const skip) (const nil))) (defface org-drill-visible-cloze-face '((t (:foreground "darkseagreen"))) @@ -256,10 +256,14 @@ directory All files with the extension '.org' in the same ;; 'file-no-restriction' means current file/buffer, ignoring restrictions ;; 'directory' means all *.org files in current directory :group 'org-drill - :type '(choice (const 'file) (const 'tree) (const 'file-no-restriction) - (const 'file-with-archives) (const 'agenda) - (const 'agenda-with-archives) (const 'directory) - list)) + :type '(choice (const :tag "The current buffer, respecting the restriction if any." file) + (const :tag "The subtree started with the entry at point" tree) + (const :tag "The current buffer, without restriction" file-no-restriction) + (const :tag "The current buffer, and any archives associated with it." file-with-archives) + (const :tag "All agenda files" agenda) + (const :tag "All agenda files with any archive files associated with them." agenda-with-archives) + (const :tag "All files with the extension '.org' in the same directory as the current file (includes the current file if it is an .org file.)" directory) + (repeat :tag "List of files to scan for drill items." file))) (defcustom org-drill-save-buffers-after-drill-sessions-p t "If non-nil, prompt to save all modified buffers after a drill session @@ -280,7 +284,7 @@ Available choices are: adjusting intervals when items are reviewed early or late has been taken from SM11, a later version of the algorithm, and included in Simple8." :group 'org-drill - :type '(choice (const 'sm2) (const 'sm5) (const 'simple8))) + :type '(choice (const sm2) (const sm5) (const simple8))) (defcustom org-drill-optimal-factor-matrix nil "DO NOT CHANGE THE VALUE OF THIS VARIABLE. diff --git a/contrib/lisp/org-registry.el b/contrib/lisp/org-registry.el index 1950797..b0ee208 100644 --- a/contrib/lisp/org-registry.el +++ b/contrib/lisp/org-registry.el @@ -5,8 +5,8 @@ ;; 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 diff --git a/contrib/lisp/org-toc.el b/contrib/lisp/org-toc.el index e0e6098..2d6c846 100644 --- a/contrib/lisp/org-toc.el +++ b/contrib/lisp/org-toc.el @@ -2,7 +2,7 @@ ;; Copyright 2007-2013 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 diff --git a/contrib/lisp/org-track.el b/contrib/lisp/org-track.el index db8c34e..4a9d71d 100644 --- a/contrib/lisp/org-track.el +++ b/contrib/lisp/org-track.el @@ -3,7 +3,7 @@ ;; Copyright (C) 2009-2013 ;; Free Software Foundation, Inc. ;; -;; Author: Bastien Guerry +;; Author: Bastien Guerry ;; Eric S Fraga ;; Sebastian Rose ;; The Worg people http://orgmode.org/worg/ diff --git a/contrib/lisp/ox-freemind.el b/contrib/lisp/ox-freemind.el index aafd714..801bda1 100644 --- a/contrib/lisp/ox-freemind.el +++ b/contrib/lisp/ox-freemind.el @@ -520,7 +520,7 @@ Return output file's name." (let* ((extension (concat ".mm" )) (file (org-export-output-file-name extension subtreep)) (org-export-coding-system 'utf-8)) - (org-export-to-file 'freemind ,file + (org-export-to-file 'freemind file async subtreep visible-only body-only ext-plist))) (provide 'ox-freemind) diff --git a/contrib/lisp/ox-rss.el b/contrib/lisp/ox-rss.el index 672e970..2777e02 100644 --- a/contrib/lisp/ox-rss.el +++ b/contrib/lisp/ox-rss.el @@ -2,7 +2,7 @@ ;; Copyright (C) 2013 Bastien Guerry -;; Author: Bastien Guerry +;; Author: Bastien Guerry ;; Keywords: org, wp, blog, feed, rss ;; This file is not yet part of GNU Emacs. @@ -236,7 +236,7 @@ communication channel." (pubdate (let ((system-time-locale "C")) (format-time-string - "%a, %d %h %Y %H:%M:%S %z" + "%a, %d %b %Y %H:%M:%S %z" (org-time-string-to-time (or (org-element-property :PUBDATE headline) (error "Missing PUBDATE property")))))) @@ -308,7 +308,7 @@ as a communication channel." (author (and (plist-get info :with-author) (let ((auth (plist-get info :author))) (and auth (org-export-data auth info))))) - (date (format-time-string "%a, %d %h %Y %H:%M:%S %z")) ;; RFC 882 + (date (format-time-string "%a, %d %b %Y %H:%M:%S %z")) ;; RFC 882 (description (org-export-data (plist-get info :description) info)) (lang (plist-get info :language)) (keywords (plist-get info :keywords)) diff --git a/contrib/lisp/ox-taskjuggler.el b/contrib/lisp/ox-taskjuggler.el index 13f2f5e..fe88b45 100644 --- a/contrib/lisp/ox-taskjuggler.el +++ b/contrib/lisp/ox-taskjuggler.el @@ -800,7 +800,9 @@ a unique id will be associated to it." (if (eq (org-element-property :todo-type task) 'done) "100" (org-element-property :COMPLETE task))) (depends (org-taskjuggler-resolve-dependencies task info)) - (effort (org-element-property :EFFORT task)) + (effort (let ((property + (intern (concat ":" (upcase org-effort-property))))) + (org-element-property property task))) (milestone (or (org-element-property :MILESTONE task) (not (or (org-element-map (org-element-contents task) 'headline diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index 15e6a06..2f9d156 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -101,7 +101,7 @@ of the list. Add support for ell, imath, jmath, varphi, varpi, aleph, gimel, beth, dalet, cdots, S (§), dag, ddag, colon, therefore, because, triangleq, leq, geq, lessgtr, lesseqgtr, ll, lll, gg, ggg, prec, preceq, -preccurleyeq, succ, succeq, succurleyeq, setminus, nexist(s), mho, +preccurlyeq, succ, succeq, succurlyeq, setminus, nexist(s), mho, check, frown, diamond. Changes loz, vert, checkmark, smile and tilde. *** Anonymous export back-ends @@ -146,7 +146,7 @@ This makes java executable configurable for ditaa blocks. This enables SVG generation from latex code blocks. -*** New option: [[doc:org-habit-show-done-alwyays-green][org-habit-show-done-alwyays-green]] +*** New option: [[doc:org-habit-show-done-always-green][org-habit-show-done-always-green]] See [[http://lists.gnu.org/archive/html/emacs-orgmode/2013-05/msg00214.html][this message]] from Max Mikhanosha. @@ -277,8 +277,8 @@ manual for details and check [[http://orgmode.org/worg/org-8.0.html][this Worg p moved some contributions into the =contrib/= directory. The rationale for deciding that these files should live in =contrib/= - is either because they rely on third-part softwares that are not - included in Emacs, or because they are not targetting a significant + is either because they rely on third-party software that is not + included in Emacs, or because they are not targeting a significant user-base. - org-colview-xemacs.el @@ -395,7 +395,7 @@ Among the new/updated export options, three are of particular importance: - [[doc:org-export-allow-bind-keywords][org-export-allow-bind-keywords]] :: This option replaces the old option =org-export-allow-BIND= and the default value is =nil=, not =confirm=. - You will need to explicitely set this to =t= in your initialization + You will need to explicitly set this to =t= in your initialization file if you want to allow =#+BIND= keywords. - [[doc:org-export-with-planning][org-export-with-planning]] :: This new option controls the export of @@ -654,7 +654,7 @@ headlines and their content (but not subheadings) into the new file. This is useful when you want to quickly share an agenda containing the full list of notes. -**** New commands to drag an agenda line forward (=M-=) or backard (=M-=) +**** New commands to drag an agenda line forward (=M-=) or backward (=M-=) It sometimes handy to move agenda lines around, just to quickly reorganize your tasks, or maybe before saving the agenda to a file. Now you can use @@ -717,7 +717,7 @@ string is important to keep the agenda alignment clean. When [[doc:org-agenda-skip-scheduled-if-deadline-is-shown][org-agenda-skip-scheduled-if-deadline-is-shown]] is set to =repeated-after-deadline=, the agenda will skip scheduled items if they are -repeated beyond the current dealine. +repeated beyond the current deadline. **** New option for [[doc:org-agenda-skip-deadline-prewarning-if-scheduled][org-agenda-skip-deadline-prewarning-if-scheduled]] @@ -757,7 +757,7 @@ check against the name of the buffer. Using =#+TAGS: { Tag1 : Tag2 Tag3 }= will define =Tag1= as a /group tag/ (note the colon after =Tag1=). If you search for =Tag1=, it will return -headlines containing either =Tag1=, =Tag2= or =Tag3= (or any combinaison +headlines containing either =Tag1=, =Tag2= or =Tag3= (or any combination of those tags.) You can use group tags for sparse tree in an Org buffer, for creating diff --git a/lisp/ob-C.el b/lisp/ob-C.el index e9eec93..ddceb14 100644 --- a/lisp/ob-C.el +++ b/lisp/ob-C.el @@ -103,20 +103,21 @@ or `org-babel-execute:C++'." (mapconcat 'identity (if (listp flags) flags (list flags)) " ") (org-babel-process-file-name tmp-src-file)) "")))) - ((lambda (results) - (org-babel-reassemble-table - (org-babel-result-cond (cdr (assoc :result-params params)) - (org-babel-read results) - (let ((tmp-file (org-babel-temp-file "c-"))) - (with-temp-file tmp-file (insert results)) - (org-babel-import-elisp-from-file tmp-file))) - (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) "")) ""))))) + (let ((results + (org-babel-trim + (org-babel-eval + (concat tmp-bin-file (if cmdline (concat " " cmdline) "")) "")))) + (org-babel-reassemble-table + (org-babel-result-cond (cdr (assoc :result-params params)) + (org-babel-read results) + (let ((tmp-file (org-babel-temp-file "c-"))) + (with-temp-file tmp-file (insert results)) + (org-babel-import-elisp-from-file tmp-file))) + (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-C-expand (body params) "Expand a block of C or C++ code with org-babel according to diff --git a/lisp/ob-R.el b/lisp/ob-R.el index 74d7513..58f5536 100644 --- a/lisp/ob-R.el +++ b/lisp/ob-R.el @@ -85,21 +85,22 @@ (or graphics-file (org-babel-R-graphical-output-file params)))) (mapconcat #'identity - ((lambda (inside) - (if graphics-file - (append - (list (org-babel-R-construct-graphics-device-call - graphics-file params)) - inside - (list "dev.off()")) - inside)) - (append - (when (cdr (assoc :prologue params)) - (list (cdr (assoc :prologue params)))) - (org-babel-variable-assignments:R params) - (list body) - (when (cdr (assoc :epilogue params)) - (list (cdr (assoc :epilogue params)))))) "\n"))) + (let ((inside + (append + (when (cdr (assoc :prologue params)) + (list (cdr (assoc :prologue params)))) + (org-babel-variable-assignments:R params) + (list body) + (when (cdr (assoc :epilogue params)) + (list (cdr (assoc :epilogue params))))))) + (if graphics-file + (append + (list (org-babel-R-construct-graphics-device-call + graphics-file params)) + inside + (list "dev.off()")) + inside)) + "\n"))) (defun org-babel-execute:R (body params) "Execute a block of R code. @@ -324,6 +325,8 @@ last statement in BODY, as elisp." column-names-p))) (output (org-babel-eval org-babel-R-command body)))) +(defvar ess-eval-visibly-p) + (defun org-babel-R-evaluate-session (session body result-type result-params column-names-p row-names-p) "Evaluate BODY in SESSION. diff --git a/lisp/ob-awk.el b/lisp/ob-awk.el index 373d5fd..a9215d0 100644 --- a/lisp/ob-awk.el +++ b/lisp/ob-awk.el @@ -59,34 +59,33 @@ called by `org-babel-execute-src-block'" (cmd-line (cdr (assoc :cmd-line params))) (in-file (cdr (assoc :in-file params))) (full-body (org-babel-expand-body:awk body params)) - (code-file ((lambda (file) (with-temp-file file (insert full-body)) file) - (org-babel-temp-file "awk-"))) - (stdin ((lambda (stdin) + (code-file (let ((file (org-babel-temp-file "awk-"))) + (with-temp-file file (insert full-body)) file)) + (stdin (let ((stdin (cdr (assoc :stdin params)))) (when stdin (let ((tmp (org-babel-temp-file "awk-stdin-")) (res (org-babel-ref-resolve stdin))) (with-temp-file tmp (insert (org-babel-awk-var-to-awk res))) - tmp))) - (cdr (assoc :stdin params)))) + tmp)))) (cmd (mapconcat #'identity (remove nil (list org-babel-awk-command "-f" code-file cmd-line in-file)) " "))) (org-babel-reassemble-table - ((lambda (results) - (when results - (org-babel-result-cond result-params - results - (let ((tmp (org-babel-temp-file "awk-results-"))) - (with-temp-file tmp (insert results)) - (org-babel-import-elisp-from-file tmp))))) - (cond - (stdin (with-temp-buffer - (call-process-shell-command cmd stdin (current-buffer)) - (buffer-string))) - (t (org-babel-eval cmd "")))) + (let ((results + (cond + (stdin (with-temp-buffer + (call-process-shell-command cmd stdin (current-buffer)) + (buffer-string))) + (t (org-babel-eval cmd ""))))) + (when results + (org-babel-result-cond result-params + results + (let ((tmp (org-babel-temp-file "awk-results-"))) + (with-temp-file tmp (insert results)) + (org-babel-import-elisp-from-file tmp))))) (org-babel-pick-name (cdr (assoc :colname-names params)) (cdr (assoc :colnames params))) (org-babel-pick-name diff --git a/lisp/ob-calc.el b/lisp/ob-calc.el index 766f6ce..b4201a1 100644 --- a/lisp/ob-calc.el +++ b/lisp/ob-calc.el @@ -42,13 +42,15 @@ (defun org-babel-expand-body:calc (body params) "Expand BODY according to PARAMS, return the expanded body." body) +(defvar org--var-syms) ; Dynamically scoped from org-babel-execute:calc + (defun org-babel-execute:calc (body params) "Execute a block of calc code with Babel." (unless (get-buffer "*Calculator*") (save-window-excursion (calc) (calc-quit))) (let* ((vars (mapcar #'cdr (org-babel-get-header params :var))) - (var-syms (mapcar #'car vars)) - (var-names (mapcar #'symbol-name var-syms))) + (org--var-syms (mapcar #'car vars)) + (var-names (mapcar #'symbol-name org--var-syms))) (mapc (lambda (pair) (calc-push-list (list (cdr pair))) @@ -66,33 +68,32 @@ ;; complex expression (t (calc-push-list - (list ((lambda (res) - (cond - ((numberp res) res) - ((math-read-number res) (math-read-number res)) - ((listp res) (error "Calc error \"%s\" on input \"%s\"" - (cadr res) line)) - (t (replace-regexp-in-string - "'" "" - (calc-eval - (math-evaluate-expr - ;; resolve user variables, calc built in - ;; variables are handled automatically - ;; upstream by calc - (mapcar #'org-babel-calc-maybe-resolve-var - ;; parse line into calc objects - (car (math-read-exprs line))))))))) - (calc-eval line)))))))) + (list (let ((res (calc-eval line))) + (cond + ((numberp res) res) + ((math-read-number res) (math-read-number res)) + ((listp res) (error "Calc error \"%s\" on input \"%s\"" + (cadr res) line)) + (t (replace-regexp-in-string + "'" "" + (calc-eval + (math-evaluate-expr + ;; resolve user variables, calc built in + ;; variables are handled automatically + ;; upstream by calc + (mapcar #'org-babel-calc-maybe-resolve-var + ;; parse line into calc objects + (car (math-read-exprs line))))))))) + )))))) (mapcar #'org-babel-trim (split-string (org-babel-expand-body:calc body params) "[\n\r]")))) (save-excursion (with-current-buffer (get-buffer "*Calculator*") (calc-eval (calc-top 1))))) -(defvar var-syms) ; Dynamically scoped from org-babel-execute:calc (defun org-babel-calc-maybe-resolve-var (el) (if (consp el) - (if (and (equal 'var (car el)) (member (cadr el) var-syms)) + (if (and (equal 'var (car el)) (member (cadr el) org--var-syms)) (progn (calc-recall (cadr el)) (prog1 (calc-top 1) diff --git a/lisp/ob-clojure.el b/lisp/ob-clojure.el index bc2bbc0..25b39f7 100644 --- a/lisp/ob-clojure.el +++ b/lisp/ob-clojure.el @@ -24,17 +24,17 @@ ;;; Commentary: -;;; support for evaluating clojure code, relies on slime for all eval +;; Support for evaluating clojure code, relies on slime for all eval. ;;; Requirements: -;;; - clojure (at least 1.2.0) -;;; - clojure-mode -;;; - slime +;; - clojure (at least 1.2.0) +;; - clojure-mode +;; - slime -;;; By far, the best way to install these components is by following -;;; the directions as set out by Phil Hagelberg (Technomancy) on the -;;; web page: http://technomancy.us/126 +;; By far, the best way to install these components is by following +;; the directions as set out by Phil Hagelberg (Technomancy) on the +;; web page: http://technomancy.us/126 ;;; Code: (require 'ob) @@ -77,16 +77,16 @@ (require 'slime) (with-temp-buffer (insert (org-babel-expand-body:clojure body params)) - ((lambda (result) - (let ((result-params (cdr (assoc :result-params params)))) - (org-babel-result-cond result-params - result - (condition-case nil (org-babel-script-escape result) - (error result))))) - (slime-eval - `(swank:eval-and-grab-output - ,(buffer-substring-no-properties (point-min) (point-max))) - (cdr (assoc :package params)))))) + (let ((result + (slime-eval + `(swank:eval-and-grab-output + ,(buffer-substring-no-properties (point-min) (point-max))) + (cdr (assoc :package params))))) + (let ((result-params (cdr (assoc :result-params params)))) + (org-babel-result-cond result-params + result + (condition-case nil (org-babel-script-escape result) + (error result))))))) (provide 'ob-clojure) diff --git a/lisp/ob-core.el b/lisp/ob-core.el index cc6b7a9..84caed7 100644 --- a/lisp/ob-core.el +++ b/lisp/ob-core.el @@ -318,7 +318,7 @@ Do not query the user." (message (format "Evaluation of this%scode-block%sis disabled." code-block block-name)))))) - ;; dynamically scoped for asynchroneous export + ;; dynamically scoped for asynchronous export (defvar org-babel-confirm-evaluate-answer-no) (defsubst org-babel-confirm-evaluate (info) @@ -632,15 +632,14 @@ block." (message "result silenced") (setq result nil)) (setq result - ((lambda (result) - (if (and (eq (cdr (assoc :result-type params)) - 'value) - (or (member "vector" result-params) - (member "table" result-params)) - (not (listp result))) - (list (list result)) result)) - (funcall cmd body params))) - ;; if non-empty result and :file then write to :file + (let ((result (funcall cmd body params))) + (if (and (eq (cdr (assoc :result-type params)) + 'value) + (or (member "vector" result-params) + (member "table" result-params)) + (not (listp result))) + (list (list result)) result))) + ;; If non-empty result and :file then write to :file. (when (cdr (assoc :file params)) (when result (with-temp-file (cdr (assoc :file params)) @@ -648,7 +647,7 @@ block." (org-babel-format-result result (cdr (assoc :sep (nth 2 info))))))) (setq result (cdr (assoc :file params)))) - ;; possibly perform post process provided its appropriate + ;; Possibly perform post process provided its appropriate. (when (cdr (assoc :post params)) (let ((*this* (if (cdr (assoc :file params)) (org-babel-result-to-file @@ -893,6 +892,8 @@ with a prefix argument then this is passed on to (defalias 'org-babel-pop-to-session 'org-babel-switch-to-session) +(defvar org-src-window-setup) + ;;;###autoload (defun org-babel-switch-to-session-with-code (&optional arg info) "Switch to code buffer and display session." @@ -1157,18 +1158,18 @@ the current subtree." (mapconcat #'identity (sort (funcall rm (split-string v)) #'string<) " ")) (t v))))))) - ((lambda (hash) - (when (org-called-interactively-p 'interactive) (message hash)) hash) - (let ((it (format "%s-%s" - (mapconcat - #'identity - (delq nil (mapcar (lambda (arg) - (let ((normalized (funcall norm arg))) - (when normalized - (format "%S" normalized)))) - (nth 2 info))) ":") - (nth 1 info)))) - (sha1 it)))))) + (let* ((it (format "%s-%s" + (mapconcat + #'identity + (delq nil (mapcar (lambda (arg) + (let ((normalized (funcall norm arg))) + (when normalized + (format "%S" normalized)))) + (nth 2 info))) ":") + (nth 1 info))) + (hash (sha1 it))) + (when (org-called-interactively-p 'interactive) (message hash)) + hash)))) (defun org-babel-current-result-hash () "Return the current in-buffer hash." @@ -1453,9 +1454,8 @@ instances of \"[ \t]:\" set ALTS to '((32 9) . 58)." (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)))))))) + (let ((raw (org-babel-balanced-split arg-string '((32 9) . 58)))) + (cons (car raw) (mapcar (lambda (r) (concat ":" r)) (cdr raw))))))))) (defun org-babel-parse-multiple-vars (header-arguments) "Expand multiple variable assignments behind a single :var keyword. @@ -1598,12 +1598,11 @@ of the vars, cnames and rnames." Given a TABLE and set of COLNAMES and ROWNAMES add the names to the table for reinsertion to org-mode." (if (listp table) - ((lambda (table) - (if (and colnames (listp (car table)) (= (length (car table)) - (length colnames))) - (org-babel-put-colnames table colnames) table)) - (if (and rownames (= (length table) (length rownames))) - (org-babel-put-rownames table rownames) table)) + (let ((table (if (and rownames (= (length table) (length rownames))) + (org-babel-put-rownames table rownames) table))) + (if (and colnames (listp (car table)) (= (length (car table)) + (length colnames))) + (org-babel-put-colnames table colnames) table)) table)) (defun org-babel-where-is-src-block-head () @@ -1640,9 +1639,8 @@ If the point is not on a source block then return nil." (defun org-babel-goto-src-block-head () "Go to the beginning of the current code block." (interactive) - ((lambda (head) - (if head (goto-char head) (error "Not currently in a code block"))) - (org-babel-where-is-src-block-head))) + (let ((head (org-babel-where-is-src-block-head))) + (if head (goto-char head) (error "Not currently in a code block")))) ;;;###autoload (defun org-babel-goto-named-src-block (name) @@ -1763,14 +1761,13 @@ With optional prefix argument ARG, jump backward ARG many source blocks." (defun org-babel-mark-block () "Mark current src block." (interactive) - ((lambda (head) - (when head - (save-excursion - (goto-char head) - (looking-at org-babel-src-block-regexp)) - (push-mark (match-end 5) nil t) - (goto-char (match-beginning 5)))) - (org-babel-where-is-src-block-head))) + (let ((head (org-babel-where-is-src-block-head))) + (when head + (save-excursion + (goto-char head) + (looking-at org-babel-src-block-regexp)) + (push-mark (match-end 5) nil t) + (goto-char (match-beginning 5))))) (defun org-babel-demarcate-block (&optional arg) "Wrap or split the code in the region or on the point. @@ -2450,7 +2447,7 @@ block but are passed literally to the \"example-block\"." (funcall (intern (concat lang "-mode"))) (comment-region (point) (progn (insert text) (point))) (org-babel-trim (buffer-string))))) - index source-name evaluate prefix blocks-in-buffer) + index source-name evaluate prefix) (with-temp-buffer (org-set-local 'org-babel-noweb-wrap-start ob-nww-start) (org-set-local 'org-babel-noweb-wrap-end ob-nww-end) @@ -2469,119 +2466,118 @@ block but are passed literally to the \"example-block\"." (funcall nb-add (buffer-substring index (point))) (goto-char (match-end 0)) (setq index (point)) - (funcall nb-add - (with-current-buffer parent-buffer - (save-restriction - (widen) - (mapconcat ;; interpose PREFIX between every line - #'identity - (split-string - (if evaluate - (let ((raw (org-babel-ref-resolve source-name))) - (if (stringp raw) raw (format "%S" raw))) - (or - ;; retrieve from the library of babel - (nth 2 (assoc (intern source-name) - org-babel-library-of-babel)) - ;; return the contents of headlines literally - (save-excursion - (when (org-babel-ref-goto-headline-id source-name) + (funcall + nb-add + (with-current-buffer parent-buffer + (save-restriction + (widen) + (mapconcat ;; Interpose PREFIX between every line. + #'identity + (split-string + (if evaluate + (let ((raw (org-babel-ref-resolve source-name))) + (if (stringp raw) raw (format "%S" raw))) + (or + ;; Retrieve from the library of babel. + (nth 2 (assoc (intern source-name) + org-babel-library-of-babel)) + ;; Return the contents of headlines literally. + (save-excursion + (when (org-babel-ref-goto-headline-id source-name) (org-babel-ref-headline-body))) - ;; find the expansion of reference in this buffer - (let ((rx (concat rx-prefix source-name "[ \t\n]")) - expansion) - (save-excursion - (goto-char (point-min)) - (if org-babel-use-quick-and-dirty-noweb-expansion - (while (re-search-forward rx nil t) - (let* ((i (org-babel-get-src-block-info 'light)) - (body (org-babel-expand-noweb-references i)) - (sep (or (cdr (assoc :noweb-sep (nth 2 i))) - "\n")) - (full (if comment - ((lambda (cs) - (concat (funcall c-wrap (car cs)) "\n" - body "\n" - (funcall c-wrap (cadr cs)))) - (org-babel-tangle-comment-links i)) - body))) - (setq expansion (cons sep (cons full expansion))))) - (org-babel-map-src-blocks nil - (let ((i (org-babel-get-src-block-info 'light))) - (when (equal (or (cdr (assoc :noweb-ref (nth 2 i))) - (nth 4 i)) - source-name) - (let* ((body (org-babel-expand-noweb-references i)) - (sep (or (cdr (assoc :noweb-sep (nth 2 i))) - "\n")) - (full (if comment - ((lambda (cs) - (concat (funcall c-wrap (car cs)) "\n" - body "\n" - (funcall c-wrap (cadr cs)))) - (org-babel-tangle-comment-links i)) - body))) - (setq expansion - (cons sep (cons full expansion))))))))) - (and expansion - (mapconcat #'identity (nreverse (cdr expansion)) ""))) - ;; possibly raise an error if named block doesn't exist - (if (member lang org-babel-noweb-error-langs) - (error "%s" (concat - (org-babel-noweb-wrap source-name) - "could not be resolved (see " - "`org-babel-noweb-error-langs')")) - ""))) - "[\n\r]") (concat "\n" prefix)))))) + ;; Find the expansion of reference in this buffer. + (let ((rx (concat rx-prefix source-name "[ \t\n]")) + expansion) + (save-excursion + (goto-char (point-min)) + (if org-babel-use-quick-and-dirty-noweb-expansion + (while (re-search-forward rx nil t) + (let* ((i (org-babel-get-src-block-info 'light)) + (body (org-babel-expand-noweb-references i)) + (sep (or (cdr (assoc :noweb-sep (nth 2 i))) + "\n")) + (full (if comment + (let ((cs (org-babel-tangle-comment-links i))) + (concat (funcall c-wrap (car cs)) "\n" + body "\n" + (funcall c-wrap (cadr cs)))) + body))) + (setq expansion (cons sep (cons full expansion))))) + (org-babel-map-src-blocks nil + (let ((i (org-babel-get-src-block-info 'light))) + (when (equal (or (cdr (assoc :noweb-ref (nth 2 i))) + (nth 4 i)) + source-name) + (let* ((body (org-babel-expand-noweb-references i)) + (sep (or (cdr (assoc :noweb-sep (nth 2 i))) + "\n")) + (full (if comment + (let ((cs (org-babel-tangle-comment-links i))) + (concat (funcall c-wrap (car cs)) "\n" + body "\n" + (funcall c-wrap (cadr cs)))) + body))) + (setq expansion + (cons sep (cons full expansion))))))))) + (and expansion + (mapconcat #'identity (nreverse (cdr expansion)) ""))) + ;; Possibly raise an error if named block doesn't exist. + (if (member lang org-babel-noweb-error-langs) + (error "%s" (concat + (org-babel-noweb-wrap source-name) + "could not be resolved (see " + "`org-babel-noweb-error-langs')")) + ""))) + "[\n\r]") (concat "\n" prefix)))))) (funcall nb-add (buffer-substring index (point-max)))) new-body)) (defun org-babel-script-escape (str &optional force) "Safely convert tables into elisp lists." - (let (in-single in-double out) - ((lambda (escaped) (condition-case nil (org-babel-read escaped) (error escaped))) - (if (or force - (and (stringp str) - (> (length str) 2) - (or (and (string-equal "[" (substring str 0 1)) - (string-equal "]" (substring str -1))) - (and (string-equal "{" (substring str 0 1)) - (string-equal "}" (substring str -1))) - (and (string-equal "(" (substring str 0 1)) - (string-equal ")" (substring str -1)))))) - (org-babel-read - (concat - "'" - (progn - (mapc - (lambda (ch) - (setq - out - (case ch - (91 (if (or in-double in-single) ; [ - (cons 91 out) - (cons 40 out))) - (93 (if (or in-double in-single) ; ] - (cons 93 out) - (cons 41 out))) - (123 (if (or in-double in-single) ; { - (cons 123 out) - (cons 40 out))) - (125 (if (or in-double in-single) ; } - (cons 125 out) - (cons 41 out))) - (44 (if (or in-double in-single) ; , - (cons 44 out) (cons 32 out))) - (39 (if in-double ; ' - (cons 39 out) - (setq in-single (not in-single)) (cons 34 out))) - (34 (if in-single ; " - (append (list 34 32) out) - (setq in-double (not in-double)) (cons 34 out))) - (t (cons ch out))))) - (string-to-list str)) - (apply #'string (reverse out))))) - str)))) + (let ((escaped + (if (or force + (and (stringp str) + (> (length str) 2) + (or (and (string-equal "[" (substring str 0 1)) + (string-equal "]" (substring str -1))) + (and (string-equal "{" (substring str 0 1)) + (string-equal "}" (substring str -1))) + (and (string-equal "(" (substring str 0 1)) + (string-equal ")" (substring str -1)))))) + (org-babel-read + (concat + "'" + (let (in-single in-double out) + (mapc + (lambda (ch) + (setq + out + (case ch + (91 (if (or in-double in-single) ; [ + (cons 91 out) + (cons 40 out))) + (93 (if (or in-double in-single) ; ] + (cons 93 out) + (cons 41 out))) + (123 (if (or in-double in-single) ; { + (cons 123 out) + (cons 40 out))) + (125 (if (or in-double in-single) ; } + (cons 125 out) + (cons 41 out))) + (44 (if (or in-double in-single) ; , + (cons 44 out) (cons 32 out))) + (39 (if in-double ; ' + (cons 39 out) + (setq in-single (not in-single)) (cons 34 out))) + (34 (if in-single ; " + (append (list 34 32) out) + (setq in-double (not in-double)) (cons 34 out))) + (t (cons ch out))))) + (string-to-list str)) + (apply #'string (reverse out))))) + str))) + (condition-case nil (org-babel-read escaped) (error escaped)))) (defun org-babel-read (cell &optional inhibit-lisp-eval) "Convert the string value of CELL to a number if appropriate. @@ -2691,8 +2687,8 @@ name is removed, since in that case the process will be executing remotely. The file name is then processed by `expand-file-name'. Unless second argument NO-QUOTE-P is non-nil, the file name is additionally processed by `shell-quote-argument'" - ((lambda (f) (if no-quote-p f (shell-quote-argument f))) - (expand-file-name (org-babel-local-file-name name)))) + (let ((f (expand-file-name (org-babel-local-file-name name)))) + (if no-quote-p f (shell-quote-argument f)))) (defvar org-babel-temporary-directory) (unless (or noninteractive (boundp 'org-babel-temporary-directory)) diff --git a/lisp/ob-ditaa.el b/lisp/ob-ditaa.el index 60ab8c5..36681d0 100644 --- a/lisp/ob-ditaa.el +++ b/lisp/ob-ditaa.el @@ -82,11 +82,10 @@ Do not leave leading or trailing spaces in this string." "Execute a block of Ditaa code with org-babel. This function is called by `org-babel-execute-src-block'." (let* ((result-params (split-string (or (cdr (assoc :results params)) ""))) - (out-file ((lambda (el) - (or el - (error - "ditaa code block requires :file header argument"))) - (cdr (assoc :file params)))) + (out-file (let ((el (cdr (assoc :file params)))) + (or el + (error + "ditaa code block requires :file header argument")))) (cmdline (cdr (assoc :cmdline params))) (java (cdr (assoc :java params))) (in-file (org-babel-temp-file "ditaa-")) diff --git a/lisp/ob-emacs-lisp.el b/lisp/ob-emacs-lisp.el index 886645d..a30e369 100644 --- a/lisp/ob-emacs-lisp.el +++ b/lisp/ob-emacs-lisp.el @@ -54,25 +54,26 @@ (defun org-babel-execute:emacs-lisp (body params) "Execute a block of emacs-lisp code with Babel." (save-window-excursion - ((lambda (result) - (org-babel-result-cond (cdr (assoc :result-params params)) - (let ((print-level nil) - (print-length nil)) - (if (or (member "scalar" (cdr (assoc :result-params params))) - (member "verbatim" (cdr (assoc :result-params params)))) - (format "%S" result) - (format "%s" result))) - (org-babel-reassemble-table - result - (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)))))) - (eval (read (format (if (member "output" - (cdr (assoc :result-params params))) - "(with-output-to-string %s)" - "(progn %s)") - (org-babel-expand-body:emacs-lisp body params))))))) + (let ((result + (eval (read (format (if (member "output" + (cdr (assoc :result-params params))) + "(with-output-to-string %s)" + "(progn %s)") + (org-babel-expand-body:emacs-lisp + body params)))))) + (org-babel-result-cond (cdr (assoc :result-params params)) + (let ((print-level nil) + (print-length nil)) + (if (or (member "scalar" (cdr (assoc :result-params params))) + (member "verbatim" (cdr (assoc :result-params params)))) + (format "%S" result) + (format "%s" result))) + (org-babel-reassemble-table + result + (org-babel-pick-name (cdr (assoc :colname-names params)) + (cdr (assoc :colnames params))) + (org-babel-pick-name (cdr (assoc :rowname-names params)) + (cdr (assoc :rownames params)))))))) (provide 'ob-emacs-lisp) diff --git a/lisp/ob-exp.el b/lisp/ob-exp.el index c8479e3..d6d4566 100644 --- a/lisp/ob-exp.el +++ b/lisp/ob-exp.el @@ -69,6 +69,8 @@ be executed." ('otherwise (error "Requested export buffer when `org-current-export-file' is nil")))) +(defvar org-link-search-inhibit-query) + (defmacro org-babel-exp-in-export-file (lang &rest body) (declare (indent 1)) `(let* ((lang-headers (intern (concat "org-babel-default-header-args:" ,lang))) @@ -372,7 +374,7 @@ replaced with its value." (cons (substring (symbol-name (car pair)) 1) (format "%S" (cdr pair)))) (nth 2 info)) - ("flags" . ,((lambda (f) (when f (concat " " f))) (nth 3 info))) + ("flags" . ,(let ((f (nth 3 info))) (when f (concat " " f)))) ("name" . ,(or (nth 4 info) ""))))) (defun org-babel-exp-results (info type &optional silent hash) diff --git a/lisp/ob-fortran.el b/lisp/ob-fortran.el index df7bfa0..61cb19a 100644 --- a/lisp/ob-fortran.el +++ b/lisp/ob-fortran.el @@ -60,20 +60,20 @@ (mapconcat 'identity (if (listp flags) flags (list flags)) " ") (org-babel-process-file-name tmp-src-file)) "")))) - ((lambda (results) - (org-babel-reassemble-table - (org-babel-result-cond (cdr (assoc :result-params params)) - (org-babel-read results) - (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-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) "")) ""))))) + (let ((results + (org-babel-trim + (org-babel-eval + (concat tmp-bin-file (if cmdline (concat " " cmdline) "")) "")))) + (org-babel-reassemble-table + (org-babel-result-cond (cdr (assoc :result-params params)) + (org-babel-read results) + (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-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-expand-body:fortran (body params) "Expand a block of fortran or fortran code with org-babel according to diff --git a/lisp/ob-haskell.el b/lisp/ob-haskell.el index a012711..6c9fed1 100644 --- a/lisp/ob-haskell.el +++ b/lisp/ob-haskell.el @@ -79,12 +79,12 @@ (cdr (member org-babel-haskell-eoe (reverse (mapcar #'org-babel-trim raw))))))) (org-babel-reassemble-table - ((lambda (result) - (org-babel-result-cond (cdr (assoc :result-params params)) - result (org-babel-haskell-table-or-string result))) - (case result-type - ('output (mapconcat #'identity (reverse (cdr results)) "\n")) - ('value (car results)))) + (let ((result + (case result-type + (output (mapconcat #'identity (reverse (cdr results)) "\n")) + (value (car results))))) + (org-babel-result-cond (cdr (assoc :result-params params)) + result (org-babel-haskell-table-or-string result))) (org-babel-pick-name (cdr (assoc :colname-names params)) (cdr (assoc :colname-names params))) (org-babel-pick-name (cdr (assoc :rowname-names params)) @@ -148,6 +148,7 @@ specifying a variable of the same value." (format "%S" var))) (defvar org-src-preserve-indentation) +(defvar org-export-copy-to-kill-ring) (declare-function org-export-to-file "ox" (backend file &optional async subtreep visible-only body-only ext-plist)) diff --git a/lisp/ob-io.el b/lisp/ob-io.el index af18f74..5368ff5 100644 --- a/lisp/ob-io.el +++ b/lisp/ob-io.el @@ -94,12 +94,11 @@ in BODY as elisp." (value (let* ((src-file (org-babel-temp-file "io-")) (wrapper (format org-babel-io-wrapper-method body))) (with-temp-file src-file (insert wrapper)) - ((lambda (raw) - (org-babel-result-cond result-params - raw - (org-babel-io-table-or-string raw))) - (org-babel-eval - (concat org-babel-io-command " " src-file) "")))))) + (let ((raw (org-babel-eval + (concat org-babel-io-command " " src-file) ""))) + (org-babel-result-cond result-params + raw + (org-babel-io-table-or-string raw))))))) (defun org-babel-prep-session:io (session params) diff --git a/lisp/ob-java.el b/lisp/ob-java.el index c0e9a53..37ac8da 100644 --- a/lisp/ob-java.el +++ b/lisp/ob-java.el @@ -55,19 +55,18 @@ ;; created package-name directories if missing (unless (or (not packagename) (file-exists-p packagename)) (make-directory packagename 'parents)) - ((lambda (results) - (org-babel-reassemble-table - (org-babel-result-cond (cdr (assoc :result-params params)) - (org-babel-read results) - (let ((tmp-file (org-babel-temp-file "c-"))) - (with-temp-file tmp-file (insert results)) - (org-babel-import-elisp-from-file tmp-file))) - (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-eval (concat org-babel-java-command - " " cmdline " " classname) "")))) + (let ((results (org-babel-eval (concat org-babel-java-command + " " cmdline " " classname) ""))) + (org-babel-reassemble-table + (org-babel-result-cond (cdr (assoc :result-params params)) + (org-babel-read results) + (let ((tmp-file (org-babel-temp-file "c-"))) + (with-temp-file tmp-file (insert results)) + (org-babel-import-elisp-from-file tmp-file))) + (org-babel-pick-name + (cdr (assoc :colname-names params)) (cdr (assoc :colnames params))) + (org-babel-pick-name + (cdr (assoc :rowname-names params)) (cdr (assoc :rownames params))))))) (provide 'ob-java) diff --git a/lisp/ob-latex.el b/lisp/ob-latex.el index edc9fe8..85918e6 100644 --- a/lisp/ob-latex.el +++ b/lisp/ob-latex.el @@ -50,7 +50,7 @@ '((:results . "latex") (:exports . "results")) "Default arguments to use when evaluating a LaTeX source block.") -(defcustom org-babel-latex-htlatex nil +(defcustom org-babel-latex-htlatex "" "The htlatex command to enable conversion of latex to SVG or HTML." :group 'org-babel :type 'string) @@ -59,7 +59,7 @@ '("[usenames]{color}" "{tikz}" "{color}" "{listings}" "{amsmath}") "Packages to use for htlatex export." :group 'org-babel - :type '(list string)) + :type '(list (string))) (defun org-babel-expand-body:latex (body params) "Expand BODY according to PARAMS, return the expanded body." @@ -141,7 +141,7 @@ This function is called by `org-babel-execute-src-block'." (delete-file transient-pdf-file)))))) ((and (or (string-match "\\.svg$" out-file) (string-match "\\.html$" out-file)) - org-babel-latex-htlatex) + (not (string= "" org-babel-latex-htlatex))) (with-temp-file tex-file (insert (concat "\\documentclass[preview]{standalone} diff --git a/lisp/ob-lilypond.el b/lisp/ob-lilypond.el index 6080a5a..a58a443 100644 --- a/lisp/ob-lilypond.el +++ b/lisp/ob-lilypond.el @@ -200,7 +200,6 @@ FILE-NAME is full path to lilypond (.ly) file" (let ((arg-1 (ly-determine-ly-path)) ;program (arg-2 nil) ;infile (arg-3 "*lilypond*") ;buffer - (arg-4 t) ;display (arg-4 t) ;display (arg-5 (if ly-gen-png "--png" "")) ;&rest... (arg-6 (if ly-gen-html "--html" "")) diff --git a/lisp/ob-lisp.el b/lisp/ob-lisp.el index 2bb1a25..c912fd9 100644 --- a/lisp/ob-lisp.el +++ b/lisp/ob-lisp.el @@ -75,23 +75,24 @@ current directory string." "Execute a block of Common Lisp code with Babel." (require 'slime) (org-babel-reassemble-table - ((lambda (result) - (org-babel-result-cond (cdr (assoc :result-params params)) - (car result) - (condition-case nil - (read (org-babel-lisp-vector-to-list (cadr result))) - (error (cadr result))))) - (with-temp-buffer - (insert (org-babel-expand-body:lisp body params)) - (slime-eval `(swank:eval-and-grab-output - ,(let ((dir (if (assoc :dir params) - (cdr (assoc :dir params)) - default-directory))) - (format - (if dir (format org-babel-lisp-dir-fmt dir) "(progn %s)") - (buffer-substring-no-properties - (point-min) (point-max))))) - (cdr (assoc :package params))))) + (let ((result + (with-temp-buffer + (insert (org-babel-expand-body:lisp body params)) + (slime-eval `(swank:eval-and-grab-output + ,(let ((dir (if (assoc :dir params) + (cdr (assoc :dir params)) + default-directory))) + (format + (if dir (format org-babel-lisp-dir-fmt dir) + "(progn %s)") + (buffer-substring-no-properties + (point-min) (point-max))))) + (cdr (assoc :package params)))))) + (org-babel-result-cond (cdr (assoc :result-params params)) + (car result) + (condition-case nil + (read (org-babel-lisp-vector-to-list (cadr result))) + (error (cadr result))))) (org-babel-pick-name (cdr (assoc :colname-names params)) (cdr (assoc :colnames params))) (org-babel-pick-name (cdr (assoc :rowname-names params)) diff --git a/lisp/ob-makefile.el b/lisp/ob-makefile.el index 7b0ff93..517b5a6 100644 --- a/lisp/ob-makefile.el +++ b/lisp/ob-makefile.el @@ -1,6 +1,6 @@ ;;; ob-makefile.el --- org-babel functions for makefile evaluation -;; Copyright (C) 2009-2012 Free Software Foundation, Inc. +;; Copyright (C) 2009-2013 Free Software Foundation, Inc. ;; Author: Eric Schulte and Thomas S. Dye ;; Keywords: literate programming, reproducible research diff --git a/lisp/ob-maxima.el b/lisp/ob-maxima.el index 726d686..5be378e 100644 --- a/lisp/ob-maxima.el +++ b/lisp/ob-maxima.el @@ -65,8 +65,8 @@ "\n"))) (defun org-babel-execute:maxima (body params) - "Execute a block of Maxima entries with org-babel. This function is -called by `org-babel-execute-src-block'." + "Execute a block of Maxima entries with org-babel. +This function is called by `org-babel-execute-src-block'." (message "executing Maxima source code block") (let ((result-params (split-string (or (cdr (assoc :results params)) ""))) (result @@ -76,18 +76,18 @@ called by `org-babel-execute-src-block'." org-babel-maxima-command in-file cmdline))) (with-temp-file in-file (insert (org-babel-maxima-expand body params))) (message cmd) - ((lambda (raw) ;; " | grep -v batch | grep -v 'replaced' | sed '/^$/d' " - (mapconcat - #'identity - (delq nil - (mapcar (lambda (line) - (unless (or (string-match "batch" line) - (string-match "^rat: replaced .*$" line) - (string-match "^;;; Loading #P" line) - (= 0 (length line))) - line)) - (split-string raw "[\r\n]"))) "\n")) - (org-babel-eval cmd ""))))) + ;; " | grep -v batch | grep -v 'replaced' | sed '/^$/d' " + (let ((raw (org-babel-eval cmd ""))) + (mapconcat + #'identity + (delq nil + (mapcar (lambda (line) + (unless (or (string-match "batch" line) + (string-match "^rat: replaced .*$" line) + (string-match "^;;; Loading #P" line) + (= 0 (length line))) + line)) + (split-string raw "[\r\n]"))) "\n"))))) (if (org-babel-maxima-graphical-output-file params) nil (org-babel-result-cond result-params diff --git a/lisp/ob-perl.el b/lisp/ob-perl.el index 43ab946..d374e47 100644 --- a/lisp/ob-perl.el +++ b/lisp/ob-perl.el @@ -135,21 +135,21 @@ return the value of the last statement in BODY, as elisp." (tmp-file (org-babel-temp-file "perl-")) (tmp-babel-file (org-babel-process-file-name tmp-file 'noquote))) - ((lambda (results) - (when results - (org-babel-result-cond result-params - (org-babel-eval-read-file tmp-file) - (org-babel-import-elisp-from-file tmp-file '(16))))) - (case result-type - (output - (with-temp-file tmp-file - (insert - (org-babel-eval org-babel-perl-command body)) - (buffer-string))) - (value - (org-babel-eval org-babel-perl-command - (format org-babel-perl-wrapper-method - body tmp-babel-file))))))) + (let ((results + (case result-type + (output + (with-temp-file tmp-file + (insert + (org-babel-eval org-babel-perl-command body)) + (buffer-string))) + (value + (org-babel-eval org-babel-perl-command + (format org-babel-perl-wrapper-method + body tmp-babel-file)))))) + (when results + (org-babel-result-cond result-params + (org-babel-eval-read-file tmp-file) + (org-babel-import-elisp-from-file tmp-file '(16))))))) (provide 'ob-perl) diff --git a/lisp/ob-picolisp.el b/lisp/ob-picolisp.el index 1d17919..279cd7b 100644 --- a/lisp/ob-picolisp.el +++ b/lisp/ob-picolisp.el @@ -99,16 +99,16 @@ called by `org-babel-execute-src-block'" (message "executing Picolisp source code block") (let* ( - ;; name of the session or "none" + ;; Name of the session or "none". (session-name (cdr (assoc :session params))) - ;; set the session if the session variable is non-nil + ;; 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 + ;; 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' + ;; 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 + ;; Wrap body appropriately for the type of evaluation and results. (wrapped-body (cond ((or (member "code" result-params) @@ -118,53 +118,54 @@ (format "(print (out \"/dev/null\" %s))" full-body)) ((member "value" result-params) (format "(out \"/dev/null\" %s)" full-body)) - (t full-body)))) - - ((lambda (result) - (org-babel-result-cond result-params - 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)) - "")))))) + (t full-body))) + (result + (if (not (string= session-name "none")) + ;; Session based evaluation. + (mapconcat ;; <- joins the list back 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 exp. + (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)) + ""))))) + (org-babel-result-cond result-params + result + (read result)))) (defun org-babel-picolisp-initiate-session (&optional session-name) "If there is not a current inferior-process-buffer in SESSION diff --git a/lisp/ob-plantuml.el b/lisp/ob-plantuml.el index c17d444..f992d04 100644 --- a/lisp/ob-plantuml.el +++ b/lisp/ob-plantuml.el @@ -40,7 +40,7 @@ '((:results . "file") (:exports . "results")) "Default arguments for evaluating a plantuml source block.") -(defcustom org-plantuml-jar-path nil +(defcustom org-plantuml-jar-path "" "Path to the plantuml.jar file." :group 'org-babel :version "24.1" @@ -55,7 +55,7 @@ This function is called by `org-babel-execute-src-block'." (cmdline (cdr (assoc :cmdline params))) (in-file (org-babel-temp-file "plantuml-")) (java (or (cdr (assoc :java params)) "")) - (cmd (if (not org-plantuml-jar-path) + (cmd (if (string= "" org-plantuml-jar-path) (error "`org-plantuml-jar-path' is not set") (concat "java " java " -jar " (shell-quote-argument diff --git a/lisp/ob-python.el b/lisp/ob-python.el index 17da109..3c3f664 100644 --- a/lisp/ob-python.el +++ b/lisp/ob-python.el @@ -54,7 +54,7 @@ This will typically be either 'python or 'python-mode." :group 'org-babel :version "24.4" :package-version '(Org . "8.0") - :type 'function) + :type 'symbol) (defvar org-src-preserve-indentation) @@ -70,7 +70,7 @@ This will typically be either 'python or 'python-mode." :group 'org-babel :version "24.4" :package-version '(Org . "8.0") - :type 'string) + :type 'symbol) (defun org-babel-execute:python (body params) "Execute a block of Python code with Babel. @@ -143,13 +143,12 @@ specifying a variable of the same value." "Convert RESULTS into an appropriate elisp value. If the results look like a list or tuple, then convert them into an Emacs-lisp table, otherwise return the results as a string." - ((lambda (res) - (if (listp res) - (mapcar (lambda (el) (if (equal el 'None) - org-babel-python-None-to el)) - res) - res)) - (org-babel-script-escape results))) + (let ((res (org-babel-script-escape results))) + (if (listp res) + (mapcar (lambda (el) (if (equal el 'None) + org-babel-python-None-to el)) + res) + res))) (defvar org-babel-python-buffers '((:default . "*Python*"))) @@ -157,14 +156,14 @@ Emacs-lisp table, otherwise return the results as a string." "Return the buffer associated with SESSION." (cdr (assoc session org-babel-python-buffers))) -(defun org-babel-python-with-earmufs (session) +(defun org-babel-python-with-earmuffs (session) (let ((name (if (stringp session) session (format "%s" session)))) (if (and (string= "*" (substring name 0 1)) (string= "*" (substring name (- (length name) 1)))) name (format "*%s*" name)))) -(defun org-babel-python-without-earmufs (session) +(defun org-babel-python-without-earmuffs (session) (let ((name (if (stringp session) session (format "%s" session)))) (if (and (string= "*" (substring name 0 1)) (string= "*" (substring name (- (length name) 1)))) @@ -172,6 +171,8 @@ Emacs-lisp table, otherwise return the results as a string." name))) (defvar py-default-interpreter) +(defvar py-which-bufname) +(defvar python-shell-buffer-name) (defun org-babel-python-initiate-session-by-key (&optional session) "Initiate a python session. If there is not a current inferior-process-buffer in SESSION @@ -189,9 +190,9 @@ then create. Return the initialized session." (if (not (version< "24.1" emacs-version)) (run-python cmd) (unless python-buffer - (setq python-buffer (org-babel-python-with-earmufs session))) + (setq python-buffer (org-babel-python-with-earmuffs session))) (let ((python-shell-buffer-name - (org-babel-python-without-earmufs python-buffer))) + (org-babel-python-without-earmuffs python-buffer))) (run-python cmd)))) ((and (eq 'python-mode org-babel-python-mode) (fboundp 'py-shell)) ; python-mode.el @@ -207,7 +208,7 @@ then create. Return the initialized session." (concat "Python-" (symbol-name session)))) (py-which-bufname bufname)) (py-shell) - (setq python-buffer (org-babel-python-with-earmufs bufname)))) + (setq python-buffer (org-babel-python-with-earmuffs bufname)))) (t (error "No function available for running an inferior Python"))) (setq org-babel-python-buffers @@ -252,34 +253,34 @@ open('%s', 'w').write( pprint.pformat(main()) )") If RESULT-TYPE equals 'output then return standard output as a string. If RESULT-TYPE equals 'value then return the value of the last statement in BODY, as elisp." - ((lambda (raw) - (org-babel-result-cond result-params - raw - (org-babel-python-table-or-string (org-babel-trim raw)))) - (case result-type - (output (org-babel-eval org-babel-python-command - (concat (if preamble (concat preamble "\n") "") - body))) - (value (let ((tmp-file (org-babel-temp-file "python-"))) - (org-babel-eval - org-babel-python-command - (concat - (if preamble (concat preamble "\n") "") - (format - (if (member "pp" result-params) - org-babel-python-pp-wrapper-method - org-babel-python-wrapper-method) - (mapconcat - (lambda (line) (format "\t%s" line)) - (split-string - (org-remove-indentation - (org-babel-trim body)) - "[\r\n]") "\n") - (org-babel-process-file-name tmp-file 'noquote)))) - (org-babel-eval-read-file tmp-file)))))) + (let ((raw + (case result-type + (output (org-babel-eval org-babel-python-command + (concat (if preamble (concat preamble "\n")) + body))) + (value (let ((tmp-file (org-babel-temp-file "python-"))) + (org-babel-eval + org-babel-python-command + (concat + (if preamble (concat preamble "\n") "") + (format + (if (member "pp" result-params) + org-babel-python-pp-wrapper-method + org-babel-python-wrapper-method) + (mapconcat + (lambda (line) (format "\t%s" line)) + (split-string + (org-remove-indentation + (org-babel-trim body)) + "[\r\n]") "\n") + (org-babel-process-file-name tmp-file 'noquote)))) + (org-babel-eval-read-file tmp-file)))))) + (org-babel-result-cond result-params + raw + (org-babel-python-table-or-string (org-babel-trim raw))))) (defun org-babel-python-evaluate-session - (session body &optional result-type result-params) + (session body &optional result-type result-params) "Pass BODY to the Python process 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 @@ -296,39 +297,41 @@ last statement in BODY, as elisp." (format "open('%s', 'w').write(pprint.pformat(_))" (org-babel-process-file-name tmp-file 'noquote))) (list (format "open('%s', 'w').write(str(_))" - (org-babel-process-file-name tmp-file 'noquote))))))) + (org-babel-process-file-name tmp-file + 'noquote))))))) (input-body (lambda (body) (mapc (lambda (line) (insert line) (funcall send-wait)) (split-string body "[\r\n]")) - (funcall send-wait)))) - ((lambda (results) - (unless (string= (substring org-babel-python-eoe-indicator 1 -1) results) - (org-babel-result-cond result-params - results - (org-babel-python-table-or-string results)))) - (case result-type - (output - (mapconcat - #'org-babel-trim - (butlast - (org-babel-comint-with-output - (session org-babel-python-eoe-indicator t body) - (funcall input-body body) - (funcall send-wait) (funcall send-wait) - (insert org-babel-python-eoe-indicator) - (funcall send-wait)) - 2) "\n")) - (value - (let ((tmp-file (org-babel-temp-file "python-"))) - (org-babel-comint-with-output - (session org-babel-python-eoe-indicator nil body) - (let ((comint-process-echoes nil)) - (funcall input-body body) - (funcall dump-last-value tmp-file (member "pp" result-params)) - (funcall send-wait) (funcall send-wait) - (insert org-babel-python-eoe-indicator) - (funcall send-wait))) - (org-babel-eval-read-file tmp-file))))))) + (funcall send-wait))) + (results + (case result-type + (output + (mapconcat + #'org-babel-trim + (butlast + (org-babel-comint-with-output + (session org-babel-python-eoe-indicator t body) + (funcall input-body body) + (funcall send-wait) (funcall send-wait) + (insert org-babel-python-eoe-indicator) + (funcall send-wait)) + 2) "\n")) + (value + (let ((tmp-file (org-babel-temp-file "python-"))) + (org-babel-comint-with-output + (session org-babel-python-eoe-indicator nil body) + (let ((comint-process-echoes nil)) + (funcall input-body body) + (funcall dump-last-value tmp-file + (member "pp" result-params)) + (funcall send-wait) (funcall send-wait) + (insert org-babel-python-eoe-indicator) + (funcall send-wait))) + (org-babel-eval-read-file tmp-file)))))) + (unless (string= (substring org-babel-python-eoe-indicator 1 -1) results) + (org-babel-result-cond result-params + results + (org-babel-python-table-or-string results))))) (defun org-babel-python-read-string (string) "Strip 's from around Python string." diff --git a/lisp/ob-ruby.el b/lisp/ob-ruby.el index af52831..34b9eaf 100644 --- a/lisp/ob-ruby.el +++ b/lisp/ob-ruby.el @@ -62,9 +62,7 @@ :group 'org-babel :version "24.4" :package-version '(Org . "8.0") - :type 'string) - - + :type 'symbol) (defun org-babel-execute:ruby (body params) "Execute a block of Ruby code with Babel. @@ -139,13 +137,12 @@ specifying a variable of the same value." "Convert RESULTS into an appropriate elisp value. If RESULTS look like a table, then convert them into an Emacs-lisp table, otherwise return the results as a string." - ((lambda (res) - (if (listp res) - (mapcar (lambda (el) (if (equal el 'nil) - org-babel-ruby-nil-to el)) - res) - res)) - (org-babel-script-escape results))) + (let ((res (org-babel-script-escape results))) + (if (listp res) + (mapcar (lambda (el) (if (equal el 'nil) + org-babel-ruby-nil-to el)) + res) + res))) (defun org-babel-ruby-initiate-session (&optional session params) "Initiate a ruby session. @@ -204,12 +201,11 @@ return the value of the last statement in BODY, as elisp." org-babel-ruby-pp-wrapper-method org-babel-ruby-wrapper-method) body (org-babel-process-file-name tmp-file 'noquote))) - ((lambda (raw) - (if (or (member "code" result-params) - (member "pp" result-params)) - raw - (org-babel-ruby-table-or-string raw))) - (org-babel-eval-read-file tmp-file))))) + (let ((raw (org-babel-eval-read-file tmp-file))) + (if (or (member "code" result-params) + (member "pp" result-params)) + raw + (org-babel-ruby-table-or-string raw)))))) ;; comint session evaluation (case result-type (output diff --git a/lisp/ob-scala.el b/lisp/ob-scala.el index 7cb3099..f778361 100644 --- a/lisp/ob-scala.el +++ b/lisp/ob-scala.el @@ -100,12 +100,11 @@ in BODY as elisp." (let* ((src-file (org-babel-temp-file "scala-")) (wrapper (format org-babel-scala-wrapper-method body))) (with-temp-file src-file (insert wrapper)) - ((lambda (raw) - (org-babel-result-cond result-params - raw - (org-babel-scala-table-or-string raw))) - (org-babel-eval - (concat org-babel-scala-command " " src-file) "")))))) + (let ((raw (org-babel-eval + (concat org-babel-scala-command " " src-file) ""))) + (org-babel-result-cond result-params + raw + (org-babel-scala-table-or-string raw))))))) (defun org-babel-prep-session:scala (session params) diff --git a/lisp/ob-sh.el b/lisp/ob-sh.el index ec1306b..4984ff9 100644 --- a/lisp/ob-sh.el +++ b/lisp/ob-sh.el @@ -53,9 +53,9 @@ This will be passed to `shell-command-on-region'") This function is called by `org-babel-execute-src-block'." (let* ((session (org-babel-sh-initiate-session (cdr (assoc :session params)))) - (stdin ((lambda (stdin) (when stdin (org-babel-sh-var-to-string - (org-babel-ref-resolve stdin)))) - (cdr (assoc :stdin params)))) + (stdin (let ((stdin (cdr (assoc :stdin params)))) + (when stdin (org-babel-sh-var-to-string + (org-babel-ref-resolve stdin))))) (full-body (org-babel-expand-body:generic body params (org-babel-variable-assignments:sh params)))) (org-babel-reassemble-table @@ -135,68 +135,69 @@ Emacs-lisp table, otherwise return the results as a string." If RESULT-TYPE equals 'output then return a list of the outputs of the statements in BODY, if RESULT-TYPE equals 'value then return the value of the last statement in BODY." - ((lambda (results) - (when results - (let ((result-params (cdr (assoc :result-params params)))) - (org-babel-result-cond result-params - results - (let ((tmp-file (org-babel-temp-file "sh-"))) - (with-temp-file tmp-file (insert results)) - (org-babel-import-elisp-from-file tmp-file)))))) - (cond - (stdin ; external shell script w/STDIN - (let ((script-file (org-babel-temp-file "sh-script-")) - (stdin-file (org-babel-temp-file "sh-stdin-")) - (shebang (cdr (assoc :shebang params))) - (padline (not (string= "no" (cdr (assoc :padline params)))))) - (with-temp-file script-file - (when shebang (insert (concat shebang "\n"))) - (when padline (insert "\n")) - (insert body)) - (set-file-modes script-file #o755) - (with-temp-file stdin-file (insert stdin)) - (with-temp-buffer - (call-process-shell-command - (if shebang - script-file - (format "%s %s" org-babel-sh-command script-file)) - stdin-file - (current-buffer)) - (buffer-string)))) - (session ; session evaluation - (mapconcat - #'org-babel-sh-strip-weird-long-prompt - (mapcar - #'org-babel-trim - (butlast - (org-babel-comint-with-output - (session org-babel-sh-eoe-output t body) - (mapc - (lambda (line) - (insert line) - (comint-send-input nil t) - (while (save-excursion - (goto-char comint-last-input-end) - (not (re-search-forward - comint-prompt-regexp nil t))) - (accept-process-output (get-buffer-process (current-buffer))))) - (append - (split-string (org-babel-trim body) "\n") - (list org-babel-sh-eoe-indicator)))) - 2)) "\n")) - ('otherwise ; external shell script - (if (and (cdr (assoc :shebang params)) - (> (length (cdr (assoc :shebang params))) 0)) - (let ((script-file (org-babel-temp-file "sh-script-")) - (shebang (cdr (assoc :shebang params))) - (padline (not (string= "no" (cdr (assoc :padline params)))))) - (with-temp-file script-file - (when shebang (insert (concat shebang "\n"))) - (when padline (insert "\n")) - (insert body)) - (set-file-modes script-file #o755) - (org-babel-eval script-file "")) - (org-babel-eval org-babel-sh-command (org-babel-trim body))))))) + (let ((results + (cond + (stdin ; external shell script w/STDIN + (let ((script-file (org-babel-temp-file "sh-script-")) + (stdin-file (org-babel-temp-file "sh-stdin-")) + (shebang (cdr (assoc :shebang params))) + (padline (not (string= "no" (cdr (assoc :padline params)))))) + (with-temp-file script-file + (when shebang (insert (concat shebang "\n"))) + (when padline (insert "\n")) + (insert body)) + (set-file-modes script-file #o755) + (with-temp-file stdin-file (insert stdin)) + (with-temp-buffer + (call-process-shell-command + (if shebang + script-file + (format "%s %s" org-babel-sh-command script-file)) + stdin-file + (current-buffer)) + (buffer-string)))) + (session ; session evaluation + (mapconcat + #'org-babel-sh-strip-weird-long-prompt + (mapcar + #'org-babel-trim + (butlast + (org-babel-comint-with-output + (session org-babel-sh-eoe-output t body) + (mapc + (lambda (line) + (insert line) + (comint-send-input nil t) + (while (save-excursion + (goto-char comint-last-input-end) + (not (re-search-forward + comint-prompt-regexp nil t))) + (accept-process-output + (get-buffer-process (current-buffer))))) + (append + (split-string (org-babel-trim body) "\n") + (list org-babel-sh-eoe-indicator)))) + 2)) "\n")) + ('otherwise ; external shell script + (if (and (cdr (assoc :shebang params)) + (> (length (cdr (assoc :shebang params))) 0)) + (let ((script-file (org-babel-temp-file "sh-script-")) + (shebang (cdr (assoc :shebang params))) + (padline (not (equal "no" (cdr (assoc :padline params)))))) + (with-temp-file script-file + (when shebang (insert (concat shebang "\n"))) + (when padline (insert "\n")) + (insert body)) + (set-file-modes script-file #o755) + (org-babel-eval script-file "")) + (org-babel-eval org-babel-sh-command (org-babel-trim body))))))) + (when results + (let ((result-params (cdr (assoc :result-params params)))) + (org-babel-result-cond result-params + results + (let ((tmp-file (org-babel-temp-file "sh-"))) + (with-temp-file tmp-file (insert results)) + (org-babel-import-elisp-from-file tmp-file))))))) (defun org-babel-sh-strip-weird-long-prompt (string) "Remove prompt cruft from a string of shell output." diff --git a/lisp/ob-shen.el b/lisp/ob-shen.el index dc6313d..68169da 100644 --- a/lisp/ob-shen.el +++ b/lisp/ob-shen.el @@ -66,14 +66,14 @@ This function is called by `org-babel-execute-src-block'" (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) - (org-babel-result-cond result-params - results - (condition-case nil (org-babel-script-escape results) - (error results)))) - (with-temp-buffer - (insert full-body) - (call-interactively #'shen-eval-defun))))) + (let ((results + (with-temp-buffer + (insert full-body) + (call-interactively #'shen-eval-defun)))) + (org-babel-result-cond result-params + results + (condition-case nil (org-babel-script-escape results) + (error results)))))) (provide 'ob-shen) ;;; ob-shen.el ends here diff --git a/lisp/ob-sql.el b/lisp/ob-sql.el index 658a54f..d17dd8a 100644 --- a/lisp/ob-sql.el +++ b/lisp/ob-sql.el @@ -186,19 +186,17 @@ This function is called by `org-babel-execute-src-block'." (lambda (pair) (setq body (replace-regexp-in-string - (format "\$%s" (car pair)) - ((lambda (val) - (if (listp val) - ((lambda (data-file) - (with-temp-file data-file - (insert (orgtbl-to-csv - val '(:fmt (lambda (el) (if (stringp el) - el - (format "%S" el))))))) - data-file) - (org-babel-temp-file "sql-data-")) - (if (stringp val) val (format "%S" val)))) - (cdr pair)) + (format "\$%s" (car pair)) ;FIXME: "\$" == "$"! + (let ((val (cdr pair))) + (if (listp val) + (let ((data-file (org-babel-temp-file "sql-data-"))) + (with-temp-file data-file + (insert (orgtbl-to-csv + val '(:fmt (lambda (el) (if (stringp el) + el + (format "%S" el))))))) + data-file) + (if (stringp val) val (format "%S" val)))) body))) vars) body) diff --git a/lisp/ob-sqlite.el b/lisp/ob-sqlite.el index 84d4688..fcfdb8e 100644 --- a/lisp/ob-sqlite.el +++ b/lisp/ob-sqlite.el @@ -114,23 +114,22 @@ This function is called by `org-babel-execute-src-block'." (defun org-babel-sqlite-expand-vars (body vars) "Expand the variables held in VARS in BODY." + ;; FIXME: Redundancy with org-babel-sql-expand-vars! (mapc (lambda (pair) (setq body (replace-regexp-in-string - (format "\$%s" (car pair)) - ((lambda (val) - (if (listp val) - ((lambda (data-file) - (with-temp-file data-file - (insert (orgtbl-to-csv - val '(:fmt (lambda (el) (if (stringp el) - el - (format "%S" el))))))) - data-file) - (org-babel-temp-file "sqlite-data-")) - (if (stringp val) val (format "%S" val)))) - (cdr pair)) + (format "\$%s" (car pair)) ;FIXME: "\$" == "$"! + (let ((val (cdr pair))) + (if (listp val) + (let ((data-file (org-babel-temp-file "sqlite-data-"))) + (with-temp-file data-file + (insert (orgtbl-to-csv + val '(:fmt (lambda (el) (if (stringp el) + el + (format "%S" el))))))) + data-file) + (if (stringp val) val (format "%S" val)))) body))) vars) body) diff --git a/lisp/ob-table.el b/lisp/ob-table.el index 8b3e36d..c71bb87 100644 --- a/lisp/ob-table.el +++ b/lisp/ob-table.el @@ -60,7 +60,7 @@ character and replace it with ellipses." (concat (substring string 0 (match-beginning 0)) (if (match-string 1 string) "...")) string)) -(defmacro sbe (source-block &rest variables) +(defmacro sbe (source-block &rest variables) ;FIXME: Namespace prefix! "Return the results of calling SOURCE-BLOCK with VARIABLES. Each element of VARIABLES should be a two element list, whose first element is the name of the variable and @@ -85,6 +85,7 @@ as shown in the example below. | 1 | 2 | :file nothing.png | nothing.png | #+TBLFM: @1$4='(sbe test-sbe $3 (x $1) (y $2))" + (declare (debug (form form))) (let* ((header-args (if (stringp (car variables)) (car variables) "")) (variables (if (stringp (car variables)) (cdr variables) variables))) (let* (quote @@ -107,31 +108,31 @@ as shown in the example below. 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)) + (let ((result + (if (and source-block (> (length source-block) 0)) + (let ((params + ;; FIXME: Why `eval'?!?!? + (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")))) + ""))) + (org-babel-trim (if (stringp result) result (format "%S" result))))))) (provide 'ob-table) diff --git a/lisp/ob-tangle.el b/lisp/ob-tangle.el index 8141943..ffc74cb 100644 --- a/lisp/ob-tangle.el +++ b/lisp/ob-tangle.el @@ -144,16 +144,18 @@ evaluating BODY." Source code blocks are extracted with `org-babel-tangle'. Optional argument TARGET-FILE can be used to specify a default export file for all source blocks. Optional argument LANG can be -used to limit the exported source code blocks by language." +used to limit the exported source code blocks by language. +Return a list whose CAR is the tangled file name." (interactive "fFile to tangle: \nP") (let ((visited-p (get-file-buffer (expand-file-name file))) to-be-removed) - (save-window-excursion - (find-file file) - (setq to-be-removed (current-buffer)) - (org-babel-tangle nil target-file lang)) - (unless visited-p - (kill-buffer to-be-removed)))) + (prog1 + (save-window-excursion + (find-file file) + (setq to-be-removed (current-buffer)) + (org-babel-tangle nil target-file lang)) + (unless visited-p + (kill-buffer to-be-removed))))) (defun org-babel-tangle-publish (_ filename pub-dir) "Tangle FILENAME and place the results in PUB-DIR." @@ -208,8 +210,8 @@ used to limit the exported source code blocks by language." (lambda (spec) (let ((get-spec (lambda (name) (cdr (assoc name (nth 4 spec)))))) (let* ((tangle (funcall get-spec :tangle)) - (she-bang ((lambda (sheb) (when (> (length sheb) 0) sheb)) - (funcall get-spec :shebang))) + (she-bang (let ((sheb (funcall get-spec :shebang))) + (when (> (length sheb) 0) sheb))) (tangle-mode (funcall get-spec :tangle-mode)) (base-name (cond ((string= "yes" tangle) @@ -222,9 +224,9 @@ used to limit the exported source code blocks by language." (if (and ext (string= "yes" tangle)) (concat base-name "." ext) base-name)))) (when file-name - ;; possibly create the parent directories for file - (when ((lambda (m) (and m (not (string= m "no")))) - (funcall get-spec :mkdirp)) + ;; Possibly create the parent directories for file. + (when (let ((m (funcall get-spec :mkdirp))) + (and m (not (string= m "no")))) (make-directory (file-name-directory file-name) 'parents)) ;; delete any old versions of file (when (and (file-exists-p file-name) @@ -312,9 +314,8 @@ that the appropriate major-mode is set. SPEC has the form: (string= comments "yes") (string= comments "noweb"))) (link-data (mapcar (lambda (el) (cons (symbol-name el) - ((lambda (le) - (if (stringp le) le (format "%S" le))) - (eval el)))) + (let ((le (eval el))) + (if (stringp le) le (format "%S" le))))) '(start-line file link source-name))) (insert-comment (lambda (text) (when (and comments (not (string= comments "no")) @@ -400,11 +401,10 @@ list to be used by `org-babel-tangle' directly." (cref-fmt (or (and (string-match "-l \"\\(.+\\)\"" extra) (match-string 1 extra)) org-coderef-label-format)) - (link ((lambda (link) - (and (string-match org-bracket-link-regexp link) - (match-string 1 link))) - (org-no-properties - (org-store-link nil)))) + (link (let ((link (org-no-properties + (org-store-link nil)))) + (and (string-match org-bracket-link-regexp link) + (match-string 1 link)))) (source-name (intern (or (nth 4 info) (format "%s:%d" @@ -416,28 +416,29 @@ list to be used by `org-babel-tangle' directly." (assignments-cmd (intern (concat "org-babel-variable-assignments:" src-lang))) (body - ((lambda (body) ;; Run the tangle-body-hook - (with-temp-buffer - (insert body) - (when (string-match "-r" extra) - (goto-char (point-min)) - (while (re-search-forward - (replace-regexp-in-string "%s" ".+" cref-fmt) nil t) - (replace-match ""))) - (run-hooks 'org-babel-tangle-body-hook) - (buffer-string))) - ((lambda (body) ;; Expand the body in language specific manner - (if (assoc :no-expand params) - body - (if (fboundp expand-cmd) - (funcall expand-cmd body params) - (org-babel-expand-body:generic - body params - (and (fboundp assignments-cmd) - (funcall assignments-cmd params)))))) - (if (org-babel-noweb-p params :tangle) - (org-babel-expand-noweb-references info) - (nth 1 info))))) + ;; Run the tangle-body-hook. + (let* ((body ;; Expand the body in language specific manner. + (if (org-babel-noweb-p params :tangle) + (org-babel-expand-noweb-references info) + (nth 1 info))) + (body + (if (assoc :no-expand params) + body + (if (fboundp expand-cmd) + (funcall expand-cmd body params) + (org-babel-expand-body:generic + body params + (and (fboundp assignments-cmd) + (funcall assignments-cmd params))))))) + (with-temp-buffer + (insert body) + (when (string-match "-r" extra) + (goto-char (point-min)) + (while (re-search-forward + (replace-regexp-in-string "%s" ".+" cref-fmt) nil t) + (replace-match ""))) + (run-hooks 'org-babel-tangle-body-hook) + (buffer-string)))) (comment (when (or (string= "both" (cdr (assoc :comments params))) (string= "org" (cdr (assoc :comments params)))) @@ -472,9 +473,8 @@ list to be used by `org-babel-tangle' directly." (source-name (nth 4 (or info (org-babel-get-src-block-info 'light)))) (link-data (mapcar (lambda (el) (cons (symbol-name el) - ((lambda (le) - (if (stringp le) le (format "%S" le))) - (eval el)))) + (let ((le (eval el))) + (if (stringp le) le (format "%S" le))))) '(start-line file link source-name)))) (list (org-fill-template org-babel-tangle-comment-format-beg link-data) (org-fill-template org-babel-tangle-comment-format-end link-data)))) diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index 8cfe858..4dfa3e9 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -863,7 +863,7 @@ When set to the symbol `not-today', skip scheduled previously, but not scheduled today. When set to the symbol `repeated-after-deadline', skip scheduled -items if they are repeated beyond the current dealine." +items if they are repeated beyond the current deadline." :group 'org-agenda-skip :group 'org-agenda-daily/weekly :type '(choice @@ -1419,13 +1419,14 @@ When nil, they may also match part of a word." :version "24.1" :type 'boolean) -(defcustom org-agenda-search-view-max-outline-level nil +(defcustom org-agenda-search-view-max-outline-level 0 "Maximum outline level to display in search view. E.g. when this is set to 1, the search view will only -show headlines of level 1." +show headlines of level 1. When set to 0, the default +value, don't limit agenda view by outline level." :group 'org-agenda-search-view :version "24.4" - :package-version '(Org . "8.0") + :package-version '(Org . "8.3") :type 'integer) (defgroup org-agenda-time-grid nil @@ -1746,10 +1747,9 @@ to capture the number of days." :version "24.4" :package-version '(Org . "8.0") :type '(list - (string :tag "Deadline today ") - (choice :tag "Deadline relative" - (string :tag "Format string") - (function)))) + (string :tag "Deadline today ") + (string :tag "Deadline in the future ") + (string :tag "Deadline in the past "))) (defcustom org-agenda-remove-times-when-in-prefix t "Non-nil means remove duplicate time specifications in agenda items. @@ -2840,6 +2840,8 @@ Pressing `<' twice means to restrict to the current subtree or region ((equal org-keys "!") (customize-variable 'org-stuck-projects)) (t (user-error "Invalid agenda key")))))) +(defvar org-agenda-multi) + (defun org-agenda-append-agenda () "Append another agenda view to the current one. This function allows interactive building of block agendas. @@ -3814,6 +3816,8 @@ generating a new one." 'org-priority)) (overlay-put ov 'org-type 'org-priority))))) +(defvar org-depend-tag-blocked) + (defun org-agenda-dim-blocked-tasks (&optional invisible) "Dim currently blocked TODO's in the agenda display. When INVISIBLE is non-nil, hide currently blocked TODO instead of @@ -3982,6 +3986,7 @@ This check for agenda markers in all agenda buffers currently active." ;;; Agenda timeline (defvar org-agenda-only-exact-dates nil) ; dynamically scoped +(defvar org-agenda-show-log-scoped) ;; dynamically scope in `org-timeline' or `org-agenda-list' (defun org-timeline (&optional dotodo) "Show a time-sorted view of the entries in the current org file. @@ -4578,7 +4583,7 @@ in `org-agenda-text-search-extra-files'." (goto-char (max (point-min) (1- (point)))) (while (re-search-forward regexp nil t) (org-back-to-heading t) - (while (and org-agenda-search-view-max-outline-level + (while (and (not (zerop org-agenda-search-view-max-outline-level)) (> (org-reduced-level (org-outline-level)) org-agenda-search-view-max-outline-level) (forward-line -1) @@ -4588,7 +4593,7 @@ in `org-agenda-text-search-extra-files'." beg1 (point) end (progn (outline-next-heading) - (while (and org-agenda-search-view-max-outline-level + (while (and (not (zerop org-agenda-search-view-max-outline-level)) (> (org-reduced-level (org-outline-level)) org-agenda-search-view-max-outline-level) (forward-line 1) @@ -5446,6 +5451,7 @@ This function is invoked if `org-agenda-todo-ignore-deadlines', (>= days n) (<= days n)))) +;;;###autoload (defun org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item (&optional end) "Do we have a reason to ignore this TODO entry because it has a time stamp?" @@ -5762,7 +5768,6 @@ please use `org-class' instead." dayname skip-weeks))) (make-obsolete 'org-diary-class 'org-class "") -(defvar org-agenda-show-log-scoped) ;; dynamically scope in `org-timeline' or `org-agenda-list' (defalias 'org-get-closed 'org-agenda-get-progress) (defun org-agenda-get-progress () "Return the logged TODO entries for agenda display." @@ -7080,6 +7085,7 @@ their type." 'help-echo "Agendas are currently limited to this subtree.") (org-detach-overlay org-agenda-restriction-lock-overlay) +;;;###autoload (defun org-agenda-set-restriction-lock (&optional type) "Set restriction lock for agenda, to current subtree or file. Restriction will be the file if TYPE is `file', or if type is the @@ -7529,9 +7535,11 @@ to switch to narrowing." (if notgroup (push (cons 'and nf0) f) (push (cons (or op 'or) nf0) f))))) - (if (equal nfilter filter) - (funcall ffunc f1 f filter t nil) - (funcall ffunc nf1 nf nfilter nil nil))))) + (cond ((equal filter '("+")) + (setq f (list (list 'not 'tags)))) + ((equal nfilter filter) + (funcall ffunc f1 f filter t nil)) + (t (funcall ffunc nf1 nf nfilter nil nil)))))) ;; Category filter ((eq type 'category) (setq filter @@ -9147,7 +9155,7 @@ Called with a universal prefix arg, show the priority instead of setting it." (goto-char (point-max)) (while (not (bobp)) (when (equal marker (org-get-at-bol 'org-marker)) - (org-move-to-column (- (window-width) (length stamp)) t) + (org-move-to-column (- (window-width) (length stamp)) t nil t) (org-agenda-fix-tags-filter-overlays-at (point)) (if (featurep 'xemacs) ;; Use `duplicable' property to trigger undo recording @@ -9913,11 +9921,12 @@ current HH:MM time." "Drag an agenda line forward by ARG lines." (interactive "p") (let ((inhibit-read-only t) lst) - (if (save-excursion - (dotimes (n arg) - (beginning-of-line 2) - (push (not (get-text-property (point) 'txt)) lst)) - (delq nil lst)) + (if (or (not (get-text-property (point) 'txt)) + (save-excursion + (dotimes (n arg) + (move-beginning-of-line 2) + (push (not (get-text-property (point) 'txt)) lst)) + (delq nil lst))) (message "Cannot move line forward") (org-drag-line-forward arg)))) @@ -9925,11 +9934,12 @@ current HH:MM time." "Drag an agenda line backward by ARG lines." (interactive "p") (let ((inhibit-read-only t) lst) - (if (save-excursion - (dotimes (n arg) - (beginning-of-line 0) - (push (not (get-text-property (point) 'txt)) lst)) - (delq nil lst)) + (if (or (not (get-text-property (point) 'txt)) + (save-excursion + (dotimes (n arg) + (move-beginning-of-line 0) + (push (not (get-text-property (point) 'txt)) lst)) + (delq nil lst))) (message "Cannot move line backward") (org-drag-line-backward arg)))) diff --git a/lisp/org-archive.el b/lisp/org-archive.el index d5bdff1..3dc52c1 100644 --- a/lisp/org-archive.el +++ b/lisp/org-archive.el @@ -135,6 +135,7 @@ information." (match-string 1)) (t org-archive-location)))))) +;;;###autoload (defun org-add-archive-files (files) "Splice the archive files into the list of files. This implies visiting all these files and finding out what the diff --git a/lisp/org-bibtex.el b/lisp/org-bibtex.el index 8d85335..def9340 100644 --- a/lisp/org-bibtex.el +++ b/lisp/org-bibtex.el @@ -2,7 +2,7 @@ ;; ;; Copyright (C) 2007-2013 Free Software Foundation, Inc. ;; -;; Authors: Bastien Guerry +;; Authors: Bastien Guerry ;; Carsten Dominik ;; Eric Schulte ;; Keywords: org, wp, capture @@ -44,7 +44,7 @@ ;; Here is an example of a capture template that use some of this ;; information (:author :year :title :journal :pages): ;; -;; (setq org-capure-templates +;; (setq org-capture-templates ;; '((?b "* READ %?\n\n%a\n\n%:author (%:year): %:title\n \ ;; In %:journal, %:pages."))) ;; @@ -293,12 +293,13 @@ This variable is relevant only if `org-bibtex-export-tags-as-keywords' is t." ;;; Utility functions (defun org-bibtex-get (property) - ((lambda (it) (when it (org-babel-trim it))) - (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))))))) + (let ((it (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))))))) + (when it (org-babel-trim it)))) (defun org-bibtex-put (property value) (let ((prop (upcase (if (keywordp property) @@ -384,8 +385,8 @@ This variable is relevant only if `org-bibtex-export-tags-as-keywords' is t." (princ (cdr (assoc field org-bibtex-fields)))) (with-current-buffer buf-name (visual-line-mode 1)) (org-fit-window-to-buffer (get-buffer-window buf-name)) - ((lambda (result) (when (> (length result) 0) result)) - (read-from-minibuffer (format "%s: " name)))))) + (let ((result (read-from-minibuffer (format "%s: " name)))) + (when (> (length result) 0) result))))) (defun org-bibtex-autokey () "Generate an autokey for the current headline." @@ -539,20 +540,21 @@ Headlines are exported using `org-bibtex-export-headline'." "Bibtex file: " nil nil nil (file-name-nondirectory (concat (file-name-sans-extension (buffer-file-name)) ".bib"))))) - ((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)))) + (let ((error-point + (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)))) + (when error-point + (goto-char error-point) + (message "Bibtex error at %S" (nth 4 (org-heading-components)))))) (defun org-bibtex-check (&optional optional) "Check the current headline for required fields. @@ -560,8 +562,8 @@ With prefix argument OPTIONAL also prompt for optional fields." (interactive "P") (save-restriction (org-narrow-to-subtree) - (let ((type ((lambda (name) (when name (intern (concat ":" name)))) - (org-bibtex-get org-bibtex-type-property-name)))) + (let ((type (let ((name (org-bibtex-get org-bibtex-type-property-name))) + (when name (intern (concat ":" name)))))) (when type (org-bibtex-fleshout type optional))))) (defun org-bibtex-check-all (&optional optional) diff --git a/lisp/org-capture.el b/lisp/org-capture.el index 0a6e4e4..39804ac 100644 --- a/lisp/org-capture.el +++ b/lisp/org-capture.el @@ -24,14 +24,14 @@ ;; ;;; Commentary: -;; This file contains an alternative implementation of the same functionality -;; that is also provided by org-remember.el. The implementation is more +;; This file contains an alternative implementation of the functionality +;; that used to be provided by org-remember.el. The implementation is more ;; streamlined, can produce more target types (e.g. plain list items or ;; table lines). Also, it does not use a temporary buffer for editing ;; the captured entry - instead it uses an indirect buffer that visits ;; the new entry already in the target buffer (this was an idea by Samuel -;; Wales). John Wiegley's excellent `remember.el' is not needed for this -;; implementation, even though we borrow heavily from its ideas. +;; Wales). John Wiegley's excellent `remember.el' is not needed anymore +;; for this implementation, even though we borrow heavily from its ideas. ;; This implementation heavily draws on ideas by James TD Smith and ;; Samuel Wales, and, of cause, uses John Wiegley's remember.el as inspiration. @@ -577,8 +577,9 @@ of the day at point (if any) or the current HH:MM time." (file-name-nondirectory (buffer-file-name orig-buf))) :annotation annotation - :initial initial) - (org-capture-put :default-time + :initial initial + :return-to-wconf (current-window-configuration) + :default-time (or org-overriding-default-time (org-current-time))) (org-capture-set-target-location) @@ -593,7 +594,8 @@ of the day at point (if any) or the current HH:MM time." ;;insert at point (org-capture-insert-template-here) (condition-case error - (org-capture-place-template) + (org-capture-place-template + (equal (car (org-capture-get :target)) 'function)) ((error quit) (if (and (buffer-base-buffer (current-buffer)) (string-match "\\`CAPTURE-" (buffer-name))) @@ -787,14 +789,14 @@ already gone. Any prefix argument will be passed to the refile command." (let ((pos (point)) (base (buffer-base-buffer (current-buffer))) (org-refile-for-capture t)) - (org-capture-finalize) (save-window-excursion (with-current-buffer (or base (current-buffer)) (save-excursion (save-restriction (widen) (goto-char pos) - (call-interactively 'org-refile))))))) + (call-interactively 'org-refile))))) + (org-capture-finalize))) (defun org-capture-kill () "Abort the current capture process." @@ -986,9 +988,12 @@ it. When it is a variable, retrieve the value. Return whatever we get." (ignore-errors (org-set-local (car v) (cdr v)))) (buffer-local-variables buffer))) -(defun org-capture-place-template () - "Insert the template at the target location, and display the buffer." - (org-capture-put :return-to-wconf (current-window-configuration)) +(defun org-capture-place-template (&optional inhibit-wconf-store) + "Insert the template at the target location, and display the buffer. +When `inhibit-wconf-store', don't store the window configuration, as it +may have been stored before." + (unless inhibit-wconf-store + (org-capture-put :return-to-wconf (current-window-configuration))) (delete-other-windows) (org-switch-to-buffer-other-window (org-capture-get-indirect-buffer (org-capture-get :buffer) "CAPTURE")) diff --git a/lisp/org-clock.el b/lisp/org-clock.el index 9f22562..3238c8c 100644 --- a/lisp/org-clock.el +++ b/lisp/org-clock.el @@ -667,7 +667,7 @@ previous clocking intervals." VALUE can be a number of minutes, or a string with format hh:mm or mm. When the string starts with a + or a - sign, the current value of the effort property will be changed by that amount. If the effort value is expressed -as an `org-effort-durations' (e.g. \"3h\"), the modificied value will be +as an `org-effort-durations' (e.g. \"3h\"), the modified value will be converted to a hh:mm duration. This command will update the \"Effort\" property of the currently @@ -1114,6 +1114,7 @@ so long." (defvar org-clock-current-task nil "Task currently clocked in.") (defvar org-clock-out-time nil) ; store the time of the last clock-out +(defvar org--msg-extra) ;;;###autoload (defun org-clock-in (&optional select start-time) @@ -1133,7 +1134,7 @@ make this the default behavior.)" (catch 'abort (let ((interrupting (and (not org-clock-resolving-clocks-due-to-idleness) (org-clocking-p))) - ts selected-task target-pos (msg-extra "") + ts selected-task target-pos (org--msg-extra "") (leftover (and (not org-clock-resolving-clocks) org-clock-leftover-time))) @@ -1305,7 +1306,7 @@ make this the default behavior.)" (setq org-clock-idle-timer nil)) (setq org-clock-idle-timer (run-with-timer 60 60 'org-resolve-clocks-if-idle)) - (message "Clock starts at %s - %s" ts msg-extra) + (message "Clock starts at %s - %s" ts org--msg-extra) (run-hooks 'org-clock-in-hook))))))) ;;;###autoload @@ -1351,7 +1352,6 @@ for a todo state to switch to, overriding the existing value (org-back-to-heading t) (move-marker org-clock-default-task (point)))) -(defvar msg-extra) (defun org-clock-get-sum-start () "Return the time from which clock times should be counted. This is for the currently running clock as it is displayed @@ -1364,10 +1364,10 @@ decides which time to use." (lr (org-entry-get nil "LAST_REPEAT"))) (cond ((equal cmt "current") - (setq msg-extra "showing time in current clock instance") + (setq org--msg-extra "showing time in current clock instance") (current-time)) ((equal cmt "today") - (setq msg-extra "showing today's task time.") + (setq org--msg-extra "showing today's task time.") (let* ((dt (decode-time (current-time)))) (setq dt (append (list 0 0 0) (nthcdr 3 dt))) (if org-extend-today-until @@ -1376,12 +1376,12 @@ decides which time to use." ((or (equal cmt "all") (and (or (not cmt) (equal cmt "auto")) (not lr))) - (setq msg-extra "showing entire task time.") + (setq org--msg-extra "showing entire task time.") nil) ((or (equal cmt "repeat") (and (or (not cmt) (equal cmt "auto")) lr)) - (setq msg-extra "showing task time since last repeat.") + (setq org--msg-extra "showing task time since last repeat.") (if (not lr) nil (org-time-string-to-time lr))) @@ -1871,6 +1871,7 @@ will be easy to remove." (overlay-put ov 'end-glyph (make-glyph tx))) (push ov org-clock-overlays))) +;;;###autoload (defun org-clock-remove-overlays (&optional beg end noremove) "Remove the occur highlights from the buffer. BEG and END are ignored. If NOREMOVE is nil, remove this function @@ -2143,6 +2144,7 @@ If you can combine both, the month starting day will have priority." ((= n 3) "3rd") ((= n 4) "4th"))) +;;;###autoload (defun org-clocktable-shift (dir n) "Try to shift the :block date of the clocktable at point. Point must be in the #+BEGIN: line of a clocktable, or this function @@ -2752,6 +2754,7 @@ This function is made for clock tables." (defvar org-clock-loaded nil "Was the clock file loaded?") +;;;###autoload (defun org-clock-update-time-maybe () "If this is a CLOCK line, update it and return t. Otherwise, return nil." diff --git a/lisp/org-colview.el b/lisp/org-colview.el index 8790ad4..361560d 100644 --- a/lisp/org-colview.el +++ b/lisp/org-colview.el @@ -323,6 +323,7 @@ for the duration of the command.") (defvar org-colview-initial-truncate-line-value nil "Remember the value of `truncate-lines' across colview.") +;;;###autoload (defun org-columns-remove-overlays () "Remove all currently active column overlays." (interactive) @@ -416,6 +417,10 @@ If yes, throw an error indicating that changing it does not make sense." (org-columns-next-allowed-value) (org-columns-edit-value "TAGS"))) +(defvar org-agenda-overriding-columns-format nil + "When set, overrides any other format definition for the agenda. +Don't set this, this is meant for dynamic scoping.") + (defun org-columns-edit-value (&optional key) "Edit the value of the property at point in column view. Where possible, use the standard interface for changing this line." @@ -666,6 +671,7 @@ around it." (let ((value (get-char-property (point) 'org-columns-value))) (org-open-link-from-string value arg))) +;;;###autoload (defun org-columns-get-format-and-top-level () (let ((fmt (org-columns-get-format))) (org-columns-goto-top-level) @@ -901,10 +907,6 @@ display, or in the #+COLUMNS line of the current buffer." (insert-before-markers "#+COLUMNS: " fmt "\n"))) (org-set-local 'org-columns-default-format fmt)))))) -(defvar org-agenda-overriding-columns-format nil - "When set, overrides any other format definition for the agenda. -Don't set this, this is meant for dynamic scoping.") - (defun org-columns-get-autowidth-alist (s cache) "Derive the maximum column widths from the format and the cache." (let ((start 0) rtn) @@ -951,6 +953,8 @@ Don't set this, this is meant for dynamic scoping.") (defvar org-inlinetask-min-level (if (featurep 'org-inlinetask) org-inlinetask-min-level 15)) + +;;;###autoload (defun org-columns-compute (property) "Sum the values of property PROPERTY hierarchically, for the entire buffer." (interactive) @@ -1054,6 +1058,7 @@ Don't set this, this is meant for dynamic scoping.") (setq sum (+ (string-to-number (pop l)) (/ sum 60)))) sum))) +;;;###autoload (defun org-columns-number-to-string (n fmt &optional printf) "Convert a computed column number to a string value, according to FMT." (cond diff --git a/lisp/org-compat.el b/lisp/org-compat.el index c4d15d8..a3eb960 100644 --- a/lisp/org-compat.el +++ b/lisp/org-compat.el @@ -190,10 +190,12 @@ If DELETE is non-nil, delete all those overlays." found)) (defun org-get-x-clipboard (value) - "Get the value of the x clipboard, compatible with XEmacs, and GNU Emacs 21." - (if (eq window-system 'x) - (let ((x (org-get-x-clipboard-compat value))) - (if x (org-no-properties x))))) + "Get the value of the x or Windows clipboard, compatible with XEmacs, and GNU Emacs 21." + (cond ((eq window-system 'x) + (let ((x (org-get-x-clipboard-compat value))) + (if x (org-no-properties x)))) + ((and (eq window-system 'w32) (fboundp 'w32-get-clipboard-data)) + (w32-get-clipboard-data)))) (defsubst org-decompose-region (beg end) "Decompose from BEG to END." @@ -335,10 +337,8 @@ Works on both Emacs and XEmacs." (org-xemacs-without-invisibility (indent-line-to column)) (indent-line-to column))) -(defun org-move-to-column (column &optional force buffer) - ;; set buffer-invisibility-spec to nil so that move-to-column - ;; does the right thing despite the presence of invisible text. - (let ((buffer-invisibility-spec nil)) +(defun org-move-to-column (column &optional force buffer ignore-invisible) + (let ((buffer-invisibility-spec ignore-invisible)) (if (featurep 'xemacs) (org-xemacs-without-invisibility (move-to-column column force buffer)) (move-to-column column force)))) diff --git a/lisp/org-crypt.el b/lisp/org-crypt.el index b02a7ce..2024144 100644 --- a/lisp/org-crypt.el +++ b/lisp/org-crypt.el @@ -73,6 +73,8 @@ compress-algorithm)) (declare-function epg-encrypt-string "epg" (context plain recipients &optional sign always-trust)) +(defvar epg-context) + (defgroup org-crypt nil "Org Crypt." @@ -161,8 +163,8 @@ See `org-crypt-disable-auto-save'." (if (and (string= crypt-key (get-text-property 0 'org-crypt-key str)) (string= (sha1 str) (get-text-property 0 'org-crypt-checksum str))) (get-text-property 0 'org-crypt-text str) - (let ((epg-context (epg-make-context nil t t))) - (epg-encrypt-string epg-context str (epg-list-keys epg-context crypt-key))))) + (set (make-local-variable 'epg-context) (epg-make-context nil t t)) + (epg-encrypt-string epg-context str (epg-list-keys epg-context crypt-key)))) (defun org-encrypt-entry () "Encrypt the content of the current headline." @@ -170,11 +172,11 @@ See `org-crypt-disable-auto-save'." (require 'epg) (save-excursion (org-back-to-heading t) + (set (make-local-variable 'epg-context) (epg-make-context nil t t)) (let ((start-heading (point))) (forward-line) (when (not (looking-at "-----BEGIN PGP MESSAGE-----")) (let ((folded (outline-invisible-p)) - (epg-context (epg-make-context nil t t)) (crypt-key (org-crypt-key-for-heading)) (beg (point)) end encrypted-text) @@ -206,11 +208,11 @@ See `org-crypt-disable-auto-save'." (forward-line) (when (looking-at "-----BEGIN PGP MESSAGE-----") (org-crypt-check-auto-save) + (set (make-local-variable 'epg-context) (epg-make-context nil t t)) (let* ((end (save-excursion (search-forward "-----END PGP MESSAGE-----") (forward-line) (point))) - (epg-context (epg-make-context nil t t)) (encrypted-text (buffer-substring-no-properties (point) end)) (decrypted-text (decode-coding-string diff --git a/lisp/org-docview.el b/lisp/org-docview.el index 72ccc46..8e61c8a 100644 --- a/lisp/org-docview.el +++ b/lisp/org-docview.el @@ -44,12 +44,10 @@ (require 'org) +(require 'doc-view) -(declare-function doc-view-goto-page "ext:doc-view" (page)) -(declare-function image-mode-window-get "ext:image-mode" - (prop &optional winprops)) - -(org-autoload "doc-view" '(doc-view-goto-page)) +(declare-function doc-view-goto-page "doc-view" (page)) +(declare-function image-mode-window-get "image-mode" (prop &optional winprops)) (org-add-link-type "docview" 'org-docview-open 'org-docview-export) (add-hook 'org-store-link-functions 'org-docview-store-link) diff --git a/lisp/org-element.el b/lisp/org-element.el index 807fdb4..6162383 100644 --- a/lisp/org-element.el +++ b/lisp/org-element.el @@ -143,10 +143,12 @@ "$" "\\|" ;; Tables (any type). "\\(?:|\\|\\+-[-+]\\)" "\\|" - ;; Blocks (any type), Babel calls, drawers (any type), - ;; fixed-width areas and keywords. Note: this is only an - ;; indication and need some thorough check. - "[#:]" "\\|" + ;; Blocks (any type), Babel calls and keywords. Note: this + ;; is only an indication and need some thorough check. + "#\\(?:[+ ]\\|$\\)" "\\|" + ;; Drawers (any type) and fixed-width areas. This is also + ;; only an indication. + ":" "\\|" ;; Horizontal rules. "-\\{5,\\}[ \t]*$" "\\|" ;; LaTeX environments. @@ -514,9 +516,9 @@ Assume point is at the beginning of the block." (pos-before-blank (progn (goto-char block-end-line) (forward-line) (point))) - (end (save-excursion (skip-chars-forward " \r\t\n" limit) - (skip-chars-backward " \t") - (if (bolp) (point) (line-end-position))))) + (end (save-excursion + (skip-chars-forward " \r\t\n" limit) + (if (eobp) (point) (line-beginning-position))))) (list 'center-block (nconc (list :begin begin @@ -569,8 +571,7 @@ Assume point is at beginning of drawer." (forward-line) (point))) (end (progn (skip-chars-forward " \r\t\n" limit) - (skip-chars-backward " \t") - (if (bolp) (point) (line-end-position))))) + (if (eobp) (point) (line-beginning-position))))) (list 'drawer (nconc (list :begin begin @@ -629,8 +630,7 @@ Assume point is at beginning of dynamic block." (forward-line) (point))) (end (progn (skip-chars-forward " \r\t\n" limit) - (skip-chars-backward " \t") - (if (bolp) (point) (line-end-position))))) + (if (eobp) (point) (line-beginning-position))))) (list 'dynamic-block (nconc (list :begin begin @@ -692,8 +692,7 @@ Assume point is at the beginning of the footnote definition." (contents-end (and contents-begin ending)) (end (progn (goto-char ending) (skip-chars-forward " \r\t\n" limit) - (skip-chars-backward " \t") - (if (bolp) (point) (line-end-position))))) + (if (eobp) (point) (line-beginning-position))))) (list 'footnote-definition (nconc (list :label label @@ -868,7 +867,7 @@ CONTENTS is the contents of the element." (commentedp (org-element-property :commentedp headline)) (quotedp (org-element-property :quotedp headline)) (pre-blank (or (org-element-property :pre-blank headline) 0)) - (heading (concat (make-string level ?*) + (heading (concat (make-string (org-reduced-level level) ?*) (and todo (concat " " todo)) (and quotedp (concat " " org-quote-string)) (and commentedp (concat " " org-comment-string)) @@ -972,8 +971,7 @@ Assume point is at beginning of the inline task." (forward-line) (point))) (end (progn (skip-chars-forward " \r\t\n" limit) - (skip-chars-backward " \t") - (if (bolp) (point) (line-end-position)))) + (if (eobp) (point) (line-beginning-position)))) (inlinetask (list 'inlinetask (nconc @@ -1230,9 +1228,10 @@ CONTENTS is the contents of the element." (throw 'exit (sort struct 'car-less-than-car)))))) ;; Skip blocks (any type) and drawers contents. (cond - ((and (looking-at "#\\+BEGIN\\(:[ \t]*$\\|_\\S-\\)+") + ((and (looking-at "#\\+BEGIN\\(:\\|_\\S-+\\)") (re-search-forward - (format "^[ \t]*#\\+END%s[ \t]*$" (match-string 1)) + (format "^[ \t]*#\\+END%s[ \t]*$" + (org-match-string-no-properties 1)) limit t))) ((and (looking-at drawers-re) (re-search-forward "^[ \t]*:END:[ \t]*$" limit t)))) @@ -1322,8 +1321,7 @@ Assume point is at the beginning of the property drawer." (forward-line) (point))) (end (progn (skip-chars-forward " \r\t\n" limit) - (skip-chars-backward " \t") - (if (bolp) (point) (line-end-position))))) + (if (eobp) (point) (line-beginning-position))))) (list 'property-drawer (nconc (list :begin begin @@ -1375,8 +1373,7 @@ Assume point is at the beginning of the block." (forward-line) (point))) (end (progn (skip-chars-forward " \r\t\n" limit) - (skip-chars-backward " \t") - (if (bolp) (point) (line-end-position))))) + (if (eobp) (point) (line-beginning-position))))) (list 'quote-block (nconc (list :begin begin @@ -1465,8 +1462,7 @@ Assume point is at the beginning of the block." (forward-line) (point))) (end (progn (skip-chars-forward " \r\t\n" limit) - (skip-chars-backward " \t") - (if (bolp) (point) (line-end-position))))) + (if (eobp) (point) (line-beginning-position))))) (list 'special-block (nconc (list :type type @@ -1522,8 +1518,7 @@ containing `:begin', `:end', `:info', `:post-blank' and (post-affiliated (point)) (pos-before-blank (progn (forward-line) (point))) (end (progn (skip-chars-forward " \r\t\n" limit) - (skip-chars-backward " \t") - (if (bolp) (point) (line-end-position))))) + (if (eobp) (point) (line-beginning-position))))) (list 'babel-call (nconc (list :begin begin @@ -1632,8 +1627,7 @@ Assume point is at comment beginning." (point))) (end (progn (goto-char com-end) (skip-chars-forward " \r\t\n" limit) - (skip-chars-backward " \t") - (if (bolp) (point) (line-end-position))))) + (if (eobp) (point) (line-beginning-position))))) (list 'comment (nconc (list :begin begin @@ -1679,8 +1673,7 @@ Assume point is at comment block beginning." (forward-line) (point))) (end (progn (skip-chars-forward " \r\t\n" limit) - (skip-chars-backward " \t") - (if (bolp) (point) (line-end-position)))) + (if (eobp) (point) (line-beginning-position)))) (value (buffer-substring-no-properties contents-begin contents-end))) (list 'comment-block @@ -1720,8 +1713,7 @@ containing `:begin', `:end', `:value', `:post-blank' and (org-match-string-no-properties 1))) (pos-before-blank (progn (forward-line) (point))) (end (progn (skip-chars-forward " \r\t\n" limit) - (skip-chars-backward " \t") - (if (bolp) (point) (line-end-position))))) + (if (eobp) (point) (line-beginning-position))))) (list 'diary-sexp (nconc (list :value value @@ -1831,8 +1823,7 @@ keywords." (forward-line) (point))) (end (progn (skip-chars-forward " \r\t\n" limit) - (skip-chars-backward " \t") - (if (bolp) (point) (line-end-position))))) + (if (eobp) (point) (line-beginning-position))))) (list 'example-block (nconc (list :begin begin @@ -1892,8 +1883,7 @@ Assume point is at export-block beginning." (forward-line) (point))) (end (progn (skip-chars-forward " \r\t\n" limit) - (skip-chars-backward " \t") - (if (bolp) (point) (line-end-position)))) + (if (eobp) (point) (line-beginning-position)))) (value (buffer-substring-no-properties contents-begin contents-end))) (list 'export-block @@ -1948,8 +1938,7 @@ Assume point is at the beginning of the fixed-width area." (forward-line)) (point))) (end (progn (skip-chars-forward " \r\t\n" limit) - (skip-chars-backward " \t") - (if (bolp) (point) (line-end-position))))) + (if (eobp) (point) (line-beginning-position))))) (list 'fixed-width (nconc (list :begin begin @@ -1987,8 +1976,7 @@ keywords." (post-affiliated (point)) (post-hr (progn (forward-line) (point))) (end (progn (skip-chars-forward " \r\t\n" limit) - (skip-chars-backward " \t") - (if (bolp) (point) (line-end-position))))) + (if (eobp) (point) (line-beginning-position))))) (list 'horizontal-rule (nconc (list :begin begin @@ -2025,8 +2013,7 @@ containing `:key', `:value', `:begin', `:end', `:post-blank' and (match-end 0) (point-at-eol)))) (pos-before-blank (progn (forward-line) (point))) (end (progn (skip-chars-forward " \r\t\n" limit) - (skip-chars-backward " \t") - (if (bolp) (point) (line-end-position))))) + (if (eobp) (point) (line-beginning-position))))) (list 'keyword (nconc (list :key key @@ -2073,8 +2060,7 @@ Assume point is at the beginning of the latex environment." (begin (car affiliated)) (value (buffer-substring-no-properties code-begin code-end)) (end (progn (skip-chars-forward " \r\t\n" limit) - (skip-chars-backward " \t") - (if (bolp) (point) (line-end-position))))) + (if (eobp) (point) (line-beginning-position))))) (list 'latex-environment (nconc (list :begin begin @@ -2206,8 +2192,7 @@ Assume point is at the beginning of the paragraph." (forward-line) (point))) (end (progn (skip-chars-forward " \r\t\n" limit) - (skip-chars-backward " \t") - (if (bolp) (point) (line-end-position))))) + (if (eobp) (point) (line-beginning-position))))) (list 'paragraph (nconc (list :begin begin @@ -2391,8 +2376,7 @@ Assume point is at the beginning of the block." (point))) ;; Get position after ending blank lines. (end (progn (skip-chars-forward " \r\t\n" limit) - (skip-chars-backward " \t") - (if (bolp) (point) (line-end-position))))) + (if (eobp) (point) (line-beginning-position))))) (list 'src-block (nconc (list :language language @@ -2468,8 +2452,7 @@ Assume point is at the beginning of the table." acc)) (pos-before-blank (point)) (end (progn (skip-chars-forward " \r\t\n" limit) - (skip-chars-backward " \t") - (if (bolp) (point) (line-end-position))))) + (if (eobp) (point) (line-beginning-position))))) (list 'table (nconc (list :begin begin @@ -2570,8 +2553,7 @@ Assume point is at beginning of the block." (forward-line) (point))) (end (progn (skip-chars-forward " \r\t\n" limit) - (skip-chars-backward " \t") - (if (bolp) (point) (line-end-position))))) + (if (eobp) (point) (line-beginning-position))))) (list 'verse-block (nconc (list :begin begin @@ -2744,16 +2726,12 @@ Return value is a cons cell whose CAR is `entity' or `latex-fragment' and CDR is beginning position." (save-excursion (unless (bolp) (backward-char)) - (let ((matchers - (remove "begin" (plist-get org-format-latex-options :matchers))) + (let ((matchers (cdr org-latex-regexps)) ;; ENTITY-RE matches both LaTeX commands and Org entities. (entity-re "\\\\\\(there4\\|sup[123]\\|frac[13][24]\\|[a-zA-Z]+\\)\\($\\|{}\\|[^[:alpha:]]\\)")) (when (re-search-forward - (concat (mapconcat (lambda (e) (nth 1 (assoc e org-latex-regexps))) - matchers "\\|") - "\\|" entity-re) - nil t) + (concat (mapconcat #'cadr matchers "\\|") "\\|" entity-re) nil t) (goto-char (match-beginning 0)) (if (looking-at entity-re) ;; Determine if it's a real entity or a LaTeX command. @@ -2763,12 +2741,9 @@ Return value is a cons cell whose CAR is `entity' or ;; 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) + (dolist (e matchers) + (when (looking-at (nth 1 e)) + (throw 'return (match-beginning (nth 2 e))))) (point)))))))) @@ -3023,29 +2998,28 @@ CONTENTS is the contents of the object." ;;;; Latex Fragment (defun org-element-latex-fragment-parser () - "Parse latex fragment at point. + "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." +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)) + (dolist (e (cdr org-latex-regexps)) + (let ((latex-regexp (nth 1 e))) + (when (or (looking-at latex-regexp) + (and (not (bobp)) + (save-excursion + (backward-char) + (looking-at latex-regexp)))) + (throw 'exit (nth 2 e))))) ;; None found: it's a macro. (looking-at "\\\\[a-zA-Z]+\\*?\\(\\(\\[[^][\n{}]*\\]\\)\\|\\({[^{}\n]*}\\)\\)*") 0)) - (value (match-string-no-properties substring-match)) + (value (org-match-string-no-properties substring-match)) (post-blank (progn (goto-char (match-end substring-match)) (skip-chars-forward " \t"))) (end (point))) @@ -3549,7 +3523,12 @@ beginning position." "Parse time stamp at point. Return a list whose CAR is `timestamp', and CDR a plist with -`:type', `:begin', `:end', `:value' and `:post-blank' keywords. +`:type', `:raw-value', `:year-start', `:month-start', +`:day-start', `:hour-start', `:minute-start', `:year-end', +`:month-end', `:day-end', `:hour-end', `:minute-end', +`:repeater-type', `:repeater-value', `:repeater-unit', +`:warning-type', `:warning-value', `:warning-unit', `:begin', +`:end', `:value' and `:post-blank' keywords. Assume point is at the beginning of the timestamp." (save-excursion @@ -3579,7 +3558,7 @@ Assume point is at the beginning of the timestamp." (t 'inactive))) (repeater-props (and (not diaryp) - (string-match "\\([.+]?\\+\\)\\([0-9]+\\)\\([hdwmy]\\)>" + (string-match "\\([.+]?\\+\\)\\([0-9]+\\)\\([hdwmy]\\)" raw-value) (list :repeater-type @@ -3591,6 +3570,15 @@ Assume point is at the beginning of the timestamp." :repeater-unit (case (string-to-char (match-string 3 raw-value)) (?h 'hour) (?d 'day) (?w 'week) (?m 'month) (t 'year))))) + (warning-props + (and (not diaryp) + (string-match "\\(-\\)?-\\([0-9]+\\)\\([hdwmy]\\)" raw-value) + (list + :warning-type (if (match-string 1 raw-value) 'first 'all) + :warning-value (string-to-number (match-string 2 raw-value)) + :warning-unit + (case (string-to-char (match-string 3 raw-value)) + (?h 'hour) (?d 'day) (?w 'week) (?m 'month) (t 'year))))) year-start month-start day-start hour-start minute-start year-end month-end day-end hour-end minute-end) ;; Parse date-start. @@ -3627,7 +3615,8 @@ Assume point is at the beginning of the timestamp." :begin begin :end end :post-blank post-blank) - repeater-props))))) + repeater-props + warning-props))))) (defun org-element-timestamp-interpreter (timestamp contents) "Interpret TIMESTAMP object as Org syntax. @@ -3643,6 +3632,15 @@ CONTENTS is nil." (and val (number-to-string val))) (case (org-element-property :repeater-unit timestamp) (hour "h") (day "d") (week "w") (month "m") (year "y")))) + (warning-string + (concat + (case (org-element-property :warning-type timestamp) + (first "--") + (all "-")) + (let ((val (org-element-property :warning-value timestamp))) + (and val (number-to-string val))) + (case (org-element-property :warning-unit timestamp) + (hour "h") (day "d") (week "w") (month "m") (year "y")))) (build-ts-string ;; Build an Org timestamp string from TIME. ACTIVEP is ;; non-nil when time stamp is active. If WITH-TIME-P is @@ -3661,11 +3659,12 @@ CONTENTS is nil." (format "\\&-%02d:%02d" hour-end minute-end) nil nil ts))) (unless activep (setq ts (format "[%s]" (substring ts 1 -1)))) - (when (org-string-nw-p repeat-string) - (setq ts (concat (substring ts 0 -1) - " " - repeat-string - (substring ts -1)))) + (dolist (s (list repeat-string warning-string)) + (when (org-string-nw-p s) + (setq ts (concat (substring ts 0 -1) + " " + s + (substring ts -1))))) ;; Return value. ts))) (type (org-element-property :type timestamp))) @@ -4838,9 +4837,10 @@ Providing it allows for quicker computation." ((let ((post (org-element-property :post-affiliated element))) (and post (< origin post))) (beginning-of-line) - (looking-at org-element--affiliated-re) + (let ((case-fold-search t)) (looking-at org-element--affiliated-re)) (cond - ((not (member (upcase (match-string 1)) org-element-parsed-keywords)) + ((not (member-ignore-case (match-string 1) + org-element-parsed-keywords)) (throw 'objects-forbidden element)) ((< (match-end 0) origin) (narrow-to-region (match-end 0) (line-end-position))) diff --git a/lisp/org-id.el b/lisp/org-id.el index f1fa05b..37f6e70 100644 --- a/lisp/org-id.el +++ b/lisp/org-id.el @@ -233,6 +233,7 @@ With optional argument FORCE, force the creation of a new ID." (org-entry-put (point) "ID" nil)) (org-id-get (point) 'create)) +;;;###autoload (defun org-id-copy () "Copy the ID of the entry at point to the kill ring. Create an ID if necessary." @@ -258,6 +259,7 @@ In any case, the ID of the entry is returned." (org-id-add-location id (buffer-file-name (buffer-base-buffer))) id))))) +;;;###autoload (defun org-id-get-with-outline-path-completion (&optional targets) "Use `outline-path-completion' to retrieve the ID of an entry. TARGETS may be a setting for `org-refile-targets' to define @@ -274,6 +276,7 @@ If necessary, the ID is created." (prog1 (org-id-get pom 'create) (move-marker pom nil)))) +;;;###autoload (defun org-id-get-with-outline-drilling (&optional targets) "Use an outline-cycling interface to retrieve the ID of an entry. This only finds entries in the current buffer, using `org-get-location'. @@ -320,6 +323,7 @@ With optional argument MARKERP, return the position as a new marker." ;; Creating new IDs +;;;###autoload (defun org-id-new (&optional prefix) "Create a new globally unique ID. diff --git a/lisp/org-inlinetask.el b/lisp/org-inlinetask.el index 112d3df..ca7572b 100644 --- a/lisp/org-inlinetask.el +++ b/lisp/org-inlinetask.el @@ -315,7 +315,8 @@ If the task has an end part, also demote it." ((= end start)) ;; Inlinetask was folded: expand it. ((get-char-property (1+ start) 'invisible) - (org-show-entry)) + (outline-flag-region start end nil) + (org-cycle-hide-drawers 'children)) (t (outline-flag-region start end t))))) (defun org-inlinetask-remove-END-maybe () diff --git a/lisp/org-list.el b/lisp/org-list.el index 1b3c509..4a3d471 100644 --- a/lisp/org-list.el +++ b/lisp/org-list.el @@ -3,7 +3,7 @@ ;; Copyright (C) 2004-2013 Free Software Foundation, Inc. ;; ;; Author: Carsten Dominik -;; Bastien Guerry +;; Bastien Guerry ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org ;; @@ -228,8 +228,7 @@ counters like \"[@c]\" will be recognized. This variable needs to be set before org.el is loaded. If you need to make a change while Emacs is running, use the customize -interface or run the following code, where VALUE stands for the -new value of the variable, after updating it: +interface or run the following code after updating it: \(when (featurep 'org-element) (load \"org-element\" t t))" :group 'org-plain-lists diff --git a/lisp/org-loaddefs.el b/lisp/org-loaddefs.el index 0862dcb..ffb7507 100644 --- a/lisp/org-loaddefs.el +++ b/lisp/org-loaddefs.el @@ -14,7 +14,7 @@ ;;;;;; org-babel-pop-to-session-maybe org-babel-load-in-session-maybe ;;;;;; org-babel-expand-src-block-maybe org-babel-view-src-block-info ;;;;;; org-babel-execute-maybe org-babel-execute-safely-maybe) "ob-core" -;;;;;; "ob-core.el" "5020331fabde60f15398bf24d3981977") +;;;;;; "ob-core.el" "b4110b1ea622f71cf4aac4ac2a73a77f") ;;; Generated autoloads from ob-core.el (autoload 'org-babel-execute-safely-maybe "ob-core" "\ @@ -258,7 +258,7 @@ Return a Library of Babel function call as a string. ;;;*** ;;;### (autoloads (org-babel-tangle org-babel-tangle-file) "ob-tangle" -;;;;;; "ob-tangle.el" "4be192fcb6c6b0ed49ed439b74cbc014") +;;;;;; "ob-tangle.el" "a8b8d21349eceb9147ddab7f6e5f1696") ;;; Generated autoloads from ob-tangle.el (autoload 'org-babel-tangle-file "ob-tangle" "\ @@ -267,6 +267,7 @@ Source code blocks are extracted with `org-babel-tangle'. Optional argument TARGET-FILE can be used to specify a default export file for all source blocks. Optional argument LANG can be used to limit the exported source code blocks by language. +Return a list whose CAR is the tangled file name. \(fn FILE &optional TARGET-FILE LANG)" t nil) @@ -285,12 +286,13 @@ used to limit the exported source code blocks by language. ;;;*** -;;;### (autoloads (org-agenda-to-appt org-calendar-goto-agenda org-diary -;;;;;; org-agenda-list-stuck-projects org-tags-view org-todo-list +;;;### (autoloads (org-agenda-to-appt org-calendar-goto-agenda org-agenda-set-restriction-lock +;;;;;; org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item +;;;;;; org-diary org-agenda-list-stuck-projects org-tags-view org-todo-list ;;;;;; org-search-view org-agenda-list org-batch-store-agenda-views ;;;;;; org-store-agenda-views org-batch-agenda-csv org-batch-agenda ;;;;;; org-agenda org-toggle-sticky-agenda) "org-agenda" "org-agenda.el" -;;;;;; (21065 1984)) +;;;;;; (21153 27247)) ;;; Generated autoloads from org-agenda.el (autoload 'org-toggle-sticky-agenda "org-agenda" "\ @@ -507,6 +509,19 @@ function from a program - use `org-agenda-get-day-entries' instead. \(fn &rest ARGS)" nil nil) +(autoload 'org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item "org-agenda" "\ +Do we have a reason to ignore this TODO entry because it has a time stamp? + +\(fn &optional END)" nil nil) + +(autoload 'org-agenda-set-restriction-lock "org-agenda" "\ +Set restriction lock for agenda, to current subtree or file. +Restriction will be the file if TYPE is `file', or if type is the +universal prefix '(4), or if the cursor is before the first headline +in the file. Otherwise, restriction will be to the current subtree. + +\(fn &optional TYPE)" t nil) + (autoload 'org-calendar-goto-agenda "org-agenda" "\ Compute the Org-mode agenda for the calendar date displayed at the cursor. This is a command that has to be installed in `calendar-mode-map'. @@ -552,9 +567,17 @@ to override `appt-message-warning-time'. ;;;### (autoloads (org-archive-subtree-default-with-confirmation ;;;;;; org-archive-subtree-default org-toggle-archive-tag org-archive-to-archive-sibling -;;;;;; org-archive-subtree) "org-archive" "org-archive.el" "bc3cb1755c5b20dc90bde801f0202eca") +;;;;;; org-archive-subtree org-add-archive-files) "org-archive" +;;;;;; "org-archive.el" "459396977488bc201173789dc42a9c37") ;;; Generated autoloads from org-archive.el +(autoload 'org-add-archive-files "org-archive" "\ +Splice the archive files into the list of files. +This implies visiting all these files and finding out what the +archive file is. + +\(fn FILES)" nil nil) + (autoload 'org-archive-subtree "org-archive" "\ Move the current subtree to the archive. The archive can be a certain top-level heading in the current file, or in @@ -621,8 +644,8 @@ Extract anniversaries from BBDB for display in the agenda. ;;;*** ;;;### (autoloads (org-capture-import-remember-templates org-capture -;;;;;; org-capture-string) "org-capture" "org-capture.el" (21034 -;;;;;; 2917)) +;;;;;; org-capture-string) "org-capture" "org-capture.el" (21153 +;;;;;; 27247)) ;;; Generated autoloads from org-capture.el (autoload 'org-capture-string "org-capture" "\ @@ -664,10 +687,12 @@ Set `org-capture-templates' to be similar to `org-remember-templates'. ;;;*** -;;;### (autoloads (org-dblock-write:clocktable org-clock-report org-clock-get-clocktable -;;;;;; org-clock-display org-clock-sum org-clock-goto org-clock-cancel -;;;;;; org-clock-out org-clock-in-last org-clock-in org-resolve-clocks) -;;;;;; "org-clock" "org-clock.el" "f999bab8b47b8a6252326354ab4c7908") +;;;### (autoloads (org-clock-update-time-maybe org-dblock-write:clocktable +;;;;;; org-clocktable-shift org-clock-report org-clock-get-clocktable +;;;;;; org-clock-remove-overlays org-clock-display org-clock-sum +;;;;;; org-clock-goto org-clock-cancel org-clock-out org-clock-in-last +;;;;;; org-clock-in org-resolve-clocks) "org-clock" "org-clock.el" +;;;;;; "0d2fceb546803a8078c2ea20fe8d6a42") ;;; Generated autoloads from org-clock.el (autoload 'org-resolve-clocks "org-clock" "\ @@ -742,6 +767,13 @@ Use \\[org-clock-remove-overlays] to remove the subtree times. \(fn &optional TOTAL-ONLY)" t nil) +(autoload 'org-clock-remove-overlays "org-clock" "\ +Remove the occur highlights from the buffer. +BEG and END are ignored. If NOREMOVE is nil, remove this function +from the `before-change-functions' in the current buffer. + +\(fn &optional BEG END NOREMOVE)" t nil) + (autoload 'org-clock-get-clocktable "org-clock" "\ Get a formatted clocktable with parameters according to PROPS. The table is created in a temporary buffer, fully formatted and @@ -761,23 +793,63 @@ buffer and update it. \(fn &optional ARG)" t nil) +(autoload 'org-clocktable-shift "org-clock" "\ +Try to shift the :block date of the clocktable at point. +Point must be in the #+BEGIN: line of a clocktable, or this function +will throw an error. +DIR is a direction, a symbol `left', `right', `up', or `down'. +Both `left' and `down' shift the block toward the past, `up' and `right' +push it toward the future. +N is the number of shift steps to take. The size of the step depends on +the currently selected interval size. + +\(fn DIR N)" nil nil) + (autoload 'org-dblock-write:clocktable "org-clock" "\ Write the standard clocktable. \(fn PARAMS)" nil nil) +(autoload 'org-clock-update-time-maybe "org-clock" "\ +If this is a CLOCK line, update it and return t. +Otherwise, return nil. + +\(fn)" t nil) + ;;;*** ;;;### (autoloads (org-agenda-columns org-insert-columns-dblock org-dblock-write:columnview -;;;;;; org-columns) "org-colview" "org-colview.el" (21055 52523)) +;;;;;; org-columns-number-to-string org-columns-compute org-columns +;;;;;; org-columns-get-format-and-top-level org-columns-remove-overlays) +;;;;;; "org-colview" "org-colview.el" (21153 27247)) ;;; Generated autoloads from org-colview.el +(autoload 'org-columns-remove-overlays "org-colview" "\ +Remove all currently active column overlays. + +\(fn)" t nil) + +(autoload 'org-columns-get-format-and-top-level "org-colview" "\ +Not documented + +\(fn)" nil nil) + (autoload 'org-columns "org-colview" "\ Turn on column view on an org-mode file. When COLUMNS-FMT-STRING is non-nil, use it as the column format. \(fn &optional COLUMNS-FMT-STRING)" t nil) +(autoload 'org-columns-compute "org-colview" "\ +Sum the values of property PROPERTY hierarchically, for the entire buffer. + +\(fn PROPERTY)" t nil) + +(autoload 'org-columns-number-to-string "org-colview" "\ +Convert a computed column number to a string value, according to FMT. + +\(fn N FMT &optional PRINTF)" nil nil) + (autoload 'org-dblock-write:columnview "org-colview" "\ Write the column view table. PARAMS is a property list of parameters: @@ -813,7 +885,7 @@ Turn on or update column view in the agenda. ;;;*** ;;;### (autoloads (org-check-version) "org-compat" "org-compat.el" -;;;;;; (21034 2917)) +;;;;;; (21136 18157)) ;;; Generated autoloads from org-compat.el (autoload 'org-check-version "org-compat" "\ @@ -838,7 +910,7 @@ tree can be found. ;;;*** ;;;### (autoloads (org-element-context org-element-at-point org-element-interpret-data) -;;;;;; "org-element" "org-element.el" "40963ed55ee478e87d9b5d7252b51b9d") +;;;;;; "org-element" "org-element.el" "4895faf7cc60668a4fd4821b8805826b") ;;; Generated autoloads from org-element.el (autoload 'org-element-interpret-data "org-element" "\ @@ -960,8 +1032,9 @@ referenced sequence. ;;;*** ;;;### (autoloads (org-id-store-link org-id-find-id-file org-id-update-id-locations -;;;;;; org-id-find org-id-goto org-id-get org-id-get-create) "org-id" -;;;;;; "org-id.el" "058cecf9786ef0ba525ed56f747a79e0") +;;;;;; org-id-new org-id-find org-id-goto org-id-get-with-outline-drilling +;;;;;; org-id-get-with-outline-path-completion org-id-get org-id-copy +;;;;;; org-id-get-create) "org-id" "org-id.el" "62f25628049e4355bfa47d9ce6068de6") ;;; Generated autoloads from org-id.el (autoload 'org-id-get-create "org-id" "\ @@ -971,6 +1044,12 @@ With optional argument FORCE, force the creation of a new ID. \(fn &optional FORCE)" t nil) +(autoload 'org-id-copy "org-id" "\ +Copy the ID of the entry at point to the kill ring. +Create an ID if necessary. + +\(fn)" t nil) + (autoload 'org-id-get "org-id" "\ Get the ID property of the entry at point-or-marker POM. If POM is nil, refer to the entry at point. @@ -981,6 +1060,22 @@ In any case, the ID of the entry is returned. \(fn &optional POM CREATE PREFIX)" nil nil) +(autoload 'org-id-get-with-outline-path-completion "org-id" "\ +Use `outline-path-completion' to retrieve the ID of an entry. +TARGETS may be a setting for `org-refile-targets' to define +eligible headlines. When omitted, all headlines in the current +file are eligible. This function returns the ID of the entry. +If necessary, the ID is created. + +\(fn &optional TARGETS)" nil nil) + +(autoload 'org-id-get-with-outline-drilling "org-id" "\ +Use an outline-cycling interface to retrieve the ID of an entry. +This only finds entries in the current buffer, using `org-get-location'. +It returns the ID of the entry. If necessary, the ID is created. + +\(fn &optional TARGETS)" nil nil) + (autoload 'org-id-goto "org-id" "\ Switch to the buffer containing the entry with id ID. Move the cursor to that entry in that buffer. @@ -995,6 +1090,21 @@ With optional argument MARKERP, return the position as a new marker. \(fn ID &optional MARKERP)" nil nil) +(autoload 'org-id-new "org-id" "\ +Create a new globally unique ID. + +An ID consists of two parts separated by a colon: +- a prefix +- a unique part that will be created according to `org-id-method'. + +PREFIX can specify the prefix, the default is given by the variable +`org-id-prefix'. However, if PREFIX is the symbol `none', don't use any +prefix even if `org-id-prefix' specifies one. + +So a typical ID could look like \"Org:4nd91V40HI\". + +\(fn &optional PREFIX)" nil nil) + (autoload 'org-id-update-id-locations "org-id" "\ Scan relevant files for IDs. Store the relation between files and corresponding IDs. @@ -1046,7 +1156,7 @@ Dispatch to the appropriate function to store a link to an IRC session. ;;;*** ;;;### (autoloads (org-load-noerror-mustsuffix) "org-macs" "org-macs.el" -;;;;;; (21034 2917)) +;;;;;; (21125 47804)) ;;; Generated autoloads from org-macs.el (autoload 'org-load-noerror-mustsuffix "org-macs" "\ @@ -1103,12 +1213,13 @@ line directly before or after the table. ;;;;;; org-table-move-row org-table-move-row-up org-table-move-row-down ;;;;;; org-table-move-column org-table-move-column-left org-table-move-column-right ;;;;;; org-table-delete-column org-table-insert-column org-table-goto-column -;;;;;; org-table-current-dline org-table-field-info org-table-copy-down -;;;;;; org-table-next-row org-table-previous-field org-table-next-field -;;;;;; org-table-justify-field-maybe org-table-align org-table-export -;;;;;; org-table-import org-table-convert-region org-table-create -;;;;;; org-table-create-or-convert-from-region org-table-create-with-table\.el) -;;;;;; "org-table" "org-table.el" "3c271d409dab6979db5a32f1f13820f5") +;;;;;; org-table-current-dline org-table-field-info org-table-blank-field +;;;;;; org-table-copy-down org-table-next-row org-table-previous-field +;;;;;; org-table-next-field org-table-justify-field-maybe org-table-end +;;;;;; org-table-begin org-table-align org-table-export org-table-import +;;;;;; org-table-convert-region org-table-create org-table-create-or-convert-from-region +;;;;;; org-table-create-with-table\.el) "org-table" "org-table.el" +;;;;;; "7d1fe2bd3f96e60383dbc5e4a1046e58") ;;; Generated autoloads from org-table.el (autoload 'org-table-create-with-table\.el "org-table" "\ @@ -1183,6 +1294,18 @@ Align the table at point by aligning all vertical bars. \(fn)" t nil) +(autoload 'org-table-begin "org-table" "\ +Find the beginning of the table and return its position. +With argument TABLE-TYPE, go to the beginning of a table.el-type table. + +\(fn &optional TABLE-TYPE)" nil nil) + +(autoload 'org-table-end "org-table" "\ +Find the end of the table and return its position. +With argument TABLE-TYPE, go to the end of a table.el-type table. + +\(fn &optional TABLE-TYPE)" nil nil) + (autoload 'org-table-justify-field-maybe "org-table" "\ Justify the current field, text to left, number to right. Optional argument NEW may specify text to replace the current field content. @@ -1221,6 +1344,11 @@ copying. In the case of a timestamp, increment by one day. \(fn N)" t nil) +(autoload 'org-table-blank-field "org-table" "\ +Blank the current table field or active region. + +\(fn)" t nil) + (autoload 'org-table-field-info "org-table" "\ Show info about the current field, and highlight any reference at point. @@ -1763,7 +1891,7 @@ replace any running timer. ;;;*** ;;;### (autoloads (org-git-version org-release) "org-version" "org-version.el" -;;;;;; (21066 16879)) +;;;;;; (21153 44665)) ;;; Generated autoloads from org-version.el (autoload 'org-release "org-version" "\ @@ -1789,7 +1917,7 @@ The location of ODT styles.") ;;;;;; org-run-like-in-org-mode turn-on-orgstruct++ turn-on-orgstruct ;;;;;; orgstruct-mode org-global-cycle org-cycle org-mode org-clock-persistence-insinuate ;;;;;; turn-on-orgtbl org-version org-babel-load-file org-babel-do-load-languages) -;;;;;; "org" "org.el" (21055 52523)) +;;;;;; "org" "org.el" (21153 27247)) ;;; Generated autoloads from org.el (autoload 'org-babel-do-load-languages "org" "\ @@ -2012,7 +2140,7 @@ Call the customize function with org as argument. ;;;### (autoloads (org-ascii-publish-to-utf8 org-ascii-publish-to-latin1 ;;;;;; org-ascii-publish-to-ascii org-ascii-export-to-ascii org-ascii-export-as-ascii) -;;;;;; "ox-ascii" "ox-ascii.el" "31dee5d02171d258b9bb18ee9aa5312a") +;;;;;; "ox-ascii" "ox-ascii.el" "7e56ce84bad3df06580643d1216cb1eb") ;;; Generated autoloads from ox-ascii.el (autoload 'org-ascii-export-as-ascii "ox-ascii" "\ @@ -2115,7 +2243,7 @@ Return output file name. ;;;### (autoloads (org-beamer-publish-to-pdf org-beamer-publish-to-latex ;;;;;; org-beamer-insert-options-template org-beamer-select-environment ;;;;;; org-beamer-export-to-pdf org-beamer-export-to-latex org-beamer-export-as-latex -;;;;;; org-beamer-mode) "ox-beamer" "ox-beamer.el" "5c4d3f062f8733a52c5db34802d9cd3e") +;;;;;; org-beamer-mode) "ox-beamer" "ox-beamer.el" "0cc5c809a9e8a88b4f9157d4e1ab8799") ;;; Generated autoloads from ox-beamer.el (autoload 'org-beamer-mode "ox-beamer" "\ @@ -2257,7 +2385,7 @@ Return output file name. ;;;### (autoloads (org-html-publish-to-html org-html-export-to-html ;;;;;; org-html-convert-region-to-html org-html-export-as-html org-html-htmlize-generate-css) -;;;;;; "ox-html" "ox-html.el" "34ee110c82e50b2994c7404c69f5b0a0") +;;;;;; "ox-html" "ox-html.el" "3c711b5cab9066a1c646cd0abc3b8496") ;;; Generated autoloads from ox-html.el (put 'org-html-head-include-default-style 'safe-local-variable 'booleanp) @@ -2365,7 +2493,7 @@ Return output file name. ;;;### (autoloads (org-icalendar-combine-agenda-files org-icalendar-export-agenda-files ;;;;;; org-icalendar-export-to-ics) "ox-icalendar" "ox-icalendar.el" -;;;;;; "02da3bde4cd0abae11ec2334c0b3c83e") +;;;;;; "6a6f72bc83138debb70bccf3be2f4e5f") ;;; Generated autoloads from ox-icalendar.el (autoload 'org-icalendar-export-to-ics "ox-icalendar" "\ @@ -2417,7 +2545,7 @@ The file is stored under the name chosen in ;;;### (autoloads (org-latex-publish-to-pdf org-latex-publish-to-latex ;;;;;; org-latex-export-to-pdf org-latex-export-to-latex org-latex-convert-region-to-latex -;;;;;; org-latex-export-as-latex) "ox-latex" "ox-latex.el" "a33b28d484ae85af5b338e9ef175718e") +;;;;;; org-latex-export-as-latex) "ox-latex" "ox-latex.el" "0ea64b61b296f98bdbce2855aa2b53ad") ;;; Generated autoloads from ox-latex.el (autoload 'org-latex-export-as-latex "ox-latex" "\ @@ -2543,7 +2671,7 @@ Return output file name. ;;;*** ;;;### (autoloads (org-md-export-to-markdown org-md-convert-region-to-md -;;;;;; org-md-export-as-markdown) "ox-md" "ox-md.el" "9613796f5e2e5a59ccd56f1fb52df3c7") +;;;;;; org-md-export-as-markdown) "ox-md" "ox-md.el" "fd408f2bbdb5e038379fd5c0ec734cf2") ;;; Generated autoloads from ox-md.el (autoload 'org-md-export-as-markdown "ox-md" "\ @@ -2605,7 +2733,7 @@ Return output file's name. ;;;*** ;;;### (autoloads (org-odt-convert org-odt-export-to-odt org-odt-export-as-odf-and-open -;;;;;; org-odt-export-as-odf) "ox-odt" "ox-odt.el" "d211042456ad899332c26ca9dcad8724") +;;;;;; org-odt-export-as-odf) "ox-odt" "ox-odt.el" "2a66d5ca58354c479b4a112993fbf777") ;;; Generated autoloads from ox-odt.el (put 'org-odt-preferred-output-format 'safe-local-variable 'stringp) @@ -2668,7 +2796,7 @@ using `org-open-file'. ;;;*** ;;;### (autoloads (org-org-publish-to-org org-org-export-to-org org-org-export-as-org) -;;;;;; "ox-org" "ox-org.el" "0b39e4bd2eb545309d3495257b1ced80") +;;;;;; "ox-org" "ox-org.el" "6e1a106b8efe79c352cc72ac77ad8d91") ;;; Generated autoloads from ox-org.el (autoload 'org-org-export-as-org "ox-org" "\ @@ -2742,7 +2870,7 @@ Return output file name. ;;;### (autoloads (org-publish-current-project org-publish-current-file ;;;;;; org-publish-all org-publish) "ox-publish" "ox-publish.el" -;;;;;; "5ece54cc06ba971c01450eb7a8359e21") +;;;;;; "2c9d03d949ff860bff37b18ab7b1f1d3") ;;; Generated autoloads from ox-publish.el (defalias 'org-publish-project 'org-publish) @@ -2786,7 +2914,7 @@ the project. ;;;*** ;;;### (autoloads (org-texinfo-convert-region-to-texinfo org-texinfo-publish-to-texinfo) -;;;;;; "ox-texinfo" "ox-texinfo.el" "84c96e4b93249af64d8e4a3959149d33") +;;;;;; "ox-texinfo" "ox-texinfo.el" "a2aac533230196b70acfed6ea19fe7e0") ;;; Generated autoloads from ox-texinfo.el (autoload 'org-texinfo-publish-to-texinfo "ox-texinfo" "\ @@ -2812,7 +2940,7 @@ this command to convert it. ;;;### (autoloads (org-export-dispatch org-export-to-file org-export-to-buffer ;;;;;; org-export-insert-default-template org-export-replace-region-by -;;;;;; org-export-string-as org-export-as) "ox" "ox.el" "76fb6fbf6c207c4514de682af5006106") +;;;;;; org-export-string-as org-export-as) "ox" "ox.el" "ec20fcb19adbe84b0807d64fee2562e3") ;;; Generated autoloads from ox.el (autoload 'org-export-as "ox" "\ @@ -2957,7 +3085,7 @@ or FILE. Export dispatcher for Org mode. It provides an access to common export related tasks in a buffer. -Its interface comes in two flavours: standard and expert. +Its interface comes in two flavors: standard and expert. While both share the same set of bindings, only the former displays the valid keys associations in a dedicated buffer. @@ -2965,7 +3093,7 @@ Scrolling (resp. line-wise motion) in this buffer is done with SPC and DEL (resp. C-n and C-p) keys. Set variable `org-export-dispatch-use-expert-ui' to switch to one -flavour or the other. +flavor or the other. When ARG is \\[universal-argument], repeat the last export action, with the same set of options used back then, on the current buffer. diff --git a/lisp/org-macro.el b/lisp/org-macro.el index fa74d83..61e9243 100644 --- a/lisp/org-macro.el +++ b/lisp/org-macro.el @@ -5,6 +5,8 @@ ;; Author: Nicolas Goaziou ;; Keywords: outlines, hypermedia, calendar, wp +;; 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 diff --git a/lisp/org-macs.el b/lisp/org-macs.el index 0083d29..4afbace 100644 --- a/lisp/org-macs.el +++ b/lisp/org-macs.el @@ -283,14 +283,6 @@ we turn off invisibility temporarily. Use this in a `let' form." (<= (match-beginning n) pos) (>= (match-end n) pos))) -(defun org-autoload (file functions) - "Establish autoload for all FUNCTIONS in FILE, if not bound already." - (let ((d (format "Documentation will be available after `%s.el' is loaded." - file)) - f) - (while (setq f (pop functions)) - (or (fboundp f) (autoload f file d t))))) - (defun org-match-line (re) "Looking-at at the beginning of the current line." (save-excursion diff --git a/lisp/org-protocol.el b/lisp/org-protocol.el index 24a319d..84b1176 100644 --- a/lisp/org-protocol.el +++ b/lisp/org-protocol.el @@ -2,7 +2,7 @@ ;; ;; Copyright (C) 2008-2013 Free Software Foundation, Inc. ;; -;; Authors: Bastien Guerry +;; Authors: Bastien Guerry ;; Daniel M German ;; Sebastian Rose ;; Ross Patterson diff --git a/lisp/org-src.el b/lisp/org-src.el index 062d2d7..259186c 100644 --- a/lisp/org-src.el +++ b/lisp/org-src.el @@ -3,7 +3,7 @@ ;; Copyright (C) 2004-2013 Free Software Foundation, Inc. ;; ;; Author: Carsten Dominik -;; Bastien Guerry +;; Bastien Guerry ;; Dan Davison ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org @@ -69,7 +69,7 @@ there are kept outside the narrowed region." This will save the content of the source code editing buffer into a newly created file, not the base buffer for this source block. -If you want to regularily save the base buffer instead of the source +If you want to regularly save the base buffer instead of the source code editing buffer, see `org-edit-src-auto-save-idle-delay' instead." :group 'org-edit-structure :version "24.4" @@ -844,8 +844,9 @@ with \",*\", \",#+\", \",,*\" and \",,#+\"." (let ((session (cdr (assoc :session (nth 2 info))))) (and session (not (string= session "none")) (org-babel-comint-buffer-livep session) - ((lambda (f) (and (fboundp f) (funcall f session))) - (intern (format "org-babel-%s-associate-session" (nth 0 info))))))) + (let ((f (intern (format "org-babel-%s-associate-session" + (nth 0 info))))) + (and (fboundp f) (funcall f session)))))) (defun org-src-babel-configure-edit-buffer () (when org-src-babel-info @@ -953,8 +954,9 @@ fontification of code blocks see `org-src-fontify-block' and LANG is a string, and the returned major mode is a symbol." (intern (concat - ((lambda (l) (if (symbolp l) (symbol-name l) l)) - (or (cdr (assoc lang org-src-lang-modes)) lang)) "-mode"))) + (let ((l (or (cdr (assoc lang org-src-lang-modes)) lang))) + (if (symbolp l) (symbol-name l) l)) + "-mode"))) (provide 'org-src) diff --git a/lisp/org-table.el b/lisp/org-table.el index 246cf8d..8418cf6 100644 --- a/lisp/org-table.el +++ b/lisp/org-table.el @@ -97,11 +97,11 @@ this variable requires a restart of Emacs to become effective." Each template must define lines that will be treated as a comment and that must contain the \"BEGIN RECEIVE ORGTBL %n\" and \"END RECEIVE ORGTBL\" lines where \"%n\" will be replaced with the name of the table during -insertion of the tempate. The transformed table will later be inserted +insertion of the template. The transformed table will later be inserted between these lines. The template should also contain a minimal table in a multiline comment. -If multiline comments are not possible in the buffer language, +If multiline comments are not possible in the buffer language, you can pack it into a string that will not be used when the code is compiled or executed. Above the table will you need a line with the fixed string \"#+ORGTBL: SEND\", followed by instruction on how to @@ -915,6 +915,7 @@ When nil, simply write \"#ERROR\" in corrupted fields.") (setq org-table-may-need-update nil) )) +;;;###autoload (defun org-table-begin (&optional table-type) "Find the beginning of the table and return its position. With argument TABLE-TYPE, go to the beginning of a table.el-type table." @@ -928,6 +929,7 @@ With argument TABLE-TYPE, go to the beginning of a table.el-type table." (beginning-of-line 2) (point)))) +;;;###autoload (defun org-table-end (&optional table-type) "Find the end of the table and return its position. With argument TABLE-TYPE, go to the end of a table.el-type table." @@ -1199,6 +1201,7 @@ Return t when the line exists, nil if it does not exist." (< (setq cnt (1+ cnt)) N))) (= cnt N))) +;;;###autoload (defun org-table-blank-field () "Blank the current table field or active region." (interactive) @@ -4121,7 +4124,7 @@ to execute outside of tables." '(arg) (concat "In tables, run `" (symbol-name fun) "'.\n" "Outside of tables, run the binding of `" - (mapconcat (lambda (x) (format "%s" x)) keys "' or `") + (mapconcat #'key-description keys "' or `") "'.") '(interactive "p") (list 'if diff --git a/lisp/org-version.el b/lisp/org-version.el index fbb4dc6..541de90 100644 --- a/lisp/org-version.el +++ b/lisp/org-version.el @@ -5,13 +5,13 @@ (defun org-release () "The release version of org-mode. Inserted by installing org-mode or when a release is made." - (let ((org-release "8.2.1")) + (let ((org-release "8.2.4")) org-release)) ;;;###autoload (defun org-git-version () "The Git version of org-mode. Inserted by installing org-mode or when a release is made." - (let ((org-git-version "8.2.1-dist")) + (let ((org-git-version "8.2.4-dist")) org-git-version)) ;;;###autoload (defvar org-odt-data-dir "/usr/share/emacs/etc/org" diff --git a/lisp/org.el b/lisp/org.el index 6d34bce..adaabeb 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -82,7 +82,7 @@ (require 'org-macs) (require 'org-compat) -;; `org-outline-regexp' ought to be a defconst but is let-binding in +;; `org-outline-regexp' ought to be a defconst but is let-bound in ;; some places -- e.g. see the macro `org-with-limited-levels'. ;; ;; In Org buffers, the value of `outline-regexp' is that of @@ -198,7 +198,8 @@ file to byte-code before it is loaded." ;; tangle if the org-mode file is newer than the elisp file (unless (and (file-exists-p exported-file) (> (funcall age file) (funcall age exported-file))) - (org-babel-tangle-file file exported-file "emacs-lisp")) + (setq exported-file + (car (org-babel-tangle-file file exported-file "emacs-lisp")))) (message "%s %s" (if compile (progn (byte-compile-file exported-file 'load) @@ -303,13 +304,13 @@ When MESSAGE is non-nil, display a message with the version." org-install-dir (concat "mixed installation! " org-install-dir " and " org-dir)) "org-loaddefs.el can not be found!"))) - (_version (if full version org-version))) + (version1 (if full version org-version))) (if (org-called-interactively-p 'interactive) (if here (insert version) (message version)) - (if message (message _version)) - _version))) + (if message (message version1)) + version1))) (defconst org-version (org-version)) @@ -653,11 +654,17 @@ the following lines anywhere in the buffer: (defcustom org-use-sub-superscripts t "Non-nil means interpret \"_\" and \"^\" for display. -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. + +If you want to control how Org exports those characters, see +`org-export-with-sub-superscripts'. `org-use-sub-superscripts' +used to be an alias for `org-export-with-sub-superscripts' in +Org <8.0, it is not anymore. + +When this option is turned on, you can use TeX-like syntax for +sub- and superscripts within the buffer. 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 @@ -665,13 +672,14 @@ sub- or superscripts. 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." +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." :group 'org-startup - :version "24.1" + :version "24.4" + :package-version '(Org . "8.0") :type '(choice (const :tag "Always interpret" t) (const :tag "Only with braces" {}) @@ -712,7 +720,7 @@ the following lines anywhere in the buffer: "Non-nil means preview LaTeX fragments when loading a new Org file. This can also be configured on a per-file basis by adding one of -the followinglines anywhere in the buffer: +the following lines anywhere in the buffer: #+STARTUP: latexpreview #+STARTUP: nolatexpreview" :group 'org-startup @@ -1036,7 +1044,7 @@ commands in the Help buffer using the `?' speed command." :last-refile "org-refile-last-stored" :last-capture-marker "org-capture-last-stored-marker") "Names for bookmarks automatically set by some Org commands. -This can provide strings as names for a number of bookmakrs Org sets +This can provide strings as names for a number of bookmarks Org sets automatically. The following keys are currently implemented: :last-capture :last-capture-marker @@ -1730,7 +1738,12 @@ In tables, the special behavior of RET has precedence." A longer mouse click will still set point. Does not work on XEmacs. Needs to be set before org.el is loaded." :group 'org-link-follow - :type 'boolean) + :version "24.4" + :package-version '(Org . "8.3") + :type '(choice + (const :tag "A double click follows the link" 'double) + (const :tag "Unconditionally follow the link with mouse-1" t) + (integer :tag "mouse-1 click does not follow the link if longer than N ms" 450))) (defcustom org-mark-ring-length 4 "Number of different positions to be recorded in the ring. @@ -2053,16 +2066,14 @@ following situations: note buffer with `C-1 C-c C-c'. The user is prompted for an org file, with `org-directory' as the default path." :group 'org-refile - :group 'org-remember :group 'org-capture :type 'directory) (defcustom org-default-notes-file (convert-standard-filename "~/.notes") "Default target for storing notes. -Used as a fall back file for org-remember.el and org-capture.el, for -templates that do not specify a target file." +Used as a fall back file for org-capture.el, for templates that +do not specify a target file." :group 'org-refile - :group 'org-remember :group 'org-capture :type '(choice (const :tag "Default from remember-data-file" nil) @@ -2092,7 +2103,6 @@ outline-path-completion Headlines in the current buffer are offered via When nil, new notes will be filed to the end of a file or entry. This can also be a list with cons cells of regular expressions that are matched against file names, and values." - :group 'org-remember :group 'org-capture :group 'org-refile :type '(choice @@ -2665,12 +2675,12 @@ agenda log mode depends on the format of these entries." "Heading when changing todo state (todo sequence only)" state) string) (cons (const :tag "Heading when just taking a note" note) string) - (cons (const :tag "Heading when clocking out" clock-out) string) - (cons (const :tag "Heading when an item is no longer scheduled" delschedule) string) (cons (const :tag "Heading when rescheduling" reschedule) string) + (cons (const :tag "Heading when an item is no longer scheduled" delschedule) string) (cons (const :tag "Heading when changing deadline" redeadline) string) (cons (const :tag "Heading when deleting a deadline" deldeadline) string) - (cons (const :tag "Heading when refiling" refile) string))) + (cons (const :tag "Heading when refiling" refile) string) + (cons (const :tag "Heading when clocking out" clock-out) string))) (unless (assq 'note org-log-note-headings) (push '(note . "%t") org-log-note-headings)) @@ -4244,12 +4254,6 @@ Normal means, no org-mode-specific context." "Detect the first line outside a table when searching from within it. This works for both table types.") -;; Autoload the functions in org-table.el that are needed by functions here. - -(eval-and-compile - (org-autoload "org-table" - '(org-table-begin org-table-blank-field org-table-end))) - (defconst org-TBLFM-regexp "^[ \t]*#\\+TBLFM: " "Detect a #+TBLFM line.") @@ -4330,12 +4334,6 @@ If TABLE-TYPE is non-nil, also check for table.el-type tables." (re-search-forward org-table-any-border-regexp nil 1)))) (unless quietly (message "Mapping tables: done"))) -;; Declare and autoload functions from org-agenda.el - -(eval-and-compile - (org-autoload "org-agenda" - '(org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item))) - (declare-function org-clock-save-markers-for-cut-and-paste "org-clock" (beg end)) (declare-function org-clock-update-mode-line "org-clock" ()) (declare-function org-resolve-clocks "org-clock" @@ -4361,11 +4359,6 @@ If TABLE-TYPE is non-nil, also check for table.el-type tables." Return nil if no clock is running." (marker-buffer org-clock-marker)) -(eval-and-compile - (org-autoload "org-clock" '(org-clock-remove-overlays - org-clock-update-time-maybe - org-clocktable-shift))) - (defun org-check-running-clock () "Check if the current buffer contains the running clock. If yes, offer to stop it and to save the buffer with the changes." @@ -4565,33 +4558,18 @@ Otherwise, these types are allowed: (defalias 'org-advertized-archive-subtree 'org-archive-subtree) -(eval-and-compile - (org-autoload "org-archive" - '(org-add-archive-files))) - -;; Autoload Column View Code +;; Declare Column View Code (declare-function org-columns-number-to-string "org-colview" (n fmt &optional printf)) (declare-function org-columns-get-format-and-top-level "org-colview" ()) (declare-function org-columns-compute "org-colview" (property)) -(org-autoload (if (featurep 'xemacs) "org-colview-xemacs" "org-colview") - '(org-columns-number-to-string - org-columns-get-format-and-top-level - org-columns-compute - org-columns-remove-overlays)) - -;; Autoload ID code +;; Declare ID code (declare-function org-id-store-link "org-id") (declare-function org-id-locations-load "org-id") (declare-function org-id-locations-save "org-id") (defvar org-id-track-globally) -(org-autoload "org-id" - '(org-id-new - org-id-copy - org-id-get-with-outline-path-completion - org-id-get-with-outline-drilling)) ;;; Variables for pre-computed regular expressions, all buffer local @@ -4806,6 +4784,8 @@ This can be turned on/off through `org-toggle-tags-groups'." :group 'org-startup :type 'boolean) +(defvar org-inhibit-startup nil) ; Dynamically-scoped param. + (defun org-toggle-tags-groups () "Toggle support for group tags. Support for group tags is controlled by the option @@ -5266,7 +5246,6 @@ This variable is set by `org-before-change-function'. "Every change indicates that a table might need an update." (setq org-table-may-need-update t)) (defvar org-mode-map) -(defvar org-inhibit-startup nil) ; Dynamically-scoped param. (defvar org-inhibit-startup-visibility-stuff nil) ; Dynamically-scoped param. (defvar org-agenda-keep-modes nil) ; Dynamically-scoped param. (defvar org-inhibit-logging nil) ; Dynamically-scoped param. @@ -5704,7 +5683,7 @@ The time stamps may be either active or inactive.") (font-lock-prepend-text-property (match-beginning 2) (match-end 2) 'face (nth 1 a)) - (and (nth 4 a) + (and (nth 2 a) (org-remove-flyspell-overlays-in (match-beginning 0) (match-end 0))) (add-text-properties (match-beginning 2) (match-end 2) @@ -6716,6 +6695,8 @@ in special contexts. (setq org-cycle-global-status 'overview) (run-hook-with-args 'org-cycle-hook 'overview))))) +(defvar org-called-with-limited-levels);Dyn-bound in ̀org-with-limited-levels'. + (defun org-cycle-internal-local () "Do the local cycling action." (let ((goal-column 0) eoh eol eos has-children children-skipped struct) @@ -7073,11 +7054,19 @@ open and agenda-wise Org files." (org-flag-drawer t)))))) (defun org-cycle-hide-inline-tasks (state) - "Re-hide inline task when switching to 'contents visibility state." - (when (and (eq state 'contents) - (boundp 'org-inlinetask-min-level) - org-inlinetask-min-level) - (hide-sublevels (1- org-inlinetask-min-level)))) + "Re-hide inline tasks when switching to 'contents or 'children +visibility state." + (case state + (contents + (when (org-bound-and-true-p org-inlinetask-min-level) + (hide-sublevels (1- org-inlinetask-min-level)))) + (children + (when (featurep 'org-inlinetask) + (save-excursion + (while (and (outline-next-heading) + (org-inlinetask-at-task-p)) + (org-inlinetask-toggle-visibility) + (org-inlinetask-goto-end))))))) (defun org-flag-drawer (flag) "When FLAG is non-nil, hide the drawer we are within. @@ -7569,7 +7558,8 @@ This is important for non-interactive uses of the command." (and (ignore-errors (org-back-to-heading invisible-ok)) (org-at-heading-p)))) (or arg (not itemp)))) - ;; At beginning of buffer or so hight up that only a heading makes sense. + ;; At beginning of buffer or so high up that only a heading + ;; makes sense. (insert (if (or (bobp) (org-previous-line-empty-p)) "" "\n") (if (org-in-src-block-p) ",* " "* ")) @@ -7631,9 +7621,9 @@ This is important for non-interactive uses of the command." (org-end-of-subtree nil t) (skip-chars-backward " \r\n") (and (looking-at "[ \t]+") (replace-match "")) - (forward-char 1) + (unless (eobp) (forward-char 1)) (when (looking-at "^\\*") - (backward-char 1) + (unless (bobp) (backward-char 1)) (insert "\n"))) ;; If we are splitting, grab the text that should be moved to the new headline @@ -7769,7 +7759,7 @@ This is a list with the following elements: "Insert TODO heading with `org-insert-heading-respect-content' set to t." (interactive "P") (let ((org-insert-heading-respect-content t)) - (org-insert-todo-heading force-state t))) + (org-insert-todo-heading force-state '(4)))) (defun org-insert-todo-heading (arg &optional force-heading) "Insert a new heading with the same level and TODO state as current heading. @@ -7937,8 +7927,6 @@ even level numbers will become the next higher odd number." (define-obsolete-function-alias 'org-get-legal-level 'org-get-valid-level "23.1"))) -(defvar org-called-with-limited-levels nil) ;; Dynamically bound in -;; ̀org-with-limited-levels' (defun org-promote () "Promote the current heading higher up the tree. If the region is active in `transient-mark-mode', promote all headings @@ -8842,13 +8830,13 @@ If WITH-CASE is non-nil, the sorting will be case-sensitive." ;; command. There might be problems if any of the keys is otherwise ;; used as a prefix key. -(defcustom orgstruct-heading-prefix-regexp nil +(defcustom orgstruct-heading-prefix-regexp "" "Regexp that matches the custom prefix of Org headlines in orgstruct(++)-mode." :group 'org :version "24.4" - :package-version '(Org . "8.0") - :type 'string) + :package-version '(Org . "8.3") + :type 'regexp) ;;;###autoload(put 'orgstruct-heading-prefix-regexp 'safe-local-variable 'stringp) (defcustom orgstruct-setup-hook nil @@ -9009,8 +8997,8 @@ buffer. It will also recognize item context in multiline items." "Create a function for binding in the structure minor mode. FUN is the command to call inside a table. KEY is the key that should be checked in for a command to execute outside of tables. -Non-nil DISABLE-WHEN-HEADING-PREFIX means to disable the command -if `orgstruct-heading-prefix-regexp' is non-nil." +Non-nil `disable-when-heading-prefix' means to disable the command +if `orgstruct-heading-prefix-regexp' is not empty." (let ((name (concat "orgstruct-hijacker-" (symbol-name fun)))) (let ((nname name) (i 0)) @@ -9036,14 +9024,13 @@ if `orgstruct-heading-prefix-regexp' is non-nil." (key-description key) "'." (when disable-when-heading-prefix (concat - "\nIf `orgstruct-heading-prefix-regexp' is non-nil, this command will always fall\n" + "\nIf `orgstruct-heading-prefix-regexp' is not empty, this command will always fall\n" "back to the default binding due to limitations of Org's implementation of\n" "`" (symbol-name fun) "'."))) (interactive "p") (let* ((disable - ,(when disable-when-heading-prefix - '(and orgstruct-heading-prefix-regexp - (not (string= orgstruct-heading-prefix-regexp ""))))) + ,(and disable-when-heading-prefix + '(not (string= orgstruct-heading-prefix-regexp "")))) (fallback (or disable (not @@ -10014,7 +10001,8 @@ Use TAB to complete link prefixes, then RET for type-specific completion support (setq org-stored-links (delq (assoc link org-stored-links) org-stored-links))) - (if (string-match org-plain-link-re link) + (if (and (string-match org-plain-link-re link) + (not (string-match org-ts-regexp link))) ;; URL-like link, normalize the use of angular brackets. (setq link (org-remove-angle-brackets link))) @@ -10313,6 +10301,7 @@ Functions in this hook must return t if they identify and follow a link at point. If they don't find anything interesting at point, they must return nil.") +(defvar org-link-search-inhibit-query nil) ;; dynamically scoped (defvar clean-buffer-list-kill-buffer-names) ; Defined in midnight.el (defun org-open-at-point (&optional arg reference-buffer) "Open link at or after point. @@ -10542,7 +10531,8 @@ application the system uses for this file type." ((and (string= type "thisfile") (or (run-hook-with-args-until-success 'org-open-link-functions path) - (and (string-match "^id:" link) + (and link + (string-match "^id:" link) (or (featurep 'org-id) (require 'org-id)) (progn (funcall (nth 1 (assoc "id" org-link-protocols)) @@ -10687,7 +10677,6 @@ the window configuration before `org-open-at-point' was called using: (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 stealth) "Search for a link search option. If S is surrounded by forward slashes, it is interpreted as a @@ -12951,6 +12940,7 @@ can either be an Org date like \"2011-07-24\" or a delta like \"+2d\"." (message "Item no longer has a deadline.")) ((equal arg '(16)) (save-excursion + (org-back-to-heading t) (if (re-search-forward org-deadline-time-regexp (save-excursion (outline-next-heading) (point)) t) @@ -13021,6 +13011,7 @@ either be an Org date like \"2011-07-24\" or a delta like \"+2d\"." (message "Item is no longer scheduled."))) ((equal arg '(16)) (save-excursion + (org-back-to-heading t) (if (re-search-forward org-scheduled-time-regexp (save-excursion (outline-next-heading) (point)) t) @@ -13093,6 +13084,9 @@ nil." (delete-region (point-at-bol) (min (point-max) (1+ (point-at-eol)))))))))) +(defvar org-time-was-given) ; dynamically scoped parameter +(defvar org-end-time-was-given) ; dynamically scoped parameter + (defun org-add-planning-info (what &optional time &rest remove) "Insert new timestamp with keyword in the line directly after the headline. WHAT indicates what kind of time stamp to add. TIME indicates the time to use. @@ -14407,7 +14401,7 @@ If ONOFF is `on' or `off', don't toggle but set to this state." (insert (make-string (- ncol (current-column)) ?\ )) (setq ncol (current-column)) (when indent-tabs-mode (tabify p (point-at-eol))) - (org-move-to-column (min ncol col) t)) + (org-move-to-column (min ncol col) t nil t)) (goto-char pos)))) (defun org-set-tags-command (&optional arg just-align) @@ -15189,103 +15183,102 @@ is a string only get exactly this property. SPECIFIC can be a string, the specific property we are interested in. Specifying it can speed things up because then unnecessary parsing is avoided." (setq which (or which 'all)) - (org-with-point-at pom - (let ((clockstr (substring org-clock-string 0 -1)) - (excluded '("TODO" "TAGS" "ALLTAGS" "PRIORITY" "BLOCKED")) - (case-fold-search nil) - beg end range props sum-props key key1 value string clocksum clocksumt) - (save-excursion - (when (condition-case nil - (and (derived-mode-p 'org-mode) (org-back-to-heading t)) - (error nil)) - (setq beg (point)) - (setq sum-props (get-text-property (point) 'org-summaries)) - (setq clocksum (get-text-property (point) :org-clock-minutes) - clocksumt (get-text-property (point) :org-clock-minutes-today)) - (outline-next-heading) - (setq end (point)) - (when (memq which '(all special)) - ;; Get the special properties, like TODO and tags - (goto-char beg) - (when (and (or (not specific) (string= specific "TODO")) - (looking-at org-todo-line-regexp) (match-end 2)) - (push (cons "TODO" (org-match-string-no-properties 2)) props)) - (when (and (or (not specific) (string= specific "PRIORITY")) - (looking-at org-priority-regexp)) - (push (cons "PRIORITY" (org-match-string-no-properties 2)) props)) - (when (or (not specific) (string= specific "FILE")) - (push (cons "FILE" buffer-file-name) props)) - (when (and (or (not specific) (string= specific "TAGS")) - (setq value (org-get-tags-string)) - (string-match "\\S-" value)) - (push (cons "TAGS" value) props)) - (when (and (or (not specific) (string= specific "ALLTAGS")) - (setq value (org-get-tags-at))) - (push (cons "ALLTAGS" (concat ":" (mapconcat 'identity value ":") - ":")) - props)) - (when (or (not specific) (string= specific "BLOCKED")) - (push (cons "BLOCKED" (if (org-entry-blocked-p) "t" "")) props)) - (when (or (not specific) - (member specific - '("SCHEDULED" "DEADLINE" "CLOCK" "CLOSED" - "TIMESTAMP" "TIMESTAMP_IA"))) - (catch 'match - (while (re-search-forward org-maybe-keyword-time-regexp end t) - (setq key (if (match-end 1) - (substring (org-match-string-no-properties 1) - 0 -1)) - string (if (equal key clockstr) - (org-trim - (buffer-substring-no-properties - (match-beginning 3) (goto-char - (point-at-eol)))) - (substring (org-match-string-no-properties 3) - 1 -1))) - ;; Get the correct property name from the key. This is - ;; necessary if the user has configured time keywords. - (setq key1 (concat key ":")) - (cond - ((not key) - (setq key - (if (= (char-after (match-beginning 3)) ?\[) - "TIMESTAMP_IA" "TIMESTAMP"))) - ((equal key1 org-scheduled-string) (setq key "SCHEDULED")) - ((equal key1 org-deadline-string) (setq key "DEADLINE")) - ((equal key1 org-closed-string) (setq key "CLOSED")) - ((equal key1 org-clock-string) (setq key "CLOCK"))) - (if (and specific (equal key specific) (not (equal key "CLOCK"))) - (progn - (push (cons key string) props) - ;; no need to search further if match is found - (throw 'match t)) - (when (or (equal key "CLOCK") (not (assoc key props))) - (push (cons key string) props))))))) - - (when (memq which '(all standard)) - ;; Get the standard properties, like :PROP: ... - (setq range (org-get-property-block beg end)) - (when range - (goto-char (car range)) - (while (re-search-forward org-property-re - (cdr range) t) - (setq key (org-match-string-no-properties 2) - value (org-trim (or (org-match-string-no-properties 3) ""))) - (unless (member key excluded) - (push (cons key (or value "")) props))))) - (if clocksum - (push (cons "CLOCKSUM" - (org-columns-number-to-string (/ (float clocksum) 60.) - 'add_times)) - props)) - (if clocksumt - (push (cons "CLOCKSUM_T" - (org-columns-number-to-string (/ (float clocksumt) 60.) - 'add_times)) - props)) - (unless (assoc "CATEGORY" props) - (push (cons "CATEGORY" (org-get-category)) props)) - (append sum-props (nreverse props))))))) + (org-with-wide-buffer + (org-with-point-at pom + (let ((clockstr (substring org-clock-string 0 -1)) + (excluded '("TODO" "TAGS" "ALLTAGS" "PRIORITY" "BLOCKED")) + (case-fold-search nil) + beg end range props sum-props key key1 value string clocksum clocksumt) + (when (and (derived-mode-p 'org-mode) + (ignore-errors (org-back-to-heading t))) + (setq beg (point)) + (setq sum-props (get-text-property (point) 'org-summaries)) + (setq clocksum (get-text-property (point) :org-clock-minutes) + clocksumt (get-text-property (point) :org-clock-minutes-today)) + (outline-next-heading) + (setq end (point)) + (when (memq which '(all special)) + ;; Get the special properties, like TODO and tags + (goto-char beg) + (when (and (or (not specific) (string= specific "TODO")) + (looking-at org-todo-line-regexp) (match-end 2)) + (push (cons "TODO" (org-match-string-no-properties 2)) props)) + (when (and (or (not specific) (string= specific "PRIORITY")) + (looking-at org-priority-regexp)) + (push (cons "PRIORITY" (org-match-string-no-properties 2)) props)) + (when (or (not specific) (string= specific "FILE")) + (push (cons "FILE" buffer-file-name) props)) + (when (and (or (not specific) (string= specific "TAGS")) + (setq value (org-get-tags-string)) + (string-match "\\S-" value)) + (push (cons "TAGS" value) props)) + (when (and (or (not specific) (string= specific "ALLTAGS")) + (setq value (org-get-tags-at))) + (push (cons "ALLTAGS" (concat ":" (mapconcat 'identity value ":") + ":")) + props)) + (when (or (not specific) (string= specific "BLOCKED")) + (push (cons "BLOCKED" (if (org-entry-blocked-p) "t" "")) props)) + (when (or (not specific) + (member specific + '("SCHEDULED" "DEADLINE" "CLOCK" "CLOSED" + "TIMESTAMP" "TIMESTAMP_IA"))) + (catch 'match + (while (re-search-forward org-maybe-keyword-time-regexp end t) + (setq key (if (match-end 1) + (substring (org-match-string-no-properties 1) + 0 -1)) + string (if (equal key clockstr) + (org-trim + (buffer-substring-no-properties + (match-beginning 3) (goto-char + (point-at-eol)))) + (substring (org-match-string-no-properties 3) + 1 -1))) + ;; Get the correct property name from the key. This is + ;; necessary if the user has configured time keywords. + (setq key1 (concat key ":")) + (cond + ((not key) + (setq key + (if (= (char-after (match-beginning 3)) ?\[) + "TIMESTAMP_IA" "TIMESTAMP"))) + ((equal key1 org-scheduled-string) (setq key "SCHEDULED")) + ((equal key1 org-deadline-string) (setq key "DEADLINE")) + ((equal key1 org-closed-string) (setq key "CLOSED")) + ((equal key1 org-clock-string) (setq key "CLOCK"))) + (if (and specific (equal key specific) (not (equal key "CLOCK"))) + (progn + (push (cons key string) props) + ;; no need to search further if match is found + (throw 'match t)) + (when (or (equal key "CLOCK") (not (assoc key props))) + (push (cons key string) props))))))) + + (when (memq which '(all standard)) + ;; Get the standard properties, like :PROP: ... + (setq range (org-get-property-block beg end)) + (when range + (goto-char (car range)) + (while (re-search-forward org-property-re + (cdr range) t) + (setq key (org-match-string-no-properties 2) + value (org-trim (or (org-match-string-no-properties 3) ""))) + (unless (member key excluded) + (push (cons key (or value "")) props))))) + (if clocksum + (push (cons "CLOCKSUM" + (org-columns-number-to-string (/ (float clocksum) 60.) + 'add_times)) + props)) + (if clocksumt + (push (cons "CLOCKSUM_T" + (org-columns-number-to-string (/ (float clocksumt) 60.) + 'add_times)) + props)) + (unless (assoc "CATEGORY" props) + (push (cons "CATEGORY" (org-get-category)) props)) + (append sum-props (nreverse props))))))) (defun org-entry-get (pom property &optional inherit literal-nil) "Get value of PROPERTY for entry or content at point-or-marker POM. @@ -15305,30 +15298,32 @@ when a \"nil\" value can supersede a non-nil value higher up the hierarchy." t)) (org-entry-get-with-inheritance property literal-nil) (if (member property org-special-properties) - ;; We need a special property. Use `org-entry-properties' to - ;; retrieve it, but specify the wanted property + ;; We need a special property. Use `org-entry-properties' + ;; to retrieve it, but specify the wanted property (cdr (assoc property (org-entry-properties nil 'special property))) - (let ((range (org-get-property-block))) - (when (and range (not (eq (car range) (cdr range)))) - (let* ((props (list (or (assoc property org-file-properties) - (assoc property org-global-properties) - (assoc property org-global-properties-fixed)))) - (ap (lambda (key) - (when (re-search-forward - (org-re-property key) (cdr range) t) - (setq props - (org-update-property-plist - key - (if (match-end 3) - (org-match-string-no-properties 3) "") - props))))) - val) - (goto-char (car range)) - (funcall ap property) - (goto-char (car range)) - (while (funcall ap (concat property "+"))) - (setq val (cdr (assoc property props))) - (when val (if literal-nil val (org-not-nil val)))))))))) + (org-with-wide-buffer + (let ((range (org-get-property-block))) + (when (and range (not (eq (car range) (cdr range)))) + (let* ((props + (list (or (assoc property org-file-properties) + (assoc property org-global-properties) + (assoc property org-global-properties-fixed)))) + (ap (lambda (key) + (when (re-search-forward + (org-re-property key) (cdr range) t) + (setq props + (org-update-property-plist + key + (if (match-end 3) + (org-match-string-no-properties 3) "") + props))))) + val) + (goto-char (car range)) + (funcall ap property) + (goto-char (car range)) + (while (funcall ap (concat property "+"))) + (setq val (cdr (assoc property props))) + (when val (if literal-nil val (org-not-nil val))))))))))) (defun org-property-or-variable-value (var &optional inherit) "Check if there is a property fixing the value of VAR. @@ -16024,8 +16019,6 @@ Return the position where this entry starts, or nil if there is no such entry." (defvar org-last-changed-timestamp nil) (defvar org-last-inserted-timestamp nil "The last time stamp inserted with `org-insert-time-stamp'.") -(defvar org-time-was-given) ; dynamically scoped parameter -(defvar org-end-time-was-given) ; dynamically scoped parameter (defvar org-ts-what) ; dynamically scoped parameter (defun org-time-stamp (arg &optional inactive) @@ -16214,6 +16207,10 @@ So these are more for recording a certain time/date." map) "Keymap for minibuffer commands when using `org-read-date'.") +(defvar org-def) +(defvar org-defdecode) +(defvar org-with-time) + (defun org-read-date (&optional org-with-time to-time from-string prompt default-time default-input inactive) "Read a date, possibly a time, and make things smooth for the user. @@ -16360,9 +16357,6 @@ user." (nth 2 final) (nth 1 final)) (format "%04d-%02d-%02d" (nth 5 final) (nth 4 final) (nth 3 final)))))) -(defvar org-def) -(defvar org-defdecode) -(defvar org-with-time) (defun org-read-date-display () "Display the current date prompt interpretation in the minibuffer." (when org-read-date-display-live @@ -18051,10 +18045,10 @@ When a buffer is unmodified, it is just killed. When modified, it is saved (inhibit-read-only t) (org-inhibit-startup org-agenda-inhibit-startup) (rea (concat ":" org-archive-tag ":")) - file re) + file re pos) (setq org-tag-alist-for-agenda nil org-tag-groups-alist-for-agenda nil) - (save-excursion + (save-window-excursion (save-restriction (while (setq file (pop files)) (catch 'nextfile @@ -18064,6 +18058,7 @@ When a buffer is unmodified, it is just killed. When modified, it is saved (set-buffer (org-get-agenda-file-buffer file))) (widen) (org-set-regexps-and-options-for-tags) + (setq pos (point)) (goto-char (point-min)) (let ((case-fold-search t)) (when (search-forward "#+setupfile" nil t) @@ -18107,7 +18102,8 @@ When a buffer is unmodified, it is just killed. When modified, it is saved org-comment-string)) (while (re-search-forward re nil t) (add-text-properties - (match-beginning 0) (org-end-of-subtree t) pc)))))))) + (match-beginning 0) (org-end-of-subtree t) pc)))) + (goto-char pos))))) (setq org-todo-keywords-for-agenda (org-uniquify org-todo-keywords-for-agenda)) (setq org-todo-keyword-alist-for-agenda @@ -19509,9 +19505,6 @@ because, in this case the deletion might narrow the column." (put 'org-self-insert-command 'pabbrev-expand-after-command t) (put 'orgtbl-self-insert-command 'pabbrev-expand-after-command t) -;; How to do this: Measure non-white length of current string -;; If equal to column width, we should realign. - (defun org-remap (map &rest commands) "In MAP, remap the functions given in COMMANDS. COMMANDS is a list of alternating OLDDEF NEWDEF command names." @@ -19526,7 +19519,7 @@ COMMANDS is a list of alternating OLDDEF NEWDEF command names." "Transpose words for Org. This uses the `org-mode-transpose-word-syntax-table' syntax table, which interprets characters in `org-emphasis-alist' as -word constituants." +word constituents." (interactive) (with-syntax-table org-mode-transpose-word-syntax-table (call-interactively 'transpose-words))) @@ -20221,6 +20214,17 @@ This command does many different things, depending on context: (if (save-excursion (beginning-of-line) (looking-at "[ \t]*$")) (or (run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-final-hook) (user-error "C-c C-c can do nothing useful at this location")) + (case type + ;; When at a link, act according to the parent instead. + (link (setq context (org-element-property :parent context)) + (setq type (org-element-type context))) + ;; Unsupported object types: check parent element instead. + ((bold code entity export-snippet inline-babel-call inline-src-block + italic latex-fragment line-break macro strike-through subscript + superscript underline verbatim) + (while (and (setq context (org-element-property :parent context)) + (not (memq (setq type (org-element-type context)) + '(paragraph verse-block))))))) ;; For convenience: at the first line of a paragraph on the ;; same line as an item, apply function on that item instead. (when (eq type 'paragraph) @@ -20228,12 +20232,6 @@ This command does many different things, depending on context: (when (and (eq (org-element-type parent) 'item) (= (point-at-bol) (org-element-property :begin parent))) (setq context parent type 'item)))) - ;; When heading text is a link, treat the heading, not the link, - ;; as the current element - (when (eq type 'link) - (let ((parent (org-element-property :parent context))) - (when (and (eq (org-element-type parent) 'headline)) - (setq context parent type 'headline)))) ;; Act according to type of element or object at point. (case type (clock (org-clock-update-time-maybe)) @@ -20387,7 +20385,7 @@ If `org-special-ctrl-o' is nil, just call `open-line' everywhere." (open-line n)) ((org-at-table-p) (org-table-insert-row)) - (t + (t (open-line n)))) (defun org-return (&optional indent) @@ -21081,7 +21079,7 @@ Your bug report will be posted to the Org-mode mailing list. (interactive) (mapc 'require '(org-agenda org-archive org-attach org-clock org-colview org-id - org-remember org-table org-timer))) + org-table org-timer))) ;;;###autoload (defun org-reload (&optional uncompiled) @@ -21134,7 +21132,7 @@ With prefix arg UNCOMPILED, load the uncompiled versions." (message "The following feature%s found in load-path, please check if that's correct:\n%s" (if (> (length load-uncore) 1) "s were" " was") load-uncore)) (if load-misses - (message "Some error occured while reloading Org feature%s\n%s\nPlease check *Messages*!\n%s" + (message "Some error occurred while reloading Org feature%s\n%s\nPlease check *Messages*!\n%s" (if (> (length load-misses) 1) "s" "") load-misses (org-version nil 'full)) (message "Successfully reloaded Org\n%s" (org-version nil 'full))))) @@ -22157,7 +22155,7 @@ hierarchy of headlines by UP levels before marking the subtree." (let ((line-end (org-current-line end))) (goto-char start) (while (< (org-current-line) line-end) - (cond ((org-in-src-block-p) (org-src-native-tab-command-maybe)) + (cond ((org-in-src-block-p t) (org-src-native-tab-command-maybe)) (t (call-interactively 'org-indent-line))) (move-beginning-of-line 2))))) diff --git a/lisp/ox-ascii.el b/lisp/ox-ascii.el index 74a7c64..55bda83 100644 --- a/lisp/ox-ascii.el +++ b/lisp/ox-ascii.el @@ -1,10 +1,12 @@ ;;; ox-ascii.el --- ASCII Back-End for Org Export Engine -;; Copyright (C) 2012, 2013 Free Software Foundation, Inc. +;; Copyright (C) 2012-2013 Free Software Foundation, Inc. ;; Author: Nicolas Goaziou ;; Keywords: outlines, hypermedia, calendar, wp +;; 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 @@ -21,19 +23,7 @@ ;;; Commentary: ;; ;; This library implements an ASCII back-end for Org generic exporter. -;; -;; It provides two commands for export, depending on the desired -;; output: `org-ascii-export-as-ascii' (temporary buffer) and -;; `org-ascii-export-to-ascii' ("txt" file). Also, three publishing -;; functions are available: `org-ascii-publish-to-ascii', -;; `org-ascii-publish-to-latin1' and `org-ascii-publish-to-utf8'. -;; -;; Output encoding is specified through `org-ascii-charset' variable, -;; among `ascii', `latin1' and `utf-8' symbols. -;; -;; By default, horizontal rules span over the full text with, but with -;; a given width attribute (set though #+ATTR_ASCII: :width ) -;; they can be shortened and centered. +;; See Org manual for more information. ;;; Code: @@ -346,7 +336,8 @@ Otherwise, place it right after it." :package-version '(Org . "8.0") :type 'string) -(defcustom org-ascii-format-drawer-function nil +(defcustom org-ascii-format-drawer-function + (lambda (name contents width) contents) "Function called to format a drawer in ASCII. The function must accept three parameters: @@ -357,63 +348,32 @@ The function must accept three parameters: The function should return either the string to be exported or nil to ignore the drawer. -For example, the variable could be set to the following function -in order to mimic default behaviour: - -\(defun org-ascii-format-drawer-default (name contents width) - \"Format a drawer element for ASCII export.\" - contents)" +The default value simply returns the value of CONTENTS." :group 'org-export-ascii :version "24.4" :package-version '(Org . "8.0") :type 'function) -(defcustom org-ascii-format-inlinetask-function nil +(defcustom org-ascii-format-inlinetask-function + 'org-ascii-format-inlinetask-default "Function called to format an inlinetask in ASCII. -The function must accept six parameters: - TODO the todo keyword, as a string - TODO-TYPE the todo type, a symbol among `todo', `done' and nil. - PRIORITY the inlinetask priority, as a string - NAME the inlinetask name, as a string. - TAGS the inlinetask tags, as a list of strings. - CONTENTS the contents of the inlinetask, as a string. +The function must accept nine parameters: + TODO the todo keyword, as a string + TODO-TYPE the todo type, a symbol among `todo', `done' and nil. + PRIORITY the inlinetask priority, as a string + NAME the inlinetask name, as a string. + TAGS the inlinetask tags, as a list of strings. + CONTENTS the contents of the inlinetask, as a string. + WIDTH the width of the inlinetask, as a number. + INLINETASK the inlinetask itself. + INFO the info channel. The function should return either the string to be exported or -nil to ignore the inline task. - -For example, the variable could be set to the following function -in order to mimic default behaviour: - -\(defun org-ascii-format-inlinetask-default - \(todo type priority name tags contents\) - \"Format an inline task element for ASCII export.\" - \(let* \(\(utf8p \(eq \(plist-get info :ascii-charset\) 'utf-8\)\) - \(width org-ascii-inlinetask-width\) - \(org-ascii--indent-string - \(concat - ;; Top line, with an additional blank line if not in UTF-8. - \(make-string width \(if utf8p ?━ ?_\)\) \"\\n\" - \(unless utf8p \(concat \(make-string width ? \) \"\\n\"\)\) - ;; Add title. Fill it if wider than inlinetask. - \(let \(\(title \(org-ascii--build-title inlinetask info width\)\)\) - \(if \(<= \(length title\) width\) title - \(org-ascii--fill-string title width info\)\)\) - \"\\n\" - ;; If CONTENTS is not empty, insert it along with - ;; a separator. - \(when \(org-string-nw-p contents\) - \(concat \(make-string width \(if utf8p ?─ ?-\)\) \"\\n\" contents\)\) - ;; Bottom line. - \(make-string width \(if utf8p ?━ ?_\)\)\) - ;; Flush the inlinetask to the right. - \(- \(plist-get info :ascii-width\) - \(plist-get info :ascii-margin\) - \(plist-get info :ascii-inner-margin\) - \(org-ascii--current-text-width inlinetask info\)\)" +nil to ignore the inline task." :group 'org-export-ascii :version "24.4" - :package-version '(Org . "8.0") + :package-version '(Org . "8.3") :type 'function) @@ -499,7 +459,7 @@ Empty lines are not indented." (defun org-ascii--box-string (s info) "Return string S with a partial box to its left. -INFO is a plist used as a communicaton channel." +INFO is a plist used as a communication channel." (let ((utf8p (eq (plist-get info :ascii-charset) 'utf-8))) (format (if utf8p "╭────\n%s\n╰────" ",----\n%s\n`----") (replace-regexp-in-string @@ -720,7 +680,7 @@ generation. INFO is a plist used as a communication channel." (let ((text-width (if keyword (org-ascii--current-text-width keyword info) (- org-ascii-text-width org-ascii-global-margin))) - ;; Use a counter instead of retreiving ordinal of each + ;; Use a counter instead of retrieving ordinal of each ;; src-block. (count 0)) (mapconcat @@ -758,7 +718,7 @@ generation. INFO is a plist used as a communication channel." (let ((text-width (if keyword (org-ascii--current-text-width keyword info) (- org-ascii-text-width org-ascii-global-margin))) - ;; Use a counter instead of retreiving ordinal of each + ;; Use a counter instead of retrieving ordinal of each ;; src-block. (count 0)) (mapconcat @@ -1081,11 +1041,7 @@ CONTENTS holds the contents of the block. INFO is a plist holding contextual information." (let ((name (org-element-property :drawer-name drawer)) (width (org-ascii--current-text-width drawer info))) - (if (functionp org-ascii-format-drawer-function) - (funcall org-ascii-format-drawer-function name contents width) - ;; If there's no user defined function: simply - ;; display contents of the drawer. - contents))) + (funcall org-ascii-format-drawer-function name contents width))) ;;;; Dynamic Block @@ -1238,55 +1194,58 @@ contextual information." ;;;; Inlinetask +(defun org-ascii-format-inlinetask-default + (todo type priority name tags contents width inlinetask info) + "Format an inline task element for ASCII export. +See `org-ascii-format-inlinetask-function' for a description +of the paramaters." + (let* ((utf8p (eq (plist-get info :ascii-charset) 'utf-8)) + (width (or width org-ascii-inlinetask-width))) + (org-ascii--indent-string + (concat + ;; Top line, with an additional blank line if not in UTF-8. + (make-string width (if utf8p ?━ ?_)) "\n" + (unless utf8p (concat (make-string width ? ) "\n")) + ;; Add title. Fill it if wider than inlinetask. + (let ((title (org-ascii--build-title inlinetask info width))) + (if (<= (length title) width) title + (org-ascii--fill-string title width info))) + "\n" + ;; If CONTENTS is not empty, insert it along with + ;; a separator. + (when (org-string-nw-p contents) + (concat (make-string width (if utf8p ?─ ?-)) "\n" contents)) + ;; Bottom line. + (make-string width (if utf8p ?━ ?_))) + ;; Flush the inlinetask to the right. + (- org-ascii-text-width org-ascii-global-margin + (if (not (org-export-get-parent-headline inlinetask)) 0 + org-ascii-inner-margin) + (org-ascii--current-text-width inlinetask info))))) + (defun org-ascii-inlinetask (inlinetask contents info) "Transcode an INLINETASK element from Org to ASCII. CONTENTS holds the contents of the block. INFO is a plist holding contextual information." (let ((width (org-ascii--current-text-width inlinetask info))) - ;; If `org-ascii-format-inlinetask-function' is provided, call it - ;; with appropriate arguments. - (if (functionp org-ascii-format-inlinetask-function) - (funcall org-ascii-format-inlinetask-function - ;; todo. - (and (plist-get info :with-todo-keywords) - (let ((todo (org-element-property - :todo-keyword inlinetask))) - (and todo (org-export-data todo info)))) - ;; todo-type - (org-element-property :todo-type inlinetask) - ;; priority - (and (plist-get info :with-priority) - (org-element-property :priority inlinetask)) - ;; title - (org-export-data (org-element-property :title inlinetask) info) - ;; tags - (and (plist-get info :with-tags) - (org-element-property :tags inlinetask)) - ;; contents and width - contents width) - ;; Otherwise, use a default template. - (let* ((utf8p (eq (plist-get info :ascii-charset) 'utf-8))) - (org-ascii--indent-string - (concat - ;; Top line, with an additional blank line if not in UTF-8. - (make-string width (if utf8p ?━ ?_)) "\n" - (unless utf8p (concat (make-string width ? ) "\n")) - ;; Add title. Fill it if wider than inlinetask. - (let ((title (org-ascii--build-title inlinetask info width))) - (if (<= (length title) width) title - (org-ascii--fill-string title width info))) - "\n" - ;; If CONTENTS is not empty, insert it along with - ;; a separator. - (when (org-string-nw-p contents) - (concat (make-string width (if utf8p ?─ ?-)) "\n" contents)) - ;; Bottom line. - (make-string width (if utf8p ?━ ?_))) - ;; Flush the inlinetask to the right. - (- org-ascii-text-width org-ascii-global-margin - (if (not (org-export-get-parent-headline inlinetask)) 0 - org-ascii-inner-margin) - (org-ascii--current-text-width inlinetask info))))))) + (funcall org-ascii-format-inlinetask-function + ;; todo. + (and (plist-get info :with-todo-keywords) + (let ((todo (org-element-property + :todo-keyword inlinetask))) + (and todo (org-export-data todo info)))) + ;; todo-type + (org-element-property :todo-type inlinetask) + ;; priority + (and (plist-get info :with-priority) + (org-element-property :priority inlinetask)) + ;; title + (org-export-data (org-element-property :title inlinetask) info) + ;; tags + (and (plist-get info :with-tags) + (org-element-property :tags inlinetask)) + ;; contents and width + contents width inlinetask info))) ;;;; Italic diff --git a/lisp/ox-beamer.el b/lisp/ox-beamer.el index a975d24..2868944 100644 --- a/lisp/ox-beamer.el +++ b/lisp/ox-beamer.el @@ -1,11 +1,13 @@ ;;; ox-beamer.el --- Beamer Back-End for Org Export Engine -;; Copyright (C) 2007-2013 Free Software Foundation, Inc. +;; Copyright (C) 2007-2013 Free Software Foundation, Inc. ;; Author: Carsten Dominik ;; Nicolas Goaziou ;; Keywords: org, wp, tex +;; This file is part of GNU Emacs. + ;; GNU Emacs is free software: you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or @@ -23,93 +25,7 @@ ;; ;; This library implements both a Beamer back-end, derived from the ;; LaTeX one and a minor mode easing structure edition of the -;; document. -;; -;; Depending on the desired output format, three commands are provided -;; for export: `org-beamer-export-as-latex' (temporary buffer), -;; `org-beamer-export-to-latex' ("tex" file) and -;; `org-beamer-export-to-pdf' ("pdf" file). -;; -;; This back-end supports every buffer keyword, attribute and options -;; items (see `org-latex-options-alist') already supported by `latex' -;; back-end. As such, it is suggested to add an entry in -;; `org-latex-classes' variable which is appropriate for Beamer -;; export. -;; -;; On top of this, the `beamer' back-end also introduces the following -;; keywords: "BEAMER_THEME", "BEAMER_COLOR_THEME", -;; "BEAMER_FONT_THEME", "BEAMER_INNER_THEME", "BEAMER_OUTER_THEME" and -;; "BEAMER_HEADER". All but the latter accept options in square -;; brackets. -;; -;; Moreover, headlines now fall into three categories: sectioning -;; elements, frames and blocks. -;; -;; - Headlines become frames when their level is equal to -;; `org-beamer-frame-level' (or "H" value in the OPTIONS line). -;; Though, if a headline in the current tree has a "BEAMER_env" -;; (see below) property set to either "frame" or "fullframe", its -;; level overrides the variable. A "fullframe" is a frame with an -;; empty (ignored) title. -;; -;; - All frames' children become block environments. Special block -;; types can be enforced by setting headline's "BEAMER_env" property -;; to an appropriate value (see `org-beamer-environments-default' -;; for supported value and `org-beamer-environments-extra' for -;; adding more). -;; -;; - As a special case, if the "BEAMER_env" property is set to either -;; "appendix", "note", "noteNH" or "againframe", the headline will -;; become, respectively, an appendix, a note (within frame or -;; between frame, depending on its level), a note with its title -;; ignored or an againframe command. In the latter case, -;; a "BEAMER_ref" property is mandatory in order to refer to the -;; frame being resumed, and contents are ignored. -;; -;; Also, a headline with an "ignoreheading" environment will have -;; its contents only inserted in the output. This special value is -;; useful to have data between frames, or to properly close -;; a "column" environment. -;; -;; Along with "BEAMER_env", headlines also support the "BEAMER_act" -;; and "BEAMER_opt" properties. The former is translated as an -;; overlay/action specification (or a default overlay specification -;; when enclosed within square brackets) whereas the latter specifies -;; options for the current frame ("fragile" option is added -;; automatically, though). -;; -;; Moreover, headlines handle the "BEAMER_col" property. Its value -;; should be a decimal number representing the width of the column as -;; a fraction of the total text width. If the headline has no -;; specific environment, its title will be ignored and its contents -;; will fill the column created. Otherwise, the block will fill the -;; whole column and the title will be preserved. Two contiguous -;; headlines with a non-nil "BEAMER_col" value share the same -;; "columns" LaTeX environment. It will end before the next headline -;; without such a property. This environment is generated -;; automatically. Although, it can also be explicitly created, with -;; a special "columns" value for "BEAMER_env" property (if it needs to -;; be set up with some specific options, for example). -;; -;; Every plain list has support for `:environment', `:overlay' and -;; `:options' attributes (through ATTR_BEAMER affiliated keyword). -;; The first one allows to use a different environment, the second -;; sets overlay specifications and the last one inserts optional -;; arguments in current list environment. -;; -;; Table of contents generated from "toc:t" option item are wrapped -;; within a "frame" environment. Those generated from a TOC keyword -;; aren't. TOC keywords accept options enclosed within square -;; brackets (e.g. #+TOC: headlines [currentsection]). -;; -;; Eventually, an export snippet with a value enclosed within angular -;; brackets put at the beginning of an element or object whose type is -;; among `bold', `item', `link', `radio-target' and `target' will -;; control its overlay specifications. -;; -;; On the minor mode side, `org-beamer-select-environment' (bound by -;; default to "C-c C-b") and `org-beamer-insert-options-template' are -;; the two entry points. +;; document. See Org manual for more information. ;;; Code: @@ -444,13 +360,32 @@ INFO is a plist used as a communication channel." "Format HEADLINE as a sectioning part. CONTENTS holds the contents of the headline. INFO is a plist used as a communication channel." - ;; Use `latex' back-end output, inserting overlay specifications - ;; if possible. - (let ((latex-headline (org-export-with-backend 'latex headline contents info)) + (let ((latex-headline + (org-export-with-backend + ;; We create a temporary export back-end which behaves the + ;; same as current one, but adds "\protect" in front of the + ;; output of some objects. + (org-export-create-backend + :parent 'latex + :transcoders + (let ((protected-output + (function + (lambda (object contents info) + (let ((code (org-export-with-backend + 'beamer object contents info))) + (if (org-string-nw-p code) (concat "\\protect" code) + code)))))) + (mapcar #'(lambda (type) (cons type protected-output)) + '(bold footnote-reference italic strike-through timestamp + underline)))) + headline + contents + info)) (mode-specs (org-element-property :BEAMER_ACT headline))) (if (and mode-specs (string-match "\\`\\\\\\(.*?\\)\\(?:\\*\\|\\[.*\\]\\)?{" latex-headline)) + ;; Insert overlay specifications. (replace-match (concat (match-string 1 latex-headline) (format "<%s>" mode-specs)) nil nil latex-headline 1) diff --git a/lisp/ox-html.el b/lisp/ox-html.el index 14b31b2..44962a5 100644 --- a/lisp/ox-html.el +++ b/lisp/ox-html.el @@ -1,11 +1,13 @@ ;;; ox-html.el --- HTML Back-End for Org Export Engine -;; Copyright (C) 2011-2013 Free Software Foundation, Inc. +;; Copyright (C) 2011-2013 Free Software Foundation, Inc. ;; Author: Carsten Dominik ;; Jambunathan K ;; Keywords: outlines, hypermedia, calendar, wp +;; 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 @@ -22,13 +24,7 @@ ;;; Commentary: ;; This library implements a HTML back-end for Org generic exporter. - -;; To test it, run: -;; -;; M-x org-html-export-as-html -;; -;; in an Org mode buffer. See ox.el for more details on how this -;; exporter works. +;; See Org manual for more information. ;;; Code: @@ -134,7 +130,9 @@ (:infojs-opt "INFOJS_OPT" nil nil) ;; Redefine regular options. (:creator "CREATOR" nil org-html-creator-string) - (:with-latex nil "tex" org-html-with-latex))) + (:with-latex nil "tex" org-html-with-latex) + ;; Retrieve LaTeX header for fragments. + (:latex-header "LATEX_HEADER" nil nil newline))) ;;; Internal Variables @@ -157,7 +155,7 @@ \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">") ("xhtml-transitional" . "") - ("xhtml-framset" . "") ("xhtml-11" . "") @@ -190,7 +188,7 @@ the headline itself.") @licstart The following is the entire license notice for the JavaScript code in this tag. -Copyright (C) 2012 Free Software Foundation, Inc. +Copyright (C) 2012-2013 Free Software Foundation, Inc. The JavaScript code in this tag is free software: you can redistribute it and/or modify it under the terms of the GNU @@ -387,7 +385,7 @@ means to use the maximum value consistent with other options." * @licstart The following is the entire license notice for the * JavaScript code in %SCRIPT_PATH. * - * Copyright (C) 2012-2013 Sebastian Rose + * Copyright (C) 2012-2013 Free Software Foundation, Inc. * * * The JavaScript code in this tag is free software: you can @@ -548,6 +546,8 @@ a formatting string to wrap fontified text with. If no association can be found for a given markup, text will be returned as-is." :group 'org-export-html + :version "24.4" + :package-version '(Org . "8.0") :type '(alist :key-type (symbol :tag "Markup type") :value-type (string :tag "Format string")) :options '(bold code italic strike-through underline verbatim)) @@ -569,7 +569,8 @@ Warning: non-nil may break indentation of source code blocks." ;;;; Drawers -(defcustom org-html-format-drawer-function nil +(defcustom org-html-format-drawer-function + (lambda (name contents) contents) "Function called to format a drawer in HTML code. The function must accept two parameters: @@ -581,10 +582,10 @@ The function should return the string to be exported. For example, the variable could be set to the following function in order to mimic default behaviour: -\(defun org-html-format-drawer-default \(name contents\) - \"Format a drawer element for HTML export.\" - contents\)" +The default value simply returns the value of CONTENTS." :group 'org-export-html + :version "24.4" + :package-version '(Org . "8.0") :type 'function) ;;;; Footnotes @@ -626,7 +627,7 @@ document title." :group 'org-export-html :type 'integer) -(defcustom org-html-format-headline-function nil +(defcustom org-html-format-headline-function 'ignore "Function to format headline text. This function will be called with 5 arguments: @@ -638,6 +639,8 @@ TAGS the tags (string or nil). The function result will be used in the section format string." :group 'org-export-html + :version "24.4" + :package-version '(Org . "8.0") :type 'function) ;;;; HTML-specific @@ -653,7 +656,7 @@ attributes, when appropriate." ;;;; Inlinetasks -(defcustom org-html-format-inlinetask-function nil +(defcustom org-html-format-inlinetask-function 'ignore "Function called to format an inlinetask in HTML code. The function must accept six parameters: @@ -666,6 +669,8 @@ The function must accept six parameters: The function should return the string to be exported." :group 'org-export-html + :version "24.4" + :package-version '(Org . "8.0") :type 'function) ;;;; LaTeX @@ -1123,6 +1128,8 @@ like that: \"%%\"." "Information about the creator of the HTML document. This option can also be set on with the CREATOR keyword." :group 'org-export-html + :version "24.4" + :package-version '(Org . "8.0") :type '(string :tag "Creator string")) ;;;; Template :: Preamble @@ -1976,33 +1983,44 @@ and value is its relative level, as an integer." "Return an appropriate table of contents entry for HEADLINE. INFO is a plist used as a communication channel." (let* ((headline-number (org-export-get-headline-number headline info)) - (section-number - (and (not (org-export-low-level-p headline info)) - (org-export-numbered-headline-p headline info) - (concat (mapconcat 'number-to-string headline-number ".") ". "))) + (todo (and (plist-get info :with-todo-keywords) + (let ((todo (org-element-property :todo-keyword headline))) + (and todo (org-export-data todo info))))) + (todo-type (and todo (org-element-property :todo-type headline))) + (priority (and (plist-get info :with-priority) + (org-element-property :priority headline))) + (text (org-export-data-with-backend + (org-export-get-alt-title headline info) + ;; Create an anonymous back-end that will ignore any + ;; footnote-reference, link, radio-target and target + ;; in table of contents. + (org-export-create-backend + :parent 'html + :transcoders '((footnote-reference . ignore) + (link . (lambda (object c i) c)) + (radio-target . (lambda (object c i) c)) + (target . ignore))) + info)) (tags (and (eq (plist-get info :with-tags) t) (org-export-get-tags headline info)))) (format "%s" ;; Label. (org-export-solidify-link-text (or (org-element-property :CUSTOM_ID headline) - (concat "sec-" (mapconcat 'number-to-string - headline-number "-")))) + (concat "sec-" + (mapconcat #'number-to-string headline-number "-")))) ;; Body. - (concat section-number - (org-export-data-with-backend - (org-export-get-alt-title headline info) - ;; Create an anonymous back-end that will ignore - ;; any footnote-reference, link, radio-target and - ;; target in table of contents. - (org-export-create-backend - :parent 'html - :transcoders '((footnote-reference . ignore) - (link . (lambda (object c i) c)) - (radio-target . (lambda (object c i) c)) - (target . ignore))) - info) - (and tags "   ") (org-html--tags tags))))) + (concat + (and (not (org-export-low-level-p headline info)) + (org-export-numbered-headline-p headline info) + (concat (mapconcat #'number-to-string headline-number ".") + ". ")) + (apply (if (not (eq org-html-format-headline-function 'ignore)) + (lambda (todo todo-type priority text tags &rest ignore) + (funcall org-html-format-headline-function + todo todo-type priority text tags)) + #'org-html-format-headline) + todo todo-type priority text tags :section-number nil))))) (defun org-html-list-of-listings (info) "Build a list of listings. @@ -2242,7 +2260,7 @@ holding contextual information." headline-number "-")))) (format-function (cond ((functionp format-function) format-function) - ((functionp org-html-format-headline-function) + ((not (eq org-html-format-headline-function 'ignore)) (lambda (todo todo-type priority text tags &rest ignore) (funcall org-html-format-headline-function todo todo-type priority text tags))) @@ -2369,9 +2387,9 @@ contextual information." CONTENTS holds the contents of the block. INFO is a plist holding contextual information." (cond - ;; If `org-html-format-inlinetask-function' is provided, call it + ;; If `org-html-format-inlinetask-function' is not 'ignore, call it ;; with appropriate arguments. - ((functionp org-html-format-inlinetask-function) + ((not (eq org-html-format-inlinetask-function 'ignore)) (let ((format-function (function* (lambda (todo todo-type priority text tags @@ -2472,18 +2490,34 @@ CONTENTS is nil. INFO is a plist holding contextual information." ;;;; Latex Environment -(defun org-html-format-latex (latex-frag processing-type) - "Format a LaTeX fragment LATEX-FRAG into HTML." +(defun org-html-format-latex (latex-frag processing-type info) + "Format a LaTeX fragment LATEX-FRAG into HTML. +PROCESSING-TYPE designates the tool used for conversion. It is +a symbol among `mathjax', `dvipng', `imagemagick', `verbatim' nil +and t. See `org-html-with-latex' for more information. INFO is +a plist containing export properties." (let ((cache-relpath "") (cache-dir "")) (unless (eq processing-type 'mathjax) (let ((bfn (or (buffer-file-name) (make-temp-name - (expand-file-name "latex" temporary-file-directory))))) + (expand-file-name "latex" temporary-file-directory)))) + (latex-header + (let ((header (plist-get info :latex-header))) + (and header + (concat (mapconcat + (lambda (line) (concat "#+LATEX_HEADER: " line)) + (org-split-string header "\n") + "\n") + "\n"))))) (setq cache-relpath (concat "ltxpng/" (file-name-sans-extension (file-name-nondirectory bfn))) - cache-dir (file-name-directory bfn)))) + cache-dir (file-name-directory bfn)) + ;; Re-create LaTeX environment from original buffer in + ;; temporary buffer so that dvipng/imagemagick can properly + ;; turn the fragment into an image. + (setq latex-frag (concat latex-header latex-frag)))) (with-temp-buffer (insert latex-frag) (org-format-latex cache-relpath cache-dir nil "Creating LaTeX Image..." @@ -2499,9 +2533,10 @@ CONTENTS is nil. INFO is a plist holding contextual information." (attributes (org-export-read-attribute :attr_html latex-environment))) (case processing-type ((t mathjax) - (org-html-format-latex latex-frag 'mathjax)) + (org-html-format-latex latex-frag 'mathjax info)) ((dvipng imagemagick) - (let ((formula-link (org-html-format-latex latex-frag processing-type))) + (let ((formula-link + (org-html-format-latex latex-frag processing-type info))) (when (and formula-link (string-match "file:\\([^]]*\\)" formula-link)) ;; Do not provide a caption or a name to be consistent with ;; `mathjax' handling. @@ -2519,9 +2554,10 @@ CONTENTS is nil. INFO is a plist holding contextual information." (processing-type (plist-get info :with-latex))) (case processing-type ((t mathjax) - (org-html-format-latex latex-frag 'mathjax)) + (org-html-format-latex latex-frag 'mathjax info)) ((dvipng imagemagick) - (let ((formula-link (org-html-format-latex latex-frag processing-type))) + (let ((formula-link + (org-html-format-latex latex-frag processing-type info))) (when (and formula-link (string-match "file:\\([^]]*\\)" formula-link)) (org-html--format-image (match-string 1 formula-link) nil info)))) (t latex-frag)))) @@ -3067,7 +3103,7 @@ CONTENTS is the contents of the object. INFO is a plist holding contextual information." (format "%s" contents)) -;;;; Tabel Cell +;;;; Table Cell (defun org-html-table-cell (table-cell contents info) "Transcode a TABLE-CELL element from Org to HTML. diff --git a/lisp/ox-icalendar.el b/lisp/ox-icalendar.el index 612fd79..7c4b4bf 100644 --- a/lisp/ox-icalendar.el +++ b/lisp/ox-icalendar.el @@ -1,12 +1,14 @@ ;;; ox-icalendar.el --- iCalendar Back-End for Org Export Engine -;; Copyright (C) 2004-2012 Free Software Foundation, Inc. +;; Copyright (C) 2004-2013 Free Software Foundation, Inc. ;; Author: Carsten Dominik ;; Nicolas Goaziou ;; Keywords: outlines, hypermedia, calendar, wp ;; 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 @@ -23,23 +25,9 @@ ;;; Commentary: ;; ;; This library implements an iCalendar back-end for Org generic -;; exporter. -;; -;; It provides three commands for export, depending on the chosen -;; source and desired output: `org-icalendar-export-to-ics' (current -;; file), `org-icalendar-export-agenda-files' (agenda files into -;; separate calendars) and `org-icalendar-combined-agenda-file' -;; (agenda files into one combined calendar). -;; -;; It also provides `org-icalendar-export-current-agenda' function, -;; which will create a calendar file from current agenda view. It is -;; meant to be called through `org-agenda-write'. -;; -;; This back-end introduces a new keyword, ICALENDAR_EXCLUDE_TAGS, -;; which allows to specify a different set of exclude tags from other -;; back-ends. +;; exporter. See Org manual for more information. ;; -;; It should follow RFC 5545 specifications. +;; It is expected to conform to RFC 5545. ;;; Code: diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el index e1173ef..3609881 100644 --- a/lisp/ox-latex.el +++ b/lisp/ox-latex.el @@ -5,6 +5,8 @@ ;; Author: Nicolas Goaziou ;; Keywords: outlines, hypermedia, calendar, wp +;; 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 @@ -554,7 +556,8 @@ returned as-is." ;;;; Drawers -(defcustom org-latex-format-drawer-function nil +(defcustom org-latex-format-drawer-function + (lambda (name contents) contents) "Function called to format a drawer in LaTeX code. The function must accept two parameters: @@ -563,19 +566,16 @@ The function must accept two parameters: The function should return the string to be exported. -For example, the variable could be set to the following function -in order to mimic default behaviour: - -\(defun org-latex-format-drawer-default \(name contents\) - \"Format a drawer element for LaTeX export.\" - contents\)" +The default function simply returns the value of CONTENTS." :group 'org-export-latex + :version "24.4" + :package-version '(Org . "8.3") :type 'function) ;;;; Inlinetasks -(defcustom org-latex-format-inlinetask-function nil +(defcustom org-latex-format-inlinetask-function 'ignore "Function called to format an inlinetask in LaTeX code. The function must accept six parameters: @@ -655,7 +655,7 @@ into previewing problems, please consult :group 'org-export-latex :type '(choice (const :tag "Use listings" t) - (const :tag "Use minted" 'minted) + (const :tag "Use minted" minted) (const :tag "Export verbatim" nil))) (defcustom org-latex-listings-langs @@ -690,8 +690,8 @@ a list containing two strings: the name of the option, and the value. For example, (setq org-latex-listings-options - '((\"basicstyle\" \"\\small\") - (\"keywordstyle\" \"\\color{black}\\bfseries\\underbar\"))) + '((\"basicstyle\" \"\\\\small\") + (\"keywordstyle\" \"\\\\color{black}\\\\bfseries\\\\underbar\"))) will typeset the code in a small size font with underlined, bold black keywords. @@ -1210,12 +1210,8 @@ channel." CONTENTS holds the contents of the block. INFO is a plist holding contextual information." (let* ((name (org-element-property :drawer-name drawer)) - (output (if (functionp org-latex-format-drawer-function) - (funcall org-latex-format-drawer-function - name contents) - ;; If there's no user defined function: simply - ;; display contents of the drawer. - contents))) + (output (funcall org-latex-format-drawer-function + name contents))) (org-latex--wrap-label drawer output))) @@ -1323,13 +1319,13 @@ holding contextual information." (let* ((class (plist-get info :latex-class)) (level (org-export-get-relative-level headline info)) (numberedp (org-export-numbered-headline-p headline info)) - (class-sectionning (assoc class org-latex-classes)) + (class-sectioning (assoc class org-latex-classes)) ;; Section formatting will set two placeholders: one for ;; the title and the other for the contents. (section-fmt - (let ((sec (if (functionp (nth 2 class-sectionning)) - (funcall (nth 2 class-sectionning) level numberedp) - (nth (1+ level) class-sectionning)))) + (let ((sec (if (functionp (nth 2 class-sectioning)) + (funcall (nth 2 class-sectioning) level numberedp) + (nth (1+ level) class-sectioning)))) (cond ;; No section available for that LEVEL. ((not sec) nil) @@ -1500,7 +1496,7 @@ holding contextual information." (org-element-property :priority inlinetask)))) ;; If `org-latex-format-inlinetask-function' is provided, call it ;; with appropriate arguments. - (if (functionp org-latex-format-inlinetask-function) + (if (not (eq org-latex-format-inlinetask-function 'ignore)) (funcall org-latex-format-inlinetask-function todo todo-type priority title tags contents) ;; Otherwise, use a default template. @@ -1620,7 +1616,7 @@ CONTENTS is nil. INFO is a plist holding contextual information." (value (org-remove-indentation (org-element-property :value latex-environment)))) (if (not (org-string-nw-p label)) value - ;; Environment is labelled: label must be within the environment + ;; Environment is labeled: label must be within the environment ;; (otherwise, a reference pointing to that element will count ;; the section instead). (with-temp-buffer @@ -2852,9 +2848,13 @@ Return PDF file name or an error if it couldn't be produced." ;; Else remove log files, when specified, and signal end of ;; process to user, along with any error encountered. (when (and (not snippet) org-latex-remove-logfiles) - (dolist (ext org-latex-logfiles-extensions) - (let ((file (concat out-dir base-name "." ext))) - (when (file-exists-p file) (delete-file file))))) + (dolist (file (directory-files + out-dir t + (concat (regexp-quote base-name) + "\\(?:\\.[0-9]+\\)?" + "\\." + (regexp-opt org-latex-logfiles-extensions)))) + (delete-file file))) (message (concat "Process completed" (if (not errors) "." (concat " with errors: " errors))))) diff --git a/lisp/ox-md.el b/lisp/ox-md.el index f7e4875..7842017 100644 --- a/lisp/ox-md.el +++ b/lisp/ox-md.el @@ -1,10 +1,12 @@ ;;; ox-md.el --- Markdown Back-End for Org Export Engine -;; Copyright (C) 2012, 2013 Free Software Foundation, Inc. +;; Copyright (C) 2012-2013 Free Software Foundation, Inc. ;; Author: Nicolas Goaziou ;; Keywords: org, wp, markdown +;; 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 @@ -20,12 +22,9 @@ ;;; Commentary: -;; This library implements a Markdown back-end (vanilla flavour) for -;; Org exporter, based on `html' back-end. -;; -;; It provides two commands for export, depending on the desired -;; output: `org-md-export-as-markdown' (temporary buffer) and -;; `org-md-export-to-markdown' ("md" file). +;; This library implements a Markdown back-end (vanilla flavor) for +;; Org exporter, based on `html' back-end. See Org manual for more +;; information. ;;; Code: diff --git a/lisp/ox-odt.el b/lisp/ox-odt.el index ae9e473..975dbdb 100644 --- a/lisp/ox-odt.el +++ b/lisp/ox-odt.el @@ -223,7 +223,7 @@ standard Emacs.") (defconst org-odt-table-style-format " - + " "Template for auto-generated Table styles.") @@ -449,7 +449,7 @@ under `org-odt-styles-dir' is used." :type '(choice (const nil) (file)) :group 'org-export-odt - :version "24.1") + :version "24.3") (defcustom org-odt-styles-file nil "Default styles file for use with ODT export. @@ -498,7 +498,8 @@ a per-file basis. For example, (defcustom org-odt-display-outline-level 2 "Outline levels considered for enumerating captioned entities." :group 'org-export-odt - :version "24.2" + :version "24.4" + :package-version '(Org . "8.0") :type 'integer) ;;;; Document conversion @@ -596,7 +597,7 @@ 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 +allow document of a given class (irrespective of its source format) to be converted to any of the export formats associated with that class. @@ -645,7 +646,8 @@ values. See Info node `(emacs) File Variables'." ;;;; Drawers -(defcustom org-odt-format-drawer-function nil +(defcustom org-odt-format-drawer-function + (lambda (name contents) contents) "Function called to format a drawer in ODT code. The function must accept two parameters: @@ -654,21 +656,16 @@ The function must accept two parameters: The function should return the string to be exported. -For example, the variable could be set to the following function -in order to mimic default behaviour: - -\(defun org-odt-format-drawer-default \(name contents\) - \"Format a drawer element for ODT export.\" - contents\)" +The default value simply returns the value of CONTENTS." :group 'org-export-odt :version "24.4" - :package-version '(Org . "8.0") + :package-version '(Org . "8.3") :type 'function) ;;;; Headline -(defcustom org-odt-format-headline-function nil +(defcustom org-odt-format-headline-function 'ignore "Function to format headline text. This function will be called with 5 arguments: @@ -687,7 +684,7 @@ The function result will be used as headline text." ;;;; Inlinetasks -(defcustom org-odt-format-inlinetask-function nil +(defcustom org-odt-format-inlinetask-function 'ignore "Function called to format an inlinetask in ODT code. The function must accept six parameters: @@ -746,6 +743,8 @@ A rule consists in an association whose key is the type of link to consider, and value is a regexp that will be matched against link's path." :group 'org-export-odt + :version "24.4" + :package-version '(Org . "8.0") :type '(alist :key-type (string :tag "Type") :value-type (regexp :tag "Path"))) @@ -757,6 +756,8 @@ A rule consists in an association whose key is the type of link to consider, and value is a regexp that will be matched against link's path." :group 'org-export-odt + :version "24.4" + :package-version '(Org . "8.0") :type '(alist :key-type (string :tag "Type") :value-type (regexp :tag "Path"))) @@ -919,7 +920,7 @@ Specifically, locale-dependent specifiers like \"%c\", \"%x\" are formatted as canonical Org timestamps. For finer control, avoid these %-specifiers. -Textutal specifiers like \"%b\", \"%h\", \"%B\", \"%a\", \"%A\" +Textual specifiers like \"%b\", \"%h\", \"%B\", \"%a\", \"%A\" etc., are displayed by the application in the default language and country specified in `org-odt-styles-file'. Note that the default styles file uses language \"en\" and country \"GB\". You @@ -929,6 +930,8 @@ the application UI or through a custom styles file. See `org-odt--build-date-styles' for implementation details." :group 'org-export-odt + :version "24.4" + :package-version '(Org . "8.0") :type 'boolean) @@ -1436,7 +1439,7 @@ original parsed data. INFO is a plist holding export options." ;; Update content.xml. (let* ( ;; `org-display-custom-times' should be accessed right - ;; within the context of the Org buffer. So obtain it's + ;; within the context of the Org buffer. So obtain its ;; value before moving on to temp-buffer context down below. (custom-time-fmts (if org-display-custom-times @@ -1456,7 +1459,7 @@ original parsed data. INFO is a plist holding export options." ;; - Dump automatic table styles. (loop for (style-name props) in (plist-get org-odt-automatic-styles 'Table) do - (when (setq props (or (plist-get props :rel-width) 96)) + (when (setq props (or (plist-get props :rel-width) "96")) (insert (format org-odt-table-style-format style-name props)))) ;; - Dump date-styles. (when org-odt-use-date-fields @@ -1619,12 +1622,8 @@ channel." CONTENTS holds the contents of the block. INFO is a plist holding contextual information." (let* ((name (org-element-property :drawer-name drawer)) - (output (if (functionp org-odt-format-drawer-function) - (funcall org-odt-format-drawer-function - name contents) - ;; If there's no user defined function: simply - ;; display contents of the drawer. - contents))) + (output (funcall org-odt-format-drawer-function + name contents))) output)) @@ -1721,7 +1720,7 @@ CONTENTS is nil. INFO is a plist holding contextual information." (and (eq (org-element-type prev) 'footnote-reference) (format "%s" "OrgSuperscript" ","))) - ;; Trancode footnote reference. + ;; Transcode footnote reference. (let ((n (org-export-get-footnote-number footnote-reference info))) (cond ((not (org-export-footnote-first-reference-p footnote-reference info)) @@ -1805,10 +1804,10 @@ INFO is a plist holding contextual information." headline-number "-"))) (format-function (cond ((functionp format-function) format-function) - ((functionp org-odt-format-headline-function) + ((not (eq org-odt-format-headline-function 'ignore)) (function* (lambda (todo todo-type priority text tags - &allow-other-keys) + &allow-other-keys) (funcall org-odt-format-headline-function todo todo-type priority text tags)))) (t 'org-odt-format-headline)))) @@ -1931,9 +1930,9 @@ contextual information." CONTENTS holds the contents of the block. INFO is a plist holding contextual information." (cond - ;; If `org-odt-format-inlinetask-function' is provided, call it + ;; If `org-odt-format-inlinetask-function' is not 'ignore, call it ;; with appropriate arguments. - ((functionp org-odt-format-inlinetask-function) + ((not (eq org-odt-format-inlinetask-function 'ignore)) (let ((format-function (function* (lambda (todo todo-type priority text tags @@ -2058,7 +2057,7 @@ CONTENTS is nil. INFO is a plist holding contextual information." (defun org-odt-line-break (line-break contents info) "Transcode a LINE-BREAK object from Org to ODT. CONTENTS is nil. INFO is a plist holding contextual information." - "\n") + "") ;;;; Link @@ -2195,7 +2194,7 @@ SHORT-CAPTION are strings." (concat ;; Sneak in a bookmark. The bookmark is used when the ;; labeled element is referenced with a link that - ;; provides it's own description. + ;; provides its own description. (format "\n" label) ;; Label definition: Typically formatted as below: ;; CATEGORY SEQ-NO: LONG CAPTION @@ -2342,7 +2341,6 @@ used as a communication channel." (user-frame-params (list user-frame-style user-frame-attrs user-frame-anchor)) ;; (embed-as (or embed-as user-frame-anchor "paragraph")) - ;; extrac ;; ;; Handle `:width', `:height' and `:scale' properties. Read ;; them as numbers since we need them for computations. @@ -2372,7 +2370,7 @@ used as a communication channel." (title (and replaces (capitalize (symbol-name (org-element-type replaces))))) - ;; If yes, note down it's contents. It will go in to frame + ;; If yes, note down its contents. It will go in to frame ;; description. This quite useful for debugging. (desc (and replaces (org-element-property :value replaces)))) (org-odt--render-image/formula entity href width height @@ -2410,7 +2408,7 @@ used as a communication channel." (title (and replaces (capitalize (symbol-name (org-element-type replaces))))) - ;; If yes, note down it's contents. It will go in to frame + ;; If yes, note down its contents. It will go in to frame ;; description. This quite useful for debugging. (desc (and replaces (org-element-property :value replaces))) width height) @@ -2614,12 +2612,12 @@ used as a communication channel." INFO is a plist holding contextual information. Return non-nil, if ELEMENT is of type paragraph satisfying -PARAGRAPH-PREDICATE and it's sole content, save for whitespaces, +PARAGRAPH-PREDICATE and its sole content, save for whitespaces, is a link that satisfies LINK-PREDICATE. Return non-nil, if ELEMENT is of type link satisfying -LINK-PREDICATE and it's containing paragraph satisfies -PARAGRAPH-PREDICATE inaddtion to having no other content save for +LINK-PREDICATE and its containing paragraph satisfies +PARAGRAPH-PREDICATE in addition to having no other content save for leading and trailing whitespaces. Return nil, otherwise." @@ -2708,7 +2706,7 @@ Return nil, otherwise." (concat (number-to-string n) "."))) item-numbers ""))))) ;; Case 2: Locate a regular and numbered headline in the - ;; hierarchy. Display it's section number. + ;; hierarchy. Display its section number. (let ((headline (loop for el in (cons destination genealogy) when (and (eq (org-element-type el) 'headline) (not (org-export-low-level-p el info)) @@ -2721,7 +2719,7 @@ Return nil, otherwise." (mapconcat 'number-to-string (org-export-get-headline-number headline info) ".")))) ;; Case 4: Locate a regular headline in the hierarchy. Display - ;; it's title. + ;; its title. (let ((headline (loop for el in (cons destination genealogy) when (and (eq (org-element-type el) 'headline) (not (org-export-low-level-p el info))) @@ -2967,7 +2965,7 @@ contextual information." ;; Handle break preservation if required. (when (plist-get info :preserve-breaks) (setq output (replace-regexp-in-string - "\\(\\\\\\\\\\)?[ \t]*\n" "\n" output t))) + "\\(\\\\\\\\\\)?[ \t]*\n" "" output t))) ;; Return value. output)) @@ -3101,9 +3099,9 @@ holding contextual information." (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 +When FN is the default face, use its foreground and background properties to create \"OrgSrcBlock\" paragraph style. Otherwise -use it's color attribute to create a character style whose name +use its color attribute to create a character style whose name is obtained from FN. Currently all attributes of FN other than color are ignored. @@ -3113,12 +3111,11 @@ 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)) + (style-name (concat "OrgSrc" + (mapconcat + 'capitalize (split-string + (hfy-face-or-def-to-name fn) "-") + ""))) (color-val (cdr (assoc "color" css-list))) (background-color-val (cdr (assoc "background" css-list))) (style (and org-odt-create-custom-styles-for-srcblocks diff --git a/lisp/ox-org.el b/lisp/ox-org.el index 644cc0d..cecad56 100644 --- a/lisp/ox-org.el +++ b/lisp/ox-org.el @@ -1,10 +1,12 @@ ;;; ox-org.el --- Org Back-End for Org Export Engine -;; Copyright (C) 2013 Free Software Foundation, Inc. +;; Copyright (C) 2013 Free Software Foundation, Inc. ;; Author: Nicolas Goaziou ;; Keywords: org, wp +;; 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 @@ -130,6 +132,8 @@ CONTENTS is its contents, as a string or nil. INFO is ignored." (org-element-put-property headline :tags nil)) (unless (plist-get info :with-priority) (org-element-put-property headline :priority nil)) + (org-element-put-property headline :level + (org-export-get-relative-level headline info)) (org-element-headline-interpreter headline contents)) (defun org-org-keyword (keyword contents info) @@ -226,6 +230,8 @@ Return output file name." (work-buffer (or visitingp (find-file filename))) newbuf) (font-lock-fontify-buffer) + (show-all) + (org-show-block-all) (setq newbuf (htmlize-buffer)) (with-current-buffer newbuf (when org-org-htmlized-css-url diff --git a/lisp/ox-publish.el b/lisp/ox-publish.el index 906c819..d87326d 100644 --- a/lisp/ox-publish.el +++ b/lisp/ox-publish.el @@ -892,10 +892,11 @@ in another process." (interactive "P") (if async (org-export-async-start 'ignore - `(when ',force (org-publish-remove-all-timestamps)) - `(let ((org-publish-use-timestamps-flag - (if ',force nil ,org-publish-use-timestamps-flag))) - (org-publish-projects ',org-publish-project-alist))) + `(progn + (when ',force (org-publish-remove-all-timestamps)) + (let ((org-publish-use-timestamps-flag + (if ',force nil ,org-publish-use-timestamps-flag))) + (org-publish-projects ',org-publish-project-alist)))) (when force (org-publish-remove-all-timestamps)) (save-window-excursion (let ((org-publish-use-timestamps-flag @@ -1224,8 +1225,9 @@ Returns value on success, else nil." (let ((attr (file-attributes (expand-file-name (or (file-symlink-p file) file) (file-name-directory file))))) - (+ (lsh (car (nth 5 attr)) 16) - (cadr (nth 5 attr))))) + (if (not attr) (error "No such file: \"%s\"" file) + (+ (lsh (car (nth 5 attr)) 16) + (cadr (nth 5 attr)))))) (provide 'ox-publish) diff --git a/lisp/ox-texinfo.el b/lisp/ox-texinfo.el index 29fbc07..43c1de2 100644 --- a/lisp/ox-texinfo.el +++ b/lisp/ox-texinfo.el @@ -1,6 +1,6 @@ ;;; ox-texinfo.el --- Texinfo Back-End for Org Export Engine -;; Copyright (C) 2012, 2013 Jonathan Leech-Pepin +;; Copyright (C) 2012-2013 Free Software Foundation, Inc. ;; Author: Jonathan Leech-Pepin ;; Keywords: outlines, hypermedia, calendar, wp @@ -143,7 +143,7 @@ ;;; Preamble -(defcustom org-texinfo-filename nil +(defcustom org-texinfo-filename "" "Default filename for Texinfo output." :group 'org-export-texinfo :type '(string :tag "Export Filename")) @@ -202,7 +202,7 @@ a format string in which the section title will be added." ;;; Headline -(defcustom org-texinfo-format-headline-function nil +(defcustom org-texinfo-format-headline-function 'ignore "Function to format headline text. This function will be called with 5 arguments: @@ -316,7 +316,8 @@ returned as-is." ;;; Drawers -(defcustom org-texinfo-format-drawer-function nil +(defcustom org-texinfo-format-drawer-function + (lambda (name contents) contents) "Function called to format a drawer in Texinfo code. The function must accept two parameters: @@ -325,18 +326,15 @@ The function must accept two parameters: The function should return the string to be exported. -For example, the variable could be set to the following function -in order to mimic default behaviour: - -\(defun org-texinfo-format-drawer-default \(name contents\) - \"Format a drawer element for Texinfo export.\" - contents\)" +The default function simply returns the value of CONTENTS." :group 'org-export-texinfo + :version "24.4" + :package-version '(Org . "8.3") :type 'function) ;;; Inlinetasks -(defcustom org-texinfo-format-inlinetask-function nil +(defcustom org-texinfo-format-inlinetask-function 'ignore "Function called to format an inlinetask in Texinfo code. The function must accept six parameters: @@ -410,6 +408,13 @@ set `org-texinfo-logfiles-extensions'." this depth Texinfo will not recognize the nodes and will cause errors. Left as a constant in case this value ever changes.") +(defconst org-texinfo-supported-coding-systems + '("US-ASCII" "UTF-8" "ISO-8859-15" "ISO-8859-1" "ISO-8859-2" "koi8-r" "koi8-u") + "List of coding systems supported by Texinfo, as strings. +Specified coding system will be matched against these strings. +If two strings share the same prefix (e.g. \"ISO-8859-1\" and +\"ISO-8859-15\"), the most specific one has to be listed first.") + ;;; Internal Functions @@ -695,9 +700,7 @@ holding export options." ;; `.' in text. (dirspacing (- 29 (length dirtitle))) (menu (org-texinfo-make-menu info 'main)) - (detail-menu (org-texinfo-make-menu info 'detailed)) - (coding-system (or org-texinfo-coding-system - buffer-file-coding-system))) + (detail-menu (org-texinfo-make-menu info 'detailed))) (concat ;; Header header "\n" @@ -705,8 +708,17 @@ holding export options." ;; Filename and Title "@setfilename " info-filename "\n" "@settitle " title "\n" - (format "@documentencoding %s\n" - (upcase (symbol-name coding-system))) "\n" + ;; Coding system. + (format + "@documentencoding %s\n" + (catch 'coding-system + (let ((case-fold-search t) + (name (symbol-name (or org-texinfo-coding-system + buffer-file-coding-system)))) + (dolist (system org-texinfo-supported-coding-systems "UTF-8") + (when (org-string-match-p (regexp-quote system) name) + (throw 'coding-system system)))))) + "\n" (format "@documentlanguage %s\n" lang) "\n\n" "@c Version and Contact Info\n" @@ -868,12 +880,8 @@ contextual information." CONTENTS holds the contents of the block. INFO is a plist holding contextual information." (let* ((name (org-element-property :drawer-name drawer)) - (output (if (functionp org-texinfo-format-drawer-function) - (funcall org-texinfo-format-drawer-function - name contents) - ;; If there's no user defined function: simply - ;; display contents of the drawer. - contents))) + (output (funcall org-texinfo-format-drawer-function + name contents))) output)) ;;; Dynamic Block @@ -949,7 +957,7 @@ holding contextual information." (let* ((class (plist-get info :texinfo-class)) (level (org-export-get-relative-level headline info)) (numberedp (org-export-numbered-headline-p headline info)) - (class-sectionning (assoc class org-texinfo-classes)) + (class-sectioning (assoc class org-texinfo-classes)) ;; Find the index type, if any (index (org-element-property :INDEX headline)) ;; Check if it is an appendix @@ -985,10 +993,10 @@ holding contextual information." ;; Section formatting will set two placeholders: one for the ;; title and the other for the contents. (section-fmt - (let ((sec (if (and (symbolp (nth 2 class-sectionning)) - (fboundp (nth 2 class-sectionning))) - (funcall (nth 2 class-sectionning) level numberedp) - (nth (1+ level) class-sectionning)))) + (let ((sec (if (and (symbolp (nth 2 class-sectioning)) + (fboundp (nth 2 class-sectioning))) + (funcall (nth 2 class-sectioning) level numberedp) + (nth (1+ level) class-sectioning)))) (cond ;; No section available for that LEVEL. ((not sec) nil) @@ -1022,7 +1030,7 @@ holding contextual information." ;; Create the headline text along with a no-tag version. The ;; latter is required to remove tags from table of contents. (full-text (org-texinfo--sanitize-content - (if (functionp org-texinfo-format-headline-function) + (if (not (eq org-texinfo-format-headline-function 'ignore)) ;; User-defined formatting function. (funcall org-texinfo-format-headline-function todo todo-type priority text tags) @@ -1037,7 +1045,7 @@ holding contextual information." (mapconcat 'identity tags ":"))))))) (full-text-no-tag (org-texinfo--sanitize-content - (if (functionp org-texinfo-format-headline-function) + (if (not (eq org-texinfo-format-headline-function 'ignore)) ;; User-defined formatting function. (funcall org-texinfo-format-headline-function todo todo-type priority text nil) @@ -1139,7 +1147,7 @@ holding contextual information." (org-element-property :priority inlinetask)))) ;; If `org-texinfo-format-inlinetask-function' is provided, call it ;; with appropriate arguments. - (if (functionp org-texinfo-format-inlinetask-function) + (if (not (eq org-texinfo-format-inlinetask-function 'ignore)) (funcall org-texinfo-format-inlinetask-function todo todo-type priority title tags contents) ;; Otherwise, use a default template. diff --git a/lisp/ox.el b/lisp/ox.el index 07239a0..8316ef2 100644 --- a/lisp/ox.el +++ b/lisp/ox.el @@ -1,10 +1,12 @@ ;;; ox.el --- Generic Export Engine for Org Mode -;; Copyright (C) 2012, 2013 Free Software Foundation, Inc. +;; Copyright (C) 2012-2013 Free Software Foundation, Inc. ;; Author: Nicolas Goaziou ;; Keywords: outlines, hypermedia, calendar, wp +;; 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 @@ -624,11 +626,20 @@ e.g. \"stat:nil\"" (defcustom org-export-with-sub-superscripts t "Non-nil means interpret \"_\" and \"^\" for export. +If you want to control how Org displays those characters, see +`org-use-sub-superscripts'. `org-export-with-sub-superscripts' +used to be an alias for `org-use-sub-superscripts' in Org <8.0, +it is not anymore. + 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. +sub- and superscripts and see them exported correctly. + +You can also set the option with #+OPTIONS: ^:t + +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 @@ -636,15 +647,14 @@ parsed as single sub- or superscripts. 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 keyword, -e.g. \"^:nil\"." +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." :group 'org-export-general + :version "24.4" + :package-version '(Org . "8.0") :type '(choice (const :tag "Interpret them" t) (const :tag "Curly brackets only" {}) @@ -2860,7 +2870,7 @@ The copy will preserve local variables, visibility, contents and narrowing of the original buffer. If a region was active in BUFFER, contents will be narrowed to that region instead. -The resulting function can be evaled at a later time, from +The resulting function can be evaluated at a later time, from another buffer, effectively cloning the original buffer there. The function assumes BUFFER's major mode is `org-mode'." @@ -3163,8 +3173,7 @@ locally for the subtree through node properties." (when options (let ((items (mapcar - (lambda (opt) - (format "%s:%s" (car opt) (format "%s" (cdr opt)))) + #'(lambda (opt) (format "%s:%S" (car opt) (cdr opt))) (sort options (lambda (k1 k2) (string< (car k1) (car k2))))))) (if subtreep (org-entry-put @@ -3450,10 +3459,16 @@ the communication channel used for export, as a plist." (org-export-barf-if-invalid-backend backend) (let ((type (org-element-type data))) (if (memq type '(nil org-data)) (error "No foreign transcoder available") - (let ((transcoder - (cdr (assq type (org-export-get-all-transcoders backend))))) - (if (functionp transcoder) (funcall transcoder data contents info) - (error "No foreign transcoder available")))))) + (let* ((all-transcoders (org-export-get-all-transcoders backend)) + (transcoder (cdr (assq type all-transcoders)))) + (if (not (functionp transcoder)) + (error "No foreign transcoder available") + (funcall + transcoder data contents + (org-combine-plists + info (list :back-end backend + :translate-alist all-transcoders + :exported-data (make-hash-table :test 'eq :size 401))))))))) ;;;; For Export Snippets @@ -4667,7 +4682,7 @@ INFO is a plist used as a communication channel." "Return TABLE-ROW number. INFO is a plist used as a communication channel. Return value is zero-based and ignores separators. The function returns nil for -special colums and separators." +special columns and separators." (when (and (eq (org-element-property :type table-row) 'standard) (not (org-export-table-row-is-special-p table-row info))) (let ((number 0)) @@ -5146,14 +5161,11 @@ all of them." ;; to a secondary string. We check the latter option ;; first. (let ((parent (org-export-get-parent blob))) - (or (and (not (memq (org-element-type blob) - org-element-all-elements)) - (let ((sec-value - (org-element-property - (cdr (assq (org-element-type parent) - org-element-secondary-value-alist)) - parent))) - (and (memq blob sec-value) sec-value))) + (or (let ((sec-value (org-element-property + (cdr (assq (org-element-type parent) + org-element-secondary-value-alist)) + parent))) + (and (memq blob sec-value) sec-value)) (org-element-contents parent)))) prev) (catch 'exit @@ -5181,14 +5193,11 @@ them." ;; An object can belong to the contents of its parent or to ;; a secondary string. We check the latter option first. (let ((parent (org-export-get-parent blob))) - (or (and (not (memq (org-element-type blob) - org-element-all-objects)) - (let ((sec-value - (org-element-property - (cdr (assq (org-element-type parent) - org-element-secondary-value-alist)) - parent))) - (cdr (memq blob sec-value)))) + (or (let ((sec-value (org-element-property + (cdr (assq (org-element-type parent) + org-element-secondary-value-alist)) + parent))) + (cdr (memq blob sec-value))) (cdr (memq blob (org-element-contents parent)))))) next) (catch 'exit @@ -5865,7 +5874,7 @@ files or buffers, only the display. "Export dispatcher for Org mode. It provides an access to common export related tasks in a buffer. -Its interface comes in two flavours: standard and expert. +Its interface comes in two flavors: standard and expert. While both share the same set of bindings, only the former displays the valid keys associations in a dedicated buffer. @@ -5873,7 +5882,7 @@ Scrolling (resp. line-wise motion) in this buffer is done with SPC and DEL (resp. C-n and C-p) keys. Set variable `org-export-dispatch-use-expert-ui' to switch to one -flavour or the other. +flavor or the other. When ARG is \\[universal-argument], repeat the last export action, with the same set of options used back then, on the current buffer. diff --git a/mk/version.mk b/mk/version.mk index e379fd0..8474735 100644 --- a/mk/version.mk +++ b/mk/version.mk @@ -1,2 +1,2 @@ -ORGVERSION ?= 8.2.1 -GITVERSION ?= 8.2.1-dist +ORGVERSION ?= 8.2.4 +GITVERSION ?= 8.2.4-dist -- cgit v1.2.3