mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-07-15 22:16:27 +00:00
Merge branch 'master' of orgmode.org:org-mode
This commit is contained in:
commit
48db329296
|
@ -136,10 +136,8 @@ So the way I have been doing things with Emacs is this:
|
|||
version in Emacs starts diverging from my own.
|
||||
|
||||
Careful: Copy /org.texi/ and /orgcard.tex/ into the right places,
|
||||
and also copy the lisp files with *two exceptions*: Do *not* copy
|
||||
/org-colview-xemacs.el/ and /org-loaddefs.el/. The former does not
|
||||
belong in Emacs. And the latter would actually be harmful because
|
||||
Emacs generates its own autoloads.
|
||||
and also copy the lisp files with *one exception*: Do *not* copy
|
||||
/org-loaddefs.el/, Emacs generates its own autoloads.
|
||||
|
||||
4. Generate the ChangeLog entries
|
||||
|
||||
|
|
|
@ -30,8 +30,8 @@ org-eval-light.el --- Evaluate in-buffer code on demand
|
|||
org-eval.el --- The <lisp> tag, adapted from Muse
|
||||
org-expiry.el --- Expiry mechanism for Org entries
|
||||
org-export-generic.el --- Export framework for configurable backends
|
||||
org-favtable.el --- Lookup table of favorite references and links
|
||||
org-git-link.el --- Provide org links to specific file version
|
||||
org-index.el --- A personal index for org and beyond
|
||||
org-interactive-query.el --- Interactive modification of tags query
|
||||
org-invoice.el --- Help manage client invoices in OrgMode
|
||||
org-jira.el --- Add a jira:ticket protocol to Org
|
||||
|
|
|
@ -75,7 +75,8 @@ For example, to point to your `obe-bibtex-file' use the following.
|
|||
"Return all citations from `obe-bibtex-file'."
|
||||
(or obe-citations
|
||||
(save-window-excursion
|
||||
(find-file obe-bibtex-file)
|
||||
(find-file (or obe-bibtex-file
|
||||
(error "`obe-bibtex-file' has not been configured")))
|
||||
(goto-char (point-min))
|
||||
(while (re-search-forward " :CUSTOM_ID: \\(.+\\)$" nil t)
|
||||
(push (org-no-properties (match-string 1))
|
||||
|
@ -88,7 +89,8 @@ For example, to point to your `obe-bibtex-file' use the following.
|
|||
(let ((citation (or citation
|
||||
(org-icompleting-read "Citation: "
|
||||
(obe-citations)))))
|
||||
(find-file obe-bibtex-file)
|
||||
(find-file (or obe-bibtex-file
|
||||
(error "`obe-bibtex-file' has not been configured")))
|
||||
(goto-char (point-min))
|
||||
(when (re-search-forward (format " :CUSTOM_ID: %s" citation) nil t)
|
||||
(outline-previous-visible-heading 1)
|
||||
|
|
|
@ -121,6 +121,7 @@ preceeding the dblock, then update the contents of the dblock."
|
|||
(scope (plist-get params :scope))
|
||||
(noquote (plist-get params :noquote))
|
||||
(colnames (plist-get params :colnames))
|
||||
(defaultval (plist-get params :defaultval))
|
||||
(content-lines (org-split-string (plist-get params :content) "\n"))
|
||||
id table line pos)
|
||||
(save-excursion
|
||||
|
@ -133,9 +134,10 @@ preceeding the dblock, then update the contents of the dblock."
|
|||
(t (error "Cannot find entry with :ID: %s" id))))
|
||||
(unless (eq id 'global) (org-narrow-to-subtree))
|
||||
(setq stringformat (if noquote "%s" "%S"))
|
||||
(setq table (org-propview-to-table
|
||||
(org-propview-collect cols stringformat conds match scope inherit
|
||||
(if colnames colnames cols)) stringformat))
|
||||
(let ((org-propview-default-value (if defaultval defaultval org-propview-default-value)))
|
||||
(setq table (org-propview-to-table
|
||||
(org-propview-collect cols stringformat conds match scope inherit
|
||||
(if colnames colnames cols)) stringformat)))
|
||||
(widen))
|
||||
(setq pos (point))
|
||||
(when content-lines
|
||||
|
|
|
@ -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
|
||||
|
|
File diff suppressed because it is too large
Load diff
228
contrib/lisp/org-effectiveness.el
Normal file
228
contrib/lisp/org-effectiveness.el
Normal file
|
@ -0,0 +1,228 @@
|
|||
;;; org-effectiveness.el --- Measuring the personal effectiveness
|
||||
|
||||
;; Copyright (C) 2013 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: David Arroyo Menéndez <davidam@es.gnu.org>
|
||||
;; Keywords: effectiveness, plot
|
||||
;; Homepage: http://orgmode.org
|
||||
;;
|
||||
;; This file is not part of GNU Emacs, yet.
|
||||
;;
|
||||
;; GNU Emacs is free software: you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation, either version 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
|
||||
;; GNU Emacs is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Commentary:
|
||||
|
||||
;; This file implements functions to measure the effectiveness in org.
|
||||
;; Org-mode doesn't load this module by default - if this is not what
|
||||
;; you want, configure the variable `org-modules'. Thanks to #emacs-es
|
||||
;; irc channel for your support.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(require 'org)
|
||||
|
||||
(defun org-effectiveness-count-keyword(keyword)
|
||||
"Print a message with the number of keyword outline in the current buffer"
|
||||
(interactive "sKeyword: ")
|
||||
(save-excursion
|
||||
(goto-char (point-min))
|
||||
(message "Number of %s: %d" keyword (count-matches (concat "* " keyword)))))
|
||||
|
||||
(defun org-effectiveness-count-todo()
|
||||
"Print a message with the number of todo tasks in the current buffer"
|
||||
(interactive)
|
||||
(save-excursion
|
||||
(goto-char (point-min))
|
||||
(message "Number of TODO: %d" (count-matches "* TODO"))))
|
||||
|
||||
(defun org-effectiveness-count-done()
|
||||
"Print a message with the number of done tasks in the current buffer"
|
||||
(interactive)
|
||||
(save-excursion
|
||||
(goto-char (point-min))
|
||||
(message "Number of DONE: %d" (count-matches "* DONE"))))
|
||||
|
||||
(defun org-effectiveness-count-canceled()
|
||||
"Print a message with the number of canceled tasks in the current buffer"
|
||||
(interactive)
|
||||
(save-excursion
|
||||
(goto-char (point-min))
|
||||
(message "Number of Canceled: %d" (count-matches "* CANCEL+ED"))))
|
||||
|
||||
(defun org-effectiveness()
|
||||
"Returns the effectiveness in the current org buffer"
|
||||
(interactive)
|
||||
(save-excursion
|
||||
(goto-char (point-min))
|
||||
(let ((done (float (count-matches "* DONE.*\n.*")))
|
||||
(canc (float (count-matches "* CANCEL+ED.*\n.*"))))
|
||||
(if (and (= done canc) (zerop done))
|
||||
(setq effectiveness 0)
|
||||
(setq effectiveness (* 100 (/ done (+ done canc)))))
|
||||
(message "Effectiveness: %f" effectiveness))))
|
||||
|
||||
(defun org-effectiveness-keywords-in-date(keyword date)
|
||||
(interactive "sKeyword: \nsDate: " keyword date)
|
||||
(setq count (count-matches (concat keyword ".*\n.*" date)))
|
||||
(message (concat "%sS: %d" keyword count)))
|
||||
|
||||
(defun org-effectiveness-dones-in-date(date)
|
||||
(interactive "sGive me a date: " date)
|
||||
(setq count (count-matches (concat "DONE.*\n.*" date)))
|
||||
(message "DONES: %d" count))
|
||||
|
||||
(defun org-effectivenes-todos-in-date(date)
|
||||
(interactive "sGive me a date: " date)
|
||||
(setq count (count-matches (concat "TODO.*\n.*" date)))
|
||||
(message "TODOS: %d" count))
|
||||
|
||||
(defun org-effectiveness-canceled-in-date(date)
|
||||
(interactive "sGive me a date: " date)
|
||||
(setq count (count-matches (concat "CANCEL+ED.*\n.*" date)))
|
||||
(message "CANCELEDS: %d" count))
|
||||
|
||||
(defun org-effectiveness-in-date(date &optional notmessage)
|
||||
(interactive "sGive me a date: " date)
|
||||
(save-excursion
|
||||
(goto-char (point-min))
|
||||
(let ((done (float (count-matches (concat "* DONE.*\n.*" date))))
|
||||
(canc (float (count-matches (concat "* CANCEL+ED.*\n.*" date)))))
|
||||
(if (and (= done canc) (zerop done))
|
||||
(setq effectiveness 0)
|
||||
(setq effectiveness (* 100 (/ done (+ done canc)))))
|
||||
(if (eq notmessage 1)
|
||||
(message "%d" effectiveness)
|
||||
(message "Effectiveness: %d " effectiveness)))))
|
||||
|
||||
(defun org-effectiveness-month-to-string (m)
|
||||
(if (< m 10)
|
||||
(concat "0" (number-to-string m))
|
||||
(number-to-string m)))
|
||||
|
||||
(defun org-effectiveness-plot(startdate enddate)
|
||||
(interactive "sGive me the start date: \nsGive me the end date: " startdate enddate)
|
||||
(setq dates (org-effectiveness-check-dates startdate enddate))
|
||||
(setq syear (cadr (assoc 'startyear dates)))
|
||||
(setq smonth (cadr (assoc 'startmonth dates)))
|
||||
(setq eyear (cadr (assoc 'endyear dates)))
|
||||
(setq emonth (assoc 'endmonth dates))
|
||||
;; Checking the format of the dates
|
||||
(if (not (string-match "[0-9][0-9][0-9][0-9]-[0-9][0-9]" startdate))
|
||||
(message "The start date must have the next format YYYY-MM"))
|
||||
(if (not (string-match "[0-9][0-9][0-9][0-9]-[0-9][0-9]" enddate))
|
||||
(message "The end date must have the next format YYYY-MM"))
|
||||
;; Checking if startdate < enddate
|
||||
(if (string-match "^[0-9][0-9][0-9][0-9]" startdate)
|
||||
(setq startyear (string-to-number (match-string 0 startdate))))
|
||||
(if (string-match "[0-9][0-9]$" startdate)
|
||||
(setq startmonth (string-to-number (match-string 0 startdate))))
|
||||
(if (string-match "^[0-9][0-9][0-9][0-9]" enddate)
|
||||
(setq endyear (string-to-number (match-string 0 enddate))))
|
||||
(if (string-match "[0-9][0-9]$" enddate)
|
||||
(setq endmonth (string-to-number (match-string 0 enddate))))
|
||||
(if (> startyear endyear)
|
||||
(message "The start date must be before that end date"))
|
||||
(if (and (= startyear endyear) (> startmonth endmonth))
|
||||
(message "The start date must be before that end date"))
|
||||
;; Create a file
|
||||
(let ((month startmonth)
|
||||
(year startyear)
|
||||
(str ""))
|
||||
(while (and (>= endyear year) (>= endmonth month))
|
||||
(setq str (concat str (number-to-string year) "-" (org-effectiveness-month-to-string month) " " (org-effectiveness-in-date (concat (number-to-string year) "-" (org-effectiveness-month-to-string month)) 1) "\n"))
|
||||
(if (= month 12)
|
||||
(progn
|
||||
(setq year (+ 1 year))
|
||||
(setq month 1))
|
||||
(setq month (+ 1 month))))
|
||||
(write-region str nil "/tmp/org-effectiveness"))
|
||||
;; Create the bar graph
|
||||
(if (file-exists-p "/usr/bin/gnuplot")
|
||||
(call-process "/bin/bash" nil t nil "-c" "/usr/bin/gnuplot -e 'plot \"/tmp/org-effectiveness\" using 2:xticlabels(1) with histograms' -p")
|
||||
(message "gnuplot is not installed")))
|
||||
|
||||
(defun org-effectiveness-ascii-bar(n &optional label)
|
||||
"Print a bar with the percentage from 0 to 100 printed in ascii"
|
||||
(interactive "nPercentage: \nsLabel: ")
|
||||
(if (or (< n 0) (> n 100))
|
||||
(message "The percentage must be between 0 to 100")
|
||||
(let ((x 0)
|
||||
(y 0)
|
||||
(z 0))
|
||||
(insert (format "\n### %s ###" label))
|
||||
(insert "\n-")
|
||||
(while (< x n)
|
||||
(insert "-")
|
||||
(setq x (+ x 1)))
|
||||
(insert "+\n")
|
||||
(insert (format "%d" n))
|
||||
(if (> n 10)
|
||||
(setq y (+ y 1)))
|
||||
(while (< y n)
|
||||
(insert " ")
|
||||
(setq y (+ y 1)))
|
||||
(insert "|\n")
|
||||
(insert "-")
|
||||
(while (< z n)
|
||||
(insert "-")
|
||||
(setq z (+ z 1)))
|
||||
(insert "+"))))
|
||||
|
||||
(defun org-effectiveness-check-dates (startdate enddate)
|
||||
"Generate a list with ((startyear startmonth) (endyear endmonth))"
|
||||
(setq str nil)
|
||||
(if (not (string-match "[0-9][0-9][0-9][0-9]-[0-9][0-9]" startdate))
|
||||
(setq str "The start date must have the next format YYYY-MM"))
|
||||
(if (not (string-match "[0-9][0-9][0-9][0-9]-[0-9][0-9]" enddate))
|
||||
(setq str "The end date must have the next format YYYY-MM"))
|
||||
;; Checking if startdate < enddate
|
||||
(if (string-match "^[0-9][0-9][0-9][0-9]" startdate)
|
||||
(setq startyear (string-to-number (match-string 0 startdate))))
|
||||
(if (string-match "[0-9][0-9]$" startdate)
|
||||
(setq startmonth (string-to-number (match-string 0 startdate))))
|
||||
(if (string-match "^[0-9][0-9][0-9][0-9]" enddate)
|
||||
(setq endyear (string-to-number (match-string 0 enddate))))
|
||||
(if (string-match "[0-9][0-9]$" enddate)
|
||||
(setq endmonth (string-to-number (match-string 0 enddate))))
|
||||
(if (> startyear endyear)
|
||||
(setq str "The start date must be before that end date"))
|
||||
(if (and (= startyear endyear) (> startmonth endmonth))
|
||||
(setq str "The start date must be before that end date"))
|
||||
(if str
|
||||
(message str)
|
||||
;; (list (list startyear startmonth) (list endyear endmonth))))
|
||||
(list (list 'startyear startyear) (list 'startmonth startmonth) (list 'endyear endyear) (list 'endmonth endmonth))))
|
||||
|
||||
(defun org-effectiveness-plot-ascii (startdate enddate)
|
||||
(interactive "sGive me the start date: \nsGive me the end date: " startdate enddate)
|
||||
(setq dates (org-effectiveness-check-dates startdate enddate))
|
||||
(setq syear (cadr (assoc 'startyear dates)))
|
||||
(setq smonth (cadr (assoc 'startmonth dates)))
|
||||
(setq eyear (cadr (assoc 'endyear dates)))
|
||||
(setq emonth (cadr (assoc 'endmonth dates)))
|
||||
;; (switch-to-buffer "*org-effectiveness*")
|
||||
(let ((month smonth)
|
||||
(year syear)
|
||||
(str ""))
|
||||
(while (and (>= eyear year) (>= emonth month))
|
||||
(org-effectiveness-ascii-bar (string-to-number (org-effectiveness-in-date (concat (number-to-string year) "-" (org-effectiveness-month-to-string month)) 1)) (format "%s-%s" year month))
|
||||
(if (= month 12)
|
||||
(progn
|
||||
(setq year (+ 1 year))
|
||||
(setq month 1))
|
||||
(setq month (+ 1 month))))))
|
||||
|
||||
(provide 'org-effectiveness)
|
||||
|
File diff suppressed because it is too large
Load diff
1943
contrib/lisp/org-index.el
Normal file
1943
contrib/lisp/org-index.el
Normal file
File diff suppressed because it is too large
Load diff
539
contrib/lisp/org-license.el
Normal file
539
contrib/lisp/org-license.el
Normal file
|
@ -0,0 +1,539 @@
|
|||
;;; org-license.el --- Add a license to your org files
|
||||
|
||||
;; Copyright (C) 2013 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: David Arroyo Menéndez <davidam@es.gnu.org>
|
||||
;; Keywords: licenses, creative commons
|
||||
;; Homepage: http://orgmode.org
|
||||
;;
|
||||
;; This file is not part of GNU Emacs, yet.
|
||||
;;
|
||||
;; GNU Emacs is free software: you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation, either version 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
|
||||
;; GNU Emacs is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Commentary:
|
||||
|
||||
;; This file implements functions to add a license fast in org files.
|
||||
;; Org-mode doesn't load this module by default - if this is not what
|
||||
;; you want, configure the variable `org-modules'. Thanks to #emacs-es
|
||||
;; irc channel for your support.
|
||||
|
||||
;;; Code:
|
||||
|
||||
;;
|
||||
;;
|
||||
;; You can download the images from http://www.davidam/img/licenses.tar.gz
|
||||
;;
|
||||
;;; CHANGELOG:
|
||||
;; v 0.2 - add public domain functions
|
||||
;; v 0.1 - Initial release
|
||||
|
||||
|
||||
(defvar org-license-images-directory "")
|
||||
|
||||
(defun org-license-cc-by (language)
|
||||
(interactive "MLanguage ( br | ca | de | en | es | eo | eu | fi | fr | gl | it | jp | nl | pt ): " language)
|
||||
(cond ((equal language "br")
|
||||
(setq org-license-cc-url "https://creativecommons.org/licenses/by-sa/3.0/br/deed.pt_BR")
|
||||
(insert (concat "* Licença
|
||||
Este texto é disponibilizado nos termos da licença [[" org-license-cc-url "][Atribuição 3.0 Brasil]]\n")))
|
||||
((equal language "ca")
|
||||
(setq org-license-cc-url "https://creativecommons.org/licenses/by-sa/3.0/es/deed.ca")
|
||||
(insert (concat "* Licència
|
||||
El text està disponible sota la [[" org-license-cc-url "][Reconeixement 3.0 Espanya]]\n")))
|
||||
((equal language "de")
|
||||
(setq org-license-cc-url "https://creativecommons.org/licenses/by-sa/3.0/de/deed.de")
|
||||
(insert (concat "* Lizenz
|
||||
Dieses Werk bzw. Inhalt steht unter einer [[" org-license-cc-url "][Lizenz Creative Commons Namensnennung 3.0 Deutschland]]\n")))
|
||||
((equal language "eo")
|
||||
(setq org-license-cc-url "http://creativecommons.org/licenses/by/3.0/eo/deed.eo")
|
||||
(insert (concat "* Licenco
|
||||
Ĉi tiu verko estas disponebla laŭ la permesilo [[" org-license-cc-url "][Krea Komunaĵo Atribuite 3.0 Neadaptita]]\n")))
|
||||
((equal language "es")
|
||||
(setq org-license-cc-url "http://creativecommons.org/licenses/by/3.0/es/deed.es")
|
||||
(insert (concat "* Licencia
|
||||
Este documento está bajo una [[" org-license-cc-url "][Licencia Creative Commons Atribución 3.0 España]]\n")))
|
||||
((equal language "eu")
|
||||
(setq org-license-cc-url "http://creativecommons.org/licenses/by/3.0/es/deed.eu")
|
||||
(insert (concat "* Licenzua
|
||||
Testua [[" org-license-cc-url "][Aitortu 3.0 Espainia]] lizentziari jarraituz erabil daiteke\n")))
|
||||
((equal language "fi")
|
||||
(setq org-license-cc-url "http://creativecommons.org/licenses/by/1.0/fi/deed.fi")
|
||||
(insert (concat "* Lisenssi
|
||||
Teksti on saatavilla [[" org-license-cc-url "][Nimeä 1.0 Suomi]] lisenssillä\n")))
|
||||
((equal language "fr")
|
||||
(setq org-license-cc-url "http://creativecommons.org/licenses/by/3.0/fr/deed.fr")
|
||||
(insert (concat "* Licence
|
||||
Ce(tte) œuvre est mise à disposition selon les termes de la [[" org-license-cc-url "][Licence Creative Commons Attribution 3.0 France]]\n")))
|
||||
((equal language "gl")
|
||||
(setq org-license-cc-url "http://creativecommons.org/licenses/by/3.0/es/deed.gl")
|
||||
(insert (concat "* Licenza
|
||||
Todo o texto está dispoñible baixo a [[" org-license-cc-url "][licenza Creative Commons recoñecemento compartir igual 3.0]].\n")))
|
||||
((equal language "it")
|
||||
(setq org-license-cc-url "http://creativecommons.org/licenses/by/3.0/it/deed.it")
|
||||
(insert (concat "* Licenza
|
||||
Quest'opera e distribuita con Licenza [[" org-license-cc-url "][Licenza Creative Commons Attribuzione 3.0 Italia]]\n")))
|
||||
((equal language "jp")
|
||||
(setq org-license-cc-url "http://creativecommons.org/licenses/by/2.1/jp/deed.en")
|
||||
(insert (concat "* ライセンス
|
||||
この文書は [[" org-license-cc-url "][Creative Commons Attribution 2.1 ]] ライセンスの下である\n")))
|
||||
((equal language "nl")
|
||||
(setq org-license-cc-url "http://creativecommons.org/licenses/by/3.0/nl/deed.nl")
|
||||
(insert (concat "* Licentie
|
||||
Dit werk is valt onder een [[" org-license-cc-url "][Creative Commons Naamsvermelding 3.0 Nederland]]\n")))
|
||||
((equal language "pt")
|
||||
(setq org-license-cc-url "http://creativecommons.org/licenses/by/3.0/pt/deed.pt")
|
||||
(insert (concat "* Licença
|
||||
Este texto é disponibilizado nos termos da licença [[" org-license-cc-url "][Atribuição 3.0 Portugal]]\n")))
|
||||
(t (concat (insert "* License
|
||||
This document is under a [[" org-license-cc-url "][Creative Commons Attribution 3.0]]\n"))))
|
||||
(if (string= "" org-license-images-directory)
|
||||
(insert (concat "\n[[" org-license-cc-url "][file:http://i.creativecommons.org/l/by/3.0/80x15.png]]\n"))
|
||||
(insert (concat "\n[[" org-license-cc-url "][file:" org-license-images-directory "/by/3.0/80x15.png]]\n"))))
|
||||
|
||||
(defun org-license-cc-by-sa (language)
|
||||
(interactive "MLanguage ( br | ca | de | en | es | eu | fi | fr | it | jp | nl | pt ): " language)
|
||||
(cond ((equal language "br")
|
||||
(setq org-license-cc-url "https://creativecommons.org/licenses/by-sa/3.0/br/deed.pt_BR")
|
||||
(concat (insert "* Licença
|
||||
Este texto é disponibilizado nos termos da licença [[" org-license-cc-url "][Atribuição Compartil ha Igual 3.0 Brasil]]\n")))
|
||||
((equal language "ca")
|
||||
(setq org-license-cc-url "http://creativecommons.org/licenses/by-sa/3.0/es/deed.ca")
|
||||
(insert (concat "* Licència
|
||||
El text està disponible sota la [[" org-license-cc-url "][Reconeixement-CompartirIgual 3.0 Espanya]]\n")))
|
||||
((equal language "de")
|
||||
(setq org-license-cc-url "http://creativecommons.org/licenses/by-sa/3.0/de/deed.de")
|
||||
(insert (concat "* Lizenz
|
||||
Dieses Werk bzw. Inhalt steht unter einer [[" org-license-cc-url "][Namensnennung - Weitergabe unter gleichen Bedingungen 3.0 Deutschland]]\n")))
|
||||
((equal language "es")
|
||||
(setq org-license-cc-url "http://creativecommons.org/licenses/by-sa/3.0/es/deed.es")
|
||||
(concat (insert "* Licencia
|
||||
Este documento está bajo una [[" org-license-cc-url "][Licencia Creative Commons Atribución Compartir por Igual 3.0 España]]\n")))
|
||||
((equal language "eu")
|
||||
(setq org-license-cc-url "http://creativecommons.org/licenses/by-sa/3.0/es/deed.eu")
|
||||
(concat (insert "* Licenzua
|
||||
Testua [[" org-license-cc-url "][Aitortu-PartekatuBerdin 3.0 Espainia]] lizentziari jarraituz erabil daiteke\n")))
|
||||
((equal language "fi")
|
||||
(setq org-license-cc-url "http://creativecommons.org/licenses/by-sa/1.0/fi/deed.fi")
|
||||
(insert (concat "* Lisenssi
|
||||
Teksti on saatavilla [[" org-license-cc-url "][Nimeä-JaaSamoin 1.0 Suomi]] lisenssillä\n")))
|
||||
((equal language "fr")
|
||||
(setq org-license-cc-url "http://creativecommons.org/licenses/by-sa/3.0/fr/deed.fr")
|
||||
(concat (insert "* Licence
|
||||
Ce(tte) œuvre est mise à disposition selon les termes de la [[" org-license-cc-url "][Licence Creative Commons Attribution - Partage dans les Mêmes Conditions 3.0 France]]\n")))
|
||||
((equal language "gl")
|
||||
(setq org-license-cc-url "http://creativecommons.org/licenses/by-sa/3.0/es/deed.gl")
|
||||
(insert (concat "* Licenza
|
||||
Todo o texto está dispoñible baixo a [[" org-license-cc-url "][licenza Creative Commons recoñecemento compartir igual 3.0]].\n")))
|
||||
((equal language "it")
|
||||
(setq org-license-cc-url "http://creativecommons.org/licenses/by-sa/3.0/it/deed.it")
|
||||
(insert (concat "* Licenza
|
||||
Quest'opera e distribuita con Licenza [[" org-license-cc-url "][Licenza Creative Commons Attribuzione - Condividi allo stesso modo 3.0 Italia]]\n")))
|
||||
((equal language "jp")
|
||||
(setq org-license-cc-url "http://creativecommons.org/licenses/by-sa/2.1/jp/deed.en")
|
||||
(insert (concat "* ライセンス
|
||||
この文書は、[[" org-license-cc-url "][Creative Commons Attribution 2.1 ]] ライセンスの下である\n")))
|
||||
((equal language "nl")
|
||||
(setq org-license-cc-url "http://creativecommons.org/licenses/by-sa/3.0/nl/deed.nl")
|
||||
(insert (concat "* Licentie
|
||||
Dit werk is valt onder een [[" org-license-cc-url "][Creative Commons Naamsvermelding Gelijk Delen 3.0 Nederland]]\n")))
|
||||
((equal language "pt")
|
||||
(setq org-license-cc-url "http://creativecommons.org/licenses/by-sa/3.0/pt/deed.pt")
|
||||
(insert (concat "* Licença
|
||||
Este texto é disponibilizado nos termos da licença [[" org-license-cc-url "][Atribuição-CompartilhaIgual 3.0 Portugal]]\n")))
|
||||
(t
|
||||
(setq org-license-cc-url "http://creativecommons.org/licenses/by-sa/3.0/deed")
|
||||
(insert (concat "* License
|
||||
This document is under a [[" org-license-cc-url "][Creative Commons Attribution-ShareAlike Unported 3.0]]\n"))))
|
||||
(if (string= "" org-license-images-directory)
|
||||
(insert (concat "\n[[" org-license-cc-url "][file:http://i.creativecommons.org/l/by-sa/3.0/80x15.png]]\n"))
|
||||
(insert (concat "\n[[" org-license-cc-url "][file:" org-license-images-directory "/by-sa/3.0/80x15.png]]\n"))))
|
||||
|
||||
(defun org-license-cc-by-nd (language)
|
||||
(interactive "MLanguage ( br | ca | de | en | es | eu | fi | fr | it | pt ): " language)
|
||||
(cond ((equal language "br")
|
||||
(setq org-license-cc-url "https://creativecommons.org/licenses/by-nd/3.0/br/deed.pt_BR")
|
||||
(insert (concat "* Licença
|
||||
Este texto é disponibilizado nos termos da licença [[" org-license-cc-url "][Atribuição Compartil ha Igual 3.0 Brasil]]\n")))
|
||||
((equal language "ca")
|
||||
(setq org-license-cc-url "http://creativecommons.org/licenses/by-nd/3.0/es/deed.ca")
|
||||
(insert (concat "* Licència
|
||||
El text està disponible sota la [[" org-license-cc-url "][Reconeixement-SenseObraDerivada 3.0 Espanya]]\n")))
|
||||
((equal language "de")
|
||||
(setq org-license-cc-url "http://creativecommons.org/licenses/by-nd/3.0/de/deed.de")
|
||||
(insert (concat "* Lizenz
|
||||
Dieses Werk bzw. Inhalt steht unter einer [[" org-license-cc-url "][Namensnennung-Keine Bearbeitung 3.0 Deutschland]]\n")))
|
||||
((equal language "es")
|
||||
(setq org-license-cc-url "http://creativecommons.org/licenses/by-nd/3.0/es/deed.es")
|
||||
(insert (concat "* Licencia
|
||||
Este documento está bajo una [[" org-license-cc-url "][Licencia Creative Commons Atribución-SinDerivadas 3.0]]\n")))
|
||||
((equal language "eu")
|
||||
(setq org-license-cc-url "http://creativecommons.org/licenses/by-sa/3.0/es/deed.eu")
|
||||
(insert (concat "* Licenzua
|
||||
Testua [[" org-license-cc-url "][Aitortu-LanEratorririkGabe 3.0 Espainia]] lizentziari jarraituz erabil daiteke\n")))
|
||||
((equal language "fi")
|
||||
(setq org-license-cc-url "http://creativecommons.org/licenses/by-sa/1.0/fi/deed.fi")
|
||||
(insert (concat "* Lisenssi
|
||||
Teksti on saatavilla [[" org-license-cc-url "][Nimeä-JaaSamoin 1.0 Suomi]] lisenssillä\n")))
|
||||
((equal language "fr")
|
||||
(setq org-license-cc-url "http://creativecommons.org/licenses/by-nd/3.0/fr/deed.fr")
|
||||
(insert (concat "* Licence
|
||||
Ce(tte) œuvre est mise à disposition selon les termes de la [[" org-license-cc-url "][Licence Creative Commons Attribution - Pas de Modification 3.0 France]]\n")))
|
||||
((equal language "gl")
|
||||
(setq org-license-cc-url "http://creativecommons.org/licenses/by-nd/3.0/es/deed.gl")
|
||||
(insert (concat "* Licenza
|
||||
Todo o texto está dispoñible baixo a [[" org-license-cc-url "][licenza Creative Commons recoñecemento compartir igual 3.0]].\n")))
|
||||
((equal language "it")
|
||||
(setq org-license-cc-url "http://creativecommons.org/licenses/by-nd/3.0/it/deed.it")
|
||||
(insert (concat "* Licenza
|
||||
Quest'opera e distribuita con Licenza [[" org-license-cc-url "][Licenza Creative Commons Attribuzione - Non opere derivate 3.0 Italia]]\n")))
|
||||
((equal language "jp")
|
||||
(setq org-license-cc-url "http://creativecommons.org/licenses/by-nd/2.1/jp/deed.en")
|
||||
(insert (concat "* ライセンス
|
||||
この文書は、[[" org-license-cc-url "][Creative Commons No Derivatives 2.1]] ライセンスの下である\n")))
|
||||
((equal language "nl")
|
||||
(setq org-license-cc-url "http://creativecommons.org/licenses/by-nd/3.0/nl/deed.nl")
|
||||
(insert (concat "* Licentie
|
||||
Dit werk is valt onder een [[" org-license-cc-url "][Creative Commons Naamsvermelding GeenAfgeleideWerken 3.0 Nederland]]\n")))
|
||||
((equal language "pt")
|
||||
(setq org-license-cc-url "http://creativecommons.org/licenses/by-nd/3.0/pt/deed.pt")
|
||||
(insert (concat "* Licença
|
||||
Este texto é disponibilizado nos termos da licença [[" org-license-cc-url "][Atribuição Sem Derivados 3.0 Portugal]]\n")))
|
||||
(t
|
||||
(setq org-license-cc-url "http://creativecommons.org/licenses/by-nd/3.0/deed")
|
||||
(insert (concat "* License
|
||||
This document is under a [[" org-license-cc-url "][Creative Commons No Derivatives Unported 3.0]]\n"))))
|
||||
(if (string= "" org-license-images-directory)
|
||||
(insert (concat "\n[[" org-license-cc-url "][file:http://i.creativecommons.org/l/by-nd/3.0/80x15.png]]\n"))
|
||||
(insert (concat "\n[[" org-license-cc-url "][file:" org-license-images-directory "/by-nd/3.0/80x15.png]]\n"))))
|
||||
|
||||
|
||||
(defun org-license-cc-by-nc (language)
|
||||
(interactive "MLanguage ( br | ca | de | en | es | eu | fi | fr | it | jp | nl | pt ): " language)
|
||||
(cond ((equal language "br")
|
||||
(setq org-license-cc-url "https://creativecommons.org/licenses/by-nc/3.0/br/deed.pt_BR")
|
||||
(insert (concat "* Licença
|
||||
Este texto é disponibilizado nos termos da licença [[" org-license-cc-url "][Atribuição Não Comercial 3.0 Brasil]]\n")))
|
||||
((equal language "ca")
|
||||
(setq org-license-cc-url "http://creativecommons.org/licenses/by-nc/3.0/es/deed.ca")
|
||||
(insert (concat "* Licència
|
||||
El text està disponible sota la [[" org-license-cc-url "][Reconeixement-NoComercial 3.0 Espanya]]\n")))
|
||||
((equal language "de")
|
||||
(setq org-license-cc-url "http://creativecommons.org/licenses/by-nc/3.0/de/deed.de")
|
||||
(insert (concat "* Lizenz
|
||||
Dieses Werk bzw. Inhalt steht unter einer [[" org-license-cc-url "][Namensnennung-Nicht-kommerziell 3.0 Deutschland]]\n")))
|
||||
((equal language "es")
|
||||
(setq org-license-cc-url "http://creativecommons.org/licenses/by-nc/3.0/es/deed.es")
|
||||
(insert (concat "* Licencia
|
||||
Este documento está bajo una [[" org-license-cc-url "][Licencia Creative Commons Reconocimiento-NoComercial 3.0]]\n")))
|
||||
((equal language "eu")
|
||||
(setq org-license-cc-url "http://creativecommons.org/licenses/by-nc/3.0/es/deed.eu")
|
||||
(insert "* Licenzua
|
||||
Testua [[" org-license-cc-url "][Aitortu-EzKomertziala 3.0 Espainia]] lizentziari jarraituz erabil daiteke\n"))
|
||||
((equal language "fi")
|
||||
(setq org-license-cc-url "http://creativecommons.org/licenses/by-nc/1.0/fi/deed.fi")
|
||||
(insert (concat "* Lisenssi
|
||||
Teksti on saatavilla [[" org-license-cc-url "][Nimeä-Epäkaupallinen 1.0 Suomi]] lisenssillä\n")))
|
||||
((equal language "fr")
|
||||
(setq org-license-cc-url "http://creativecommons.org/licenses/by-nc/3.0/fr/deed.fr")
|
||||
(insert (concat "* Licence
|
||||
Ce(tte) œuvre est mise à disposition selon les termes de la [[" org-license-cc-url "][Licence Creative Commons Attribution - Pas d'Utilisation Commerciale 3.0 France]]\n")))
|
||||
((equal language "gl")
|
||||
(setq org-license-cc-url "http://creativecommons.org/licenses/by-nc/3.0/es/deed.gl")
|
||||
(insert (concat "* Licenza
|
||||
Todo o texto está dispoñible baixo a [[" org-license-cc-url "][licenza Creative Commons recoñecemento compartir igual 3.0]].\n")))
|
||||
((equal language "it")
|
||||
(setq org-license-cc-url "http://creativecommons.org/licenses/by-nc/3.0/it/deed.it")
|
||||
(insert (concat "* Licenza
|
||||
Quest'opera e distribuita con Licenza [[" org-license-cc-url "][Licenza Creative Commons Attribuzione - Non commerciale 3.0 Italia]]\n")))
|
||||
((equal language "jp")
|
||||
(setq org-license-cc-url "http://creativecommons.org/licenses/by-nc/2.1/jp/deed.en")
|
||||
(insert (concat "* ライセンス
|
||||
この文書は、[[" org-license-cc-url "][Creative Commons Attribution-NonCommercial 2.1 ]] ライセンスの下である\n")))
|
||||
((equal language "nl")
|
||||
(setq org-license-cc-url "http://creativecommons.org/licenses/by-nc/3.0/nl/deed.nl")
|
||||
(insert (concat "* Licentie
|
||||
Dit werk is valt onder een [[" org-license-cc-url "][Creative Commons Naamsvermelding NietCommercieel 3.0 Nederland 3.0 Nederland]]\n")))
|
||||
((equal language "pt")
|
||||
(setq org-license-cc-url "http://creativecommons.org/licenses/by-nc/3.0/pt/deed.pt")
|
||||
(insert (concat "* Licença
|
||||
Este texto é disponibilizado nos termos da licença [[" org-license-cc-url "][Atribuição Não Comercial 3.0 Portugal]]\n")))
|
||||
(t
|
||||
(setq org-license-cc-url "http://creativecommons.org/licenses/by-nc/3.0/deed")
|
||||
(insert (concat "* License
|
||||
This document is under a [[" org-license-cc-url "][Creative Commons Attribution-NonCommercial 3.0 Unported]]\n"))))
|
||||
(if (string= "" org-license-images-directory)
|
||||
(insert (concat "\n[[" org-license-cc-url "][file:http://i.creativecommons.org/l/by-nc/3.0/80x15.png]]\n"))
|
||||
(insert (concat "\n[[" org-license-cc-url "][file:" org-license-images-directory "/by-nc/3.0/80x15.png]]\n"))))
|
||||
|
||||
(defun org-license-cc-by-nc-sa (language)
|
||||
(interactive "MLanguage ( br | ca | de | en | es | eu | fi | fr | gl | it | jp | nl | pt ): " language)
|
||||
(cond ((equal language "br")
|
||||
(setq org-license-cc-url "https://creativecommons.org/licenses/by-nc-sa/3.0/br/deed.pt_BR")
|
||||
(insert (concat "* Licença
|
||||
Este texto é disponibilizado nos termos da licença [[" org-license-cc-url "][Atribuição Não Comercial - Compartil ha Igual 3.0 Brasil]]\n")))
|
||||
((equal language "ca")
|
||||
(setq org-license-cc-url "http://creativecommons.org/licenses/by-nc-sa/3.0/es/deed.ca")
|
||||
(insert (concat "* Licència
|
||||
El text està disponible sota la [[" org-license-cc-url "][Reconeixement-NoComercial 3.0 Espanya]]\n")))
|
||||
((equal language "de")
|
||||
(setq org-license-cc-url "http://creativecommons.org/licenses/by-nc-sa/3.0/de/deed.de")
|
||||
(insert (concat "* Lizenz
|
||||
Dieses Werk bzw. Inhalt steht unter einer [[" org-license-cc-url "][Namensnennung - Weitergabe unter gleichen Bedingungen 3.0 Deutschland]]\n")))
|
||||
((equal language "es")
|
||||
(setq org-license-cc-url "http://creativecommons.org/licenses/by-nc-sa/3.0/es/deed.es")
|
||||
(insert (concat "* Licencia
|
||||
Este documento está bajo una [[" org-license-cc-url "][Licencia Creative Commons Reconocimiento-NoComercial 3.0]]\n")))
|
||||
((equal language "eu")
|
||||
(setq org-license-cc-url "http://creativecommons.org/licenses/by-nc-sa/3.0/es/deed.eu")
|
||||
(insert "* Licenzua
|
||||
Testua [[" org-license-cc-url "][Aitortu-EzKomertziala-PartekatuBerdin 3.0 Espainia]] lizentziari jarraituz erabil daiteke\n"))
|
||||
((equal language "fi")
|
||||
(setq org-license-cc-url "http://creativecommons.org/licenses/by-nc-sa/1.0/fi/deed.fi")
|
||||
(insert (concat "* Lisenssi
|
||||
Teksti on saatavilla [[" org-license-cc-url "][Nimeä-Epäkaupallinen-JaaSamoin 1.0 Suomi]] lisenssillä\n")))
|
||||
((equal language "fr")
|
||||
(setq org-license-cc-url "http://creativecommons.org/licenses/by-nc-sa/3.0/fr/deed.fr")
|
||||
(insert (concat "* Licence
|
||||
Ce(tte) œuvre est mise à disposition selon les termes de la [[" org-license-cc-url "][Licence Creative Commons Attribution - Pas d’Utilisation Commerciale - Partage dans les Mêmes Conditions 3.0 France]]\n")))
|
||||
((equal language "gl")
|
||||
(setq org-license-cc-url "http://creativecommons.org/licenses/by-nc-sa/3.0/es/deed.gl")
|
||||
(insert (concat "* Licenza
|
||||
Todo o texto está dispoñible baixo a [[" org-license-cc-url "][licenza Creative Commons recoñecemento compartir igual 3.0]].\n")))
|
||||
((equal language "it")
|
||||
(setq org-license-cc-url "http://creativecommons.org/licenses/by-nc-sa/3.0/it/deed.it")
|
||||
(insert (concat "* Licenza
|
||||
Quest'opera e distribuita con Licenza [[" org-license-cc-url "][Licenza Creative Commons Attribuzione - Non opere derivate 3.0 Italia]]\n")))
|
||||
((equal language "jp")
|
||||
(setq org-license-cc-url "http://creativecommons.org/licenses/by-nc-sa/2.1/jp/deed.en")
|
||||
(insert (concat "* ライセンス
|
||||
この文書は、[[" org-license-cc-url "][License Creative Commons Attribution Non Commercial Share Alike 2.1 ]] ライセンスの下である\n")))
|
||||
((equal language "nl")
|
||||
(setq org-license-cc-url "http://creativecommons.org/licenses/by-nc-sa/3.0/nl/deed.nl")
|
||||
(insert (concat "* Licentie
|
||||
Dit werk is valt onder een [[" org-license-cc-url "][Creative Commons Naamsvermelding NietCommercieel GelijkDelen 3.0 Nederland]]\n")))
|
||||
((equal language "pt")
|
||||
(setq org-license-cc-url "http://creativecommons.org/licenses/by-nc/3.0/pt/deed.pt")
|
||||
(insert (concat "* Licença
|
||||
Este texto é disponibilizado nos termos da licença [[" org-license-cc-url "][Atribuição NãoComercial Compartil ha Igual 3.0 Portugal]]\n")))
|
||||
(t
|
||||
(setq org-license-cc-url "http://creativecommons.org/licenses/by-nc-sa/3.0/deed")
|
||||
(insert (concat "* License
|
||||
This document is under a [[" org-license-cc-url "][License Creative Commons Attribution Non Commercial Share Alike 3.0 Unported]]\n"))))
|
||||
(if (string= "" org-license-images-directory)
|
||||
(insert (concat "\n[[" org-license-cc-url "][file:http://i.creativecommons.org/l/by-nc-sa/3.0/80x15.png]]\n"))
|
||||
(insert (concat "\n[[" org-license-cc-url "][file:" org-license-images-directory "/by-nc-sa/3.0/80x15.png]]\n"))))
|
||||
|
||||
(defun org-license-cc-by-nc-nd (language)
|
||||
(interactive "MLanguage ( br | ca | de | en | es | eu | fi | fr | gl | it | pt ): " language)
|
||||
(cond ((equal language "br")
|
||||
(setq org-license-cc-url "http://creativecommons.org/licenses/by-nc-nd/3.0/pt/deed.pt")
|
||||
(insert (concat "* Licença
|
||||
Este texto é disponibilizado nos termos da licença [[" org-license-cc-url "][Atribuição Não Comercial Sem Derivados 3.0 Brasil]]\n")))
|
||||
((equal language "ca")
|
||||
(setq org-license-cc-url "http://creativecommons.org/licenses/by-nc-nd/3.0/es/deed.ca")
|
||||
(insert (concat "* Licència
|
||||
El text està disponible sota la [[" org-license-cc-url "][Reconeixement-NoComercial-SenseObraDerivada 3.0 Espanya]]\n")))
|
||||
((equal language "de")
|
||||
(setq org-license-cc-url "http://creativecommons.org/licenses/by-nc-nd/3.0/de/deed.de")
|
||||
(insert (concat "* Lizenz
|
||||
Dieses Werk bzw. Inhalt steht unter einer [[" org-license-cc-url "][Namensnennung-NichtKommerziell-KeineBearbeitung 3.0 Deutschland]]\n")))
|
||||
((equal language "es")
|
||||
(setq org-license-cc-url "http://creativecommons.org/licenses/by-nc-nd/3.0/es/deed.es")
|
||||
(insert (concat "* Licencia
|
||||
Este documento está bajo una [[" org-license-cc-url "][Licencia Creative Commons Reconocimiento-NoComercial-SinObraDerivada 3.0]]\n")))
|
||||
((equal language "eu")
|
||||
(setq org-license-cc-url "http://creativecommons.org/licenses/by-nc-nd/3.0/es/deed.eu")
|
||||
(insert (concat "* Licenzua
|
||||
Testua [[" org-license-cc-url "][Aitortu-LanEratorririkGabe 3.0 Espainia]] lizentziari jarraituz erabil daiteke\n")))
|
||||
((equal language "fi")
|
||||
(setq org-license-cc-url "http://creativecommons.org/licenses/by-nc-nd/1.0/fi/deed.fi")
|
||||
(insert (concat "* Lisenssi
|
||||
Teksti on saatavilla [[" org-license-cc-url "][Nimeä-Ei muutoksia-Epäkaupallinen 1.0 Suomi]] lisenssillä\n")))
|
||||
((equal language "fr")
|
||||
(setq org-license-cc-url "http://creativecommons.org/licenses/by-nc-nd/3.0/fr/deed.fr")
|
||||
(insert (concat "* Licence
|
||||
Ce(tte) œuvre est mise à disposition selon les termes de la [[" org-license-cc-url "][Licence Creative Commons Attribution - Pas de Modification 3.0 France]]\n")))
|
||||
((equal language "gl")
|
||||
(setq org-license-cc-url "http://creativecommons.org/licenses/by-nc-nd/3.0/es/deed.gl")
|
||||
(insert (concat "* Licenza
|
||||
Todo o texto está dispoñible baixo a [[" org-license-cc-url "][licenza Creative Commons recoñecemento compartir igual 3.0]].\n")))
|
||||
((equal language "it")
|
||||
(setq org-license-cc-url "http://creativecommons.org/licenses/by-nc-nd/3.0/it/deed.it")
|
||||
(insert (concat "* Licenza
|
||||
Quest'opera e distribuita con Licenza [[" org-license-cc-url "][Licenza Creative Commons Attribuzione - Non opere derivate 3.0 Italia]]\n")))
|
||||
((equal language "jp")
|
||||
(setq org-license-cc-url "http://creativecommons.org/licenses/by-nc-nd/2.1/jp/deed.en")
|
||||
(insert (concat "* ライセンス
|
||||
この文書は [[" org-license-cc-url "][License Creative Commons Attribution Non Commercial - No Derivs 2.1]] ライセンスの下である\n")))
|
||||
((equal language "nl")
|
||||
(setq org-license-cc-url "http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.nl")
|
||||
(insert (concat "* Licentie
|
||||
Dit werk is valt onder een [[" org-license-cc-url "][Creative Commons Naamsvermelding NietCommercieel GeenAfgeleideWerken 3.0 Nederland]]\n")))
|
||||
((equal language "pt")
|
||||
(setq org-license-cc-url "http://creativecommons.org/licenses/by-nc-nd/3.0/pt/deed.pt")
|
||||
(insert (concat "* Licença
|
||||
Este texto é disponibilizado nos termos da licença [[" org-license-cc-url "][Atribuição Não Comercial Sem Derivados 3.0 Portugal]]\n")))
|
||||
(t
|
||||
(setq org-license-cc-url "http://creativecommons.org/licenses/by-nc-nd/3.0/deed")
|
||||
(insert (concat "* License
|
||||
This document is under a [[" org-license-cc-url "][License Creative Commons
|
||||
Reconocimiento-NoComercial-SinObraDerivada 3.0 Unported]]\n"))))
|
||||
(if (string= "" org-license-images-directory)
|
||||
(insert (concat "\n[[" org-license-cc-url "][file:http://i.creativecommons.org/l/by-nc-nd/3.0/80x15.png]]\n"))
|
||||
(insert (concat "\n[[" org-license-cc-url "][file:" org-license-images-directory "/by-nc-nd/3.0/80x15.png]]\n"))))
|
||||
|
||||
(defun org-license-gfdl (language)
|
||||
(interactive "MLanguage (es | en): " language)
|
||||
(cond ((equal language "es")
|
||||
(insert "* Licencia
|
||||
Copyright (C) 2013 " user-full-name
|
||||
"\n Se permite copiar, distribuir y/o modificar este documento
|
||||
bajo los términos de la GNU Free Documentation License, Version 1.3
|
||||
o cualquier versión publicada por la Free Software Foundation;
|
||||
sin Secciones Invariantes y sin Textos de Portada o Contraportada.
|
||||
Una copia de la licencia está incluida en [[https://www.gnu.org/copyleft/fdl.html][GNU Free Documentation License]].\n"))
|
||||
(t (insert (concat "* License
|
||||
Copyright (C) 2013 " user-full-name
|
||||
"\n Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.3
|
||||
or any later version published by the Free Software Foundation;
|
||||
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
|
||||
A copy of the license is included in [[https://www.gnu.org/copyleft/fdl.html][GNU Free Documentation License]].\n"))))
|
||||
(if (string= "" org-license-images-directory)
|
||||
(insert "\n[[https://www.gnu.org/copyleft/fdl.html][file:https://upload.wikimedia.org/wikipedia/commons/thumb/4/42/GFDL_Logo.svg/200px-GFDL_Logo.svg.png]]\n")
|
||||
(insert (concat "\n[[https://www.gnu.org/copyleft/fdl.html][file:" org-license-images-directory "/gfdl/gfdl.png]]\n"))))
|
||||
|
||||
(defun org-license-publicdomain-zero (language)
|
||||
(interactive "MLanguage ( en | es ): " language)
|
||||
(setq org-license-pd-url "http://creativecommons.org/publicdomain/zero/1.0/")
|
||||
(setq org-license-pd-file "zero/1.0/80x15.png")
|
||||
(if (equal language "es")
|
||||
(insert (concat "* Licencia
|
||||
Este documento está bajo una licencia [[" org-license-pd-url "][Public Domain Zero]]\n"))
|
||||
(insert (concat "* License
|
||||
This documento is under a [[" org-license-pd-url "][Public Domain Zero]] license\n")))
|
||||
(if (string= "" org-license-images-directory)
|
||||
(insert (concat "\n[[" org-license-pd-url "][file:http://i.creativecommons.org/p/zero/1.0/80x15.png]]\n"))
|
||||
(insert (concat "\n[[" org-license-pd-url "][file:" org-license-images-directory org-license-pd-file "]]\n"))))
|
||||
|
||||
(defun org-license-publicdomain-mark (language)
|
||||
(interactive "MLanguage ( en | es ): " language)
|
||||
(setq org-license-pd-url "http://creativecommons.org/publicdomain/mark/1.0/")
|
||||
(setq org-license-pd-file "mark/1.0/80x15.png")
|
||||
(if (equal language "es")
|
||||
(insert (concat "* Licencia
|
||||
Este documento está bajo una licencia [[" org-license-pd-url "][Etiqueta de Dominio Público 1.0]]\n"))
|
||||
(insert (concat "* License
|
||||
This documento is under a [[" org-license-pd-url "][Public Domain Mark]] license\n")))
|
||||
(if (string= "" org-license-images-directory)
|
||||
(insert (concat "\n[[" org-license-pd-url "][file:http://i.creativecommons.org/p/mark/1.0/80x15.png]]\n"))
|
||||
(insert (concat "\n[[" org-license-pd-url "][file:" org-license-images-directory org-license-pd-file "]]\n"))))
|
||||
|
||||
(defun org-license-print-all ()
|
||||
"Print all combinations of licenses and languages, it's useful to find bugs"
|
||||
(interactive)
|
||||
(org-license-gfdl "es")
|
||||
(org-license-gfdl "en")
|
||||
(org-license-publicdomain-mark "es")
|
||||
(org-license-publicdomain-mark "en")
|
||||
(org-license-publicdomain-zero "es")
|
||||
(org-license-publicdomain-zero "en")
|
||||
(org-license-cc-by "br")
|
||||
(org-license-cc-by "ca")
|
||||
(org-license-cc-by "de")
|
||||
(org-license-cc-by "es")
|
||||
(org-license-cc-by "en")
|
||||
(org-license-cc-by "eo")
|
||||
(org-license-cc-by "eu")
|
||||
(org-license-cc-by "fi")
|
||||
(org-license-cc-by "fr")
|
||||
(org-license-cc-by "gl")
|
||||
(org-license-cc-by "it")
|
||||
(org-license-cc-by "jp")
|
||||
(org-license-cc-by "nl")
|
||||
(org-license-cc-by "pt")
|
||||
(org-license-cc-by-sa "br")
|
||||
(org-license-cc-by-sa "ca")
|
||||
(org-license-cc-by-sa "de")
|
||||
(org-license-cc-by-sa "es")
|
||||
(org-license-cc-by-sa "en")
|
||||
;; (org-license-cc-by-sa "eo")
|
||||
(org-license-cc-by-sa "eu")
|
||||
(org-license-cc-by-sa "fi")
|
||||
(org-license-cc-by-sa "fr")
|
||||
(org-license-cc-by-sa "gl")
|
||||
(org-license-cc-by-sa "it")
|
||||
(org-license-cc-by-sa "jp")
|
||||
(org-license-cc-by-sa "nl")
|
||||
(org-license-cc-by-sa "pt")
|
||||
(org-license-cc-by-nd "br")
|
||||
(org-license-cc-by-nd "ca")
|
||||
(org-license-cc-by-nd "de")
|
||||
(org-license-cc-by-nd "es")
|
||||
(org-license-cc-by-nd "en")
|
||||
;; (org-license-cc-by-nd "eo")
|
||||
(org-license-cc-by-nd "eu")
|
||||
(org-license-cc-by-nd "fi")
|
||||
(org-license-cc-by-nd "fr")
|
||||
(org-license-cc-by-nd "gl")
|
||||
(org-license-cc-by-nd "it")
|
||||
(org-license-cc-by-nd "jp")
|
||||
(org-license-cc-by-nd "nl")
|
||||
(org-license-cc-by-nd "pt")
|
||||
(org-license-cc-by-nc "br")
|
||||
(org-license-cc-by-nc "ca")
|
||||
(org-license-cc-by-nc "de")
|
||||
(org-license-cc-by-nc "es")
|
||||
(org-license-cc-by-nc "en")
|
||||
;; (org-license-cc-by-nc "eo")
|
||||
(org-license-cc-by-nc "eu")
|
||||
(org-license-cc-by-nc "fi")
|
||||
(org-license-cc-by-nc "fr")
|
||||
(org-license-cc-by-nc "gl")
|
||||
(org-license-cc-by-nc "it")
|
||||
(org-license-cc-by-nc "jp")
|
||||
(org-license-cc-by-nc "nl")
|
||||
(org-license-cc-by-nc "pt")
|
||||
(org-license-cc-by-nc-sa "br")
|
||||
(org-license-cc-by-nc-sa "ca")
|
||||
(org-license-cc-by-nc-sa "de")
|
||||
(org-license-cc-by-nc-sa "es")
|
||||
(org-license-cc-by-nc-sa "en")
|
||||
;; (org-license-cc-by-nc-sa "eo")
|
||||
(org-license-cc-by-nc-sa "eu")
|
||||
(org-license-cc-by-nc-sa "fi")
|
||||
(org-license-cc-by-nc-sa "fr")
|
||||
(org-license-cc-by-nc-sa "gl")
|
||||
(org-license-cc-by-nc-sa "it")
|
||||
(org-license-cc-by-nc-sa "jp")
|
||||
(org-license-cc-by-nc-sa "nl")
|
||||
(org-license-cc-by-nc-sa "pt")
|
||||
(org-license-cc-by-nc-nd "br")
|
||||
(org-license-cc-by-nc-nd "ca")
|
||||
(org-license-cc-by-nc-nd "de")
|
||||
(org-license-cc-by-nc-nd "es")
|
||||
(org-license-cc-by-nc-nd "en")
|
||||
;; (org-license-cc-by-nc-nd "eo")
|
||||
(org-license-cc-by-nc-nd "eu")
|
||||
(org-license-cc-by-nc-nd "fi")
|
||||
(org-license-cc-by-nc-nd "fr")
|
||||
(org-license-cc-by-nc-nd "gl")
|
||||
(org-license-cc-by-nc-nd "it")
|
||||
(org-license-cc-by-nc-nd "jp")
|
||||
(org-license-cc-by-nc-nd "nl")
|
||||
(org-license-cc-by-nc-nd "pt")
|
||||
)
|
||||
|
||||
|
|
@ -82,8 +82,6 @@ to `directory'."
|
|||
;; in heading - deactivate flyspell
|
||||
(org-remove-flyspell-overlays-in (match-beginning 0)
|
||||
(match-end 0))
|
||||
(add-text-properties (match-beginning 0) (match-end 0)
|
||||
'(org-no-flyspell t))
|
||||
t)
|
||||
;; this is a wiki link
|
||||
(org-remove-flyspell-overlays-in (match-beginning 0)
|
||||
|
|
|
@ -77,8 +77,8 @@
|
|||
;; Initialization
|
||||
|
||||
(eval-when-compile (require 'cl))
|
||||
(org-add-link-type "cite" 'ebib)
|
||||
|
||||
(let ((jump-fn (car (org-remove-if-not #'fboundp '(ebib obe-goto-citation)))))
|
||||
(org-add-link-type "cite" jump-fn))
|
||||
|
||||
;;; Internal Functions
|
||||
|
||||
|
@ -284,7 +284,8 @@ Return new parse tree. This function assumes current back-end is HTML."
|
|||
|
||||
(eval-after-load 'ox
|
||||
'(add-to-list 'org-export-filter-parse-tree-functions
|
||||
'org-bibtex-process-bib-files))
|
||||
(lambda (e b i) (when (eql b 'html)
|
||||
(org-bibtex-process-bib-files e b i)))))
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
;; Copyright (C) 2012 Sébastien Delafond
|
||||
|
||||
;; Author: Sébastien Delafond <sdelafond at gmx dot net>
|
||||
;; Author: Sébastien Delafond <sdelafond@gmail.com>
|
||||
;; Keywords: outlines, confluence, wiki
|
||||
|
||||
;; This file is not part of GNU Emacs.
|
||||
|
@ -45,6 +45,7 @@
|
|||
(footnote-reference . org-confluence-empty)
|
||||
(headline . org-confluence-headline)
|
||||
(italic . org-confluence-italic)
|
||||
(item . org-confluence-item)
|
||||
(link . org-confluence-link)
|
||||
(property-drawer . org-confluence-property-drawer)
|
||||
(section . org-confluence-section)
|
||||
|
@ -71,6 +72,11 @@
|
|||
(defun org-confluence-italic (italic contents info)
|
||||
(format "_%s_" contents))
|
||||
|
||||
(defun org-confluence-item (item contents info)
|
||||
(concat (make-string (1+ (org-confluence--li-depth item)) ?\-)
|
||||
" "
|
||||
(org-trim contents)))
|
||||
|
||||
(defun org-confluence-fixed-width (fixed-width contents info)
|
||||
(format "\{\{%s\}\}" contents))
|
||||
|
||||
|
@ -144,6 +150,22 @@
|
|||
contents
|
||||
"\{code\}\n"))
|
||||
|
||||
(defun org-confluence--li-depth (item)
|
||||
"Return depth of a list item; -1 means not a list item"
|
||||
;; FIXME check whether it's worth it to cache depth
|
||||
;; (it gets recalculated quite a few times while
|
||||
;; traversing a list)
|
||||
(let ((depth -1)
|
||||
(tag))
|
||||
(while (and item
|
||||
(setq tag (car item))
|
||||
(or (eq tag 'item) ; list items interleave with plain-list
|
||||
(eq tag 'plain-list)))
|
||||
(when (eq tag 'item)
|
||||
(incf depth))
|
||||
(setq item (org-export-get-parent item)))
|
||||
depth))
|
||||
|
||||
;; main interactive entrypoint
|
||||
(defun org-confluence-export-as-confluence
|
||||
(&optional async subtreep visible-only body-only ext-plist)
|
||||
|
|
|
@ -242,7 +242,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"))))))
|
||||
|
@ -315,7 +315,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))
|
||||
|
|
70
doc/org.texi
70
doc/org.texi
|
@ -1365,7 +1365,7 @@ entries.
|
|||
@vindex org-catch-invisible-edits
|
||||
@cindex edits, catching invisible
|
||||
Sometimes you may inadvertently edit an invisible part of the buffer and be
|
||||
confused on what as been edited and how to undo the mistake. Setting
|
||||
confused on what has been edited and how to undo the mistake. Setting
|
||||
@code{org-catch-invisible-edits} to non-@code{nil} will help prevent this. See the
|
||||
docstring of this option on how Org should catch invisible edits and process
|
||||
them.
|
||||
|
@ -1831,18 +1831,14 @@ or by a custom function.
|
|||
@node Drawers
|
||||
@section Drawers
|
||||
@cindex drawers
|
||||
@cindex #+DRAWERS
|
||||
@cindex visibility cycling, drawers
|
||||
|
||||
@vindex org-drawers
|
||||
@cindex org-insert-drawer
|
||||
@kindex C-c C-x d
|
||||
Sometimes you want to keep information associated with an entry, but you
|
||||
normally don't want to see it. For this, Org mode has @emph{drawers}.
|
||||
Drawers need to be configured with the option @code{org-drawers}@footnote{You
|
||||
can define additional drawers on a per-file basis with a line like
|
||||
@code{#+DRAWERS: HIDDEN STATE}}. They can contain anything but a headline
|
||||
and another drawer. Drawers look like this:
|
||||
normally don't want to see it. For this, Org mode has @emph{drawers}. They
|
||||
can contain anything but a headline and another drawer. Drawers look like
|
||||
this:
|
||||
|
||||
@example
|
||||
** This is a headline
|
||||
|
@ -3876,7 +3872,7 @@ Jump to line 255.
|
|||
Search for a link target @samp{<<My Target>>}, or do a text search for
|
||||
@samp{my target}, similar to the search in internal links, see
|
||||
@ref{Internal links}. In HTML export (@pxref{HTML export}), such a file
|
||||
link will become a HTML reference to the corresponding named anchor in
|
||||
link will become an HTML reference to the corresponding named anchor in
|
||||
the linked file.
|
||||
@item *My Target
|
||||
In an Org file, restrict search to headlines.
|
||||
|
@ -6252,6 +6248,9 @@ switch the date like this:
|
|||
DEADLINE: <2005-11-01 Tue +1m>
|
||||
@end example
|
||||
|
||||
To mark a task with a repeater as @code{DONE}, use @kbd{C-- 1 C-c C-t}
|
||||
(i.e., @code{org-todo} with a numeric prefix argument of -1.)
|
||||
|
||||
@vindex org-log-repeat
|
||||
A timestamp@footnote{You can change this using the option
|
||||
@code{org-log-repeat}, or the @code{#+STARTUP} options @code{logrepeat},
|
||||
|
@ -7337,12 +7336,7 @@ Prompt for a feed name and go to the inbox configured for this feed.
|
|||
|
||||
Under the same headline, Org will create a drawer @samp{FEEDSTATUS} in which
|
||||
it will store information about the status of items in the feed, to avoid
|
||||
adding the same item several times. You should add @samp{FEEDSTATUS} to the
|
||||
list of drawers in that file:
|
||||
|
||||
@example
|
||||
#+DRAWERS: LOGBOOK PROPERTIES FEEDSTATUS
|
||||
@end example
|
||||
adding the same item several times.
|
||||
|
||||
For more information, including how to read atom feeds, see
|
||||
@file{org-feed.el} and the docstring of @code{org-feed-alist}.
|
||||
|
@ -8057,7 +8051,7 @@ You may also test for properties (@pxref{Properties and columns}) at the same
|
|||
time as matching tags. The properties may be real properties, or special
|
||||
properties that represent other metadata (@pxref{Special properties}). For
|
||||
example, the ``property'' @code{TODO} represents the TODO keyword of the
|
||||
entry and the ``propety'' @code{PRIORITY} represents the PRIORITY keyword of
|
||||
entry and the ``property'' @code{PRIORITY} represents the PRIORITY keyword of
|
||||
the entry. The ITEM special property cannot currently be used in tags/property
|
||||
searches@footnote{But @pxref{x-agenda-skip-entry-regexp,
|
||||
,skipping entries based on regexp}.}.
|
||||
|
@ -9634,7 +9628,7 @@ or on a per-file basis with a line like
|
|||
@end example
|
||||
|
||||
If you would like to move the table of contents to a different location, you
|
||||
should turn off the detault table using @code{org-export-with-toc} or
|
||||
should turn off the default table using @code{org-export-with-toc} or
|
||||
@code{#+OPTIONS} and insert @code{#+TOC: headlines N} at the desired
|
||||
location(s).
|
||||
|
||||
|
@ -10875,7 +10869,7 @@ recognized. See @ref{@LaTeX{} and PDF export} for more information.
|
|||
@cindex #+BEAMER_INNER_THEME
|
||||
@cindex #+BEAMER_OUTER_THEME
|
||||
Beamer export introduces a number of keywords to insert code in the
|
||||
document's header. Four control appearance of the presentantion:
|
||||
document's header. Four control appearance of the presentation:
|
||||
@code{#+BEAMER_THEME}, @code{#+BEAMER_COLOR_THEME},
|
||||
@code{#+BEAMER_FONT_THEME}, @code{#+BEAMER_INNER_THEME} and
|
||||
@code{#+BEAMER_OUTER_THEME}. All of them accept optional arguments
|
||||
|
@ -10994,7 +10988,7 @@ Here is a simple example Org document that is intended for Beamer export.
|
|||
@section HTML export
|
||||
@cindex HTML export
|
||||
|
||||
Org mode contains a HTML (XHTML 1.0 strict) exporter with extensive
|
||||
Org mode contains an HTML (XHTML 1.0 strict) exporter with extensive
|
||||
HTML formatting, in ways similar to John Gruber's @emph{markdown}
|
||||
language, but with additional support for tables.
|
||||
|
||||
|
@ -11017,11 +11011,11 @@ language, but with additional support for tables.
|
|||
|
||||
@table @kbd
|
||||
@orgcmd{C-c C-e h h,org-html-export-to-html}
|
||||
Export as a HTML file. For an Org file @file{myfile.org},
|
||||
Export as an HTML file. For an Org file @file{myfile.org},
|
||||
the HTML file will be @file{myfile.html}. The file will be overwritten
|
||||
without warning.
|
||||
@kbd{C-c C-e h o}
|
||||
Export as a HTML file and immediately open it with a browser.
|
||||
Export as an HTML file and immediately open it with a browser.
|
||||
@orgcmd{C-c C-e h H,org-html-export-as-html}
|
||||
Export to a temporary buffer. Do not create a file.
|
||||
@end table
|
||||
|
@ -11048,7 +11042,7 @@ Export to a temporary buffer. Do not create a file.
|
|||
Org can export to various (X)HTML flavors.
|
||||
|
||||
Setting the variable @code{org-html-doctype} allows you to export to different
|
||||
(X)HTML variants. The exported HTML will be adjusted according to the sytax
|
||||
(X)HTML variants. The exported HTML will be adjusted according to the syntax
|
||||
requirements of that variant. You can either set this variable to a doctype
|
||||
string directly, in which case the exporter will try to adjust the syntax
|
||||
automatically, or you can use a ready-made doctype. The ready-made options
|
||||
|
@ -11195,7 +11189,7 @@ includes automatic links created by radio targets (@pxref{Radio
|
|||
targets}). Links to external files will still work if the target file is on
|
||||
the same @i{relative} path as the published Org file. Links to other
|
||||
@file{.org} files will be translated into HTML links under the assumption
|
||||
that a HTML version also exists of the linked file, at the same relative
|
||||
that an HTML version also exists of the linked file, at the same relative
|
||||
path. @samp{id:} links can then be used to jump to specific entries across
|
||||
files. For information related to linking files while publishing them to a
|
||||
publishing directory see @ref{Publishing links}.
|
||||
|
@ -11792,10 +11786,10 @@ attribute. You may set it to:
|
|||
@code{t}: if you want to make the source block a float. It is the default
|
||||
value when a caption is provided.
|
||||
@item
|
||||
@code{mulicolumn}: if you wish to include a source block which spans multiple
|
||||
colums in a page.
|
||||
@code{multicolumn}: if you wish to include a source block which spans multiple
|
||||
columns in a page.
|
||||
@item
|
||||
@code{nil}: if you need to avoid any floating evironment, even when a caption
|
||||
@code{nil}: if you need to avoid any floating environment, even when a caption
|
||||
is provided. It is useful for source code that may not fit in a single page.
|
||||
@end itemize
|
||||
|
||||
|
@ -11857,7 +11851,7 @@ respectively, @code{:width} and @code{:thickness} attributes:
|
|||
@section Markdown export
|
||||
@cindex Markdown export
|
||||
|
||||
@code{md} export back-end generates Markdown syntax@footnote{Vanilla flavour,
|
||||
@code{md} export back-end generates Markdown syntax@footnote{Vanilla flavor,
|
||||
as defined at @url{http://daringfireball.net/projects/markdown/}.} for an Org
|
||||
mode buffer.
|
||||
|
||||
|
@ -12561,13 +12555,13 @@ file. The use of this feature is better illustrated with couple of examples.
|
|||
@enumerate
|
||||
@item Embedding ODT tags as part of regular text
|
||||
|
||||
You can include simple OpenDocument tags by prefixing them with
|
||||
@samp{@@}. For example, to highlight a region of text do the following:
|
||||
You can inline OpenDocument syntax by enclosing it within
|
||||
@samp{@@@@odt:...@@@@} markup. For example, to highlight a region of text do
|
||||
the following:
|
||||
|
||||
@example
|
||||
@@<text:span text:style-name="Highlight">This is a
|
||||
highlighted text@@</text:span>. But this is a
|
||||
regular text.
|
||||
@@@@odt:<text:span text:style-name="Highlight">This is a highlighted
|
||||
text</text:span>@@@@. But this is a regular text.
|
||||
@end example
|
||||
|
||||
@strong{Hint:} To see the above example in action, edit your
|
||||
|
@ -12877,7 +12871,7 @@ you are using. The FAQ covers this issue.
|
|||
@cindex export back-ends, built-in
|
||||
@vindex org-export-backends
|
||||
|
||||
On top of the aforemetioned back-ends, Org comes with other built-in ones:
|
||||
On top of the aforementioned back-ends, Org comes with other built-in ones:
|
||||
|
||||
@itemize
|
||||
@item @file{ox-man.el}: export to a man page.
|
||||
|
@ -12910,8 +12904,8 @@ Convert the selected region into @code{Texinfo}.
|
|||
Convert the selected region into @code{MarkDown}.
|
||||
@end table
|
||||
|
||||
This is particularily useful for converting tables and lists in foreign
|
||||
buffers. E.g., in a HTML buffer, you can turn on @code{orgstruct-mode}, then
|
||||
This is particularly useful for converting tables and lists in foreign
|
||||
buffers. E.g., in an HTML buffer, you can turn on @code{orgstruct-mode}, then
|
||||
use Org commands for editing a list, and finally select and convert the list
|
||||
with @code{M-x org-html-convert-region-to-html RET}.
|
||||
|
||||
|
@ -15858,10 +15852,6 @@ The global version of this variable is
|
|||
@item #+FILETAGS: :tag1:tag2:tag3:
|
||||
Set tags that can be inherited by any entry in the file, including the
|
||||
top-level entries.
|
||||
@item #+DRAWERS: NAME1 .....
|
||||
@vindex org-drawers
|
||||
Set the file-local set of additional drawers. The corresponding global
|
||||
variable is @code{org-drawers}.
|
||||
@item #+LINK: linkword replace
|
||||
@vindex org-link-abbrev-alist
|
||||
These lines (several are allowed) specify link abbreviations.
|
||||
|
@ -17978,7 +17968,7 @@ inspired some of the early development, including HTML export. He also
|
|||
asked for a way to narrow wide table columns.
|
||||
@item
|
||||
@i{Jason Dunsmore} has been maintaining the Org-Mode server at Rackspace for
|
||||
several years now. He also sponsered the hosting costs until Rackspace
|
||||
several years now. He also sponsored the hosting costs until Rackspace
|
||||
started to host us for free.
|
||||
@item
|
||||
@i{Thomas S. Dye} contributed documentation on Worg and helped integrating
|
||||
|
|
16
etc/ORG-NEWS
16
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-<down>=) or backard (=M-<up>=)
|
||||
**** New commands to drag an agenda line forward (=M-<down>=) or backward (=M-<up>=)
|
||||
|
||||
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
|
||||
|
|
34
lisp/ob-C.el
34
lisp/ob-C.el
|
@ -32,10 +32,12 @@
|
|||
;;; Code:
|
||||
(require 'ob)
|
||||
(require 'cc-mode)
|
||||
(eval-when-compile
|
||||
(require 'cl))
|
||||
|
||||
(declare-function org-entry-get "org"
|
||||
(pom property &optional inherit literal-nil))
|
||||
|
||||
(declare-function org-remove-indentation "org" (code &optional n))
|
||||
|
||||
(defvar org-babel-tangle-lang-exts)
|
||||
(add-to-list 'org-babel-tangle-lang-exts '("C++" . "cpp"))
|
||||
|
@ -103,20 +105,22 @@ 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-remove-indentation
|
||||
(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 t)
|
||||
(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
|
||||
|
|
47
lisp/ob-R.el
47
lisp/ob-R.el
|
@ -37,6 +37,7 @@
|
|||
(declare-function ess-eval-buffer "ext:ess-inf" (vis))
|
||||
(declare-function org-number-sequence "org-compat" (from &optional to inc))
|
||||
(declare-function org-remove-if-not "org" (predicate seq))
|
||||
(declare-function org-every "org" (pred seq))
|
||||
|
||||
(defconst org-babel-header-args:R
|
||||
'((width . :any)
|
||||
|
@ -65,7 +66,20 @@
|
|||
(output value graphics))))
|
||||
"R-specific header arguments.")
|
||||
|
||||
(defconst ob-R-safe-header-args
|
||||
(append org-babel-safe-header-args
|
||||
'(:width :height :bg :units :pointsize :antialias :quality
|
||||
:compression :res :type :family :title :fonts
|
||||
:version :paper :encoding :pagecentre :colormodel
|
||||
:useDingbats :horizontal))
|
||||
"Header args which are safe for R babel blocks.
|
||||
|
||||
See `org-babel-safe-header-args' for documentation of the format of
|
||||
this variable.")
|
||||
|
||||
(defvar org-babel-default-header-args:R '())
|
||||
(put 'org-babel-default-header-args:R 'safe-local-variable
|
||||
(org-babel-header-args-safe-fn ob-R-safe-header-args))
|
||||
|
||||
(defcustom org-babel-R-command "R --slave --no-save"
|
||||
"Name of command to use for executing R code."
|
||||
|
@ -85,21 +99,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 +339,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.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -24,30 +24,39 @@
|
|||
|
||||
;;; Commentary:
|
||||
|
||||
;;; support for evaluating clojure code, relies either on slime or
|
||||
;;; on nrepl for all eval
|
||||
;; Support for evaluating clojure code, relies either on Slime or
|
||||
;; on Nrepl.el for all eval.
|
||||
|
||||
;;; Requirements:
|
||||
;; Requirements:
|
||||
|
||||
;;; - clojure (at least 1.2.0)
|
||||
;;; - clojure-mode
|
||||
;;; - either slime or nrepl
|
||||
;; - clojure (at least 1.2.0)
|
||||
;; - clojure-mode
|
||||
;; - either cider or nrepl.el or SLIME
|
||||
|
||||
;;; For SLIME-way, 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
|
||||
;; For cider, see https://github.com/clojure-emacs/cider
|
||||
|
||||
;;; For nREPL-way:
|
||||
;;; get clojure is with https://github.com/technomancy/leiningen
|
||||
;;; get nrepl from MELPA (clojure-mode is a dependency).
|
||||
;; For SLIME, 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
|
||||
|
||||
;; For nREPL:
|
||||
;; get clojure with https://github.com/technomancy/leiningen
|
||||
;; get nrepl from MELPA (clojure-mode is a dependency).
|
||||
|
||||
;;; Code:
|
||||
(require 'ob)
|
||||
(eval-when-compile
|
||||
(require 'cl))
|
||||
|
||||
(declare-function cider-current-ns "ext:cider-interaction" ())
|
||||
(declare-function nrepl-send-string-sync "ext:nrepl-client" (input &optional ns session))
|
||||
(declare-function nrepl-current-tooling-session "ext:nrepl-client" ())
|
||||
|
||||
(declare-function slime-eval "ext:slime" (sexp &optional package))
|
||||
(declare-function nrepl-current-connection-buffer "ext:nrepl" ())
|
||||
(declare-function nrepl-eval "ext:nrepl" (body))
|
||||
|
||||
(declare-function slime-eval "ext:slime" (sexp &optional package))
|
||||
|
||||
(defvar org-babel-tangle-lang-exts)
|
||||
(add-to-list 'org-babel-tangle-lang-exts '("clojure" . "clj"))
|
||||
|
||||
|
@ -57,7 +66,10 @@
|
|||
(defcustom org-babel-clojure-backend 'nrepl
|
||||
"Backend used to evaluate Clojure code blocks."
|
||||
:group 'org-babel
|
||||
:type 'symbol)
|
||||
:type '(choice
|
||||
(const :tag "cider" cider)
|
||||
(const :tag "nrepl" nrepl)
|
||||
(const :tag "SLIME" slime)))
|
||||
|
||||
(defun org-babel-expand-body:clojure (body params)
|
||||
"Expand BODY according to PARAMS, return the expanded body."
|
||||
|
@ -88,31 +100,36 @@
|
|||
"Execute a block of Clojure code with Babel."
|
||||
(let ((expanded (org-babel-expand-body:clojure body params)))
|
||||
(case org-babel-clojure-backend
|
||||
(slime
|
||||
(require 'slime)
|
||||
(with-temp-buffer
|
||||
(insert expanded)
|
||||
((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))))))
|
||||
(cider
|
||||
(require 'cider)
|
||||
(or (nth 1 (nrepl-send-string-sync
|
||||
(format "(clojure.pprint/pprint %s)" expanded)
|
||||
(cider-current-ns)
|
||||
(nrepl-current-tooling-session)))
|
||||
(error "nREPL not connected! Use M-x cider-jack-in RET")))
|
||||
(nrepl
|
||||
(require 'nrepl)
|
||||
(if (nrepl-current-connection-buffer)
|
||||
(let* ((result (nrepl-eval expanded))
|
||||
(s (plist-get result :stdout))
|
||||
(r (plist-get result :value)))
|
||||
(if s (concat s "\n" r) r))
|
||||
(error "nREPL not connected! Use M-x nrepl-jack-in."))))))
|
||||
(let* ((result (nrepl-eval expanded))
|
||||
(s (plist-get result :stdout))
|
||||
(r (plist-get result :value)))
|
||||
(if s (concat s "\n" r) r))
|
||||
(error "nREPL not connected! Use M-x nrepl-jack-in RET")))
|
||||
(slime
|
||||
(require 'slime)
|
||||
(with-temp-buffer
|
||||
(insert expanded)
|
||||
((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)))))))))
|
||||
|
||||
(provide 'ob-clojure)
|
||||
|
||||
|
||||
|
||||
;;; ob-clojure.el ends here
|
||||
|
|
|
@ -48,12 +48,13 @@ BUFFER is checked with `org-babel-comint-buffer-livep'. BODY is
|
|||
executed inside the protection of `save-excursion' and
|
||||
`save-match-data'."
|
||||
(declare (indent 1))
|
||||
`(save-excursion
|
||||
`(progn
|
||||
(unless (org-babel-comint-buffer-livep ,buffer)
|
||||
(error "Buffer %s does not exist or has no process" ,buffer))
|
||||
(save-match-data
|
||||
(unless (org-babel-comint-buffer-livep ,buffer)
|
||||
(error "Buffer %s does not exist or has no process" ,buffer))
|
||||
(set-buffer ,buffer)
|
||||
,@body)))
|
||||
(with-current-buffer ,buffer
|
||||
(let ((comint-input-filter (lambda (input) nil)))
|
||||
,@body)))))
|
||||
(def-edebug-spec org-babel-comint-in-buffer (form body))
|
||||
|
||||
(defmacro org-babel-comint-with-output (meta &rest body)
|
||||
|
@ -69,46 +70,42 @@ elements are optional.
|
|||
This macro ensures that the filter is removed in case of an error
|
||||
or user `keyboard-quit' during execution of body."
|
||||
(declare (indent 1))
|
||||
(let ((buffer (car meta))
|
||||
(eoe-indicator (cadr meta))
|
||||
(remove-echo (cadr (cdr meta)))
|
||||
(full-body (cadr (cdr (cdr meta)))))
|
||||
(let ((buffer (nth 0 meta))
|
||||
(eoe-indicator (nth 1 meta))
|
||||
(remove-echo (nth 2 meta))
|
||||
(full-body (nth 3 meta)))
|
||||
`(org-babel-comint-in-buffer ,buffer
|
||||
(let ((string-buffer "") dangling-text raw)
|
||||
;; setup filter
|
||||
(setq comint-output-filter-functions
|
||||
(let* ((string-buffer "")
|
||||
(comint-output-filter-functions
|
||||
(cons (lambda (text) (setq string-buffer (concat string-buffer text)))
|
||||
comint-output-filter-functions))
|
||||
(unwind-protect
|
||||
(progn
|
||||
;; got located, and save dangling text
|
||||
(goto-char (process-mark (get-buffer-process (current-buffer))))
|
||||
(let ((start (point))
|
||||
(end (point-max)))
|
||||
(setq dangling-text (buffer-substring start end))
|
||||
(delete-region start end))
|
||||
;; pass FULL-BODY to process
|
||||
,@body
|
||||
;; wait for end-of-evaluation indicator
|
||||
(while (progn
|
||||
(goto-char comint-last-input-end)
|
||||
(not (save-excursion
|
||||
(and (re-search-forward
|
||||
(regexp-quote ,eoe-indicator) nil t)
|
||||
(re-search-forward
|
||||
comint-prompt-regexp nil t)))))
|
||||
(accept-process-output (get-buffer-process (current-buffer)))
|
||||
;; thought the following this would allow async
|
||||
;; background running, but I was wrong...
|
||||
;; (run-with-timer .5 .5 'accept-process-output
|
||||
;; (get-buffer-process (current-buffer)))
|
||||
)
|
||||
;; replace cut dangling text
|
||||
(goto-char (process-mark (get-buffer-process (current-buffer))))
|
||||
(insert dangling-text))
|
||||
;; remove filter
|
||||
(setq comint-output-filter-functions
|
||||
(cdr comint-output-filter-functions)))
|
||||
dangling-text raw)
|
||||
;; got located, and save dangling text
|
||||
(goto-char (process-mark (get-buffer-process (current-buffer))))
|
||||
(let ((start (point))
|
||||
(end (point-max)))
|
||||
(setq dangling-text (buffer-substring start end))
|
||||
(delete-region start end))
|
||||
;; pass FULL-BODY to process
|
||||
,@body
|
||||
;; wait for end-of-evaluation indicator
|
||||
(while (progn
|
||||
(goto-char comint-last-input-end)
|
||||
(not (save-excursion
|
||||
(and (re-search-forward
|
||||
(regexp-quote ,eoe-indicator) nil t)
|
||||
(re-search-forward
|
||||
comint-prompt-regexp nil t)))))
|
||||
(accept-process-output (get-buffer-process (current-buffer)))
|
||||
;; thought the following this would allow async
|
||||
;; background running, but I was wrong...
|
||||
;; (run-with-timer .5 .5 'accept-process-output
|
||||
;; (get-buffer-process (current-buffer)))
|
||||
)
|
||||
;; replace cut dangling text
|
||||
(goto-char (process-mark (get-buffer-process (current-buffer))))
|
||||
(insert dangling-text)
|
||||
|
||||
;; remove echo'd FULL-BODY from input
|
||||
(if (and ,remove-echo ,full-body
|
||||
(string-match
|
||||
|
|
396
lisp/ob-core.el
396
lisp/ob-core.el
|
@ -38,6 +38,7 @@
|
|||
(defvar org-src-lang-modes)
|
||||
(defvar org-babel-library-of-babel)
|
||||
(declare-function show-all "outline" ())
|
||||
(declare-function org-remove-indentation "org" (code &optional n))
|
||||
(declare-function org-reduce "org" (CL-FUNC CL-SEQ &rest CL-KEYS))
|
||||
(declare-function org-mark-ring-push "org" (&optional pos buffer))
|
||||
(declare-function tramp-compat-make-temp-file "tramp-compat"
|
||||
|
@ -96,6 +97,7 @@
|
|||
(declare-function org-table-to-lisp "org-table" (&optional txt))
|
||||
(declare-function org-reverse-string "org" (string))
|
||||
(declare-function org-element-context "org-element" (&optional ELEMENT))
|
||||
(declare-function org-every "org" (pred seq))
|
||||
|
||||
(defgroup org-babel nil
|
||||
"Code block evaluation and management in `org-mode' documents."
|
||||
|
@ -158,6 +160,11 @@ See also `org-babel-noweb-wrap-start'."
|
|||
This string must include a \"%s\" which will be replaced by the results."
|
||||
:group 'org-babel
|
||||
:type 'string)
|
||||
(put 'org-babel-inline-result-wrap
|
||||
'safe-local-variable
|
||||
(lambda (value)
|
||||
(and (stringp value)
|
||||
(string-match-p "%s" value))))
|
||||
|
||||
(defun org-babel-noweb-wrap (&optional regexp)
|
||||
(concat org-babel-noweb-wrap-start
|
||||
|
@ -211,7 +218,7 @@ not match KEY should be returned."
|
|||
(lambda (p) (when (funcall (if others #'not #'identity) (eq (car p) key)) p))
|
||||
params)))
|
||||
|
||||
(defun org-babel-get-inline-src-block-matches()
|
||||
(defun org-babel-get-inline-src-block-matches ()
|
||||
"Set match data if within body of an inline source block.
|
||||
Returns non-nil if match-data set"
|
||||
(let ((src-at-0-p (save-excursion
|
||||
|
@ -234,7 +241,7 @@ Returns non-nil if match-data set"
|
|||
t ))))))
|
||||
|
||||
(defvar org-babel-inline-lob-one-liner-regexp)
|
||||
(defun org-babel-get-lob-one-liner-matches()
|
||||
(defun org-babel-get-lob-one-liner-matches ()
|
||||
"Set match data if on line of an lob one liner.
|
||||
Returns non-nil if match-data set"
|
||||
(save-excursion
|
||||
|
@ -271,6 +278,7 @@ Returns a list
|
|||
(setq name (org-no-properties (match-string 3)))))
|
||||
;; inline source block
|
||||
(when (org-babel-get-inline-src-block-matches)
|
||||
(setq head (match-beginning 0))
|
||||
(setq info (org-babel-parse-inline-src-block-match))))
|
||||
;; resolve variable references and add summary parameters
|
||||
(when (and info (not light))
|
||||
|
@ -321,7 +329,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)
|
||||
|
@ -480,14 +488,55 @@ then run `org-babel-switch-to-session'."
|
|||
Note that individual languages may define their own language
|
||||
specific header arguments as well.")
|
||||
|
||||
(defconst org-babel-safe-header-args
|
||||
'(:cache :colnames :comments :exports :epilogue :hlines :noeval
|
||||
:noweb :noweb-ref :noweb-sep :padline :prologue :rownames
|
||||
:sep :session :tangle :wrap
|
||||
(:eval . ("never" "query"))
|
||||
(:results . (lambda (str) (not (string-match "file" str)))))
|
||||
"A list of safe header arguments for babel source blocks.
|
||||
|
||||
The list can have entries of the following forms:
|
||||
- :ARG -> :ARG is always a safe header arg
|
||||
- (:ARG . (VAL1 VAL2 ...)) -> :ARG is safe as a header arg if it is
|
||||
`equal' to one of the VALs.
|
||||
- (:ARG . FN) -> :ARG is safe as a header arg if the function FN
|
||||
returns non-nil. FN is passed one
|
||||
argument, the value of the header arg
|
||||
(as a string).")
|
||||
|
||||
(defmacro org-babel-header-args-safe-fn (safe-list)
|
||||
"Return a function that determines whether a list of header args are safe.
|
||||
|
||||
Intended usage is:
|
||||
\(put 'org-babel-default-header-args 'safe-local-variable
|
||||
(org-babel-header-args-safe-p org-babel-safe-header-args)
|
||||
|
||||
This allows org-babel languages to extend the list of safe values for
|
||||
their `org-babel-default-header-args:foo' variable.
|
||||
|
||||
For the format of SAFE-LIST, see `org-babel-safe-header-args'."
|
||||
`(lambda (value)
|
||||
(and (listp value)
|
||||
(org-every
|
||||
(lambda (pair)
|
||||
(and (consp pair)
|
||||
(org-babel-one-header-arg-safe-p pair ,safe-list)))
|
||||
value))))
|
||||
|
||||
(defvar org-babel-default-header-args
|
||||
'((:session . "none") (:results . "replace") (:exports . "code")
|
||||
(:cache . "no") (:noweb . "no") (:hlines . "no") (:tangle . "no"))
|
||||
"Default arguments to use when evaluating a source block.")
|
||||
(put 'org-babel-default-header-args 'safe-local-variable
|
||||
(org-babel-header-args-safe-fn org-babel-safe-header-args))
|
||||
|
||||
(defvar org-babel-default-inline-header-args
|
||||
'((:session . "none") (:results . "replace") (:exports . "results"))
|
||||
'((:session . "none") (:results . "replace")
|
||||
(:exports . "results") (:hlines . "yes"))
|
||||
"Default arguments to use when evaluating an inline source block.")
|
||||
(put 'org-babel-default-inline-header-args 'safe-local-variable
|
||||
(org-babel-header-args-safe-fn org-babel-safe-header-args))
|
||||
|
||||
(defvar org-babel-data-names '("tblname" "results" "name"))
|
||||
|
||||
|
@ -568,7 +617,10 @@ block."
|
|||
(let* ((org-babel-current-src-block-location
|
||||
(or org-babel-current-src-block-location
|
||||
(nth 6 info)
|
||||
(org-babel-where-is-src-block-head)))
|
||||
(org-babel-where-is-src-block-head)
|
||||
;; inline src block
|
||||
(and (org-babel-get-inline-src-block-matches)
|
||||
(match-beginning 0))))
|
||||
(info (if info
|
||||
(copy-tree info)
|
||||
(org-babel-get-src-block-info)))
|
||||
|
@ -635,15 +687,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))
|
||||
|
@ -651,7 +702,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
|
||||
|
@ -902,6 +953,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."
|
||||
|
@ -1166,18 +1219,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."
|
||||
|
@ -1402,7 +1455,8 @@ specified in the properties of the current outline entry."
|
|||
(append
|
||||
(org-babel-params-from-properties lang)
|
||||
(list (org-babel-parse-header-arguments
|
||||
(org-no-properties (or (match-string 4) "")))))))))
|
||||
(org-no-properties (or (match-string 4) ""))))))
|
||||
nil)))
|
||||
|
||||
(defun org-babel-balanced-split (string alts)
|
||||
"Split STRING on instances of ALTS.
|
||||
|
@ -1462,9 +1516,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.
|
||||
|
@ -1607,12 +1660,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 ()
|
||||
|
@ -1649,9 +1701,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)
|
||||
|
@ -1772,14 +1823,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.
|
||||
|
@ -1885,7 +1935,10 @@ following the source block."
|
|||
(cond
|
||||
((looking-at (concat org-babel-result-regexp "\n"))
|
||||
(throw 'non-comment t))
|
||||
((looking-at "^[ \t]*#") (end-of-line 1))
|
||||
((and (looking-at "^[ \t]*#")
|
||||
(not (looking-at
|
||||
org-babel-lob-one-liner-regexp)))
|
||||
(end-of-line 1))
|
||||
(t (throw 'non-comment nil))))))
|
||||
(let ((this-hash (match-string 5)))
|
||||
(prog1 (point)
|
||||
|
@ -1923,7 +1976,7 @@ following the source block."
|
|||
((org-at-table-p) (org-babel-read-table))
|
||||
((org-at-item-p) (org-babel-read-list))
|
||||
((looking-at org-bracket-link-regexp) (org-babel-read-link))
|
||||
((looking-at org-block-regexp) (org-babel-trim (match-string 4)))
|
||||
((looking-at org-block-regexp) (org-remove-indentation (match-string 4)))
|
||||
((or (looking-at "^[ \t]*: ") (looking-at "^[ \t]*:$"))
|
||||
(setq result-string
|
||||
(org-babel-trim
|
||||
|
@ -2255,7 +2308,8 @@ file's directory then expand relative links."
|
|||
(if (not (org-babel-where-is-src-block-head))
|
||||
(error "Not in a source block")
|
||||
(save-match-data
|
||||
(replace-match (concat (org-babel-trim new-body) "\n") nil t nil 5))
|
||||
(replace-match (concat (org-babel-trim (org-remove-indentation new-body))
|
||||
"\n") nil t nil 5))
|
||||
(indent-rigidly (match-beginning 5) (match-end 5) 2)))
|
||||
|
||||
(defun org-babel-merge-params (&rest plists)
|
||||
|
@ -2461,7 +2515,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)
|
||||
|
@ -2480,119 +2534,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.
|
||||
|
@ -2698,11 +2751,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)))
|
||||
;; We must apply `expand-file-name' on the whole filename. If we
|
||||
;; would apply it on the local filename only, undesired effects
|
||||
;; like prepending a drive letter on MS Windows could happen.
|
||||
(org-babel-local-file-name (expand-file-name name))))
|
||||
(let ((f (org-babel-local-file-name (expand-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))
|
||||
|
@ -2785,6 +2835,24 @@ of `org-babel-temporary-directory'."
|
|||
|
||||
(add-hook 'kill-emacs-hook 'org-babel-remove-temporary-directory)
|
||||
|
||||
(defun org-babel-one-header-arg-safe-p (pair safe-list)
|
||||
"Determine if the PAIR is a safe babel header arg according to SAFE-LIST.
|
||||
|
||||
For the format of SAFE-LIST, see `org-babel-safe-header-args'."
|
||||
(and (consp pair)
|
||||
(keywordp (car pair))
|
||||
(stringp (cdr pair))
|
||||
(or
|
||||
(memq (car pair) safe-list)
|
||||
(let ((entry (assq (car pair) safe-list)))
|
||||
(and entry
|
||||
(consp entry)
|
||||
(cond ((functionp (cdr entry))
|
||||
(funcall (cdr entry) (cdr pair)))
|
||||
((listp (cdr entry))
|
||||
(member (cdr pair) (cdr entry)))
|
||||
(t nil)))))))
|
||||
|
||||
(provide 'ob-core)
|
||||
|
||||
;; Local variables:
|
||||
|
|
|
@ -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-"))
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
;;; ob-ebnf.el --- org-babel functions for ebnf evaluation
|
||||
|
||||
;; Copyright (C) your name here
|
||||
;; Copyright (C) 2013 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Michael Gauland
|
||||
;; Keywords: literate programming, reproducible research
|
||||
|
@ -36,7 +36,7 @@
|
|||
;;;
|
||||
;;; :style specifies a value in ebnf-style-database. This provides the
|
||||
;;; ability to customise the output. The style can also specify the
|
||||
;;; gramnmar syntax (by setting ebnf-syntax); note that only ebnf,
|
||||
;;; grammar syntax (by setting ebnf-syntax); note that only ebnf,
|
||||
;;; iso-ebnf, and yacc are supported by this file.
|
||||
|
||||
;;; Requirements:
|
||||
|
@ -64,14 +64,13 @@ called by `org-babel-execute-src-block'"
|
|||
(result nil))
|
||||
(with-temp-buffer
|
||||
(when style (ebnf-push-style style))
|
||||
(let
|
||||
((comment-format
|
||||
(cond ((string= ebnf-syntax 'yacc) "/*%s*/")
|
||||
((string= ebnf-syntax 'ebnf) ";%s")
|
||||
((string= ebnf-syntax 'iso-ebnf) "(*%s*)")
|
||||
(t (setq result
|
||||
(format "EBNF error: format %s not supported."
|
||||
ebnf-syntax))))))
|
||||
(let ((comment-format
|
||||
(cond ((string= ebnf-syntax 'yacc) "/*%s*/")
|
||||
((string= ebnf-syntax 'ebnf) ";%s")
|
||||
((string= ebnf-syntax 'iso-ebnf) "(*%s*)")
|
||||
(t (setq result
|
||||
(format "EBNF error: format %s not supported."
|
||||
ebnf-syntax))))))
|
||||
(setq ebnf-eps-prefix dest-dir)
|
||||
(insert (format comment-format (format "[%s" dest-root)))
|
||||
(newline)
|
||||
|
@ -80,8 +79,7 @@ called by `org-babel-execute-src-block'"
|
|||
(insert (format comment-format (format "]%s" dest-root)))
|
||||
(ebnf-eps-buffer)
|
||||
(when style (ebnf-pop-style))))
|
||||
result
|
||||
)))
|
||||
result)))
|
||||
|
||||
(provide 'ob-ebnf)
|
||||
;;; ob-ebnf.el ends here
|
||||
|
|
|
@ -53,25 +53,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)
|
||||
|
||||
|
|
|
@ -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)))
|
||||
|
@ -110,12 +112,14 @@ none ---- do not display either code or results upon export
|
|||
|
||||
Assume point is at the beginning of block's starting line."
|
||||
(interactive)
|
||||
(unless noninteractive (message "org-babel-exp processing..."))
|
||||
(save-excursion
|
||||
(let* ((info (org-babel-get-src-block-info 'light))
|
||||
(line (org-current-line))
|
||||
(lang (nth 0 info))
|
||||
(raw-params (nth 2 info)) hash)
|
||||
;; bail if we couldn't get any info from the block
|
||||
(unless noninteractive
|
||||
(message "org-babel-exp process %s at line %d..." lang line))
|
||||
(when info
|
||||
;; if we're actually going to need the parameters
|
||||
(when (member (cdr (assoc :exports (nth 2 info))) '("both" "results"))
|
||||
|
@ -174,7 +178,9 @@ this template."
|
|||
(end-el (org-element-property :end element)))
|
||||
(case type
|
||||
(inline-src-block
|
||||
(let* ((info (org-babel-parse-inline-src-block-match))
|
||||
(let* ((head (match-beginning 0))
|
||||
(info (append (org-babel-parse-inline-src-block-match)
|
||||
(list nil nil head)))
|
||||
(params (nth 2 info)))
|
||||
(setf (nth 1 info)
|
||||
(if (and (cdr (assoc :noweb params))
|
||||
|
@ -372,7 +378,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)
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
(declare-function org-entry-get "org"
|
||||
(pom property &optional inherit literal-nil))
|
||||
(declare-function org-every "org" (pred seq))
|
||||
(declare-function org-remove-indentation "org" (code &optional n))
|
||||
|
||||
(defvar org-babel-tangle-lang-exts)
|
||||
(add-to-list 'org-babel-tangle-lang-exts '("fortran" . "F90"))
|
||||
|
@ -60,20 +61,21 @@
|
|||
(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-remove-indentation
|
||||
(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
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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}
|
||||
|
|
|
@ -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" ""))
|
||||
|
|
|
@ -75,30 +75,26 @@ 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))
|
||||
result
|
||||
(condition-case nil
|
||||
(if (member "output" (cdr (assoc :result-params params)))
|
||||
;; read printed output using normal org table parsing
|
||||
(let ((tmp-file (org-babel-temp-file "lisp-output-")))
|
||||
(with-temp-file tmp-file (insert result))
|
||||
(org-babel-import-elisp-from-file tmp-file))
|
||||
;; read valued output as lisp
|
||||
(read (org-babel-lisp-vector-to-list result)))
|
||||
(error result))))
|
||||
(funcall (if (member "output" (cdr (assoc :result-params params)))
|
||||
#'car #'cadr)
|
||||
(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 (format org-babel-lisp-dir-fmt dir)
|
||||
(buffer-substring-no-properties
|
||||
(point-min) (point-max)))))
|
||||
(cdr (assoc :package params))))))
|
||||
(let ((result
|
||||
(funcall (if (member "output" (cdr (assoc :result-params params)))
|
||||
#'car #'cadr)
|
||||
(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))
|
||||
result
|
||||
(condition-case nil
|
||||
(read (org-babel-lisp-vector-to-list result))
|
||||
(error result))))
|
||||
(org-babel-pick-name (cdr (assoc :colname-names params))
|
||||
(cdr (assoc :colnames params)))
|
||||
(org-babel-pick-name (cdr (assoc :rowname-names params))
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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 "-> <<return-value>>" 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 "-> <<return-value>>" 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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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."
|
||||
|
|
|
@ -63,6 +63,8 @@
|
|||
(declare-function org-show-context "org" (&optional key))
|
||||
(declare-function org-pop-to-buffer-same-window
|
||||
"org-compat" (&optional buffer-or-name norecord label))
|
||||
(declare-function org-babel-lob-execute "ob-lob" (info))
|
||||
(declare-function org-babel-lob-get-info "ob-lob" nil)
|
||||
|
||||
(defvar org-babel-ref-split-regexp
|
||||
"[ \f\t\n\r\v]*\\(.+?\\)[ \f\t\n\r\v]*=[ \f\t\n\r\v]*\\(.+\\)[ \f\t\n\r\v]*")
|
||||
|
@ -85,7 +87,9 @@ the variable."
|
|||
(cons (intern var)
|
||||
(let ((out (save-excursion
|
||||
(when org-babel-current-src-block-location
|
||||
(goto-char org-babel-current-src-block-location))
|
||||
(goto-char (if (markerp org-babel-current-src-block-location)
|
||||
(marker-position org-babel-current-src-block-location)
|
||||
org-babel-current-src-block-location)))
|
||||
(org-babel-read ref))))
|
||||
(if (equal out ref)
|
||||
(if (string-match "^\".*\"$" ref)
|
||||
|
@ -120,6 +124,7 @@ the variable."
|
|||
(point))
|
||||
(point-max))))
|
||||
|
||||
(defvar org-babel-lob-one-liner-regexp)
|
||||
(defvar org-babel-library-of-babel)
|
||||
(defun org-babel-ref-resolve (ref)
|
||||
"Resolve the reference REF and return its value."
|
||||
|
@ -184,6 +189,11 @@ the variable."
|
|||
(or (looking-at org-babel-src-block-regexp)
|
||||
(looking-at org-babel-multi-line-header-regexp))))
|
||||
(setq type 'source-block))
|
||||
((and (looking-at org-babel-src-name-regexp)
|
||||
(save-excursion
|
||||
(forward-line 1)
|
||||
(looking-at org-babel-lob-one-liner-regexp)))
|
||||
(setq type 'call-line))
|
||||
(t (while (not (setq type (org-babel-ref-at-ref-p)))
|
||||
(forward-line 1)
|
||||
(beginning-of-line)
|
||||
|
@ -199,6 +209,10 @@ the variable."
|
|||
(source-block (org-babel-execute-src-block
|
||||
nil nil (if org-babel-update-intermediate
|
||||
nil params)))
|
||||
(call-line (save-excursion
|
||||
(forward-line 1)
|
||||
(org-babel-lob-execute
|
||||
(org-babel-lob-get-info))))
|
||||
(lob (org-babel-execute-src-block
|
||||
nil lob-info params))
|
||||
(id (org-babel-ref-headline-body)))))
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
133
lisp/ob-sh.el
133
lisp/ob-sh.el
|
@ -38,7 +38,7 @@
|
|||
|
||||
(defvar org-babel-default-header-args:sh '())
|
||||
|
||||
(defvar org-babel-sh-command "sh"
|
||||
(defvar org-babel-sh-command "bash"
|
||||
"Command used to invoke a shell.
|
||||
This will be passed to `shell-command-on-region'")
|
||||
|
||||
|
@ -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."
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -27,8 +27,6 @@
|
|||
|
||||
;;; Code:
|
||||
(require 'org-src)
|
||||
(eval-when-compile
|
||||
(require 'cl))
|
||||
|
||||
(declare-function org-edit-special "org" (&optional arg))
|
||||
(declare-function org-link-escape "org" (text &optional table))
|
||||
|
@ -38,6 +36,7 @@
|
|||
(declare-function org-back-to-heading "org" (invisible-ok))
|
||||
(declare-function org-fill-template "org" (template alist))
|
||||
(declare-function org-babel-update-block-body "org" (new-body))
|
||||
(declare-function org-up-heading-safe "org" ())
|
||||
(declare-function make-directory "files" (dir &optional parents))
|
||||
|
||||
(defcustom org-babel-tangle-lang-exts
|
||||
|
@ -107,11 +106,11 @@ controlled by the :comments header argument."
|
|||
:version "24.1"
|
||||
:type 'string)
|
||||
|
||||
(defcustom org-babel-process-comment-text #'org-babel-trim
|
||||
(defcustom org-babel-process-comment-text #'org-remove-indentation
|
||||
"Function called to process raw Org-mode text collected to be
|
||||
inserted as comments in tangled source-code files. The function
|
||||
should take a single string argument and return a string
|
||||
result. The default value is `org-babel-trim'."
|
||||
result. The default value is `org-remove-indentation'."
|
||||
:group 'org-babel
|
||||
:version "24.1"
|
||||
:type 'function)
|
||||
|
@ -149,16 +148,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."
|
||||
|
@ -179,12 +180,12 @@ used to limit the exported source code blocks by language."
|
|||
(run-hooks 'org-babel-pre-tangle-hook)
|
||||
;; Possibly Restrict the buffer to the current code block
|
||||
(save-restriction
|
||||
(when (equal arg '(4))
|
||||
(let ((head (org-babel-where-is-src-block-head)))
|
||||
(save-excursion
|
||||
(when (equal arg '(4))
|
||||
(let ((head (org-babel-where-is-src-block-head)))
|
||||
(if head
|
||||
(goto-char head)
|
||||
(user-error "Point is not in a source code block"))))
|
||||
(save-excursion
|
||||
(let ((block-counter 0)
|
||||
(org-babel-default-header-args
|
||||
(if target-file
|
||||
|
@ -213,8 +214,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)
|
||||
|
@ -227,9 +228,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)
|
||||
|
@ -331,9 +332,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"))
|
||||
|
@ -355,16 +355,16 @@ that the appropriate major-mode is set. SPEC has the form:
|
|||
insert-comment
|
||||
(org-fill-template org-babel-tangle-comment-format-end link-data)))))
|
||||
|
||||
(defvar org-comment-string) ;; Defined in org.el
|
||||
(defun org-babel-under-commented-heading-p ()
|
||||
"Return t if currently under a commented heading."
|
||||
(if (string-match (concat "^" org-comment-string)
|
||||
(nth 4 (org-heading-components)))
|
||||
(if (let ((hd (nth 4 (org-heading-components))))
|
||||
(and hd (string-match (concat "^" org-comment-string) hd)))
|
||||
t
|
||||
(save-excursion
|
||||
(and (org-up-heading-safe)
|
||||
(org-babel-under-commented-heading-p)))))
|
||||
|
||||
(defvar org-comment-string) ;; Defined in org.el
|
||||
(defun org-babel-tangle-collect-blocks (&optional language tangle-file)
|
||||
"Collect source blocks in the current Org-mode file.
|
||||
Return an association list of source-code block specifications of
|
||||
|
@ -426,11 +426,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"
|
||||
|
@ -442,28 +441,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))))
|
||||
|
@ -498,9 +498,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))))
|
||||
|
|
|
@ -69,6 +69,7 @@
|
|||
(declare-function calendar-persian-date-string "cal-persia" (&optional date))
|
||||
(declare-function calendar-check-holidays "holidays" (date))
|
||||
|
||||
(declare-function org-columns-remove-overlays "org-colview" ())
|
||||
(declare-function org-datetree-find-date-create "org-datetree"
|
||||
(date &optional keep-restriction))
|
||||
(declare-function org-columns-quit "org-colview" ())
|
||||
|
@ -863,7 +864,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 +1420,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 +1748,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 +2841,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.
|
||||
|
@ -3642,7 +3645,6 @@ generating a new one."
|
|||
(or org-agenda-multi (org-agenda-fit-window-to-buffer))
|
||||
(throw 'exit "Sticky Agenda buffer, use `r' to refresh"))
|
||||
(setq org-todo-keywords-for-agenda nil)
|
||||
(setq org-drawers-for-agenda nil)
|
||||
(unless org-agenda-persistent-filter
|
||||
(setq org-agenda-tag-filter nil
|
||||
org-agenda-category-filter nil
|
||||
|
@ -3682,7 +3684,6 @@ generating a new one."
|
|||
(org-uniquify org-todo-keywords-for-agenda))
|
||||
(setq org-done-keywords-for-agenda
|
||||
(org-uniquify org-done-keywords-for-agenda))
|
||||
(setq org-drawers-for-agenda (org-uniquify org-drawers-for-agenda))
|
||||
(setq org-agenda-last-prefix-arg current-prefix-arg)
|
||||
(setq org-agenda-this-buffer-name org-agenda-buffer-name)
|
||||
(and name (not org-agenda-name)
|
||||
|
@ -3817,6 +3818,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
|
||||
|
@ -3985,6 +3988,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.
|
||||
|
@ -4581,7 +4585,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)
|
||||
|
@ -4591,7 +4595,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)
|
||||
|
@ -5449,6 +5453,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?"
|
||||
|
@ -5765,7 +5770,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."
|
||||
|
@ -7083,6 +7087,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
|
||||
|
@ -7532,9 +7537,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
|
||||
|
@ -8627,15 +8634,10 @@ if it was hidden in the outline."
|
|||
(run-hook-with-args 'org-cycle-hook 'subtree))
|
||||
(message "Remote: SUBTREE"))
|
||||
((= more 4)
|
||||
(let* ((org-drawers (delete "LOGBOOK" (copy-sequence org-drawers)))
|
||||
(org-drawer-regexp
|
||||
(concat "^[ \t]*:\\("
|
||||
(mapconcat 'regexp-quote org-drawers "\\|")
|
||||
"\\):[ \t]*$")))
|
||||
(show-subtree)
|
||||
(save-excursion
|
||||
(org-back-to-heading)
|
||||
(org-cycle-hide-drawers 'subtree)))
|
||||
(show-subtree)
|
||||
(save-excursion
|
||||
(org-back-to-heading)
|
||||
(org-cycle-hide-drawers 'subtree '("LOGBOOK")))
|
||||
(message "Remote: SUBTREE AND LOGBOOK"))
|
||||
((> more 4)
|
||||
(show-subtree)
|
||||
|
@ -9150,7 +9152,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
|
||||
|
@ -9916,11 +9918,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))))
|
||||
|
||||
|
@ -9928,11 +9931,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))))
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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"))
|
||||
|
|
|
@ -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)))
|
||||
(hour (nth 2 dt))
|
||||
(day (nth 3 dt)))
|
||||
|
@ -1378,12 +1378,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)))
|
||||
|
@ -1589,7 +1589,7 @@ to, overriding the existing value of `org-clock-out-switch-to-state'."
|
|||
(while (and (< (point) end)
|
||||
(search-forward clock-drawer end t))
|
||||
(goto-char (match-beginning 0))
|
||||
(org-remove-empty-drawer-at clock-drawer (point))
|
||||
(org-remove-empty-drawer-at (point))
|
||||
(forward-line 1))))))
|
||||
|
||||
(defun org-clock-timestamps-up (&optional n)
|
||||
|
@ -1653,12 +1653,12 @@ Optional argument N tells to change by that many units."
|
|||
(setq frame-title-format org-frame-title-format-backup)
|
||||
(force-mode-line-update)
|
||||
(error "No active clock"))
|
||||
(save-excursion ; Do not replace this with `with-current-buffer'.
|
||||
(save-excursion ; Do not replace this with `with-current-buffer'.
|
||||
(org-no-warnings (set-buffer (org-clocking-buffer)))
|
||||
(goto-char org-clock-marker)
|
||||
(if (org-looking-back (concat "^[ \t]*" org-clock-string ".*"))
|
||||
(progn (delete-region (1- (point-at-bol)) (point-at-eol))
|
||||
(org-remove-empty-drawer-at "LOGBOOK" (point)))
|
||||
(org-remove-empty-drawer-at (point)))
|
||||
(message "Clock gone, cancel the timer anyway")
|
||||
(sit-for 2)))
|
||||
(move-marker org-clock-marker nil)
|
||||
|
@ -1873,6 +1873,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
|
||||
|
@ -2145,6 +2146,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
|
||||
|
@ -2754,6 +2756,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."
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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))))
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
1263
lisp/org-element.el
1263
lisp/org-element.el
File diff suppressed because it is too large
Load diff
|
@ -215,10 +215,7 @@ Here are the keyword-value pair allows in `org-feed-alist'.
|
|||
(defcustom org-feed-drawer "FEEDSTATUS"
|
||||
"The name of the drawer for feed status information.
|
||||
Each feed may also specify its own drawer name using the `:drawer'
|
||||
parameter in `org-feed-alist'.
|
||||
Note that in order to make these drawers behave like drawers, they must
|
||||
be added to the variable `org-drawers' or configured with a #+DRAWERS
|
||||
line."
|
||||
parameter in `org-feed-alist'."
|
||||
:group 'org-feed
|
||||
:type '(string :tag "Drawer Name"))
|
||||
|
||||
|
|
|
@ -106,8 +106,18 @@ the notes. However, by hand you may place definitions
|
|||
*anywhere*.
|
||||
|
||||
If this is a string, during export, all subtrees starting with
|
||||
this heading will be ignored."
|
||||
this heading will be ignored.
|
||||
|
||||
If you don't use the customize interface to change this variable,
|
||||
you will need to run the following command after the change:
|
||||
|
||||
\\[universal-argument] \\[org-element-cache-reset]"
|
||||
:group 'org-footnote
|
||||
:initialize 'custom-initialize-default
|
||||
:set (lambda (var val)
|
||||
(set var val)
|
||||
(when (fboundp 'org-element-cache-reset)
|
||||
(org-element-cache-reset 'all)))
|
||||
:type '(choice
|
||||
(string :tag "Collect footnotes under heading")
|
||||
(const :tag "Define footnotes locally" nil)))
|
||||
|
|
|
@ -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.
|
||||
|
||||
|
|
|
@ -107,7 +107,6 @@ When nil, the first star is not shown."
|
|||
|
||||
(defvar org-odd-levels-only)
|
||||
(defvar org-keyword-time-regexp)
|
||||
(defvar org-drawer-regexp)
|
||||
(defvar org-complex-heading-regexp)
|
||||
(defvar org-property-end-re)
|
||||
|
||||
|
@ -315,7 +314,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 ()
|
||||
|
|
|
@ -88,11 +88,11 @@
|
|||
(defvar org-closed-string)
|
||||
(defvar org-deadline-string)
|
||||
(defvar org-description-max-indent)
|
||||
(defvar org-drawers)
|
||||
(defvar org-odd-levels-only)
|
||||
(defvar org-scheduled-string)
|
||||
(defvar org-ts-regexp)
|
||||
(defvar org-ts-regexp-both)
|
||||
(defvar org-drawer-regexp)
|
||||
|
||||
(declare-function outline-invisible-p "outline" (&optional pos))
|
||||
(declare-function outline-flag-region "outline" (from to flag))
|
||||
|
@ -430,9 +430,6 @@ group 4: description tag")
|
|||
(let* ((case-fold-search t)
|
||||
(context (org-list-context))
|
||||
(lim-up (car context))
|
||||
(drawers-re (concat "^[ \t]*:\\("
|
||||
(mapconcat 'regexp-quote org-drawers "\\|")
|
||||
"\\):[ \t]*$"))
|
||||
(inlinetask-re (and (featurep 'org-inlinetask)
|
||||
(org-inlinetask-outline-regexp)))
|
||||
(item-re (org-item-re))
|
||||
|
@ -476,7 +473,7 @@ group 4: description tag")
|
|||
((and (looking-at "^[ \t]*#\\+end_")
|
||||
(re-search-backward "^[ \t]*#\\+begin_" lim-up t)))
|
||||
((and (looking-at "^[ \t]*:END:")
|
||||
(re-search-backward drawers-re lim-up t))
|
||||
(re-search-backward org-drawer-regexp lim-up t))
|
||||
(beginning-of-line))
|
||||
((and inlinetask-re (looking-at inlinetask-re))
|
||||
(org-inlinetask-goto-beginning)
|
||||
|
@ -547,11 +544,7 @@ Contexts `block' and `invalid' refer to `org-list-forbidden-blocks'."
|
|||
(lim-down (or (save-excursion (outline-next-heading)) (point-max))))
|
||||
;; Is point inside a drawer?
|
||||
(let ((end-re "^[ \t]*:END:")
|
||||
;; Can't use org-drawers-regexp as this function might
|
||||
;; be called in buffers not in Org mode.
|
||||
(beg-re (concat "^[ \t]*:\\("
|
||||
(mapconcat 'regexp-quote org-drawers "\\|")
|
||||
"\\):[ \t]*$")))
|
||||
(beg-re org-drawer-regexp))
|
||||
(when (save-excursion
|
||||
(and (not (looking-at beg-re))
|
||||
(not (looking-at end-re))
|
||||
|
@ -635,9 +628,6 @@ Assume point is at an item."
|
|||
(lim-down (nth 1 context))
|
||||
(text-min-ind 10000)
|
||||
(item-re (org-item-re))
|
||||
(drawers-re (concat "^[ \t]*:\\("
|
||||
(mapconcat 'regexp-quote org-drawers "\\|")
|
||||
"\\):[ \t]*$"))
|
||||
(inlinetask-re (and (featurep 'org-inlinetask)
|
||||
(org-inlinetask-outline-regexp)))
|
||||
(beg-cell (cons (point) (org-get-indentation)))
|
||||
|
@ -700,7 +690,7 @@ Assume point is at an item."
|
|||
((and (looking-at "^[ \t]*#\\+end_")
|
||||
(re-search-backward "^[ \t]*#\\+begin_" lim-up t)))
|
||||
((and (looking-at "^[ \t]*:END:")
|
||||
(re-search-backward drawers-re lim-up t))
|
||||
(re-search-backward org-drawer-regexp lim-up t))
|
||||
(beginning-of-line))
|
||||
((and inlinetask-re (looking-at inlinetask-re))
|
||||
(org-inlinetask-goto-beginning)
|
||||
|
@ -766,7 +756,7 @@ Assume point is at an item."
|
|||
(cond
|
||||
((and (looking-at "^[ \t]*#\\+begin_")
|
||||
(re-search-forward "^[ \t]*#\\+end_" lim-down t)))
|
||||
((and (looking-at drawers-re)
|
||||
((and (looking-at org-drawer-regexp)
|
||||
(re-search-forward "^[ \t]*:END:" lim-down t))))
|
||||
(forward-line 1))))))
|
||||
(setq struct (append itm-lst (cdr (nreverse itm-lst-2)))
|
||||
|
@ -2326,9 +2316,6 @@ in subtree, ignoring drawers."
|
|||
block-item
|
||||
lim-up
|
||||
lim-down
|
||||
(drawer-re (concat "^[ \t]*:\\("
|
||||
(mapconcat 'regexp-quote org-drawers "\\|")
|
||||
"\\):[ \t]*$"))
|
||||
(keyword-re (concat "^[ \t]*\\<\\(" org-scheduled-string
|
||||
"\\|" org-deadline-string
|
||||
"\\|" org-closed-string
|
||||
|
@ -2350,7 +2337,8 @@ in subtree, ignoring drawers."
|
|||
;; time-stamps (scheduled, etc.).
|
||||
(let ((limit (save-excursion (outline-next-heading) (point))))
|
||||
(forward-line 1)
|
||||
(while (or (looking-at drawer-re) (looking-at keyword-re))
|
||||
(while (or (looking-at org-drawer-regexp)
|
||||
(looking-at keyword-re))
|
||||
(if (looking-at keyword-re)
|
||||
(forward-line 1)
|
||||
(re-search-forward "^[ \t]*:END:" limit nil)))
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
;; Author: Nicolas Goaziou <n.goaziou@gmail.com>
|
||||
;; 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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -425,7 +425,7 @@ agenda view showing the flagged items."
|
|||
(def-tags (default-value 'org-tag-alist))
|
||||
(target-file (expand-file-name org-mobile-index-file
|
||||
org-mobile-directory))
|
||||
file link-name todo-kwds done-kwds tags drawers entry kwds dwds twds)
|
||||
file link-name todo-kwds done-kwds tags entry kwds dwds twds)
|
||||
(when (stringp (car def-todo))
|
||||
(setq def-todo (list (cons 'sequence def-todo))))
|
||||
(org-agenda-prepare-buffers (mapcar 'car files-alist))
|
||||
|
@ -433,7 +433,6 @@ agenda view showing the flagged items."
|
|||
(setq todo-kwds (org-delete-all
|
||||
done-kwds
|
||||
(org-uniquify org-todo-keywords-for-agenda)))
|
||||
(setq drawers (org-uniquify org-drawers-for-agenda))
|
||||
(setq tags (mapcar 'car (org-global-tags-completion-table
|
||||
(mapcar 'car files-alist))))
|
||||
(with-temp-file
|
||||
|
@ -468,7 +467,6 @@ agenda view showing the flagged items."
|
|||
(setq tags (sort tags (lambda (a b) (string< (downcase a) (downcase b)))))
|
||||
(setq tags (append def-tags tags nil))
|
||||
(insert "#+TAGS: " (mapconcat 'identity tags " ") "\n")
|
||||
(insert "#+DRAWERS: " (mapconcat 'identity drawers " ") "\n")
|
||||
(insert "#+ALLPRIORITIES: " org-mobile-allpriorities "\n")
|
||||
(when (file-exists-p (expand-file-name
|
||||
org-mobile-directory "agendas.org"))
|
||||
|
|
|
@ -363,25 +363,6 @@ This needs more work, to handle headings with lots of spaces in them."
|
|||
lst))
|
||||
(substring pcomplete-stub 1)))
|
||||
|
||||
(defvar org-drawers)
|
||||
|
||||
(defun pcomplete/org-mode/drawer ()
|
||||
"Complete a drawer name."
|
||||
(let ((spc (save-excursion
|
||||
(move-beginning-of-line 1)
|
||||
(looking-at "^\\([ \t]*\\):")
|
||||
(match-string 1)))
|
||||
(cpllist (mapcar (lambda (x) (concat x ": ")) org-drawers)))
|
||||
(pcomplete-here cpllist
|
||||
(substring pcomplete-stub 1)
|
||||
(unless (or (not (delq
|
||||
nil
|
||||
(mapcar (lambda(x)
|
||||
(string-match (substring pcomplete-stub 1) x))
|
||||
cpllist)))
|
||||
(looking-at "[ \t]*\n.*:END:"))
|
||||
(save-excursion (insert "\n" spc ":END:"))))))
|
||||
|
||||
(defun pcomplete/org-mode/block-option/src ()
|
||||
"Complete the arguments of a begin_src block.
|
||||
Complete a language in the first field, the header arguments and switches."
|
||||
|
|
|
@ -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"
|
||||
|
@ -753,14 +753,14 @@ with \",*\", \",#+\", \",,*\" and \",,#+\"."
|
|||
(kill-buffer buffer))
|
||||
(goto-char beg)
|
||||
(when allow-write-back-p
|
||||
(let ((buffer-undo-list t))
|
||||
(delete-region beg (max beg end))
|
||||
(unless (string-match "\\`[ \t]*\\'" code)
|
||||
(insert code))
|
||||
;; Make sure the overlay stays in place
|
||||
(undo-boundary)
|
||||
(delete-region beg (max beg end))
|
||||
(unless (string-match "\\`[ \t]*\\'" code)
|
||||
(insert code))
|
||||
;; Make sure the overlay stays in place
|
||||
(when (eq context 'save) (move-overlay ovl beg (point)))
|
||||
(goto-char beg)
|
||||
(if single (just-one-space))))
|
||||
(goto-char beg)
|
||||
(if single (just-one-space)))
|
||||
(if (memq t (mapcar (lambda (overlay)
|
||||
(eq (overlay-get overlay 'invisible)
|
||||
'org-hide-block))
|
||||
|
@ -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)
|
||||
|
||||
|
|
|
@ -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
|
||||
|
@ -921,6 +921,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."
|
||||
|
@ -934,6 +935,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."
|
||||
|
@ -1205,6 +1207,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)
|
||||
|
@ -3016,6 +3019,8 @@ known that the table will be realigned a little later anyway."
|
|||
;; Insert constants in all formulas
|
||||
(setq eqlist
|
||||
(mapcar (lambda (x)
|
||||
(if (string-match "^@-?I+" (car x))
|
||||
(user-error "Can't assign to hline relative reference"))
|
||||
(when (string-match "\\`$[<>]" (car x))
|
||||
(setq lhs1 (car x))
|
||||
(setq x (cons (substring
|
||||
|
@ -4136,7 +4141,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
|
||||
|
|
1560
lisp/org.el
1560
lisp/org.el
File diff suppressed because it is too large
Load diff
171
lisp/ox-ascii.el
171
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 <n.goaziou at gmail dot com>
|
||||
;; 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
|
||||
|
@ -336,7 +338,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:
|
||||
|
@ -347,63 +350,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)
|
||||
|
||||
|
||||
|
@ -489,7 +461,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
|
||||
|
@ -710,7 +682,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
|
||||
|
@ -748,7 +720,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
|
||||
|
@ -1071,11 +1043,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
|
||||
|
@ -1228,55 +1196,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
|
||||
|
|
|
@ -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 <carsten.dominik AT gmail DOT com>
|
||||
;; Nicolas Goaziou <n.goaziou AT gmail DOT com>
|
||||
;; 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
|
||||
|
|
|
@ -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 <carsten at orgmode dot org>
|
||||
;; Jambunathan K <kjambunathan at gmail dot com>
|
||||
;; 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
|
||||
|
@ -152,7 +154,7 @@
|
|||
\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">")
|
||||
("xhtml-transitional" . "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"
|
||||
\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">")
|
||||
("xhtml-framset" . "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Frameset//EN\"
|
||||
("xhtml-frameset" . "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Frameset//EN\"
|
||||
\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd\">")
|
||||
("xhtml-11" . "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\"
|
||||
\"http://www.w3.org/TR/xhtml1/DTD/xhtml11.dtd\">")
|
||||
|
@ -185,7 +187,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
|
||||
|
@ -382,7 +384,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
|
||||
|
@ -543,6 +545,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))
|
||||
|
@ -564,7 +568,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:
|
||||
|
@ -576,10 +581,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
|
||||
|
@ -621,7 +626,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:
|
||||
|
@ -633,6 +638,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
|
||||
|
@ -648,7 +655,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:
|
||||
|
@ -661,6 +668,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
|
||||
|
@ -1118,6 +1127,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
|
||||
|
@ -1971,33 +1982,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 "<a href=\"#%s\">%s</a>"
|
||||
;; 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.
|
||||
|
@ -2237,7 +2259,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)))
|
||||
|
@ -2364,9 +2386,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
|
||||
|
@ -3074,7 +3096,7 @@ CONTENTS is the contents of the object. INFO is a plist holding
|
|||
contextual information."
|
||||
(format "<sup>%s</sup>" contents))
|
||||
|
||||
;;;; Tabel Cell
|
||||
;;;; Table Cell
|
||||
|
||||
(defun org-html-table-cell (table-cell contents info)
|
||||
"Transcode a TABLE-CELL element from Org to HTML.
|
||||
|
|
|
@ -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 <carsten at orgmode dot org>
|
||||
;; Nicolas Goaziou <n dot goaziou at gmail dot com>
|
||||
;; 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
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
;; Author: Nicolas Goaziou <n.goaziou at gmail dot com>
|
||||
;; 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
|
||||
|
@ -343,7 +345,8 @@ the toc:nil option, not to those generated with #+TOC keyword."
|
|||
(defcustom org-latex-with-hyperref t
|
||||
"Toggle insertion of \\hypersetup{...} in the preamble."
|
||||
:group 'org-export-latex
|
||||
:type 'boolean)
|
||||
:type 'boolean
|
||||
:safe #'booleanp)
|
||||
|
||||
;;;; Headline
|
||||
|
||||
|
@ -488,12 +491,14 @@ When modifying this variable, it may be useful to change
|
|||
:type '(choice (const :tag "Table" table)
|
||||
(const :tag "Matrix" math)
|
||||
(const :tag "Inline matrix" inline-math)
|
||||
(const :tag "Verbatim" verbatim)))
|
||||
(const :tag "Verbatim" verbatim))
|
||||
:safe (lambda (s) (memq s '(table math inline-math verbatim))))
|
||||
|
||||
(defcustom org-latex-tables-centered t
|
||||
"When non-nil, tables are exported in a center environment."
|
||||
:group 'org-export-latex
|
||||
:type 'boolean)
|
||||
:type 'boolean
|
||||
:safe #'booleanp)
|
||||
|
||||
(defcustom org-latex-tables-booktabs nil
|
||||
"When non-nil, display tables in a formal \"booktabs\" style.
|
||||
|
@ -504,13 +509,15 @@ attributes."
|
|||
:group 'org-export-latex
|
||||
:version "24.4"
|
||||
:package-version '(Org . "8.0")
|
||||
:type 'boolean)
|
||||
:type 'boolean
|
||||
:safe #'booleanp)
|
||||
|
||||
(defcustom org-latex-table-caption-above t
|
||||
"When non-nil, place caption string at the beginning of the table.
|
||||
Otherwise, place it near the end."
|
||||
:group 'org-export-latex
|
||||
:type 'boolean)
|
||||
:type 'boolean
|
||||
:safe #'booleanp)
|
||||
|
||||
(defcustom org-latex-table-scientific-notation "%s\\,(%s)"
|
||||
"Format string to display numbers in scientific notation.
|
||||
|
@ -525,20 +532,6 @@ When nil, no transformation is made."
|
|||
(string :tag "Format string")
|
||||
(const :tag "No formatting")))
|
||||
|
||||
(defcustom org-latex-longtable-continued-on "Continued on next page"
|
||||
"String to indicate table continued on next page."
|
||||
:group 'org-export-latex
|
||||
:version "24.4"
|
||||
:package-version '(Org . "8.0")
|
||||
:type 'string)
|
||||
|
||||
(defcustom org-latex-longtable-continued-from "Continued from previous page"
|
||||
"String to indicate table continued from previous page."
|
||||
:group 'org-export-latex
|
||||
:version "24.4"
|
||||
:package-version '(Org . "8.0")
|
||||
:type 'string)
|
||||
|
||||
;;;; Text markup
|
||||
|
||||
(defcustom org-latex-text-markup-alist '((bold . "\\textbf{%s}")
|
||||
|
@ -568,7 +561,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:
|
||||
|
@ -577,19 +571,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:
|
||||
|
@ -669,8 +660,9 @@ into previewing problems, please consult
|
|||
:group 'org-export-latex
|
||||
:type '(choice
|
||||
(const :tag "Use listings" t)
|
||||
(const :tag "Use minted" 'minted)
|
||||
(const :tag "Export verbatim" nil)))
|
||||
(const :tag "Use minted" minted)
|
||||
(const :tag "Export verbatim" nil))
|
||||
:safe (lambda (s) (memq s '(t nil minted))))
|
||||
|
||||
(defcustom org-latex-listings-langs
|
||||
'((emacs-lisp "Lisp") (lisp "Lisp") (clojure "Lisp")
|
||||
|
@ -1077,6 +1069,11 @@ just outside of it."
|
|||
(funcall search-refs element))
|
||||
""))
|
||||
|
||||
(defun org-latex--translate (s info)
|
||||
"Translate string S according to specified language.
|
||||
INFO is a plist used as a communication channel."
|
||||
(org-export-translate s :latex info))
|
||||
|
||||
|
||||
|
||||
;;; Template
|
||||
|
@ -1224,12 +1221,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)))
|
||||
|
||||
|
||||
|
@ -1337,13 +1330,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)
|
||||
|
@ -1514,7 +1507,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.
|
||||
|
@ -1634,7 +1627,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
|
||||
|
@ -2649,7 +2642,7 @@ a communication channel."
|
|||
(if booktabsp "\\midrule" "\\hline")
|
||||
(cdr (org-export-table-dimensions
|
||||
(org-export-get-parent-table table-row) info))
|
||||
org-latex-longtable-continued-from
|
||||
(org-latex--translate "Continued from previous page" info)
|
||||
(cond ((and booktabsp (memq 'top borders)) "\\toprule\n")
|
||||
((and (memq 'top borders)
|
||||
(memq 'above borders)) "\\hline\n")
|
||||
|
@ -2660,7 +2653,7 @@ a communication channel."
|
|||
;; Number of columns.
|
||||
(cdr (org-export-table-dimensions
|
||||
(org-export-get-parent-table table-row) info))
|
||||
org-latex-longtable-continued-on))
|
||||
(org-latex--translate "Continued on next page" info)))
|
||||
;; When BOOKTABS are activated enforce bottom rule even when
|
||||
;; no hline was specifically marked.
|
||||
((and booktabsp (memq 'bottom borders)) "\\bottomrule")
|
||||
|
@ -2903,9 +2896,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)))))
|
||||
|
|
|
@ -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 <n.goaziou@gmail.com>
|
||||
;; 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,7 +22,7 @@
|
|||
|
||||
;;; Commentary:
|
||||
|
||||
;; This library implements a Markdown back-end (vanilla flavour) for
|
||||
;; This library implements a Markdown back-end (vanilla flavor) for
|
||||
;; Org exporter, based on `html' back-end. See Org manual for more
|
||||
;; information.
|
||||
|
||||
|
|
|
@ -224,7 +224,7 @@ standard Emacs.")
|
|||
(defconst org-odt-table-style-format
|
||||
"
|
||||
<style:style style:name=\"%s\" style:family=\"table\">
|
||||
<style:table-properties style:rel-width=\"%d%%\" fo:margin-top=\"0cm\" fo:margin-bottom=\"0.20cm\" table:align=\"center\"/>
|
||||
<style:table-properties style:rel-width=\"%s%%\" fo:margin-top=\"0cm\" fo:margin-bottom=\"0.20cm\" table:align=\"center\"/>
|
||||
</style:style>
|
||||
"
|
||||
"Template for auto-generated Table styles.")
|
||||
|
@ -450,7 +450,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.
|
||||
|
@ -499,7 +499,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
|
||||
|
@ -597,7 +598,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.
|
||||
|
||||
|
@ -646,7 +647,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:
|
||||
|
@ -655,21 +657,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:
|
||||
|
@ -688,7 +685,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:
|
||||
|
@ -747,6 +744,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")))
|
||||
|
||||
|
@ -758,6 +757,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")))
|
||||
|
||||
|
@ -920,7 +921,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
|
||||
|
@ -930,6 +931,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)
|
||||
|
||||
|
||||
|
@ -1437,7 +1440,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
|
||||
|
@ -1457,7 +1460,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
|
||||
|
@ -1620,12 +1623,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))
|
||||
|
||||
|
||||
|
@ -1722,7 +1721,7 @@ CONTENTS is nil. INFO is a plist holding contextual information."
|
|||
(and (eq (org-element-type prev) 'footnote-reference)
|
||||
(format "<text:span text:style-name=\"%s\">%s</text:span>"
|
||||
"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))
|
||||
|
@ -1806,10 +1805,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))))
|
||||
|
@ -1932,9 +1931,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
|
||||
|
@ -2196,7 +2195,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<text:bookmark text:name=\"%s\"/>" label)
|
||||
;; Label definition: Typically formatted as below:
|
||||
;; CATEGORY SEQ-NO: LONG CAPTION
|
||||
|
@ -2343,7 +2342,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.
|
||||
|
@ -2373,7 +2371,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
|
||||
|
@ -2411,7 +2409,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)
|
||||
|
@ -2615,12 +2613,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."
|
||||
|
@ -2709,7 +2707,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))
|
||||
|
@ -2722,7 +2720,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)))
|
||||
|
@ -3114,9 +3112,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.
|
||||
|
||||
|
@ -3126,12 +3124,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
|
||||
|
|
|
@ -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 <n.goaziou@gmail.com>
|
||||
;; 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
|
||||
|
@ -85,6 +87,7 @@ setting of `org-html-htmlize-output-type' is 'css."
|
|||
(line-break . org-org-identity)
|
||||
(link . org-org-identity)
|
||||
(node-property . org-org-identity)
|
||||
(template . org-org-template)
|
||||
(paragraph . org-org-identity)
|
||||
(plain-list . org-org-identity)
|
||||
(planning . org-org-identity)
|
||||
|
@ -130,22 +133,62 @@ 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)
|
||||
"Transcode KEYWORD element back into Org syntax.
|
||||
CONTENTS is nil. INFO is ignored. This function ignores
|
||||
keywords targeted at other export back-ends."
|
||||
(unless (member (org-element-property :key keyword)
|
||||
(mapcar
|
||||
(lambda (block-cons)
|
||||
(and (eq (cdr block-cons) 'org-element-export-block-parser)
|
||||
(car block-cons)))
|
||||
org-element-block-name-alist))
|
||||
(org-element-keyword-interpreter keyword nil)))
|
||||
(let ((key (org-element-property :key keyword)))
|
||||
(unless (or (member key
|
||||
(mapcar
|
||||
(lambda (block-cons)
|
||||
(and (eq (cdr block-cons)
|
||||
'org-element-export-block-parser)
|
||||
(car block-cons)))
|
||||
org-element-block-name-alist))
|
||||
(member key
|
||||
'("AUTHOR" "CREATOR" "DATE" "DESCRIPTION" "EMAIL"
|
||||
"KEYWORDS" "TITLE")))
|
||||
(org-element-keyword-interpreter keyword nil))))
|
||||
|
||||
(defun org-org-template (contents info)
|
||||
"Return Org document template with document keywords.
|
||||
CONTENTS is the transcoded contents string. INFO is a plist used
|
||||
as a communication channel."
|
||||
(concat
|
||||
(and (plist-get info :time-stamp-file)
|
||||
(format-time-string "# Created %Y-%m-%d %a %H:%M\n"))
|
||||
(format "#+TITLE: %s\n" (org-export-data (plist-get info :title) info))
|
||||
(and (plist-get info :with-date)
|
||||
(let ((date (org-export-data (org-export-get-date info) info)))
|
||||
(and (org-string-nw-p date)
|
||||
(format "#+DATE: %s\n" date))))
|
||||
(and (plist-get info :with-author)
|
||||
(let ((author (org-export-data (plist-get info :author) info)))
|
||||
(and (org-string-nw-p author)
|
||||
(format "#+AUTHOR: %s\n" author))))
|
||||
(and (plist-get info :with-email)
|
||||
(let ((email (org-export-data (plist-get info :email) info)))
|
||||
(and (org-string-nw-p email)
|
||||
(format "#+EMAIL: %s\n" email))))
|
||||
(and (eq (plist-get info :with-creator) t)
|
||||
(org-string-nw-p (plist-get info :creator))
|
||||
(format "#+CREATOR: %s\n" (plist-get info :creator)))
|
||||
(and (org-string-nw-p (plist-get info :keywords))
|
||||
(format "#+KEYWORDS: %s\n" (plist-get info :keywords)))
|
||||
(and (org-string-nw-p (plist-get info :description))
|
||||
(format "#+DESCRIPTION: %s\n" (plist-get info :description)))
|
||||
contents
|
||||
(and (eq (plist-get info :with-creator) 'comment)
|
||||
(org-string-nw-p (plist-get info :creator))
|
||||
(format "\n# %s\n" (plist-get info :creator)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun org-org-export-as-org (&optional async subtreep visible-only ext-plist)
|
||||
(defun org-org-export-as-org
|
||||
(&optional async subtreep visible-only body-only ext-plist)
|
||||
"Export current buffer to an Org buffer.
|
||||
|
||||
If narrowing is active in the current buffer, only export its
|
||||
|
@ -164,6 +207,9 @@ first.
|
|||
When optional argument VISIBLE-ONLY is non-nil, don't export
|
||||
contents of hidden elements.
|
||||
|
||||
When optional argument BODY-ONLY is non-nil, strip document
|
||||
keywords from output.
|
||||
|
||||
EXT-PLIST, when provided, is a property list with external
|
||||
parameters overriding Org default settings, but still inferior to
|
||||
file-local settings.
|
||||
|
@ -173,10 +219,11 @@ be displayed when `org-export-show-temporary-export-buffer' is
|
|||
non-nil."
|
||||
(interactive)
|
||||
(org-export-to-buffer 'org "*Org ORG Export*"
|
||||
async subtreep visible-only nil ext-plist (lambda () (org-mode))))
|
||||
async subtreep visible-only body-only ext-plist (lambda () (org-mode))))
|
||||
|
||||
;;;###autoload
|
||||
(defun org-org-export-to-org (&optional async subtreep visible-only ext-plist)
|
||||
(defun org-org-export-to-org
|
||||
(&optional async subtreep visible-only body-only ext-plist)
|
||||
"Export current buffer to an org file.
|
||||
|
||||
If narrowing is active in the current buffer, only export its
|
||||
|
@ -195,6 +242,9 @@ first.
|
|||
When optional argument VISIBLE-ONLY is non-nil, don't export
|
||||
contents of hidden elements.
|
||||
|
||||
When optional argument BODY-ONLY is non-nil, strip document
|
||||
keywords from output.
|
||||
|
||||
EXT-PLIST, when provided, is a property list with external
|
||||
parameters overriding Org default settings, but still inferior to
|
||||
file-local settings.
|
||||
|
@ -203,7 +253,7 @@ Return output file name."
|
|||
(interactive)
|
||||
(let ((outfile (org-export-output-file-name ".org" subtreep)))
|
||||
(org-export-to-file 'org outfile
|
||||
async subtreep visible-only nil ext-plist)))
|
||||
async subtreep visible-only body-only ext-plist)))
|
||||
|
||||
;;;###autoload
|
||||
(defun org-org-publish-to-org (plist filename pub-dir)
|
||||
|
|
|
@ -1226,8 +1226,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)
|
||||
|
|
|
@ -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 <jonathan.leechpepin at gmail dot com>
|
||||
;; Keywords: outlines, hypermedia, calendar, wp
|
||||
|
||||
|
@ -144,7 +144,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"))
|
||||
|
@ -203,7 +203,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:
|
||||
|
@ -317,7 +317,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:
|
||||
|
@ -326,18 +327,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:
|
||||
|
@ -411,6 +409,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
|
||||
|
||||
|
@ -696,9 +701,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"
|
||||
|
@ -706,8 +709,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"
|
||||
|
@ -869,12 +881,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
|
||||
|
@ -950,7 +958,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
|
||||
|
@ -986,10 +994,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)
|
||||
|
@ -1023,7 +1031,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)
|
||||
|
@ -1038,7 +1046,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)
|
||||
|
@ -1140,7 +1148,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.
|
||||
|
|
181
lisp/ox.el
181
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 <n.goaziou at gmail dot com>
|
||||
;; 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
|
||||
|
@ -88,6 +90,11 @@
|
|||
(defvar org-table-number-regexp)
|
||||
|
||||
|
||||
(defsubst org-export-get-parent (blob)
|
||||
"Return BLOB parent or nil.
|
||||
BLOB is the element or object considered."
|
||||
(org-element-property :parent blob))
|
||||
|
||||
|
||||
;;; Internal Variables
|
||||
;;
|
||||
|
@ -643,11 +650,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
|
||||
|
@ -655,15 +671,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" {})
|
||||
|
@ -839,15 +854,23 @@ automatically. But you can retrieve them with \\[org-export-stack]."
|
|||
:package-version '(Org . "8.0")
|
||||
:type 'boolean)
|
||||
|
||||
(defcustom org-export-async-init-file user-init-file
|
||||
(defcustom org-export-async-init-file nil
|
||||
"File used to initialize external export process.
|
||||
Value must be an absolute file name. It defaults to user's
|
||||
initialization file. Though, a specific configuration makes the
|
||||
process faster and the export more portable."
|
||||
|
||||
Value must be either nil or an absolute file name. When nil, the
|
||||
external process is launched like a regular Emacs session,
|
||||
loading user's initialization file and any site specific
|
||||
configuration. If a file is provided, it, and only it, is loaded
|
||||
at start-up.
|
||||
|
||||
Therefore, using a specific configuration makes the process to
|
||||
load faster and the export more portable."
|
||||
:group 'org-export-general
|
||||
:version "24.4"
|
||||
:package-version '(Org . "8.0")
|
||||
:type '(file :must-match t))
|
||||
:type '(choice
|
||||
(const :tag "Regular startup" nil)
|
||||
(file :tag "Specific start-up file" :must-match t)))
|
||||
|
||||
(defcustom org-export-dispatch-use-expert-ui nil
|
||||
"Non-nil means using a non-intrusive `org-export-dispatch'.
|
||||
|
@ -1242,7 +1265,7 @@ The back-end could then be called with, for example:
|
|||
;;
|
||||
;; + `:back-end' :: Current back-end used for transcoding.
|
||||
;; - category :: tree
|
||||
;; - type :: symbol
|
||||
;; - type :: structure
|
||||
;;
|
||||
;; + `:creator' :: String to write as creation information.
|
||||
;; - category :: option
|
||||
|
@ -1325,6 +1348,10 @@ The back-end could then be called with, for example:
|
|||
;; - category :: tree
|
||||
;; - type :: list of elements and objects
|
||||
;;
|
||||
;; + `:input-buffer' :: Original buffer name.
|
||||
;; - category :: option
|
||||
;; - type :: string
|
||||
;;
|
||||
;; + `:input-file' :: Full path to input file, if any.
|
||||
;; - category :: option
|
||||
;; - type :: string or nil
|
||||
|
@ -1779,7 +1806,8 @@ Assume buffer is in Org mode. Narrowing, if any, is ignored."
|
|||
"Return properties related to buffer attributes, as a plist."
|
||||
;; Store full path of input file name, or nil. For internal use.
|
||||
(let ((visited-file (buffer-file-name (buffer-base-buffer))))
|
||||
(list :input-file visited-file
|
||||
(list :input-buffer (buffer-name (buffer-base-buffer))
|
||||
:input-file visited-file
|
||||
:title (if (not visited-file) (buffer-name (buffer-base-buffer))
|
||||
(file-name-sans-extension
|
||||
(file-name-nondirectory visited-file))))))
|
||||
|
@ -2891,7 +2919,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'."
|
||||
|
@ -3194,8 +3222,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
|
||||
|
@ -4192,17 +4219,21 @@ ELEMENT is excluded from count."
|
|||
ELEMENT has either a `src-block' an `example-block' type.
|
||||
|
||||
Return a cons cell whose CAR is the source code, cleaned from any
|
||||
reference and protective comma and CDR is an alist between
|
||||
relative line number (integer) and name of code reference on that
|
||||
line (string)."
|
||||
reference, protective commas and spurious indentation, and CDR is
|
||||
an alist between relative line number (integer) and name of code
|
||||
reference on that line (string)."
|
||||
(let* ((line 0) refs
|
||||
(value (org-element-property :value element))
|
||||
;; Get code and clean it. Remove blank lines at its
|
||||
;; beginning and end.
|
||||
(code (replace-regexp-in-string
|
||||
"\\`\\([ \t]*\n\\)+" ""
|
||||
(replace-regexp-in-string
|
||||
"\\([ \t]*\n\\)*[ \t]*\\'" "\n"
|
||||
(org-element-property :value element))))
|
||||
(if (or org-src-preserve-indentation
|
||||
(org-element-property :preserve-indent element))
|
||||
value
|
||||
(org-element-remove-indentation value)))))
|
||||
;; Get format used for references.
|
||||
(label-fmt (regexp-quote
|
||||
(or (org-element-property :label-fmt element)
|
||||
|
@ -4646,7 +4677,7 @@ Returned borders ignore special rows."
|
|||
borders))
|
||||
|
||||
(defun org-export-table-cell-starts-colgroup-p (table-cell info)
|
||||
"Non-nil when TABLE-CELL is at the beginning of a row group.
|
||||
"Non-nil when TABLE-CELL is at the beginning of a column group.
|
||||
INFO is a plist used as a communication channel."
|
||||
;; A cell starts a column group either when it is at the beginning
|
||||
;; of a row (or after the special column, if any) or when it has
|
||||
|
@ -4657,7 +4688,7 @@ INFO is a plist used as a communication channel."
|
|||
(memq 'left (org-export-table-cell-borders table-cell info))))
|
||||
|
||||
(defun org-export-table-cell-ends-colgroup-p (table-cell info)
|
||||
"Non-nil when TABLE-CELL is at the end of a row group.
|
||||
"Non-nil when TABLE-CELL is at the end of a column group.
|
||||
INFO is a plist used as a communication channel."
|
||||
;; A cell ends a column group either when it is at the end of a row
|
||||
;; or when it has a right border.
|
||||
|
@ -4667,7 +4698,7 @@ INFO is a plist used as a communication channel."
|
|||
(memq 'right (org-export-table-cell-borders table-cell info))))
|
||||
|
||||
(defun org-export-table-row-starts-rowgroup-p (table-row info)
|
||||
"Non-nil when TABLE-ROW is at the beginning of a column group.
|
||||
"Non-nil when TABLE-ROW is at the beginning of a row group.
|
||||
INFO is a plist used as a communication channel."
|
||||
(unless (or (eq (org-element-property :type table-row) 'rule)
|
||||
(org-export-table-row-is-special-p table-row info))
|
||||
|
@ -4676,7 +4707,7 @@ INFO is a plist used as a communication channel."
|
|||
(or (memq 'top borders) (memq 'above borders)))))
|
||||
|
||||
(defun org-export-table-row-ends-rowgroup-p (table-row info)
|
||||
"Non-nil when TABLE-ROW is at the end of a column group.
|
||||
"Non-nil when TABLE-ROW is at the end of a row group.
|
||||
INFO is a plist used as a communication channel."
|
||||
(unless (or (eq (org-element-property :type table-row) 'rule)
|
||||
(org-export-table-row-is-special-p table-row info))
|
||||
|
@ -4704,7 +4735,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))
|
||||
|
@ -4951,6 +4982,18 @@ Return a list of src-block elements with a caption."
|
|||
(opening-single-quote :utf-8 "‘" :html "‘" :latex "`" :texinfo "`")
|
||||
(closing-single-quote :utf-8 "’" :html "’" :latex "'" :texinfo "'")
|
||||
(apostrophe :utf-8 "’" :html "’"))
|
||||
("ru"
|
||||
;; http://ru.wikipedia.org/wiki/%D0%9A%D0%B0%D0%B2%D1%8B%D1%87%D0%BA%D0%B8#.D0.9A.D0.B0.D0.B2.D1.8B.D1.87.D0.BA.D0.B8.2C_.D0.B8.D1.81.D0.BF.D0.BE.D0.BB.D1.8C.D0.B7.D1.83.D0.B5.D0.BC.D1.8B.D0.B5_.D0.B2_.D1.80.D1.83.D1.81.D1.81.D0.BA.D0.BE.D0.BC_.D1.8F.D0.B7.D1.8B.D0.BA.D0.B5
|
||||
;; http://www.artlebedev.ru/kovodstvo/sections/104/
|
||||
(opening-double-quote :utf-8 "«" :html "«" :latex "{}<<"
|
||||
:texinfo "@guillemetleft{}")
|
||||
(closing-double-quote :utf-8 "»" :html "»" :latex ">>{}"
|
||||
:texinfo "@guillemetright{}")
|
||||
(opening-single-quote :utf-8 "„" :html "„" :latex "\\glqq{}"
|
||||
:texinfo "@quotedblbase{}")
|
||||
(closing-single-quote :utf-8 "“" :html "“" :latex "\\grqq{}"
|
||||
:texinfo "@quotedblleft{}")
|
||||
(apostrophe :utf-8 "’" :html: "'"))
|
||||
("sv"
|
||||
;; based on https://sv.wikipedia.org/wiki/Citattecken
|
||||
(opening-double-quote :utf-8 "”" :html "”" :latex "’’" :texinfo "’’")
|
||||
|
@ -5126,11 +5169,6 @@ Return the new string."
|
|||
;; `org-export-get-genealogy' returns the full genealogy of a given
|
||||
;; element or object, from closest parent to full parse tree.
|
||||
|
||||
(defsubst org-export-get-parent (blob)
|
||||
"Return BLOB parent or nil.
|
||||
BLOB is the element or object considered."
|
||||
(org-element-property :parent blob))
|
||||
|
||||
(defun org-export-get-genealogy (blob)
|
||||
"Return full genealogy relative to a given element or object.
|
||||
|
||||
|
@ -5183,14 +5221,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
|
||||
|
@ -5218,14 +5253,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
|
||||
|
@ -5272,6 +5304,22 @@ them."
|
|||
("uk" :html "Автор" :utf-8 "Автор")
|
||||
("zh-CN" :html "作者" :utf-8 "作者")
|
||||
("zh-TW" :html "作者" :utf-8 "作者"))
|
||||
("Continued from previous page"
|
||||
("de" :default "Fortsetzung von vorheriger Seite")
|
||||
("es" :default "Continúa de la página anterior")
|
||||
("fr" :default "Suite de la page précédente")
|
||||
("it" :default "Continua da pagina precedente")
|
||||
("ja" :utf-8 "前ページから続く")
|
||||
("nl" :default "Vervolg van vorige pagina")
|
||||
("pt" :default "Continuação da página anterior"))
|
||||
("Continued on next page"
|
||||
("de" :default "Fortsetzung nächste Seite")
|
||||
("es" :default "Continúa en la siguiente página")
|
||||
("fr" :default "Suite page suivante")
|
||||
("it" :default "Continua alla pagina successiva")
|
||||
("ja" :utf-8 "次ページに続く")
|
||||
("nl" :default "Vervolg op volgende pagina")
|
||||
("pt" :default "Continua na página seguinte"))
|
||||
("Date"
|
||||
("ca" :default "Data")
|
||||
("cs" :default "Datum")
|
||||
|
@ -5380,8 +5428,8 @@ them."
|
|||
("es" :default "Listado de programa %d")
|
||||
("et" :default "Loend %d")
|
||||
("fr" :default "Programme %d :" :html "Programme %d :")
|
||||
("no" :default "Dataprogram")
|
||||
("nb" :default "Dataprogram")
|
||||
("no" :default "Dataprogram %d")
|
||||
("nb" :default "Dataprogram %d")
|
||||
("zh-CN" :html "代码%d " :utf-8 "代码%d "))
|
||||
("See section %s"
|
||||
("da" :default "jævnfør afsnit %s")
|
||||
|
@ -5389,7 +5437,7 @@ them."
|
|||
("es" :default "vea seccion %s")
|
||||
("et" :html "Vaata peatükki %s" :utf-8 "Vaata peatükki %s")
|
||||
("fr" :default "cf. section %s")
|
||||
("zh-CN" :html "参见第%d节" :utf-8 "参见第%s节"))
|
||||
("zh-CN" :html "参见第%s节" :utf-8 "参见第%s节"))
|
||||
("Table"
|
||||
("de" :default "Tabelle")
|
||||
("es" :default "Tabla")
|
||||
|
@ -5544,12 +5592,17 @@ and `org-export-to-file' for more specialized functions."
|
|||
(let* ((process-connection-type nil)
|
||||
(,proc-buffer (generate-new-buffer-name "*Org Export Process*"))
|
||||
(,process
|
||||
(start-process
|
||||
"org-export-process" ,proc-buffer
|
||||
(expand-file-name invocation-name invocation-directory)
|
||||
"-Q" "--batch"
|
||||
"-l" org-export-async-init-file
|
||||
"-l" ,temp-file)))
|
||||
(apply
|
||||
#'start-process
|
||||
(append
|
||||
(list "org-export-process"
|
||||
,proc-buffer
|
||||
(expand-file-name invocation-name invocation-directory)
|
||||
"--batch")
|
||||
(if org-export-async-init-file
|
||||
(list "-Q" "-l" org-export-async-init-file)
|
||||
(list "-l" user-init-file))
|
||||
(list "-l" ,temp-file)))))
|
||||
;; Register running process in stack.
|
||||
(org-export-add-to-stack (get-buffer ,proc-buffer) nil ,process)
|
||||
;; Set-up sentinel in order to catch results.
|
||||
|
@ -5916,7 +5969,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.
|
||||
|
@ -5924,7 +5977,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.
|
||||
|
|
|
@ -39,8 +39,9 @@ BTEST_POST =
|
|||
# -L <path-to>/ert # needed for Emacs23, Emacs24 has ert built in
|
||||
# -L <path-to>/ess # needed for running R tests
|
||||
# -L <path-to>/htmlize # need at least version 1.34 for source code formatting
|
||||
BTEST_OB_LANGUAGES = awk C fortran maxima lilypond octave python sh perl
|
||||
BTEST_OB_LANGUAGES = awk C fortran maxima lilypond octave perl python
|
||||
# R # requires ESS to be installed and configured
|
||||
# ruby # requires inf-ruby to be installed and configured
|
||||
# extra packages to require for testing
|
||||
BTEST_EXTRA =
|
||||
# ess-site # load ESS for R tests
|
||||
|
@ -50,17 +51,26 @@ BTEST_EXTRA =
|
|||
|
||||
# How to run tests
|
||||
req-ob-lang = --eval '(require '"'"'ob-$(ob-lang))'
|
||||
lst-ob-lang = ($(ob-lang) . t)
|
||||
req-extra = --eval '(require '"'"'$(req))'
|
||||
BTEST_RE ?= \\(org\\|ob\\)
|
||||
BTEST = $(BATCH) \
|
||||
$(BTEST_PRE) \
|
||||
--eval '(add-to-list '"'"'load-path "./lisp")' \
|
||||
--eval '(add-to-list '"'"'load-path "./testing")' \
|
||||
--eval '(add-to-list '"'"'load-path (concat default-directory "lisp"))' \
|
||||
--eval '(add-to-list '"'"'load-path (concat default-directory "testing"))' \
|
||||
$(BTEST_POST) \
|
||||
-l org-batch-test-init \
|
||||
--eval '(setq \
|
||||
org-batch-test t \
|
||||
org-babel-load-languages \
|
||||
(quote ($(foreach ob-lang,$(BTEST_OB_LANGUAGES) emacs-lisp sh org,$(lst-ob-lang)))) \
|
||||
org-test-select-re "$(BTEST_RE)" \
|
||||
)' \
|
||||
-l org-loaddefs.el \
|
||||
-l testing/org-test.el \
|
||||
$(foreach ob-lang,$(BTEST_OB_LANGUAGES),$(req-ob-lang)) \
|
||||
-l cl -l testing/org-test.el \
|
||||
-l ert -l org -l ox \
|
||||
$(foreach req,$(BTEST_EXTRA),$(req-extra)) \
|
||||
--eval '(setq org-confirm-babel-evaluate nil)'
|
||||
--eval '(org-test-run-batch-tests org-test-select-re)'
|
||||
|
||||
# Using emacs in batch mode.
|
||||
# BATCH = $(EMACS) -batch -vanilla # XEmacs
|
||||
|
|
|
@ -35,7 +35,7 @@ endif
|
|||
|
||||
CONF_BASE = EMACS DESTDIR ORGCM ORG_MAKE_DOC
|
||||
CONF_DEST = lispdir infodir datadir testdir
|
||||
CONF_TEST = BTEST_PRE BTEST_POST BTEST_OB_LANGUAGES BTEST_EXTRA
|
||||
CONF_TEST = BTEST_PRE BTEST_POST BTEST_OB_LANGUAGES BTEST_EXTRA BTEST_RE
|
||||
CONF_EXEC = CP MKDIR RM RMR FIND SUDO PDFTEX TEXI2PDF TEXI2HTML MAKEINFO INSTALL_INFO
|
||||
CONF_CALL = BATCH BATCHL ELC ELCDIR BTEST MAKE_LOCAL_MK MAKE_ORG_INSTALL MAKE_ORG_VERSION
|
||||
config-eol:: EOL = \#
|
||||
|
@ -94,15 +94,10 @@ compile compile-dirty::
|
|||
all clean-install::
|
||||
$(foreach dir, $(SUBDIRS), $(MAKE) -C $(dir) $@;)
|
||||
|
||||
check test single-test:: compile
|
||||
check test:: compile
|
||||
check test test-dirty::
|
||||
-$(MKDIR) $(testdir)
|
||||
TMPDIR=$(testdir) $(BTEST) -f org-test-run-batch-tests
|
||||
|
||||
single-test single-test-dirty::
|
||||
-$(MKDIR) $(testdir)
|
||||
TMPDIR=$(testdir) $(BTEST) --eval "(org-test-load)" --eval "(ert '$(TEST))"
|
||||
|
||||
TMPDIR=$(testdir) $(BTEST)
|
||||
ifeq ($(TEST_NO_AUTOCLEAN),) # define this variable to leave $(testdir) around for inspection
|
||||
$(MAKE) cleantest
|
||||
endif
|
||||
|
|
|
@ -413,6 +413,9 @@ Note: Just export of a property can be done with a macro: {{{property(a)}}}.
|
|||
|
||||
**** function definition
|
||||
|
||||
comments for ":var":
|
||||
- The "or" is to deal with a property not present.
|
||||
- The t is to get property inheritance.
|
||||
#+NAME: src_block_location_shell
|
||||
#+HEADER: :var a=(or (org-entry-get org-babel-current-src-block-location "a" t) "0")
|
||||
#+HEADER: :var b=(or (org-entry-get org-babel-current-src-block-location "b" t) "0")
|
||||
|
@ -433,6 +436,11 @@ Note: Just export of a property can be done with a macro: {{{property(a)}}}.
|
|||
#+HEADER: :var e='nil
|
||||
#+BEGIN_SRC emacs-lisp :exports results
|
||||
(setq
|
||||
;; - The first `or' together with ":var <var>='nil" is to check for
|
||||
;; a value bound from an optional call argument, in the examples
|
||||
;; here: c=5, e=6
|
||||
;; - The second `or' is to deal with a property not present
|
||||
;; - The t is to get property inheritance
|
||||
a (or a (string-to-number
|
||||
(or (org-entry-get org-babel-current-src-block-location "a" t)
|
||||
"0")))
|
||||
|
|
|
@ -99,7 +99,10 @@
|
|||
|
||||
(ert-deftest test-org-babel/default-inline-header-args ()
|
||||
(should(equal
|
||||
'((:session . "none") (:results . "replace") (:exports . "results"))
|
||||
'((:session . "none")
|
||||
(:results . "replace")
|
||||
(:exports . "results")
|
||||
(:hlines . "yes"))
|
||||
org-babel-default-inline-header-args)))
|
||||
|
||||
(ert-deftest ob-test/org-babel-combine-header-arg-lists ()
|
||||
|
@ -1181,6 +1184,27 @@ echo \"$data\"
|
|||
(list (org-get-indentation)
|
||||
(progn (forward-line) (org-get-indentation)))))))
|
||||
|
||||
(ert-deftest test-ob/safe-header-args ()
|
||||
"Detect safe and unsafe header args."
|
||||
(let ((safe-args '((:cache . "foo")
|
||||
(:results . "output")
|
||||
(:eval . "never")
|
||||
(:eval . "query")))
|
||||
(unsafe-args '((:eval . "yes")
|
||||
(:results . "output file")
|
||||
(:foo . "bar")))
|
||||
(malformed-args '((bar . "foo")
|
||||
("foo" . "bar")
|
||||
:foo))
|
||||
(safe-p (org-babel-header-args-safe-fn org-babel-safe-header-args)))
|
||||
(dolist (arg safe-args)
|
||||
(should (org-babel-one-header-arg-safe-p arg org-babel-safe-header-args)))
|
||||
(dolist (arg unsafe-args)
|
||||
(should (not (org-babel-one-header-arg-safe-p arg org-babel-safe-header-args))))
|
||||
(dolist (arg malformed-args)
|
||||
(should (not (org-babel-one-header-arg-safe-p arg org-babel-safe-header-args))))
|
||||
(should (not (funcall safe-p (append safe-args unsafe-args))))))
|
||||
|
||||
(provide 'test-ob)
|
||||
|
||||
;;; test-ob ends here
|
||||
|
|
|
@ -239,7 +239,11 @@ Some other text
|
|||
;; Ignore case.
|
||||
(should
|
||||
(org-test-with-temp-text "#+call: test()"
|
||||
(org-element-map (org-element-parse-buffer) 'babel-call 'identity))))
|
||||
(org-element-map (org-element-parse-buffer) 'babel-call 'identity)))
|
||||
;; Handle non-empty blank line at the end of buffer.
|
||||
(should
|
||||
(org-test-with-temp-text "#+CALL: test()\n "
|
||||
(= (org-element-property :end (org-element-at-point)) (point-max)))))
|
||||
|
||||
|
||||
;;;; Bold
|
||||
|
@ -276,8 +280,12 @@ Some other text
|
|||
;; Ignore incomplete block.
|
||||
(should-not
|
||||
(org-test-with-temp-text "#+BEGIN_CENTER"
|
||||
(org-element-map
|
||||
(org-element-parse-buffer) 'center-block 'identity nil t))))
|
||||
(org-element-map (org-element-parse-buffer) 'center-block
|
||||
'identity nil t)))
|
||||
;; Handle non-empty blank line at the end of buffer.
|
||||
(should
|
||||
(org-test-with-temp-text "#+BEGIN_CENTER\nC\n#+END_CENTER\n "
|
||||
(= (org-element-property :end (org-element-at-point)) (point-max)))))
|
||||
|
||||
|
||||
;;;; Clock
|
||||
|
@ -285,9 +293,8 @@ Some other text
|
|||
(ert-deftest test-org-element/clock-parser ()
|
||||
"Test `clock' parser."
|
||||
;; Running clock.
|
||||
(let* ((org-clock-string "CLOCK:")
|
||||
(clock (org-test-with-temp-text "CLOCK: [2012-01-01 sun. 00:01]"
|
||||
(org-element-at-point))))
|
||||
(let ((clock (org-test-with-temp-text "CLOCK: [2012-01-01 sun. 00:01]"
|
||||
(org-element-at-point))))
|
||||
(should (eq (org-element-property :status clock) 'running))
|
||||
(should
|
||||
(equal (org-element-property :raw-value
|
||||
|
@ -295,11 +302,10 @@ Some other text
|
|||
"[2012-01-01 sun. 00:01]"))
|
||||
(should-not (org-element-property :duration clock)))
|
||||
;; Closed clock.
|
||||
(let* ((org-clock-string "CLOCK:")
|
||||
(clock
|
||||
(org-test-with-temp-text
|
||||
"CLOCK: [2012-01-01 sun. 00:01]--[2012-01-01 sun. 00:02] => 0:01"
|
||||
(org-element-at-point))))
|
||||
(let ((clock
|
||||
(org-test-with-temp-text
|
||||
"CLOCK: [2012-01-01 sun. 00:01]--[2012-01-01 sun. 00:02] => 0:01"
|
||||
(org-element-at-point))))
|
||||
(should (eq (org-element-property :status clock) 'closed))
|
||||
(should (equal (org-element-property :raw-value
|
||||
(org-element-property :value clock))
|
||||
|
@ -360,15 +366,19 @@ Some other text
|
|||
(should
|
||||
(eq 1
|
||||
(org-test-with-temp-text "#+keyword: value\n# comment\n#+keyword: value"
|
||||
(length (org-element-map
|
||||
(org-element-parse-buffer) 'comment 'identity)))))
|
||||
(length (org-element-map (org-element-parse-buffer) 'comment
|
||||
'identity)))))
|
||||
(should
|
||||
(equal "comment"
|
||||
(org-test-with-temp-text "#+keyword: value\n# comment\n#+keyword: value"
|
||||
(org-element-property
|
||||
:value
|
||||
(org-element-map
|
||||
(org-element-parse-buffer) 'comment 'identity nil t))))))
|
||||
(org-element-map (org-element-parse-buffer) 'comment
|
||||
'identity nil t)))))
|
||||
;; Correctly handle non-empty blank lines at the end of buffer.
|
||||
(should
|
||||
(org-test-with-temp-text "# A\n "
|
||||
(= (org-element-property :end (org-element-at-point)) (point-max)))))
|
||||
|
||||
|
||||
;;;; Comment Block
|
||||
|
@ -378,18 +388,20 @@ Some other text
|
|||
;; Standard test.
|
||||
(should
|
||||
(org-test-with-temp-text "#+BEGIN_COMMENT\nText\n#+END_COMMENT"
|
||||
(org-element-map
|
||||
(org-element-parse-buffer) 'comment-block 'identity)))
|
||||
(org-element-map (org-element-parse-buffer) 'comment-block 'identity)))
|
||||
;; Ignore case.
|
||||
(should
|
||||
(org-test-with-temp-text "#+begin_comment\nText\n#+end_comment"
|
||||
(org-element-map
|
||||
(org-element-parse-buffer) 'comment-block 'identity)))
|
||||
(org-element-map (org-element-parse-buffer) 'comment-block 'identity)))
|
||||
;; Ignore incomplete block.
|
||||
(should-not
|
||||
(org-test-with-temp-text "#+BEGIN_COMMENT"
|
||||
(org-element-map
|
||||
(org-element-parse-buffer) 'comment-block 'identity nil t))))
|
||||
(org-element-map (org-element-parse-buffer) 'comment-block
|
||||
'identity nil t)))
|
||||
;; Handle non-empty blank line at the end of buffer.
|
||||
(should
|
||||
(org-test-with-temp-text "#+BEGIN_COMMENT\nC\n#+END_COMMENT\n "
|
||||
(= (org-element-property :end (org-element-at-point)) (point-max)))))
|
||||
|
||||
|
||||
;;;; Diary Sexp
|
||||
|
@ -406,7 +418,11 @@ Some other text
|
|||
(should-not
|
||||
(eq 'diary-sexp
|
||||
(org-test-with-temp-text " %%(org-bbdb-anniversaries)"
|
||||
(org-element-type (org-element-at-point))))))
|
||||
(org-element-type (org-element-at-point)))))
|
||||
;; Handle non-empty blank line at the end of buffer.
|
||||
(should
|
||||
(org-test-with-temp-text "%%(org-bbdb-anniversaries)\n "
|
||||
(= (org-element-property :end (org-element-at-point)) (point-max)))))
|
||||
|
||||
|
||||
;;;; Drawer
|
||||
|
@ -415,21 +431,20 @@ Some other text
|
|||
"Test `drawer' parser."
|
||||
;; Standard test.
|
||||
(should
|
||||
(let ((org-drawers '("TEST")))
|
||||
(org-test-with-temp-text ":TEST:\nText\n:END:"
|
||||
(org-element-map (org-element-parse-buffer) 'drawer 'identity))))
|
||||
(org-test-with-temp-text ":TEST:\nText\n:END:"
|
||||
(org-element-map (org-element-parse-buffer) 'drawer 'identity)))
|
||||
;; Do not mix regular drawers and property drawers.
|
||||
(should-not
|
||||
(let ((org-drawers '("PROPERTIES")))
|
||||
(org-test-with-temp-text ":PROPERTIES:\n:prop: value\n:END:"
|
||||
(org-element-map
|
||||
(org-element-parse-buffer) 'drawer 'identity nil t))))
|
||||
(org-test-with-temp-text ":PROPERTIES:\n:prop: value\n:END:"
|
||||
(org-element-map (org-element-parse-buffer) 'drawer 'identity nil t)))
|
||||
;; Ignore incomplete drawer.
|
||||
(should-not
|
||||
(let ((org-drawers '("TEST")))
|
||||
(org-test-with-temp-text ":TEST:"
|
||||
(org-element-map
|
||||
(org-element-parse-buffer) 'drawer 'identity nil t)))))
|
||||
(org-test-with-temp-text ":TEST:"
|
||||
(org-element-map (org-element-parse-buffer) 'drawer 'identity nil t)))
|
||||
;; Handle non-empty blank line at the end of buffer.
|
||||
(should
|
||||
(org-test-with-temp-text ":TEST:\nC\n:END:\n "
|
||||
(= (org-element-property :end (org-element-at-point)) (point-max)))))
|
||||
|
||||
|
||||
;;;; Dynamic Block
|
||||
|
@ -449,8 +464,12 @@ Some other text
|
|||
;; Ignore incomplete block.
|
||||
(should-not
|
||||
(org-test-with-temp-text "#+BEGIN: myblock :param1 val1 :param2 val2"
|
||||
(org-element-map
|
||||
(org-element-parse-buffer) 'dynamic-block 'identity nil t))))
|
||||
(org-element-map (org-element-parse-buffer) 'dynamic-block
|
||||
'identity nil t)))
|
||||
;; Handle non-empty blank line at the end of buffer.
|
||||
(should
|
||||
(org-test-with-temp-text "#+BEGIN: myblock :param val1\nC\n#+END:\n "
|
||||
(= (org-element-property :end (org-element-at-point)) (point-max)))))
|
||||
|
||||
|
||||
;;;; Entity
|
||||
|
@ -504,16 +523,8 @@ Some other text
|
|||
(org-test-with-temp-text
|
||||
"#+BEGIN_EXAMPLE\n,* Headline\n ,#+keyword\nText\n#+END_EXAMPLE"
|
||||
(org-element-property :value (org-element-at-point)))))
|
||||
;; Nil `org-src-preserve-indentation': Remove maximum common
|
||||
;; indentation.
|
||||
(should
|
||||
(equal " L1\nL2\n"
|
||||
(org-test-with-temp-text "#+BEGIN_EXAMPLE\n L1\n L2\n#+END_EXAMPLE"
|
||||
(let ((org-src-preserve-indentation nil))
|
||||
(org-element-property :value (org-element-at-point))))))
|
||||
;; Non-nil `org-src-preserve-indentation': Remove block indentation
|
||||
;; only, unless block contents are less indented than block
|
||||
;; boundaries.
|
||||
;; Remove block indentation according to block boundaries, unless
|
||||
;; block contents are less indented than block boundaries.
|
||||
(should
|
||||
(equal " L1\nL2\n"
|
||||
(org-test-with-temp-text " #+BEGIN_EXAMPLE\n L1\n L2\n #+END_EXAMPLE"
|
||||
|
@ -524,7 +535,11 @@ Some other text
|
|||
" L1\n L2\n"
|
||||
(org-test-with-temp-text " #+BEGIN_EXAMPLE\n L1\n L2\n #+END_EXAMPLE"
|
||||
(let ((org-src-preserve-indentation t))
|
||||
(org-element-property :value (org-element-at-point)))))))
|
||||
(org-element-property :value (org-element-at-point))))))
|
||||
;; Handle non-empty blank line at the end of buffer.
|
||||
(should
|
||||
(org-test-with-temp-text "#+BEGIN_EXAMPLE\nC\n#+END_EXAMPLE\n "
|
||||
(= (org-element-property :end (org-element-at-point)) (point-max)))))
|
||||
|
||||
(ert-deftest test-org-element/block-switches ()
|
||||
"Test `example-block' and `src-block' switches parsing."
|
||||
|
@ -654,20 +669,23 @@ Some other text
|
|||
'export-block 'identity)))
|
||||
;; Ignore case.
|
||||
(should
|
||||
(org-test-with-temp-text "#+begin_latex\nText\n#+end_latex"
|
||||
(org-element-map
|
||||
(let ((org-element-block-name-alist
|
||||
'(("LATEX" . org-element-export-block-parser))))
|
||||
(org-element-parse-buffer))
|
||||
'export-block 'identity)))
|
||||
(let ((org-element-block-name-alist
|
||||
'(("LATEX" . org-element-export-block-parser))))
|
||||
(org-test-with-temp-text "#+begin_latex\nText\n#+end_latex"
|
||||
(org-element-map (org-element-parse-buffer) 'export-block 'identity))))
|
||||
;; Ignore incomplete block.
|
||||
(should-not
|
||||
(org-test-with-temp-text "#+BEGIN_LATEX"
|
||||
(org-element-map
|
||||
(let ((org-element-block-name-alist
|
||||
'(("LATEX" . org-element-export-block-parser))))
|
||||
(org-element-parse-buffer))
|
||||
'export-block 'identity nil t))))
|
||||
(let ((org-element-block-name-alist
|
||||
'(("LATEX" . org-element-export-block-parser))))
|
||||
(org-test-with-temp-text "#+BEGIN_LATEX"
|
||||
(org-element-map (org-element-parse-buffer) 'export-block
|
||||
'identity nil t))))
|
||||
;; Handle non-empty blank line at the end of buffer.
|
||||
(should
|
||||
(let ((org-element-block-name-alist
|
||||
'(("LATEX" . org-element-export-block-parser))))
|
||||
(org-test-with-temp-text "#+BEGIN_LATEX\nC\n#+END_LATEX\n "
|
||||
(= (org-element-property :end (org-element-at-point)) (point-max))))))
|
||||
|
||||
|
||||
;;;; Export Snippet
|
||||
|
@ -687,7 +705,7 @@ Some other text
|
|||
|
||||
;;;; Fixed Width
|
||||
|
||||
(ert-deftest test-org-element/fixed-width ()
|
||||
(ert-deftest test-org-element/fixed-width-parser ()
|
||||
"Test fixed-width area parsing."
|
||||
;; Preserve indentation.
|
||||
(should
|
||||
|
@ -709,8 +727,11 @@ Some other text
|
|||
- Item
|
||||
: fixed-width inside
|
||||
: fixed-width outside"
|
||||
(org-element-map
|
||||
(org-element-parse-buffer) 'fixed-width 'identity))))))
|
||||
(org-element-map (org-element-parse-buffer) 'fixed-width 'identity)))))
|
||||
;; Handle non-empty blank line at the end of buffer.
|
||||
(should
|
||||
(org-test-with-temp-text ": A\n "
|
||||
(= (org-element-property :end (org-element-at-point)) (point-max)))))
|
||||
|
||||
|
||||
;;;; Footnote Definition
|
||||
|
@ -737,8 +758,11 @@ Some other text
|
|||
(should
|
||||
(= 9
|
||||
(org-test-with-temp-text "[fn:1]\n\n Body"
|
||||
(org-element-property :contents-begin
|
||||
(org-element-at-point))))))
|
||||
(org-element-property :contents-begin (org-element-at-point)))))
|
||||
;; Handle non-empty blank line at the end of buffer.
|
||||
(should
|
||||
(org-test-with-temp-text "[fn:1] Definition\n "
|
||||
(= (org-element-property :end (org-element-at-point)) (point-max)))))
|
||||
|
||||
|
||||
;;;; Footnotes Reference.
|
||||
|
@ -858,25 +882,29 @@ Some other text
|
|||
(ert-deftest test-org-element/headline-archive-tag ()
|
||||
"Test ARCHIVE tag recognition."
|
||||
;; Reference test.
|
||||
(org-test-with-temp-text "* Headline"
|
||||
(let ((org-archive-tag "ARCHIVE"))
|
||||
(should-not (org-element-property :archivedp (org-element-at-point)))))
|
||||
(should-not
|
||||
(org-test-with-temp-text "* Headline"
|
||||
(let ((org-archive-tag "ARCHIVE"))
|
||||
(org-element-property :archivedp (org-element-at-point)))))
|
||||
;; Single tag.
|
||||
(org-test-with-temp-text "* Headline :ARCHIVE:"
|
||||
(let ((org-archive-tag "ARCHIVE"))
|
||||
(let ((headline (org-element-at-point)))
|
||||
(should (org-element-property :archivedp headline))
|
||||
;; Test tag removal.
|
||||
(should-not (org-element-property :tags headline))))
|
||||
(let ((org-archive-tag "Archive"))
|
||||
(should-not (org-element-property :archivedp (org-element-at-point)))))
|
||||
(should-not (org-element-property :tags headline)))))
|
||||
;; Multiple tags.
|
||||
(org-test-with-temp-text "* Headline :test:ARCHIVE:"
|
||||
(let ((org-archive-tag "ARCHIVE"))
|
||||
(let ((headline (org-element-at-point)))
|
||||
(should (org-element-property :archivedp headline))
|
||||
;; Test tag removal.
|
||||
(should (equal (org-element-property :tags headline) '("test")))))))
|
||||
(should (equal (org-element-property :tags headline) '("test"))))))
|
||||
;; Tag is case-sensitive.
|
||||
(should-not
|
||||
(org-test-with-temp-text "* Headline :ARCHIVE:"
|
||||
(let ((org-archive-tag "Archive"))
|
||||
(org-element-property :archivedp (org-element-at-point))))))
|
||||
|
||||
(ert-deftest test-org-element/headline-properties ()
|
||||
"Test properties from property drawer."
|
||||
|
@ -909,7 +937,11 @@ Some other text
|
|||
;; 4 hyphens is too small.
|
||||
(should-not
|
||||
(org-test-with-temp-text "----"
|
||||
(org-element-map (org-element-parse-buffer) 'horizontal-rule 'identity))))
|
||||
(org-element-map (org-element-parse-buffer) 'horizontal-rule 'identity)))
|
||||
;; Handle non-empty blank line at the end of buffer.
|
||||
(should
|
||||
(org-test-with-temp-text "-----\n "
|
||||
(= (org-element-property :end (org-element-at-point)) (point-max)))))
|
||||
|
||||
|
||||
;;;; Inline Babel Call
|
||||
|
@ -1008,7 +1040,11 @@ DEADLINE: <2012-03-29 thu.>"
|
|||
:END:
|
||||
*************** END"
|
||||
(forward-line)
|
||||
(org-element-property :foo (org-element-at-point)))))))
|
||||
(org-element-property :foo (org-element-at-point))))
|
||||
;; Handle non-empty blank line at the end of buffer.
|
||||
(should
|
||||
(org-test-with-temp-text "*************** Task\n*************** END\n "
|
||||
(= (org-element-property :end (org-element-at-point)) (point-max)))))))
|
||||
|
||||
|
||||
;;;; Italic
|
||||
|
@ -1074,14 +1110,13 @@ DEADLINE: <2012-03-29 thu.>"
|
|||
(should
|
||||
(equal '(("- item"))
|
||||
(org-test-with-temp-text "- - item"
|
||||
(org-element-map
|
||||
(org-element-parse-buffer) 'paragraph 'org-element-contents))))
|
||||
(org-element-map (org-element-parse-buffer) 'paragraph
|
||||
'org-element-contents))))
|
||||
;; Block in an item: ignore indentation within the block.
|
||||
(should
|
||||
(org-test-with-temp-text "- item\n #+begin_src emacs-lisp\n(+ 1 1)\n #+end_src"
|
||||
(forward-char)
|
||||
(goto-char (org-element-property :end (org-element-at-point)))
|
||||
(eobp))))
|
||||
(= (org-element-property :end (org-element-at-point)) (point-max)))))
|
||||
|
||||
|
||||
;;;; Keyword
|
||||
|
@ -1107,7 +1142,11 @@ Paragraph"
|
|||
(org-element-map (org-element-parse-buffer) 'keyword 'identity)))
|
||||
(should-not
|
||||
(org-test-with-temp-text "#+BEGIN: my-fun\nBody\n#+END:"
|
||||
(org-element-map (org-element-parse-buffer) 'keyword 'identity))))
|
||||
(org-element-map (org-element-parse-buffer) 'keyword 'identity)))
|
||||
;; Handle non-empty blank line at the end of buffer.
|
||||
(should
|
||||
(org-test-with-temp-text "#+KEYWORD: value\n "
|
||||
(= (org-element-property :end (org-element-at-point)) (point-max)))))
|
||||
|
||||
|
||||
;;;; Latex Environment
|
||||
|
@ -1148,7 +1187,11 @@ e^{i\\pi}+1=0
|
|||
(should-not
|
||||
(eq 'latex-environment
|
||||
(org-test-with-temp-text "\\begin{env}{arg} something\nvalue\n\\end{env}"
|
||||
(org-element-type (org-element-at-point))))))
|
||||
(org-element-type (org-element-at-point)))))
|
||||
;; Handle non-empty blank line at the end of buffer.
|
||||
(should
|
||||
(org-test-with-temp-text "\\begin{env}\n\\end{env}\n "
|
||||
(= (org-element-property :end (org-element-at-point)) (point-max)))))
|
||||
|
||||
|
||||
;;;; Latex Fragment
|
||||
|
@ -1401,26 +1444,19 @@ e^{i\\pi}+1=0
|
|||
(should
|
||||
(eq ?#
|
||||
(org-test-with-temp-text "Paragraph\n# Comment"
|
||||
(org-element-map
|
||||
(org-element-parse-buffer) 'paragraph
|
||||
(lambda (p) (char-after (org-element-property :end p)))
|
||||
nil t))))
|
||||
(org-element-map (org-element-parse-buffer) 'paragraph
|
||||
(lambda (p) (char-after (org-element-property :end p)))
|
||||
nil t))))
|
||||
;; Include ill-formed Keywords.
|
||||
(should
|
||||
(org-test-with-temp-text "#+wrong_keyword something"
|
||||
(org-element-map (org-element-parse-buffer) 'paragraph 'identity)))
|
||||
;; Include incomplete-drawers.
|
||||
(should
|
||||
(let ((org-drawers '("TEST")))
|
||||
(org-test-with-temp-text ":TEST:\nParagraph"
|
||||
(let ((elem (org-element-at-point)))
|
||||
(and (eq (org-element-type elem) 'paragraph)
|
||||
(= (point-max) (org-element-property :end elem)))))))
|
||||
;; Include non-existent drawers.
|
||||
(should
|
||||
(let ((org-drawers '("TEST")))
|
||||
(org-test-with-temp-text ":NONAME:"
|
||||
(org-element-map (org-element-parse-buffer) 'paragraph 'identity))))
|
||||
(org-test-with-temp-text ":TEST:\nParagraph"
|
||||
(let ((elem (org-element-at-point)))
|
||||
(and (eq (org-element-type elem) 'paragraph)
|
||||
(= (point-max) (org-element-property :end elem))))))
|
||||
;; Include incomplete blocks.
|
||||
(should
|
||||
(org-test-with-temp-text "#+BEGIN_CENTER\nParagraph"
|
||||
|
@ -1445,7 +1481,11 @@ e^{i\\pi}+1=0
|
|||
(let ((elem (progn (search-forward "item") (org-element-at-point))))
|
||||
(and (eq (org-element-type elem) 'paragraph)
|
||||
(not (org-element-property :attr_latex elem))
|
||||
(/= (org-element-property :begin elem) 1))))))
|
||||
(/= (org-element-property :begin elem) 1)))))
|
||||
;; Handle non-empty blank line at the end of buffer.
|
||||
(should
|
||||
(org-test-with-temp-text "#+BEGIN_CENTER\nC\n#+END_CENTER\n "
|
||||
(= (org-element-property :end (org-element-at-point)) (point-max)))))
|
||||
|
||||
|
||||
;;;; Plain List
|
||||
|
@ -1509,26 +1549,27 @@ Outside list"
|
|||
|
||||
;;;; Property Drawer
|
||||
|
||||
(ert-deftest test-org-element/property-drawer ()
|
||||
(ert-deftest test-org-element/property-drawer-parser ()
|
||||
"Test `property-drawer' parser."
|
||||
;; Standard test.
|
||||
(should
|
||||
(let ((org-drawers '("PROPERTIES")))
|
||||
(org-test-with-temp-text ":PROPERTIES:\n:prop: value\n:END:"
|
||||
(org-element-map
|
||||
(org-element-parse-buffer) 'property-drawer 'identity nil t))))
|
||||
(org-test-with-temp-text ":PROPERTIES:\n:prop: value\n:END:"
|
||||
(org-element-map
|
||||
(org-element-parse-buffer) 'property-drawer 'identity nil t)))
|
||||
;; Do not mix property drawers and regular drawers.
|
||||
(should-not
|
||||
(let ((org-drawers '("TEST")))
|
||||
(org-test-with-temp-text ":TEST:\n:prop: value\n:END:"
|
||||
(org-element-map
|
||||
(org-element-parse-buffer) 'property-drawer 'identity nil t))))
|
||||
(org-test-with-temp-text ":TEST:\n:prop: value\n:END:"
|
||||
(org-element-map
|
||||
(org-element-parse-buffer) 'property-drawer 'identity nil t)))
|
||||
;; Ignore incomplete drawer.
|
||||
(should-not
|
||||
(let ((org-drawers '("PROPERTIES")))
|
||||
(org-test-with-temp-text ":PROPERTIES:\n:prop: value"
|
||||
(org-element-map
|
||||
(org-element-parse-buffer) 'property-drawer 'identity nil t)))))
|
||||
(org-test-with-temp-text ":PROPERTIES:\n:prop: value"
|
||||
(org-element-map
|
||||
(org-element-parse-buffer) 'property-drawer 'identity nil t)))
|
||||
;; Handle non-empty blank line at the end of buffer.
|
||||
(should
|
||||
(org-test-with-temp-text ":PROPERTIES:\n:END:\n "
|
||||
(= (org-element-property :end (org-element-at-point)) (point-max)))))
|
||||
|
||||
|
||||
;;;; Quote Block
|
||||
|
@ -1542,8 +1583,11 @@ Outside list"
|
|||
;; Ignore incomplete block.
|
||||
(should-not
|
||||
(org-test-with-temp-text "#+BEGIN_QUOTE"
|
||||
(org-element-map
|
||||
(org-element-parse-buffer) 'quote-block 'identity nil t))))
|
||||
(org-element-map (org-element-parse-buffer) 'quote-block 'identity nil t)))
|
||||
;; Handle non-empty blank line at the end of buffer.
|
||||
(should
|
||||
(org-test-with-temp-text "#+BEGIN_QUOTE\nC\n#+END_QUOTE\n "
|
||||
(= (org-element-property :end (org-element-at-point)) (point-max)))))
|
||||
|
||||
|
||||
;;;; Quote Section
|
||||
|
@ -1624,7 +1668,11 @@ Outside list"
|
|||
(org-test-with-temp-text "#+BEGIN_SPECIAL*\nContents\n#+END_SPECIAL*"
|
||||
(let ((element (org-element-at-point)))
|
||||
(list (org-element-type element)
|
||||
(org-element-property :type element)))))))
|
||||
(org-element-property :type element))))))
|
||||
;; Handle non-empty blank line at the end of buffer.
|
||||
(should
|
||||
(org-test-with-temp-text "#+BEGIN_SPECIAL\nC\n#+END_SPECIAL\n "
|
||||
(= (org-element-property :end (org-element-at-point)) (point-max)))))
|
||||
|
||||
|
||||
;;;; Src Block
|
||||
|
@ -1645,16 +1693,8 @@ Outside list"
|
|||
(org-test-with-temp-text
|
||||
"#+BEGIN_SRC org\n,* Headline\n ,#+keyword\nText\n#+END_SRC"
|
||||
(org-element-property :value (org-element-at-point)))))
|
||||
;; Nil `org-src-preserve-indentation': Remove maximum common
|
||||
;; indentation.
|
||||
(should
|
||||
(equal " L1\nL2\n"
|
||||
(org-test-with-temp-text "#+BEGIN_SRC org\n L1\n L2\n#+END_SRC"
|
||||
(let ((org-src-preserve-indentation nil))
|
||||
(org-element-property :value (org-element-at-point))))))
|
||||
;; Non-nil `org-src-preserve-indentation': Remove block indentation
|
||||
;; only, unless block contents are less indented than block
|
||||
;; boundaries.
|
||||
;; Remove block indentation according to block boundaries, unless
|
||||
;; block contents are less indented than block boundaries.
|
||||
(should
|
||||
(equal " L1\nL2\n"
|
||||
(org-test-with-temp-text " #+BEGIN_SRC org\n L1\n L2\n #+END_SRC"
|
||||
|
@ -1665,7 +1705,11 @@ Outside list"
|
|||
" L1\n L2\n"
|
||||
(org-test-with-temp-text " #+BEGIN_SRC org\n L1\n L2\n #+END_SRC"
|
||||
(let ((org-src-preserve-indentation t))
|
||||
(org-element-property :value (org-element-at-point)))))))
|
||||
(org-element-property :value (org-element-at-point))))))
|
||||
;; Handle non-empty blank line at the end of buffer.
|
||||
(should
|
||||
(org-test-with-temp-text "#+BEGIN_SRC emacs-lisp\nC\n#+END_SRC\n "
|
||||
(= (org-element-property :end (org-element-at-point)) (point-max)))))
|
||||
|
||||
|
||||
;;;; Statistics Cookie
|
||||
|
@ -1764,9 +1808,11 @@ Outside list"
|
|||
(length (org-element-property
|
||||
:tblfm
|
||||
(org-element-map
|
||||
(org-element-parse-buffer) 'table 'identity nil t))))))
|
||||
;; Do not error when parsing a table with trailing white spaces.
|
||||
(should (org-test-with-temp-text "| a |\n " (org-element-parse-buffer))))
|
||||
(org-element-parse-buffer) 'table 'identity nil t))))))
|
||||
;; Handle non-empty blank line at the end of buffer.
|
||||
(should
|
||||
(org-test-with-temp-text "| a |\n "
|
||||
(= (org-element-property :end (org-element-at-point)) (point-max)))))
|
||||
|
||||
|
||||
;;;; Table Cell
|
||||
|
@ -1931,34 +1977,37 @@ Outside list"
|
|||
;; Ignore incomplete verse block.
|
||||
(should-not
|
||||
(org-test-with-temp-text "#+BEGIN_VERSE"
|
||||
(org-element-map
|
||||
(org-element-parse-buffer) 'verse-block 'identity nil t))))
|
||||
(org-element-map (org-element-parse-buffer) 'verse-block 'identity nil t)))
|
||||
;; Handle non-empty blank line at the end of buffer.
|
||||
(should
|
||||
(org-test-with-temp-text "#+BEGIN_VERSE\nC\n#+END_VERSE\n "
|
||||
(= (org-element-property :end (org-element-at-point)) (point-max)))))
|
||||
|
||||
|
||||
|
||||
;;; Test Interpreters.
|
||||
|
||||
(ert-deftest test-org-element/affiliated-keywords-interpreter ()
|
||||
"Test if affiliated keywords are correctly interpreted."
|
||||
;; Interpret simple keywords.
|
||||
(ert-deftest test-org-element/interpret-data ()
|
||||
"Test `org-element-interpret-data' specifications."
|
||||
;; Interpret simple affiliated keywords.
|
||||
(should
|
||||
(equal
|
||||
(org-element-interpret-data
|
||||
'(org-data nil (paragraph (:name "para") "Paragraph")))
|
||||
"#+NAME: para\nParagraph\n"))
|
||||
;; Interpret multiple keywords.
|
||||
;; Interpret multiple affiliated keywords.
|
||||
(should
|
||||
(equal
|
||||
(org-element-interpret-data
|
||||
'(org-data nil (paragraph (:attr_ascii ("line2" "line1")) "Paragraph")))
|
||||
"#+ATTR_ASCII: line1\n#+ATTR_ASCII: line2\nParagraph\n"))
|
||||
;; Interpret parsed keywords.
|
||||
;; Interpret parsed affiliated keywords.
|
||||
(should
|
||||
(equal
|
||||
(org-element-interpret-data
|
||||
'(org-data nil (paragraph (:caption (("caption"))) "Paragraph")))
|
||||
"#+CAPTION: caption\nParagraph\n"))
|
||||
;; Interpret dual keywords.
|
||||
;; Interpret dual affiliated keywords.
|
||||
(should
|
||||
(equal
|
||||
(org-element-interpret-data
|
||||
|
@ -1970,7 +2019,19 @@ Outside list"
|
|||
(org-element-interpret-data
|
||||
'(org-data nil (paragraph
|
||||
(:caption ((("l2") "s2") (("l1") "s1"))) "Paragraph")))
|
||||
"#+CAPTION[s1]: l1\n#+CAPTION[s2]: l2\nParagraph\n")))
|
||||
"#+CAPTION[s1]: l1\n#+CAPTION[s2]: l2\nParagraph\n"))
|
||||
;; Pseudo objects and elements are transparent.
|
||||
(should
|
||||
(equal "A B\n"
|
||||
(org-element-interpret-data
|
||||
'(paragraph nil (pseudo-object (:post-blank 1) "A") "B")
|
||||
'(pseudo-object))))
|
||||
(should
|
||||
(equal "A\n\nB\n"
|
||||
(org-element-interpret-data
|
||||
'(center nil
|
||||
(pseudo-element (:post-blank 1) (paragraph nil "A"))
|
||||
(paragraph nil "B"))))))
|
||||
|
||||
(ert-deftest test-org-element/center-block-interpreter ()
|
||||
"Test center block interpreter."
|
||||
|
@ -1981,8 +2042,7 @@ Outside list"
|
|||
(ert-deftest test-org-element/drawer-interpreter ()
|
||||
"Test drawer interpreter."
|
||||
(should
|
||||
(equal (let ((org-drawers '("TEST")))
|
||||
(org-test-parse-and-interpret ":TEST:\nTest\n:END:"))
|
||||
(equal (org-test-parse-and-interpret ":TEST:\nTest\n:END:")
|
||||
":TEST:\nTest\n:END:\n")))
|
||||
|
||||
(ert-deftest test-org-element/dynamic-block-interpreter ()
|
||||
|
@ -2149,16 +2209,15 @@ Outside list"
|
|||
"Test clock interpreter."
|
||||
;; Running clock.
|
||||
(should
|
||||
(equal (let ((org-clock-string "CLOCK:"))
|
||||
(org-test-parse-and-interpret "CLOCK: [2012-01-01 sun. 00:01]"))
|
||||
"CLOCK: [2012-01-01 sun. 00:01]\n"))
|
||||
(string-match
|
||||
"CLOCK: \\[2012-01-01 .* 00:01\\]"
|
||||
(org-test-parse-and-interpret "CLOCK: [2012-01-01 sun. 00:01]")))
|
||||
;; Closed clock.
|
||||
(should
|
||||
(equal
|
||||
(let ((org-clock-string "CLOCK:"))
|
||||
(org-test-parse-and-interpret "
|
||||
CLOCK: [2012-01-01 sun. 00:01]--[2012-01-01 sun. 00:02] => 0:01"))
|
||||
"CLOCK: [2012-01-01 sun. 00:01]--[2012-01-01 sun. 00:02] => 0:01\n")))
|
||||
(string-match
|
||||
"CLOCK: \\[2012-01-01 .* 00:01\\]--\\[2012-01-01 .* 00:02\\] => 0:01"
|
||||
(org-test-parse-and-interpret "
|
||||
CLOCK: [2012-01-01 sun. 00:01]--[2012-01-01 sun. 00:02] => 0:01"))))
|
||||
|
||||
(ert-deftest test-org-element/comment-interpreter ()
|
||||
"Test comment interpreter."
|
||||
|
@ -2254,16 +2313,13 @@ CLOCK: [2012-01-01 sun. 00:01]--[2012-01-01 sun. 00:02] => 0:01"))
|
|||
|
||||
(ert-deftest test-org-element/planning-interpreter ()
|
||||
"Test planning interpreter."
|
||||
(let ((org-closed-string "CLOSED:")
|
||||
(org-deadline-string "DEADLINE:")
|
||||
(org-scheduled-string "SCHEDULED:"))
|
||||
(should
|
||||
(equal
|
||||
(org-test-parse-and-interpret
|
||||
"* Headline
|
||||
DEADLINE: <2012-01-01> SCHEDULED: <2012-01-01> CLOSED: [2012-01-01]")
|
||||
"* Headline
|
||||
DEADLINE: <2012-01-01> SCHEDULED: <2012-01-01> CLOSED: [2012-01-01]\n"))))
|
||||
(should
|
||||
(string-match
|
||||
"\\* Headline
|
||||
DEADLINE: <2012-03-29 .*?> SCHEDULED: <2012-03-29 .*?> CLOSED: \\[2012-03-29 .*?\\]"
|
||||
(org-test-parse-and-interpret
|
||||
"* Headline
|
||||
DEADLINE: <2012-03-29 thu.> SCHEDULED: <2012-03-29 thu.> CLOSED: [2012-03-29 thu.]"))))
|
||||
|
||||
(ert-deftest test-org-element/property-drawer-interpreter ()
|
||||
"Test property drawer interpreter."
|
||||
|
@ -2333,8 +2389,9 @@ DEADLINE: <2012-01-01> SCHEDULED: <2012-01-01> CLOSED: [2012-01-01]\n"))))
|
|||
(ert-deftest test-org-element/timestamp-interpreter ()
|
||||
"Test timestamp interpreter."
|
||||
;; Active.
|
||||
(should (equal (org-test-parse-and-interpret "<2012-03-29 thu. 16:40>")
|
||||
"<2012-03-29 thu. 16:40>\n"))
|
||||
(should
|
||||
(string-match "<2012-03-29 .* 16:40>"
|
||||
(org-test-parse-and-interpret "<2012-03-29 thu. 16:40>")))
|
||||
(should
|
||||
(string-match "<2012-03-29 .* 16:40>"
|
||||
(org-element-timestamp-interpreter
|
||||
|
@ -2342,8 +2399,9 @@ DEADLINE: <2012-01-01> SCHEDULED: <2012-01-01> CLOSED: [2012-01-01]\n"))))
|
|||
(:type active :year-start 2012 :month-start 3 :day-start 29
|
||||
:hour-start 16 :minute-start 40)) nil)))
|
||||
;; Inactive.
|
||||
(should (equal (org-test-parse-and-interpret "[2012-03-29 thu. 16:40]")
|
||||
"[2012-03-29 thu. 16:40]\n"))
|
||||
(should
|
||||
(string-match "\\[2012-03-29 .* 16:40\\]"
|
||||
(org-test-parse-and-interpret "[2012-03-29 thu. 16:40]")))
|
||||
(should
|
||||
(string-match
|
||||
"\\[2012-03-29 .* 16:40\\]"
|
||||
|
@ -2352,9 +2410,10 @@ DEADLINE: <2012-01-01> SCHEDULED: <2012-01-01> CLOSED: [2012-01-01]\n"))))
|
|||
(:type inactive :year-start 2012 :month-start 3 :day-start 29
|
||||
:hour-start 16 :minute-start 40)) nil)))
|
||||
;; Active range.
|
||||
(should (equal (org-test-parse-and-interpret
|
||||
"<2012-03-29 thu. 16:40>--<2012-03-29 thu. 16:41>")
|
||||
"<2012-03-29 thu. 16:40>--<2012-03-29 thu. 16:41>\n"))
|
||||
(should
|
||||
(string-match "<2012-03-29 .* 16:40>--<2012-03-29 .* 16:41>"
|
||||
(org-test-parse-and-interpret
|
||||
"<2012-03-29 thu. 16:40>--<2012-03-29 thu. 16:41>")))
|
||||
(should
|
||||
(string-match
|
||||
"<2012-03-29 .* 16:40>--<2012-03-29 .* 16:41>"
|
||||
|
@ -2364,9 +2423,10 @@ DEADLINE: <2012-01-01> SCHEDULED: <2012-01-01> CLOSED: [2012-01-01]\n"))))
|
|||
:hour-start 16 :minute-start 40 :year-end 2012 :month-end 3
|
||||
:day-end 29 :hour-end 16 :minute-end 41)) nil)))
|
||||
;; Inactive range.
|
||||
(should (equal (org-test-parse-and-interpret
|
||||
"[2012-03-29 thu. 16:40]--[2012-03-29 thu. 16:41]")
|
||||
"[2012-03-29 thu. 16:40]--[2012-03-29 thu. 16:41]\n"))
|
||||
(should
|
||||
(string-match "\\[2012-03-29 .* 16:40\\]--\\[2012-03-29 .* 16:41\\]"
|
||||
(org-test-parse-and-interpret
|
||||
"[2012-03-29 thu. 16:40]--[2012-03-29 thu. 16:41]")))
|
||||
(should
|
||||
(string-match
|
||||
"\\[2012-03-29 .* 16:40\\]--\\[2012-03-29 .* 16:41\\]"
|
||||
|
@ -2379,8 +2439,9 @@ DEADLINE: <2012-01-01> SCHEDULED: <2012-01-01> CLOSED: [2012-01-01]\n"))))
|
|||
(should (equal (org-test-parse-and-interpret "<%%diary-float t 4 2>")
|
||||
"<%%diary-float t 4 2>\n"))
|
||||
;; Timestamp with repeater interval, with delay, with both.
|
||||
(should (equal (org-test-parse-and-interpret "<2012-03-29 thu. +1y>")
|
||||
"<2012-03-29 thu. +1y>\n"))
|
||||
(should
|
||||
(string-match "<2012-03-29 .* \\+1y>"
|
||||
(org-test-parse-and-interpret "<2012-03-29 thu. +1y>")))
|
||||
(should
|
||||
(string-match
|
||||
"<2012-03-29 .* \\+1y>"
|
||||
|
@ -2407,9 +2468,10 @@ DEADLINE: <2012-01-01> SCHEDULED: <2012-01-01> CLOSED: [2012-01-01]\n"))))
|
|||
:repeater-type cumulate :repeater-value 1 :repeater-unit year))
|
||||
nil)))
|
||||
;; Timestamp range with repeater interval
|
||||
(should (equal (org-test-parse-and-interpret
|
||||
"<2012-03-29 Thu +1y>--<2012-03-30 Thu +1y>")
|
||||
"<2012-03-29 Thu +1y>--<2012-03-30 Thu +1y>\n"))
|
||||
(should
|
||||
(string-match "<2012-03-29 .* \\+1y>--<2012-03-30 .* \\+1y>"
|
||||
(org-test-parse-and-interpret
|
||||
"<2012-03-29 Thu +1y>--<2012-03-30 Thu +1y>")))
|
||||
(should
|
||||
(string-match
|
||||
"<2012-03-29 .* \\+1y>--<2012-03-30 .* \\+1y>"
|
||||
|
@ -2492,20 +2554,12 @@ DEADLINE: <2012-01-01> SCHEDULED: <2012-01-01> CLOSED: [2012-01-01]\n"))))
|
|||
|
||||
(ert-deftest test-org-element/latex-fragment-interpreter ()
|
||||
"Test latex fragment interpreter."
|
||||
(let ((org-latex-regexps
|
||||
'(("begin" "^[ ]*\\(\\\\begin{\\([a-zA-Z0-9\\*]+\\)[^ |