2013-01-27 17:11:34 -05:00
|
|
|
|
;;; ox-koma-letter.el --- KOMA Scrlttr2 Back-End for Org Export Engine
|
2012-11-26 02:55:27 -05:00
|
|
|
|
|
2014-01-07 08:18:17 -05:00
|
|
|
|
;; Copyright (C) 2007-2012, 2014 Free Software Foundation, Inc.
|
2012-11-26 02:55:27 -05:00
|
|
|
|
|
|
|
|
|
;; Author: Nicolas Goaziou <n.goaziou AT gmail DOT com>
|
|
|
|
|
;; Alan Schmitt <alan.schmitt AT polytechnique DOT org>
|
2013-05-19 11:32:44 -04:00
|
|
|
|
;; Viktor Rosenfeld <listuser36 AT gmail DOT com>
|
|
|
|
|
;; Rasmus Pank Roulund <emacs AT pank DOT eu>
|
2012-11-26 02:55:27 -05:00
|
|
|
|
;; Keywords: org, wp, tex
|
|
|
|
|
|
2013-03-10 12:57:47 -04:00
|
|
|
|
;; This program is free software: you can redistribute it and/or modify
|
2012-11-26 02:55:27 -05:00
|
|
|
|
;; 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.
|
|
|
|
|
|
2013-03-10 12:57:47 -04:00
|
|
|
|
;; This program is distributed in the hope that it will be useful,
|
2012-11-26 02:55:27 -05:00
|
|
|
|
;; 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 library implements a KOMA Scrlttr2 back-end, derived from the
|
|
|
|
|
;; LaTeX one.
|
|
|
|
|
;;
|
|
|
|
|
;; Depending on the desired output format, three commands are provided
|
|
|
|
|
;; for export: `org-koma-letter-export-as-latex' (temporary buffer),
|
|
|
|
|
;; `org-koma-letter-export-to-latex' ("tex" file) and
|
|
|
|
|
;; `org-koma-letter-export-to-pdf' ("pdf" file).
|
|
|
|
|
;;
|
2013-01-27 17:11:34 -05:00
|
|
|
|
;; On top of buffer keywords supported by `latex' back-end (see
|
2013-02-08 16:59:47 -05:00
|
|
|
|
;; `org-latex-options-alist'), this back-end introduces the following
|
2013-05-27 11:29:14 -04:00
|
|
|
|
;; keywords:
|
2014-01-25 08:08:15 -05:00
|
|
|
|
;; - CLOSING: see `org-koma-letter-closing',
|
|
|
|
|
;; - FROM_ADDRESS: see `org-koma-letter-from-address',
|
|
|
|
|
;; - LCO: see `org-koma-letter-class-option-file',
|
|
|
|
|
;; - OPENING: see `org-koma-letter-opening',
|
|
|
|
|
;; - PHONE_NUMBER: see `org-koma-letter-phone-number',
|
|
|
|
|
;; - SIGNATURE: see `org-koma-letter-signature',
|
|
|
|
|
;; - PLACE: see `org-koma-letter-place',
|
|
|
|
|
;; - TO_ADDRESS: If unspecified this is set to "\mbox{}".
|
2013-06-01 13:52:36 -04:00
|
|
|
|
;;
|
|
|
|
|
;; TO_ADDRESS and FROM_ADDRESS can also be specified using heading
|
|
|
|
|
;; with the special tags specified in
|
|
|
|
|
;; `org-koma-letter-special-tags-in-letter', namely "to" and "from".
|
|
|
|
|
;; LaTeX line breaks are not necessary if using these headings. If
|
|
|
|
|
;; both a headline and a keyword specify a to or from address the
|
|
|
|
|
;; value is determined in accordance with
|
|
|
|
|
;; `org-koma-letter-prefer-special-headings'.
|
2013-05-27 11:29:14 -04:00
|
|
|
|
;;
|
|
|
|
|
;; A number of OPTIONS settings can be set to change which contents is
|
|
|
|
|
;; exported.
|
|
|
|
|
;; - backaddress (see `org-koma-letter-use-backaddress')
|
|
|
|
|
;; - foldmarks (see `org-koma-letter-use-foldmarks')
|
|
|
|
|
;; - phone (see `org-koma-letter-use-phone')
|
|
|
|
|
;; - email (see `org-koma-letter-use-email')
|
|
|
|
|
;; - place (see `org-koma-letter-use-place')
|
|
|
|
|
;; - subject, a list of format options
|
|
|
|
|
;; (see `org-koma-letter-subject-format')
|
|
|
|
|
;; - after-closing-order, a list of the ordering of headings with
|
|
|
|
|
;; special tags after closing (see
|
2013-08-17 16:50:47 -04:00
|
|
|
|
;; `org-koma-letter-special-tags-after-closing')
|
|
|
|
|
;; - after-letter-order, as above, but after the end of the letter
|
2013-05-27 11:29:14 -04:00
|
|
|
|
;; (see `org-koma-letter-special-tags-after-letter').
|
|
|
|
|
;;
|
|
|
|
|
;; The following variables works differently from the main LaTeX class
|
2014-01-25 08:08:15 -05:00
|
|
|
|
;; - AUTHOR: Default to user-full-name but may be disabled.
|
|
|
|
|
;; (See also `org-koma-letter-author'),
|
|
|
|
|
;; - EMAIL: Same as AUTHOR. (see also `org-koma-letter-email'),
|
2013-05-27 11:29:14 -04:00
|
|
|
|
;;
|
|
|
|
|
;; Headlines are in general ignored. However, headlines with special
|
|
|
|
|
;; tags can be used for specified contents like postscript (ps),
|
|
|
|
|
;; carbon copy (cc), enclosures (encl) and code to be inserted after
|
|
|
|
|
;; \end{letter} (after_letter). Specials tags are defined in
|
|
|
|
|
;; `org-koma-letter-special-tags-after-closing' and
|
|
|
|
|
;; `org-koma-letter-special-tags-after-letter'. Currently members of
|
|
|
|
|
;; `org-koma-letter-special-tags-after-closing' used as macros and the
|
|
|
|
|
;; content of the headline is the argument.
|
2012-11-26 02:55:27 -05:00
|
|
|
|
;;
|
2013-06-02 11:59:48 -04:00
|
|
|
|
;; Headlines with two and from may also be used rather than the
|
|
|
|
|
;; keyword approach described above. If both a keyword and a headline
|
|
|
|
|
;; with information is present precedence is determined by
|
|
|
|
|
;; `org-koma-letter-prefer-special-headings'.
|
|
|
|
|
;;
|
2012-11-26 02:55:27 -05:00
|
|
|
|
;; You will need to add an appropriate association in
|
2013-06-02 11:59:48 -04:00
|
|
|
|
;; `org-latex-classes' in order to use the KOMA Scrlttr2 class.
|
|
|
|
|
;; The easiest way to do this is by adding
|
|
|
|
|
;;
|
|
|
|
|
;; (eval-after-load "ox-koma-letter"
|
|
|
|
|
;; '(org-koma-letter-plug-into-ox))
|
|
|
|
|
;;
|
2013-08-17 16:50:47 -04:00
|
|
|
|
;; to your init file. This will add a sparse scrlttr2 class and
|
2013-06-02 11:59:48 -04:00
|
|
|
|
;; set it as the default `org-koma-latex-default-class'. You can also
|
|
|
|
|
;; add you own letter class. For instace:
|
2012-11-26 02:55:27 -05:00
|
|
|
|
;;
|
2013-01-27 17:11:34 -05:00
|
|
|
|
;; (add-to-list 'org-latex-classes
|
2012-11-26 02:55:27 -05:00
|
|
|
|
;; '("my-letter"
|
|
|
|
|
;; "\\documentclass\[%
|
|
|
|
|
;; DIV=14,
|
|
|
|
|
;; fontsize=12pt,
|
|
|
|
|
;; parskip=half,
|
|
|
|
|
;; subject=titled,
|
|
|
|
|
;; backaddress=false,
|
|
|
|
|
;; fromalign=left,
|
|
|
|
|
;; fromemail=true,
|
|
|
|
|
;; fromphone=true\]\{scrlttr2\}
|
|
|
|
|
;; \[DEFAULT-PACKAGES]
|
|
|
|
|
;; \[PACKAGES]
|
|
|
|
|
;; \[EXTRA]"))
|
|
|
|
|
;;
|
|
|
|
|
;; Then, in your Org document, be sure to require the proper class
|
2014-01-25 08:08:15 -05:00
|
|
|
|
;; with:
|
2012-11-26 02:55:27 -05:00
|
|
|
|
;;
|
|
|
|
|
;; #+LATEX_CLASS: my-letter
|
2013-06-02 11:59:48 -04:00
|
|
|
|
;;
|
|
|
|
|
;; Or by setting `org-koma-letter-default-class'.
|
2014-01-25 08:08:15 -05:00
|
|
|
|
;;
|
|
|
|
|
;; You may have to load (LaTeX) Babel as well, e.g., by adding
|
|
|
|
|
;; it to `org-latex-packages-alist',
|
|
|
|
|
;;
|
|
|
|
|
;; (add-to-list 'org-latex-packages-alist '("AUTO" "babel" nil))
|
2012-11-26 02:55:27 -05:00
|
|
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(require 'ox-latex)
|
2012-11-26 02:55:27 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;; User-Configurable Variables
|
|
|
|
|
|
|
|
|
|
(defgroup org-export-koma-letter nil
|
|
|
|
|
"Options for exporting to KOMA scrlttr2 class in LaTeX export."
|
|
|
|
|
:tag "Org Koma-Letter"
|
2013-02-26 11:57:13 -05:00
|
|
|
|
:group 'org-export)
|
2012-11-26 02:55:27 -05:00
|
|
|
|
|
|
|
|
|
(defcustom org-koma-letter-class-option-file "NF"
|
|
|
|
|
"Letter Class Option File."
|
|
|
|
|
:group 'org-export-koma-letter
|
|
|
|
|
:type 'string)
|
|
|
|
|
|
2013-05-26 10:13:39 -04:00
|
|
|
|
(defcustom org-koma-letter-author 'user-full-name
|
|
|
|
|
"The sender's name.
|
|
|
|
|
|
|
|
|
|
This variable defaults to calling the function `user-full-name'
|
2013-08-17 16:50:47 -04:00
|
|
|
|
which just returns the current function `user-full-name'. Alternatively a
|
|
|
|
|
string, nil or a function may be given. Functions must return a
|
2013-05-26 10:13:39 -04:00
|
|
|
|
string."
|
|
|
|
|
:group 'org-export-koma-letter
|
|
|
|
|
:type '(radio (function-item user-full-name)
|
|
|
|
|
(string)
|
|
|
|
|
(function)
|
2013-05-27 11:29:14 -04:00
|
|
|
|
(const :tag "Do not export author" nil)))
|
2013-05-26 10:13:39 -04:00
|
|
|
|
|
|
|
|
|
(defcustom org-koma-letter-email 'org-koma-letter-email
|
|
|
|
|
"The sender's email address.
|
|
|
|
|
|
|
|
|
|
This variable defaults to the value `org-koma-letter-email' which
|
|
|
|
|
returns `user-mail-address'. Alternatively a string, nil or a
|
|
|
|
|
function may be given. Functions must return a string."
|
|
|
|
|
:group 'org-export-koma-letter
|
|
|
|
|
:type '(radio (function-item org-koma-letter-email)
|
|
|
|
|
(string)
|
|
|
|
|
(function)
|
2013-05-27 11:29:14 -04:00
|
|
|
|
(const :tag "Do not export email" nil)))
|
2012-11-26 02:55:27 -05:00
|
|
|
|
|
2013-04-21 07:41:22 -04:00
|
|
|
|
(defcustom org-koma-letter-from-address nil
|
2012-11-26 02:55:27 -05:00
|
|
|
|
"Sender's address, as a string."
|
|
|
|
|
:group 'org-export-koma-letter
|
|
|
|
|
:type 'string)
|
|
|
|
|
|
ox-koma-letter: Export options to control letter
* ox-koma-letter.el ((org-koma-letter-use-subject):
Configure printing of subject line.
(org-koma-letter-use-backaddress): Configure presence of back
address.
(org-koma-letter-use-foldmarks): Configure presence of foldmarks.
(org-koma-letter-use-phone): Configure printing of phone number.
(org-koma-letter-use-email): Configure printing of email.
(org-koma-letter-use-place): Configure printing of place.
(koma-letter): Add export option to exporter backend.
(org-koma-letter-template): Evaluate export options in
exporter template.
Usage:
#+OPTIONS: backaddress:t foldmarks:t subject:titled phone:t email:t place:t
Except for `subject', all options are boolean, i.e., the accept the
values `nil' and `t'. `subject' accepts the values defined in
`scrlttr2`, i.e., `afteropening', `beforeopening', `centered', `left',
`right', `titled', `underlined', and `untitled'.
Signed-off-by: Alan Schmitt <alan.schmitt@polytechnique.org>
2013-04-21 10:34:35 -04:00
|
|
|
|
(defcustom org-koma-letter-phone-number nil
|
|
|
|
|
"Sender's phone number, as a string."
|
|
|
|
|
:group 'org-export-koma-letter
|
|
|
|
|
:type 'string)
|
|
|
|
|
|
|
|
|
|
(defcustom org-koma-letter-place nil
|
|
|
|
|
"Place from which the letter is sent."
|
|
|
|
|
:group 'org-export-koma-letter
|
|
|
|
|
:type 'string)
|
|
|
|
|
|
2013-05-05 09:11:15 -04:00
|
|
|
|
(defcustom org-koma-letter-opening nil
|
2013-08-17 14:24:36 -04:00
|
|
|
|
"Letter's opening, as a string.
|
|
|
|
|
|
|
|
|
|
If (1) this value is nil; (2) the letter is started with a
|
|
|
|
|
headline; and (3) `org-koma-letter-headline-is-opening-maybe' is
|
|
|
|
|
t the value opening will be implicit set as the headline title."
|
2012-11-26 02:55:27 -05:00
|
|
|
|
:group 'org-export-koma-letter
|
|
|
|
|
:type 'string)
|
|
|
|
|
|
2013-05-05 09:11:15 -04:00
|
|
|
|
(defcustom org-koma-letter-closing nil
|
ox-koma-letter: Export options to control letter
* ox-koma-letter.el ((org-koma-letter-use-subject):
Configure printing of subject line.
(org-koma-letter-use-backaddress): Configure presence of back
address.
(org-koma-letter-use-foldmarks): Configure presence of foldmarks.
(org-koma-letter-use-phone): Configure printing of phone number.
(org-koma-letter-use-email): Configure printing of email.
(org-koma-letter-use-place): Configure printing of place.
(koma-letter): Add export option to exporter backend.
(org-koma-letter-template): Evaluate export options in
exporter template.
Usage:
#+OPTIONS: backaddress:t foldmarks:t subject:titled phone:t email:t place:t
Except for `subject', all options are boolean, i.e., the accept the
values `nil' and `t'. `subject' accepts the values defined in
`scrlttr2`, i.e., `afteropening', `beforeopening', `centered', `left',
`right', `titled', `underlined', and `untitled'.
Signed-off-by: Alan Schmitt <alan.schmitt@polytechnique.org>
2013-04-21 10:34:35 -04:00
|
|
|
|
"Koma-Letter's closing, as a string."
|
2012-11-26 02:55:27 -05:00
|
|
|
|
:group 'org-export-koma-letter
|
|
|
|
|
:type 'string)
|
|
|
|
|
|
2013-06-01 13:52:36 -04:00
|
|
|
|
(defcustom org-koma-letter-prefer-special-headings nil
|
2013-08-17 16:50:47 -04:00
|
|
|
|
"If TO and/or FROM is specified using both a heading and a keyword the heading value will be preferred if the variable is t."
|
2013-06-01 13:52:36 -04:00
|
|
|
|
:group 'org-export-koma-letter
|
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
2013-05-25 13:35:10 -04:00
|
|
|
|
(defcustom org-koma-letter-signature nil
|
2012-11-26 02:55:27 -05:00
|
|
|
|
"String used as the signature."
|
|
|
|
|
:group 'org-export-koma-letter
|
|
|
|
|
:type 'string)
|
|
|
|
|
|
2013-05-19 11:32:44 -04:00
|
|
|
|
(defcustom org-koma-letter-subject-format t
|
2013-08-17 16:50:47 -04:00
|
|
|
|
"Use the title as the subject of the letter.
|
|
|
|
|
|
|
|
|
|
At this time the following values are allowed:
|
|
|
|
|
|
|
|
|
|
- afteropening: subject after opening.
|
|
|
|
|
- beforeopening: subject before opening.
|
|
|
|
|
- centered: subject centered.
|
|
|
|
|
- left:subject left-justified.
|
|
|
|
|
- right: subject right-justified.
|
|
|
|
|
- titled: add title/description to subject.
|
|
|
|
|
- underlined: set subject underlined.
|
2013-05-19 11:32:44 -04:00
|
|
|
|
- untitled: do not add title/description to subject.
|
|
|
|
|
- No-export: do no insert a subject even if present.
|
|
|
|
|
|
|
|
|
|
Please refer to the KOMA-script manual (Table 4.16. in the
|
2013-08-17 16:50:47 -04:00
|
|
|
|
English manual of 2012-07-22)."
|
2013-05-27 11:29:14 -04:00
|
|
|
|
:type '(radio
|
|
|
|
|
(const :tag "No export" nil)
|
|
|
|
|
(const :tag "Default options" t)
|
|
|
|
|
(set :tag "selection"
|
|
|
|
|
(const 'afteropening)
|
|
|
|
|
(const 'beforeopening)
|
|
|
|
|
(const 'centered)
|
|
|
|
|
(const 'left)
|
|
|
|
|
(const 'right)
|
|
|
|
|
(const 'underlined)
|
|
|
|
|
(const 'titled)
|
|
|
|
|
(const 'untitled))
|
|
|
|
|
(string))
|
2013-05-19 11:32:44 -04:00
|
|
|
|
:group 'org-export-koma-letter)
|
|
|
|
|
|
2013-07-22 10:46:02 -04:00
|
|
|
|
(defcustom org-koma-letter-use-backaddress nil
|
2014-01-25 08:08:15 -05:00
|
|
|
|
"Print return address in line above to address."
|
2013-04-21 07:41:22 -04:00
|
|
|
|
:group 'org-export-koma-letter
|
ox-koma-letter: Export options to control letter
* ox-koma-letter.el ((org-koma-letter-use-subject):
Configure printing of subject line.
(org-koma-letter-use-backaddress): Configure presence of back
address.
(org-koma-letter-use-foldmarks): Configure presence of foldmarks.
(org-koma-letter-use-phone): Configure printing of phone number.
(org-koma-letter-use-email): Configure printing of email.
(org-koma-letter-use-place): Configure printing of place.
(koma-letter): Add export option to exporter backend.
(org-koma-letter-template): Evaluate export options in
exporter template.
Usage:
#+OPTIONS: backaddress:t foldmarks:t subject:titled phone:t email:t place:t
Except for `subject', all options are boolean, i.e., the accept the
values `nil' and `t'. `subject' accepts the values defined in
`scrlttr2`, i.e., `afteropening', `beforeopening', `centered', `left',
`right', `titled', `underlined', and `untitled'.
Signed-off-by: Alan Schmitt <alan.schmitt@polytechnique.org>
2013-04-21 10:34:35 -04:00
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
2013-05-05 09:22:51 -04:00
|
|
|
|
(defcustom org-koma-letter-use-foldmarks "true"
|
|
|
|
|
"Configure appearence of fold marks.
|
|
|
|
|
|
|
|
|
|
Accepts any valid value for the KOMA-Script `foldmarks' option.
|
|
|
|
|
|
|
|
|
|
Use `foldmarks:true' to activate default fold marks or
|
|
|
|
|
`foldmarks:nil' to deactivate fold marks."
|
ox-koma-letter: Export options to control letter
* ox-koma-letter.el ((org-koma-letter-use-subject):
Configure printing of subject line.
(org-koma-letter-use-backaddress): Configure presence of back
address.
(org-koma-letter-use-foldmarks): Configure presence of foldmarks.
(org-koma-letter-use-phone): Configure printing of phone number.
(org-koma-letter-use-email): Configure printing of email.
(org-koma-letter-use-place): Configure printing of place.
(koma-letter): Add export option to exporter backend.
(org-koma-letter-template): Evaluate export options in
exporter template.
Usage:
#+OPTIONS: backaddress:t foldmarks:t subject:titled phone:t email:t place:t
Except for `subject', all options are boolean, i.e., the accept the
values `nil' and `t'. `subject' accepts the values defined in
`scrlttr2`, i.e., `afteropening', `beforeopening', `centered', `left',
`right', `titled', `underlined', and `untitled'.
Signed-off-by: Alan Schmitt <alan.schmitt@polytechnique.org>
2013-04-21 10:34:35 -04:00
|
|
|
|
:group 'org-export-koma-letter
|
2013-05-05 09:22:51 -04:00
|
|
|
|
:type 'string)
|
ox-koma-letter: Export options to control letter
* ox-koma-letter.el ((org-koma-letter-use-subject):
Configure printing of subject line.
(org-koma-letter-use-backaddress): Configure presence of back
address.
(org-koma-letter-use-foldmarks): Configure presence of foldmarks.
(org-koma-letter-use-phone): Configure printing of phone number.
(org-koma-letter-use-email): Configure printing of email.
(org-koma-letter-use-place): Configure printing of place.
(koma-letter): Add export option to exporter backend.
(org-koma-letter-template): Evaluate export options in
exporter template.
Usage:
#+OPTIONS: backaddress:t foldmarks:t subject:titled phone:t email:t place:t
Except for `subject', all options are boolean, i.e., the accept the
values `nil' and `t'. `subject' accepts the values defined in
`scrlttr2`, i.e., `afteropening', `beforeopening', `centered', `left',
`right', `titled', `underlined', and `untitled'.
Signed-off-by: Alan Schmitt <alan.schmitt@polytechnique.org>
2013-04-21 10:34:35 -04:00
|
|
|
|
|
2013-07-22 10:46:02 -04:00
|
|
|
|
(defcustom org-koma-letter-use-phone nil
|
ox-koma-letter: Export options to control letter
* ox-koma-letter.el ((org-koma-letter-use-subject):
Configure printing of subject line.
(org-koma-letter-use-backaddress): Configure presence of back
address.
(org-koma-letter-use-foldmarks): Configure presence of foldmarks.
(org-koma-letter-use-phone): Configure printing of phone number.
(org-koma-letter-use-email): Configure printing of email.
(org-koma-letter-use-place): Configure printing of place.
(koma-letter): Add export option to exporter backend.
(org-koma-letter-template): Evaluate export options in
exporter template.
Usage:
#+OPTIONS: backaddress:t foldmarks:t subject:titled phone:t email:t place:t
Except for `subject', all options are boolean, i.e., the accept the
values `nil' and `t'. `subject' accepts the values defined in
`scrlttr2`, i.e., `afteropening', `beforeopening', `centered', `left',
`right', `titled', `underlined', and `untitled'.
Signed-off-by: Alan Schmitt <alan.schmitt@polytechnique.org>
2013-04-21 10:34:35 -04:00
|
|
|
|
"Print sender's phone number."
|
|
|
|
|
:group 'org-export-koma-letter
|
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
2013-07-22 10:46:02 -04:00
|
|
|
|
(defcustom org-koma-letter-use-email nil
|
ox-koma-letter: Export options to control letter
* ox-koma-letter.el ((org-koma-letter-use-subject):
Configure printing of subject line.
(org-koma-letter-use-backaddress): Configure presence of back
address.
(org-koma-letter-use-foldmarks): Configure presence of foldmarks.
(org-koma-letter-use-phone): Configure printing of phone number.
(org-koma-letter-use-email): Configure printing of email.
(org-koma-letter-use-place): Configure printing of place.
(koma-letter): Add export option to exporter backend.
(org-koma-letter-template): Evaluate export options in
exporter template.
Usage:
#+OPTIONS: backaddress:t foldmarks:t subject:titled phone:t email:t place:t
Except for `subject', all options are boolean, i.e., the accept the
values `nil' and `t'. `subject' accepts the values defined in
`scrlttr2`, i.e., `afteropening', `beforeopening', `centered', `left',
`right', `titled', `underlined', and `untitled'.
Signed-off-by: Alan Schmitt <alan.schmitt@polytechnique.org>
2013-04-21 10:34:35 -04:00
|
|
|
|
"Print sender's email address."
|
|
|
|
|
:group 'org-export-koma-letter
|
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
|
|
|
|
(defcustom org-koma-letter-use-place t
|
|
|
|
|
"Print the letter's place next to the date."
|
|
|
|
|
:group 'org-export-koma-letter
|
|
|
|
|
:type 'boolean)
|
2013-04-21 07:41:22 -04:00
|
|
|
|
|
2013-06-02 11:59:48 -04:00
|
|
|
|
(defcustom org-koma-letter-default-class nil
|
2013-08-17 16:50:47 -04:00
|
|
|
|
"Default class for `org-koma-letter'.
|
|
|
|
|
|
|
|
|
|
The value must be a member of `org-latex-classes'."
|
2013-06-02 11:59:48 -04:00
|
|
|
|
:group 'org-export-koma-letter
|
|
|
|
|
:type 'string)
|
|
|
|
|
|
2013-08-17 14:24:36 -04:00
|
|
|
|
(defcustom org-koma-letter-headline-is-opening-maybe t
|
|
|
|
|
"Whether a headline may be used as an opening.
|
|
|
|
|
A headline is only used if #+OPENING is not set. See also
|
|
|
|
|
`org-koma-letter-opening'."
|
|
|
|
|
:group 'org-export-koma-letter
|
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
2013-06-01 13:52:36 -04:00
|
|
|
|
(defconst org-koma-letter-special-tags-in-letter '(to from)
|
2013-08-17 16:50:47 -04:00
|
|
|
|
"Header tags related to the letter itself.")
|
2013-05-27 11:29:14 -04:00
|
|
|
|
|
|
|
|
|
(defconst org-koma-letter-special-tags-after-closing '(ps encl cc)
|
2013-08-17 16:50:47 -04:00
|
|
|
|
"Header tags to be inserted after closing.")
|
2013-05-26 10:14:51 -04:00
|
|
|
|
|
2013-05-27 11:29:14 -04:00
|
|
|
|
(defconst org-koma-letter-special-tags-after-letter '(after_letter)
|
2013-08-17 16:50:47 -04:00
|
|
|
|
"Header tags to be inserted after closing.")
|
2013-05-26 10:14:51 -04:00
|
|
|
|
|
2013-05-27 11:29:14 -04:00
|
|
|
|
(defvar org-koma-letter-special-contents nil
|
2013-08-17 16:50:47 -04:00
|
|
|
|
"Holds special content temporarily.")
|
2013-05-26 10:14:51 -04:00
|
|
|
|
|
|
|
|
|
|
2012-11-26 02:55:27 -05:00
|
|
|
|
|
|
|
|
|
;;; Define Back-End
|
|
|
|
|
|
2013-03-19 11:26:30 -04:00
|
|
|
|
(org-export-define-derived-backend 'koma-letter 'latex
|
2012-11-26 02:55:27 -05:00
|
|
|
|
:options-alist
|
2013-04-21 07:41:22 -04:00
|
|
|
|
'((:lco "LCO" nil org-koma-letter-class-option-file)
|
2013-06-02 11:59:48 -04:00
|
|
|
|
(:latex-class "LATEX_CLASS" nil (if org-koma-letter-default-class
|
|
|
|
|
org-koma-letter-default-class
|
|
|
|
|
org-latex-default-class) t)
|
2013-08-17 16:50:47 -04:00
|
|
|
|
(:author "AUTHOR" nil (org-koma-letter--get-value org-koma-letter-author) t)
|
2013-07-22 10:46:02 -04:00
|
|
|
|
(:author-changed-in-buffer-p "AUTHOR" nil nil t)
|
2014-06-18 18:47:42 -04:00
|
|
|
|
(:from-address "FROM_ADDRESS" nil org-koma-letter-from-address newline)
|
2013-03-19 11:26:30 -04:00
|
|
|
|
(:phone-number "PHONE_NUMBER" nil org-koma-letter-phone-number)
|
2013-08-17 16:50:47 -04:00
|
|
|
|
(:email "EMAIL" nil (org-koma-letter--get-value org-koma-letter-email) t)
|
2013-07-22 10:46:02 -04:00
|
|
|
|
(:email-changed-in-buffer-p "EMAIL" nil nil t)
|
2013-04-21 07:41:22 -04:00
|
|
|
|
(:to-address "TO_ADDRESS" nil nil newline)
|
ox-koma-letter: Export options to control letter
* ox-koma-letter.el ((org-koma-letter-use-subject):
Configure printing of subject line.
(org-koma-letter-use-backaddress): Configure presence of back
address.
(org-koma-letter-use-foldmarks): Configure presence of foldmarks.
(org-koma-letter-use-phone): Configure printing of phone number.
(org-koma-letter-use-email): Configure printing of email.
(org-koma-letter-use-place): Configure printing of place.
(koma-letter): Add export option to exporter backend.
(org-koma-letter-template): Evaluate export options in
exporter template.
Usage:
#+OPTIONS: backaddress:t foldmarks:t subject:titled phone:t email:t place:t
Except for `subject', all options are boolean, i.e., the accept the
values `nil' and `t'. `subject' accepts the values defined in
`scrlttr2`, i.e., `afteropening', `beforeopening', `centered', `left',
`right', `titled', `underlined', and `untitled'.
Signed-off-by: Alan Schmitt <alan.schmitt@polytechnique.org>
2013-04-21 10:34:35 -04:00
|
|
|
|
(:place "PLACE" nil org-koma-letter-place)
|
2013-04-21 07:41:22 -04:00
|
|
|
|
(:opening "OPENING" nil org-koma-letter-opening)
|
|
|
|
|
(:closing "CLOSING" nil org-koma-letter-closing)
|
ox-koma-letter: Export options to control letter
* ox-koma-letter.el ((org-koma-letter-use-subject):
Configure printing of subject line.
(org-koma-letter-use-backaddress): Configure presence of back
address.
(org-koma-letter-use-foldmarks): Configure presence of foldmarks.
(org-koma-letter-use-phone): Configure printing of phone number.
(org-koma-letter-use-email): Configure printing of email.
(org-koma-letter-use-place): Configure printing of place.
(koma-letter): Add export option to exporter backend.
(org-koma-letter-template): Evaluate export options in
exporter template.
Usage:
#+OPTIONS: backaddress:t foldmarks:t subject:titled phone:t email:t place:t
Except for `subject', all options are boolean, i.e., the accept the
values `nil' and `t'. `subject' accepts the values defined in
`scrlttr2`, i.e., `afteropening', `beforeopening', `centered', `left',
`right', `titled', `underlined', and `untitled'.
Signed-off-by: Alan Schmitt <alan.schmitt@polytechnique.org>
2013-04-21 10:34:35 -04:00
|
|
|
|
(:signature "SIGNATURE" nil org-koma-letter-signature newline)
|
2013-06-01 13:52:36 -04:00
|
|
|
|
(:special-tags nil nil (append
|
|
|
|
|
org-koma-letter-special-tags-in-letter
|
|
|
|
|
org-koma-letter-special-tags-after-closing
|
|
|
|
|
org-koma-letter-special-tags-after-letter))
|
|
|
|
|
(:special-headings nil "special-headings"
|
|
|
|
|
org-koma-letter-prefer-special-headings)
|
2013-05-26 10:14:51 -04:00
|
|
|
|
(:with-after-closing nil "after-closing-order"
|
|
|
|
|
org-koma-letter-special-tags-after-closing)
|
|
|
|
|
(:with-after-letter nil "after-letter-order"
|
|
|
|
|
org-koma-letter-special-tags-after-letter)
|
ox-koma-letter: Export options to control letter
* ox-koma-letter.el ((org-koma-letter-use-subject):
Configure printing of subject line.
(org-koma-letter-use-backaddress): Configure presence of back
address.
(org-koma-letter-use-foldmarks): Configure presence of foldmarks.
(org-koma-letter-use-phone): Configure printing of phone number.
(org-koma-letter-use-email): Configure printing of email.
(org-koma-letter-use-place): Configure printing of place.
(koma-letter): Add export option to exporter backend.
(org-koma-letter-template): Evaluate export options in
exporter template.
Usage:
#+OPTIONS: backaddress:t foldmarks:t subject:titled phone:t email:t place:t
Except for `subject', all options are boolean, i.e., the accept the
values `nil' and `t'. `subject' accepts the values defined in
`scrlttr2`, i.e., `afteropening', `beforeopening', `centered', `left',
`right', `titled', `underlined', and `untitled'.
Signed-off-by: Alan Schmitt <alan.schmitt@polytechnique.org>
2013-04-21 10:34:35 -04:00
|
|
|
|
(:with-backaddress nil "backaddress" org-koma-letter-use-backaddress)
|
2013-07-22 10:46:02 -04:00
|
|
|
|
(:with-backaddress-changed-in-buffer-p nil "backaddress" nil)
|
ox-koma-letter: Export options to control letter
* ox-koma-letter.el ((org-koma-letter-use-subject):
Configure printing of subject line.
(org-koma-letter-use-backaddress): Configure presence of back
address.
(org-koma-letter-use-foldmarks): Configure presence of foldmarks.
(org-koma-letter-use-phone): Configure printing of phone number.
(org-koma-letter-use-email): Configure printing of email.
(org-koma-letter-use-place): Configure printing of place.
(koma-letter): Add export option to exporter backend.
(org-koma-letter-template): Evaluate export options in
exporter template.
Usage:
#+OPTIONS: backaddress:t foldmarks:t subject:titled phone:t email:t place:t
Except for `subject', all options are boolean, i.e., the accept the
values `nil' and `t'. `subject' accepts the values defined in
`scrlttr2`, i.e., `afteropening', `beforeopening', `centered', `left',
`right', `titled', `underlined', and `untitled'.
Signed-off-by: Alan Schmitt <alan.schmitt@polytechnique.org>
2013-04-21 10:34:35 -04:00
|
|
|
|
(:with-foldmarks nil "foldmarks" org-koma-letter-use-foldmarks)
|
2013-07-22 10:46:02 -04:00
|
|
|
|
(:with-foldmarks-changed-in-buffer-p nil "foldmarks" "foldmarks-not-set")
|
ox-koma-letter: Export options to control letter
* ox-koma-letter.el ((org-koma-letter-use-subject):
Configure printing of subject line.
(org-koma-letter-use-backaddress): Configure presence of back
address.
(org-koma-letter-use-foldmarks): Configure presence of foldmarks.
(org-koma-letter-use-phone): Configure printing of phone number.
(org-koma-letter-use-email): Configure printing of email.
(org-koma-letter-use-place): Configure printing of place.
(koma-letter): Add export option to exporter backend.
(org-koma-letter-template): Evaluate export options in
exporter template.
Usage:
#+OPTIONS: backaddress:t foldmarks:t subject:titled phone:t email:t place:t
Except for `subject', all options are boolean, i.e., the accept the
values `nil' and `t'. `subject' accepts the values defined in
`scrlttr2`, i.e., `afteropening', `beforeopening', `centered', `left',
`right', `titled', `underlined', and `untitled'.
Signed-off-by: Alan Schmitt <alan.schmitt@polytechnique.org>
2013-04-21 10:34:35 -04:00
|
|
|
|
(:with-phone nil "phone" org-koma-letter-use-phone)
|
2013-07-22 10:46:02 -04:00
|
|
|
|
(:with-phone-changed-in-buffer-p nil "phone" nil)
|
ox-koma-letter: Export options to control letter
* ox-koma-letter.el ((org-koma-letter-use-subject):
Configure printing of subject line.
(org-koma-letter-use-backaddress): Configure presence of back
address.
(org-koma-letter-use-foldmarks): Configure presence of foldmarks.
(org-koma-letter-use-phone): Configure printing of phone number.
(org-koma-letter-use-email): Configure printing of email.
(org-koma-letter-use-place): Configure printing of place.
(koma-letter): Add export option to exporter backend.
(org-koma-letter-template): Evaluate export options in
exporter template.
Usage:
#+OPTIONS: backaddress:t foldmarks:t subject:titled phone:t email:t place:t
Except for `subject', all options are boolean, i.e., the accept the
values `nil' and `t'. `subject' accepts the values defined in
`scrlttr2`, i.e., `afteropening', `beforeopening', `centered', `left',
`right', `titled', `underlined', and `untitled'.
Signed-off-by: Alan Schmitt <alan.schmitt@polytechnique.org>
2013-04-21 10:34:35 -04:00
|
|
|
|
(:with-email nil "email" org-koma-letter-use-email)
|
2013-07-22 10:46:02 -04:00
|
|
|
|
(:with-email-changed-in-buffer-p nil "email" nil)
|
ox-koma-letter: Export options to control letter
* ox-koma-letter.el ((org-koma-letter-use-subject):
Configure printing of subject line.
(org-koma-letter-use-backaddress): Configure presence of back
address.
(org-koma-letter-use-foldmarks): Configure presence of foldmarks.
(org-koma-letter-use-phone): Configure printing of phone number.
(org-koma-letter-use-email): Configure printing of email.
(org-koma-letter-use-place): Configure printing of place.
(koma-letter): Add export option to exporter backend.
(org-koma-letter-template): Evaluate export options in
exporter template.
Usage:
#+OPTIONS: backaddress:t foldmarks:t subject:titled phone:t email:t place:t
Except for `subject', all options are boolean, i.e., the accept the
values `nil' and `t'. `subject' accepts the values defined in
`scrlttr2`, i.e., `afteropening', `beforeopening', `centered', `left',
`right', `titled', `underlined', and `untitled'.
Signed-off-by: Alan Schmitt <alan.schmitt@polytechnique.org>
2013-04-21 10:34:35 -04:00
|
|
|
|
(:with-place nil "place" org-koma-letter-use-place)
|
2013-05-19 11:32:44 -04:00
|
|
|
|
(:with-subject nil "subject" org-koma-letter-subject-format))
|
2013-03-19 11:26:30 -04:00
|
|
|
|
:translate-alist '((export-block . org-koma-letter-export-block)
|
|
|
|
|
(export-snippet . org-koma-letter-export-snippet)
|
2013-05-26 10:14:51 -04:00
|
|
|
|
(headline . org-koma-letter-headline)
|
2013-03-19 11:26:30 -04:00
|
|
|
|
(keyword . org-koma-letter-keyword)
|
|
|
|
|
(template . org-koma-letter-template))
|
2012-11-26 02:55:27 -05:00
|
|
|
|
:menu-entry
|
2013-03-19 11:26:30 -04:00
|
|
|
|
'(?k "Export with KOMA Scrlttr2"
|
2013-04-21 07:40:09 -04:00
|
|
|
|
((?L "As LaTeX buffer" org-koma-letter-export-as-latex)
|
|
|
|
|
(?l "As LaTeX file" org-koma-letter-export-to-latex)
|
2013-03-19 11:26:30 -04:00
|
|
|
|
(?p "As PDF file" org-koma-letter-export-to-pdf)
|
2013-04-21 07:40:09 -04:00
|
|
|
|
(?o "As PDF file and open"
|
2013-03-19 11:26:30 -04:00
|
|
|
|
(lambda (a s v b)
|
|
|
|
|
(if a (org-koma-letter-export-to-pdf t s v b)
|
|
|
|
|
(org-open-file (org-koma-letter-export-to-pdf nil s v b))))))))
|
2012-11-26 02:55:27 -05:00
|
|
|
|
|
|
|
|
|
|
2013-06-02 11:59:48 -04:00
|
|
|
|
;;; Initialize class function
|
|
|
|
|
|
|
|
|
|
(defun org-koma-letter-plug-into-ox ()
|
2013-08-17 16:50:47 -04:00
|
|
|
|
"Add a sparse `default-koma-letter' to `org-latex-classes' and set `org-koma-letter-default-class' to `default-koma-letter'."
|
2013-06-02 11:59:48 -04:00
|
|
|
|
(let ((class "default-koma-letter"))
|
|
|
|
|
(eval-after-load "ox-latex"
|
2013-07-26 05:20:41 -04:00
|
|
|
|
`(unless (member ,class 'org-latex-classes)
|
2013-06-02 11:59:48 -04:00
|
|
|
|
(add-to-list 'org-latex-classes
|
|
|
|
|
`(,class
|
|
|
|
|
"\\documentclass[11pt]{scrlttr2}") ())
|
|
|
|
|
(setq org-koma-letter-default-class class)))))
|
|
|
|
|
|
2013-05-26 10:13:39 -04:00
|
|
|
|
;;; Helper functions
|
|
|
|
|
|
|
|
|
|
(defun org-koma-letter-email ()
|
2013-08-17 16:50:47 -04:00
|
|
|
|
"Return the current `user-mail-address'."
|
2013-05-26 10:13:39 -04:00
|
|
|
|
user-mail-address)
|
|
|
|
|
|
2013-05-26 10:14:51 -04:00
|
|
|
|
;; The following is taken from/inspired by ox-grof.el
|
|
|
|
|
;; Thanks, Luis!
|
|
|
|
|
|
2013-05-27 11:29:14 -04:00
|
|
|
|
(defun org-koma-letter--get-tagged-contents (key)
|
2013-08-17 16:50:47 -04:00
|
|
|
|
"Get contents from a headline tagged with KEY.
|
|
|
|
|
Technically, the contents is stored in `org-koma-letter-special-contents'."
|
|
|
|
|
(cdr (assoc (org-koma-letter--get-value key)
|
2013-05-27 11:29:14 -04:00
|
|
|
|
org-koma-letter-special-contents)))
|
2013-05-26 10:13:39 -04:00
|
|
|
|
|
2013-08-17 16:50:47 -04:00
|
|
|
|
(defun org-koma-letter--get-value (value)
|
|
|
|
|
"Determines if VALUE is nil, a string, a function or a symbol and return a string or nil."
|
2013-05-26 10:13:39 -04:00
|
|
|
|
(when value
|
|
|
|
|
(cond ((stringp value) value)
|
|
|
|
|
((functionp value) (funcall value))
|
2013-05-27 11:29:14 -04:00
|
|
|
|
((symbolp value) (symbol-name value))
|
|
|
|
|
(t value))))
|
2013-05-26 10:13:39 -04:00
|
|
|
|
|
|
|
|
|
|
2013-08-17 16:50:47 -04:00
|
|
|
|
(defun org-koma-letter--special-contents-as-macro (a-list &optional keep-newlines no-tag)
|
|
|
|
|
"Find members of `org-koma-letter-special-contents' corresponding to A-LIST.
|
|
|
|
|
Return them as a string to be formatted.
|
2013-05-26 10:14:51 -04:00
|
|
|
|
|
2013-08-17 16:50:47 -04:00
|
|
|
|
The function is used for inserting content of speciall headings
|
|
|
|
|
such as PS.
|
|
|
|
|
|
|
|
|
|
If KEEP-NEWLINES is t newlines will not be removed. If NO-TAG is
|
2013-05-26 10:14:51 -04:00
|
|
|
|
is t the content in `org-koma-letter-special-contents' will not
|
2013-08-17 16:50:47 -04:00
|
|
|
|
be wrapped in a macro named whatever the members of A-LIST are
|
|
|
|
|
called."
|
2013-05-26 10:14:51 -04:00
|
|
|
|
(let (output)
|
2013-05-27 11:29:14 -04:00
|
|
|
|
(dolist (ac* a-list output)
|
|
|
|
|
(let*
|
2013-08-17 16:50:47 -04:00
|
|
|
|
((ac (org-koma-letter--get-value ac*))
|
2013-05-27 11:29:14 -04:00
|
|
|
|
(x (org-koma-letter--get-tagged-contents ac)))
|
2013-05-26 10:14:51 -04:00
|
|
|
|
(when x
|
|
|
|
|
(setq output
|
|
|
|
|
(concat
|
|
|
|
|
output "\n"
|
|
|
|
|
;; sometimes LaTeX complains about newlines
|
|
|
|
|
;; at the end or beginning of macros. Remove them.
|
|
|
|
|
(org-koma-letter--format-string-as-macro
|
2013-08-17 16:50:47 -04:00
|
|
|
|
(if keep-newlines x (org-koma-letter--normalize-string x))
|
2013-05-26 10:14:51 -04:00
|
|
|
|
(unless no-tag ac)))))))))
|
|
|
|
|
|
|
|
|
|
(defun org-koma-letter--format-string-as-macro (string &optional macro)
|
2013-08-17 16:50:47 -04:00
|
|
|
|
"Format STRING as \"\\macro{string}\" if MACRO is given else as \"string\"."
|
2013-05-26 10:14:51 -04:00
|
|
|
|
(if macro
|
|
|
|
|
(format "\\%s{%s}" macro string)
|
|
|
|
|
(format "%s" string)))
|
|
|
|
|
|
2013-08-17 16:50:47 -04:00
|
|
|
|
(defun org-koma-letter--normalize-string (string)
|
|
|
|
|
"Remove new lines in the beginning and end of `STRING'."
|
2013-05-27 11:29:14 -04:00
|
|
|
|
(replace-regexp-in-string "\\`[ \n\t]+\\|[\n\t ]*\\'" "" string))
|
|
|
|
|
|
2013-08-17 16:50:47 -04:00
|
|
|
|
(defun org-koma-letter--determine-to-and-from (info key)
|
|
|
|
|
"Given INFO determine KEY for the letter.
|
|
|
|
|
KEY should be `to' or `from'.
|
|
|
|
|
|
|
|
|
|
`ox-koma-letter' allows two ways to specify to and from. If both
|
|
|
|
|
are present return the preferred one as determined by
|
|
|
|
|
`org-koma-letter-prefer-special-headings'."
|
2013-06-01 13:52:36 -04:00
|
|
|
|
(let* ((plist-alist '((from . :from-address)
|
|
|
|
|
(to . :to-address)))
|
|
|
|
|
(default-alist `((from ,org-koma-letter-from-address)
|
|
|
|
|
(to "\\mbox{}")))
|
|
|
|
|
(option-value (plist-get info (cdr-safe (assoc key plist-alist))))
|
|
|
|
|
(head-value (org-koma-letter--get-tagged-contents key))
|
|
|
|
|
(order (append
|
|
|
|
|
(funcall
|
|
|
|
|
(if (plist-get info :special-headings)
|
|
|
|
|
'reverse 'identity)
|
|
|
|
|
`(,option-value ,head-value))
|
|
|
|
|
(cdr-safe (assoc key default-alist))))
|
|
|
|
|
tmp
|
|
|
|
|
(adr (dolist (x order tmp)
|
|
|
|
|
(when (and (not tmp) x)
|
|
|
|
|
(setq tmp x)))))
|
|
|
|
|
(when adr
|
|
|
|
|
(replace-regexp-in-string
|
|
|
|
|
"\n" "\\\\\\\\\n"
|
2013-08-17 16:50:47 -04:00
|
|
|
|
(org-koma-letter--normalize-string adr)))))
|
2013-06-01 13:52:36 -04:00
|
|
|
|
|
2012-11-26 02:55:27 -05:00
|
|
|
|
;;; Transcode Functions
|
|
|
|
|
|
|
|
|
|
;;;; Export Block
|
|
|
|
|
|
|
|
|
|
(defun org-koma-letter-export-block (export-block contents info)
|
|
|
|
|
"Transcode an EXPORT-BLOCK element into KOMA Scrlttr2 code.
|
|
|
|
|
CONTENTS is nil. INFO is a plist used as a communication
|
|
|
|
|
channel."
|
|
|
|
|
(when (member (org-element-property :type export-block) '("KOMA-LETTER" "LATEX"))
|
|
|
|
|
(org-remove-indentation (org-element-property :value export-block))))
|
|
|
|
|
|
|
|
|
|
;;;; Export Snippet
|
|
|
|
|
|
|
|
|
|
(defun org-koma-letter-export-snippet (export-snippet contents info)
|
|
|
|
|
"Transcode an EXPORT-SNIPPET object into KOMA Scrlttr2 code.
|
|
|
|
|
CONTENTS is nil. INFO is a plist used as a communication
|
|
|
|
|
channel."
|
2013-02-08 17:07:36 -05:00
|
|
|
|
(when (memq (org-export-snippet-backend export-snippet) '(latex koma-letter))
|
2012-11-26 02:55:27 -05:00
|
|
|
|
(org-element-property :value export-snippet)))
|
|
|
|
|
|
|
|
|
|
;;;; Keyword
|
|
|
|
|
|
|
|
|
|
(defun org-koma-letter-keyword (keyword contents info)
|
|
|
|
|
"Transcode a KEYWORD element into KOMA Scrlttr2 code.
|
|
|
|
|
CONTENTS is nil. INFO is a plist used as a communication
|
|
|
|
|
channel."
|
|
|
|
|
(let ((key (org-element-property :key keyword))
|
2013-06-01 13:52:36 -04:00
|
|
|
|
(value (org-element-property :value keyword)))
|
2012-11-26 02:55:27 -05:00
|
|
|
|
;; Handle specifically BEAMER and TOC (headlines only) keywords.
|
2013-02-08 17:07:36 -05:00
|
|
|
|
;; Otherwise, fallback to `latex' back-end.
|
2012-11-26 02:55:27 -05:00
|
|
|
|
(if (equal key "KOMA-LETTER") value
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(org-export-with-backend 'latex keyword contents info))))
|
2012-11-26 02:55:27 -05:00
|
|
|
|
|
2013-05-26 10:14:51 -04:00
|
|
|
|
|
|
|
|
|
;; Headline
|
|
|
|
|
|
|
|
|
|
(defun org-koma-letter-headline (headline contents info)
|
|
|
|
|
"Transcode a HEADLINE element from Org to LaTeX.
|
|
|
|
|
CONTENTS holds the contents of the headline. INFO is a plist
|
|
|
|
|
holding contextual information.
|
|
|
|
|
|
|
|
|
|
Note that if a headline is tagged with a tag from
|
|
|
|
|
`org-koma-letter-special-tags' it will not be exported, but
|
|
|
|
|
stored in `org-koma-letter-special-contents' and included at the
|
|
|
|
|
appropriate place."
|
|
|
|
|
(let*
|
2013-05-27 11:29:14 -04:00
|
|
|
|
((tags (org-export-get-tags headline info))
|
|
|
|
|
(tag* (car tags))
|
|
|
|
|
(tag (when tag*
|
|
|
|
|
(car (member-ignore-case
|
|
|
|
|
tag*
|
|
|
|
|
(mapcar 'symbol-name (plist-get info :special-tags)))))))
|
|
|
|
|
(if tag
|
2013-05-26 10:14:51 -04:00
|
|
|
|
(progn
|
|
|
|
|
(push (cons tag contents)
|
|
|
|
|
org-koma-letter-special-contents)
|
|
|
|
|
nil)
|
2013-08-17 14:24:36 -04:00
|
|
|
|
(unless (or (plist-get info :opening)
|
|
|
|
|
(not org-koma-letter-headline-is-opening-maybe))
|
|
|
|
|
(plist-put info :opening
|
|
|
|
|
(org-export-data (org-element-property :title headline) info)))
|
2013-05-26 10:14:51 -04:00
|
|
|
|
contents)))
|
|
|
|
|
|
|
|
|
|
|
2012-11-26 02:55:27 -05:00
|
|
|
|
;;;; Template
|
|
|
|
|
|
|
|
|
|
(defun org-koma-letter-template (contents info)
|
|
|
|
|
"Return complete document string after KOMA Scrlttr2 conversion.
|
|
|
|
|
CONTENTS is the transcoded contents string. INFO is a plist
|
|
|
|
|
holding export options."
|
2013-05-26 10:14:51 -04:00
|
|
|
|
;; FIXME: instead of setq'ing org-koma-letter-special-contents and
|
|
|
|
|
;; callying varioues stuff it might be nice to put a big let* around the templace
|
|
|
|
|
;; as in org-groff...
|
2012-11-26 02:55:27 -05:00
|
|
|
|
(concat
|
|
|
|
|
;; Time-stamp.
|
|
|
|
|
(and (plist-get info :time-stamp-file)
|
|
|
|
|
(format-time-string "%% Created %Y-%m-%d %a %H:%M\n"))
|
|
|
|
|
;; Document class and packages.
|
2013-07-12 03:07:23 -04:00
|
|
|
|
(let* ((class (plist-get info :latex-class))
|
|
|
|
|
(class-options (plist-get info :latex-class-options))
|
|
|
|
|
(header (nth 1 (assoc class org-latex-classes)))
|
|
|
|
|
(document-class-string
|
|
|
|
|
(and (stringp header)
|
|
|
|
|
(if (not class-options) header
|
|
|
|
|
(replace-regexp-in-string
|
|
|
|
|
"^[ \t]*\\\\documentclass\\(\\(\\[[^]]*\\]\\)?\\)"
|
|
|
|
|
class-options header t nil 1)))))
|
|
|
|
|
(if (not document-class-string)
|
2013-07-12 03:10:26 -04:00
|
|
|
|
(user-error "Unknown LaTeX class `%s'" class)
|
2013-07-12 03:07:23 -04:00
|
|
|
|
(org-latex-guess-babel-language
|
|
|
|
|
(org-latex-guess-inputenc
|
|
|
|
|
(org-element-normalize-string
|
|
|
|
|
(org-splice-latex-header
|
|
|
|
|
document-class-string
|
|
|
|
|
org-latex-default-packages-alist ; Defined in org.el.
|
|
|
|
|
org-latex-packages-alist nil ; Defined in org.el.
|
2013-07-12 03:10:26 -04:00
|
|
|
|
(concat (org-element-normalize-string (plist-get info :latex-header))
|
2013-07-12 03:07:23 -04:00
|
|
|
|
(plist-get info :latex-header-extra)))))
|
|
|
|
|
info)))
|
2013-04-21 07:41:22 -04:00
|
|
|
|
(let ((lco (plist-get info :lco))
|
2013-05-26 10:13:39 -04:00
|
|
|
|
(author (plist-get info :author))
|
2013-07-22 10:46:02 -04:00
|
|
|
|
(author-set (plist-get info :author-changed-in-buffer-p))
|
2013-08-17 16:50:47 -04:00
|
|
|
|
(from-address (org-koma-letter--determine-to-and-from info 'from))
|
2013-04-21 07:41:22 -04:00
|
|
|
|
(phone-number (plist-get info :phone-number))
|
|
|
|
|
(email (plist-get info :email))
|
2013-07-22 10:46:02 -04:00
|
|
|
|
(email-set (plist-get info :email-changed-in-buffer-p))
|
2013-04-21 07:41:22 -04:00
|
|
|
|
(signature (plist-get info :signature)))
|
|
|
|
|
(concat
|
2013-07-22 10:46:02 -04:00
|
|
|
|
;; author or email not set in file: may be overridden by lco
|
|
|
|
|
(unless author-set
|
|
|
|
|
(when author (format "\\setkomavar{fromname}{%s}\n"
|
|
|
|
|
(org-export-data author info))))
|
|
|
|
|
(unless email-set
|
|
|
|
|
(when email (format "\\setkomavar{fromemail}{%s}\n" email)))
|
2013-04-21 07:41:22 -04:00
|
|
|
|
;; Letter Class Option File
|
2013-05-26 10:14:51 -04:00
|
|
|
|
(when lco
|
2013-04-21 12:43:11 -04:00
|
|
|
|
(let ((lco-files (split-string lco " "))
|
|
|
|
|
(lco-def ""))
|
|
|
|
|
(dolist (lco-file lco-files lco-def)
|
|
|
|
|
(setq lco-def (format "%s\\LoadLetterOption{%s}\n" lco-def lco-file)))
|
|
|
|
|
lco-def))
|
2013-04-21 07:41:22 -04:00
|
|
|
|
;; Define "From" data.
|
2013-07-22 10:46:02 -04:00
|
|
|
|
(when (and author author-set) (format "\\setkomavar{fromname}{%s}\n"
|
|
|
|
|
(org-export-data author info)))
|
2013-04-21 07:41:22 -04:00
|
|
|
|
(when from-address (format "\\setkomavar{fromaddress}{%s}\n" from-address))
|
2013-07-22 10:46:02 -04:00
|
|
|
|
(when phone-number
|
|
|
|
|
(format "\\setkomavar{fromphone}{%s}\n" phone-number))
|
|
|
|
|
(when (and email email-set) (format "\\setkomavar{fromemail}{%s}\n" email))
|
2013-04-21 07:41:22 -04:00
|
|
|
|
(when signature (format "\\setkomavar{signature}{%s}\n" signature))))
|
2012-11-26 02:55:27 -05:00
|
|
|
|
;; Date.
|
2013-04-02 18:02:15 -04:00
|
|
|
|
(format "\\date{%s}\n" (org-export-data (org-export-get-date info) info))
|
ox-koma-letter: Export options to control letter
* ox-koma-letter.el ((org-koma-letter-use-subject):
Configure printing of subject line.
(org-koma-letter-use-backaddress): Configure presence of back
address.
(org-koma-letter-use-foldmarks): Configure presence of foldmarks.
(org-koma-letter-use-phone): Configure printing of phone number.
(org-koma-letter-use-email): Configure printing of email.
(org-koma-letter-use-place): Configure printing of place.
(koma-letter): Add export option to exporter backend.
(org-koma-letter-template): Evaluate export options in
exporter template.
Usage:
#+OPTIONS: backaddress:t foldmarks:t subject:titled phone:t email:t place:t
Except for `subject', all options are boolean, i.e., the accept the
values `nil' and `t'. `subject' accepts the values defined in
`scrlttr2`, i.e., `afteropening', `beforeopening', `centered', `left',
`right', `titled', `underlined', and `untitled'.
Signed-off-by: Alan Schmitt <alan.schmitt@polytechnique.org>
2013-04-21 10:34:35 -04:00
|
|
|
|
;; Place
|
|
|
|
|
(let ((with-place (plist-get info :with-place))
|
|
|
|
|
(place (plist-get info :place)))
|
|
|
|
|
(when (or place (not with-place))
|
|
|
|
|
(format "\\setkomavar{place}{%s}\n" (if with-place place ""))))
|
|
|
|
|
;; KOMA options
|
|
|
|
|
(let ((with-backaddress (plist-get info :with-backaddress))
|
2013-07-22 10:46:02 -04:00
|
|
|
|
(with-backaddress-set (plist-get info :with-backaddress-changed-in-buffer-p))
|
ox-koma-letter: Export options to control letter
* ox-koma-letter.el ((org-koma-letter-use-subject):
Configure printing of subject line.
(org-koma-letter-use-backaddress): Configure presence of back
address.
(org-koma-letter-use-foldmarks): Configure presence of foldmarks.
(org-koma-letter-use-phone): Configure printing of phone number.
(org-koma-letter-use-email): Configure printing of email.
(org-koma-letter-use-place): Configure printing of place.
(koma-letter): Add export option to exporter backend.
(org-koma-letter-template): Evaluate export options in
exporter template.
Usage:
#+OPTIONS: backaddress:t foldmarks:t subject:titled phone:t email:t place:t
Except for `subject', all options are boolean, i.e., the accept the
values `nil' and `t'. `subject' accepts the values defined in
`scrlttr2`, i.e., `afteropening', `beforeopening', `centered', `left',
`right', `titled', `underlined', and `untitled'.
Signed-off-by: Alan Schmitt <alan.schmitt@polytechnique.org>
2013-04-21 10:34:35 -04:00
|
|
|
|
(with-foldmarks (plist-get info :with-foldmarks))
|
2013-07-22 10:46:02 -04:00
|
|
|
|
(with-foldmarks-set
|
|
|
|
|
(not (string-equal (plist-get info :with-foldmarks-changed-in-buffer-p)
|
|
|
|
|
"foldmarks-not-set")))
|
ox-koma-letter: Export options to control letter
* ox-koma-letter.el ((org-koma-letter-use-subject):
Configure printing of subject line.
(org-koma-letter-use-backaddress): Configure presence of back
address.
(org-koma-letter-use-foldmarks): Configure presence of foldmarks.
(org-koma-letter-use-phone): Configure printing of phone number.
(org-koma-letter-use-email): Configure printing of email.
(org-koma-letter-use-place): Configure printing of place.
(koma-letter): Add export option to exporter backend.
(org-koma-letter-template): Evaluate export options in
exporter template.
Usage:
#+OPTIONS: backaddress:t foldmarks:t subject:titled phone:t email:t place:t
Except for `subject', all options are boolean, i.e., the accept the
values `nil' and `t'. `subject' accepts the values defined in
`scrlttr2`, i.e., `afteropening', `beforeopening', `centered', `left',
`right', `titled', `underlined', and `untitled'.
Signed-off-by: Alan Schmitt <alan.schmitt@polytechnique.org>
2013-04-21 10:34:35 -04:00
|
|
|
|
(with-phone (plist-get info :with-phone))
|
2013-07-22 10:46:02 -04:00
|
|
|
|
(with-phone-set (plist-get info :with-phone-changed-in-buffer-p))
|
|
|
|
|
(with-email (plist-get info :with-email))
|
|
|
|
|
(with-email-set (plist-get info :with-email-changed-in-buffer-p)))
|
ox-koma-letter: Export options to control letter
* ox-koma-letter.el ((org-koma-letter-use-subject):
Configure printing of subject line.
(org-koma-letter-use-backaddress): Configure presence of back
address.
(org-koma-letter-use-foldmarks): Configure presence of foldmarks.
(org-koma-letter-use-phone): Configure printing of phone number.
(org-koma-letter-use-email): Configure printing of email.
(org-koma-letter-use-place): Configure printing of place.
(koma-letter): Add export option to exporter backend.
(org-koma-letter-template): Evaluate export options in
exporter template.
Usage:
#+OPTIONS: backaddress:t foldmarks:t subject:titled phone:t email:t place:t
Except for `subject', all options are boolean, i.e., the accept the
values `nil' and `t'. `subject' accepts the values defined in
`scrlttr2`, i.e., `afteropening', `beforeopening', `centered', `left',
`right', `titled', `underlined', and `untitled'.
Signed-off-by: Alan Schmitt <alan.schmitt@polytechnique.org>
2013-04-21 10:34:35 -04:00
|
|
|
|
(concat
|
2013-07-22 10:46:02 -04:00
|
|
|
|
(when with-backaddress-set
|
|
|
|
|
(format "\\KOMAoption{backaddress}{%s}\n" (if with-backaddress "true" "false")))
|
|
|
|
|
(when with-foldmarks-set
|
|
|
|
|
(format "\\KOMAoption{foldmarks}{%s}\n" (if with-foldmarks with-foldmarks "false")))
|
|
|
|
|
(when with-phone-set
|
|
|
|
|
(format "\\KOMAoption{fromphone}{%s}\n" (if with-phone "true" "false")))
|
|
|
|
|
(when with-email-set
|
|
|
|
|
(format "\\KOMAoption{fromemail}{%s}\n" (if with-email "true" "false")))))
|
ox-koma-letter: Export options to control letter
* ox-koma-letter.el ((org-koma-letter-use-subject):
Configure printing of subject line.
(org-koma-letter-use-backaddress): Configure presence of back
address.
(org-koma-letter-use-foldmarks): Configure presence of foldmarks.
(org-koma-letter-use-phone): Configure printing of phone number.
(org-koma-letter-use-email): Configure printing of email.
(org-koma-letter-use-place): Configure printing of place.
(koma-letter): Add export option to exporter backend.
(org-koma-letter-template): Evaluate export options in
exporter template.
Usage:
#+OPTIONS: backaddress:t foldmarks:t subject:titled phone:t email:t place:t
Except for `subject', all options are boolean, i.e., the accept the
values `nil' and `t'. `subject' accepts the values defined in
`scrlttr2`, i.e., `afteropening', `beforeopening', `centered', `left',
`right', `titled', `underlined', and `untitled'.
Signed-off-by: Alan Schmitt <alan.schmitt@polytechnique.org>
2013-04-21 10:34:35 -04:00
|
|
|
|
;; Document start
|
2012-11-26 02:55:27 -05:00
|
|
|
|
"\\begin{document}\n\n"
|
ox-koma-letter: Export options to control letter
* ox-koma-letter.el ((org-koma-letter-use-subject):
Configure printing of subject line.
(org-koma-letter-use-backaddress): Configure presence of back
address.
(org-koma-letter-use-foldmarks): Configure presence of foldmarks.
(org-koma-letter-use-phone): Configure printing of phone number.
(org-koma-letter-use-email): Configure printing of email.
(org-koma-letter-use-place): Configure printing of place.
(koma-letter): Add export option to exporter backend.
(org-koma-letter-template): Evaluate export options in
exporter template.
Usage:
#+OPTIONS: backaddress:t foldmarks:t subject:titled phone:t email:t place:t
Except for `subject', all options are boolean, i.e., the accept the
values `nil' and `t'. `subject' accepts the values defined in
`scrlttr2`, i.e., `afteropening', `beforeopening', `centered', `left',
`right', `titled', `underlined', and `untitled'.
Signed-off-by: Alan Schmitt <alan.schmitt@polytechnique.org>
2013-04-21 10:34:35 -04:00
|
|
|
|
;; Subject
|
2013-05-19 11:32:44 -04:00
|
|
|
|
(let* ((with-subject (plist-get info :with-subject))
|
|
|
|
|
(subject-format (cond ((member with-subject '("true" "t" t)) nil)
|
|
|
|
|
((stringp with-subject) (list with-subject))
|
|
|
|
|
((symbolp with-subject)
|
|
|
|
|
(list (symbol-name with-subject)))
|
|
|
|
|
(t with-subject)))
|
|
|
|
|
(subject (org-export-data (plist-get info :title) info))
|
|
|
|
|
(l (length subject-format))
|
|
|
|
|
(y ""))
|
|
|
|
|
(concat
|
|
|
|
|
(when (and with-subject subject-format)
|
|
|
|
|
(concat
|
|
|
|
|
"\\KOMAoption{subject}{"
|
|
|
|
|
(apply 'format
|
|
|
|
|
(dotimes (x l y)
|
|
|
|
|
(setq y (concat (if (> x 0) "%s," "%s") y)))
|
|
|
|
|
subject-format) "}\n"))
|
2013-07-12 03:10:26 -04:00
|
|
|
|
(when (and subject with-subject)
|
|
|
|
|
(format "\\setkomavar{subject}{%s}\n\n" subject))))
|
ox-koma-letter: Export options to control letter
* ox-koma-letter.el ((org-koma-letter-use-subject):
Configure printing of subject line.
(org-koma-letter-use-backaddress): Configure presence of back
address.
(org-koma-letter-use-foldmarks): Configure presence of foldmarks.
(org-koma-letter-use-phone): Configure printing of phone number.
(org-koma-letter-use-email): Configure printing of email.
(org-koma-letter-use-place): Configure printing of place.
(koma-letter): Add export option to exporter backend.
(org-koma-letter-template): Evaluate export options in
exporter template.
Usage:
#+OPTIONS: backaddress:t foldmarks:t subject:titled phone:t email:t place:t
Except for `subject', all options are boolean, i.e., the accept the
values `nil' and `t'. `subject' accepts the values defined in
`scrlttr2`, i.e., `afteropening', `beforeopening', `centered', `left',
`right', `titled', `underlined', and `untitled'.
Signed-off-by: Alan Schmitt <alan.schmitt@polytechnique.org>
2013-04-21 10:34:35 -04:00
|
|
|
|
;; Letter start
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(format "\\begin{letter}{%%\n%s}\n\n"
|
2013-08-17 16:50:47 -04:00
|
|
|
|
(org-koma-letter--determine-to-and-from info 'to))
|
2012-11-26 02:55:27 -05:00
|
|
|
|
;; Opening.
|
2013-08-17 14:24:36 -04:00
|
|
|
|
(format "\\opening{%s}\n\n" (or (plist-get info :opening) ""))
|
2012-11-26 02:55:27 -05:00
|
|
|
|
;; Letter body.
|
|
|
|
|
contents
|
|
|
|
|
;; Closing.
|
2013-08-17 14:24:36 -04:00
|
|
|
|
(format "\n\\closing{%s}\n" (or (plist-get info :closing) ""))
|
2013-08-17 16:50:47 -04:00
|
|
|
|
(org-koma-letter--special-contents-as-macro
|
2013-05-26 10:14:51 -04:00
|
|
|
|
(plist-get info :with-after-closing))
|
2012-11-26 02:55:27 -05:00
|
|
|
|
;; Letter end.
|
2013-05-26 10:14:51 -04:00
|
|
|
|
"\n\\end{letter}\n"
|
2013-08-17 16:50:47 -04:00
|
|
|
|
(org-koma-letter--special-contents-as-macro
|
2013-05-26 10:14:51 -04:00
|
|
|
|
(plist-get info :with-after-letter) t t)
|
|
|
|
|
;; Document end.
|
|
|
|
|
"\n\\end{document}"
|
|
|
|
|
))
|
2012-11-26 02:55:27 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;; Commands
|
|
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
|
(defun org-koma-letter-export-as-latex
|
2012-12-14 10:55:17 -05:00
|
|
|
|
(&optional async subtreep visible-only body-only ext-plist)
|
2012-11-26 02:55:27 -05:00
|
|
|
|
"Export current buffer as a KOMA Scrlttr2 letter.
|
|
|
|
|
|
|
|
|
|
If narrowing is active in the current buffer, only export its
|
|
|
|
|
narrowed part.
|
|
|
|
|
|
|
|
|
|
If a region is active, export that region.
|
|
|
|
|
|
2012-12-14 10:55:17 -05:00
|
|
|
|
A non-nil optional argument ASYNC means the process should happen
|
|
|
|
|
asynchronously. The resulting buffer should be accessible
|
|
|
|
|
through the `org-export-stack' interface.
|
|
|
|
|
|
2012-11-26 02:55:27 -05:00
|
|
|
|
When optional argument SUBTREEP is non-nil, export the sub-tree
|
|
|
|
|
at point, extracting information from the headline properties
|
|
|
|
|
first.
|
|
|
|
|
|
|
|
|
|
When optional argument VISIBLE-ONLY is non-nil, don't export
|
|
|
|
|
contents of hidden elements.
|
|
|
|
|
|
|
|
|
|
When optional argument BODY-ONLY is non-nil, only write code
|
|
|
|
|
between \"\\begin{letter}\" and \"\\end{letter}\".
|
|
|
|
|
|
2013-05-26 10:14:51 -04:00
|
|
|
|
EXT-PLIST, when provided, is a proeprty list with external
|
2012-11-26 02:55:27 -05:00
|
|
|
|
parameters overriding Org default settings, but still inferior to
|
|
|
|
|
file-local settings.
|
|
|
|
|
|
|
|
|
|
Export is done in a buffer named \"*Org KOMA-LETTER Export*\". It
|
|
|
|
|
will be displayed if `org-export-show-temporary-export-buffer' is
|
|
|
|
|
non-nil."
|
|
|
|
|
(interactive)
|
2013-05-26 10:14:51 -04:00
|
|
|
|
(let (org-koma-letter-special-contents)
|
Export back-ends: Apply changes to export functions
* contrib/lisp/ox-confluence.el (org-confluence-export-as-confluence):
* contrib/lisp/ox-deck.el (org-deck-export-as-html,
org-deck-export-to-html):
* contrib/lisp/ox-freemind.el (org-freemind-export-to-freemind):
* contrib/lisp/ox-groff.el (org-groff-export-to-groff,
org-groff-export-to-pdf):
* contrib/lisp/ox-koma-letter.el (org-koma-letter-export-as-latex,
org-koma-letter-export-to-latex, org-koma-letter-export-to-pdf):
* contrib/lisp/ox-rss.el (org-rss-export-as-rss,
org-rss-export-to-rss):
* contrib/lisp/ox-s5.el (org-s5-export-as-html,
org-s5-export-to-html):
* contrib/lisp/ox-taskjuggler.el (org-taskjuggler-export):
* lisp/ob-haskell.el:
* lisp/ox-ascii.el (org-ascii-export-as-ascii,
org-ascii-export-to-ascii):
* lisp/ox-beamer.el (org-beamer-export-as-latex,
org-beamer-export-to-latex, org-beamer-export-to-pdf):
* lisp/ox-html.el (org-html-export-as-html, org-html-export-to-html):
* lisp/ox-icalendar.el (org-icalendar-export-to-ics):
* lisp/ox-latex.el (org-latex-export-as-latex,
org-latex-export-to-pdf):
* lisp/ox-man.el (org-man-export-to-man, org-man-export-to-pdf):
* lisp/ox-md.el (org-md-export-as-markdown,
org-md-export-to-markdown):
* lisp/ox-odt.el (org-odt-export-to-odt):
* lisp/ox-org.el (org-org-export-as-org, org-org-export-to-org):
* lisp/ox-publish.el (org-publish-org-to):
* lisp/ox-texinfo.el (org-texinfo-export-to-texinfo,
org-texinfo-export-to-info):
* testing/lisp/test-ob-exp.el (test-ob-exp/org-babel-exp-src-blocks/w-no-file):
2013-08-07 04:35:42 -04:00
|
|
|
|
(org-export-to-buffer 'koma-letter "*Org KOMA-LETTER Export*"
|
|
|
|
|
async subtreep visible-only body-only ext-plist
|
|
|
|
|
(lambda () (LaTeX-mode)))))
|
2012-11-26 02:55:27 -05:00
|
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
|
(defun org-koma-letter-export-to-latex
|
2012-12-14 10:55:17 -05:00
|
|
|
|
(&optional async subtreep visible-only body-only ext-plist)
|
2012-11-26 02:55:27 -05:00
|
|
|
|
"Export current buffer as a KOMA Scrlttr2 letter (tex).
|
|
|
|
|
|
|
|
|
|
If narrowing is active in the current buffer, only export its
|
|
|
|
|
narrowed part.
|
|
|
|
|
|
|
|
|
|
If a region is active, export that region.
|
|
|
|
|
|
2012-12-14 10:55:17 -05:00
|
|
|
|
A non-nil optional argument ASYNC means the process should happen
|
|
|
|
|
asynchronously. The resulting file should be accessible through
|
|
|
|
|
the `org-export-stack' interface.
|
|
|
|
|
|
2012-11-26 02:55:27 -05:00
|
|
|
|
When optional argument SUBTREEP is non-nil, export the sub-tree
|
|
|
|
|
at point, extracting information from the headline properties
|
|
|
|
|
first.
|
|
|
|
|
|
|
|
|
|
When optional argument VISIBLE-ONLY is non-nil, don't export
|
|
|
|
|
contents of hidden elements.
|
|
|
|
|
|
|
|
|
|
When optional argument BODY-ONLY is non-nil, only write code
|
|
|
|
|
between \"\\begin{letter}\" and \"\\end{letter}\".
|
|
|
|
|
|
|
|
|
|
EXT-PLIST, when provided, is a property list with external
|
|
|
|
|
parameters overriding Org default settings, but still inferior to
|
|
|
|
|
file-local settings.
|
|
|
|
|
|
|
|
|
|
When optional argument PUB-DIR is set, use it as the publishing
|
|
|
|
|
directory.
|
|
|
|
|
|
|
|
|
|
Return output file's name."
|
|
|
|
|
(interactive)
|
2013-05-27 11:29:14 -04:00
|
|
|
|
(let ((outfile (org-export-output-file-name ".tex" subtreep))
|
Export back-ends: Apply changes to export functions
* contrib/lisp/ox-confluence.el (org-confluence-export-as-confluence):
* contrib/lisp/ox-deck.el (org-deck-export-as-html,
org-deck-export-to-html):
* contrib/lisp/ox-freemind.el (org-freemind-export-to-freemind):
* contrib/lisp/ox-groff.el (org-groff-export-to-groff,
org-groff-export-to-pdf):
* contrib/lisp/ox-koma-letter.el (org-koma-letter-export-as-latex,
org-koma-letter-export-to-latex, org-koma-letter-export-to-pdf):
* contrib/lisp/ox-rss.el (org-rss-export-as-rss,
org-rss-export-to-rss):
* contrib/lisp/ox-s5.el (org-s5-export-as-html,
org-s5-export-to-html):
* contrib/lisp/ox-taskjuggler.el (org-taskjuggler-export):
* lisp/ob-haskell.el:
* lisp/ox-ascii.el (org-ascii-export-as-ascii,
org-ascii-export-to-ascii):
* lisp/ox-beamer.el (org-beamer-export-as-latex,
org-beamer-export-to-latex, org-beamer-export-to-pdf):
* lisp/ox-html.el (org-html-export-as-html, org-html-export-to-html):
* lisp/ox-icalendar.el (org-icalendar-export-to-ics):
* lisp/ox-latex.el (org-latex-export-as-latex,
org-latex-export-to-pdf):
* lisp/ox-man.el (org-man-export-to-man, org-man-export-to-pdf):
* lisp/ox-md.el (org-md-export-as-markdown,
org-md-export-to-markdown):
* lisp/ox-odt.el (org-odt-export-to-odt):
* lisp/ox-org.el (org-org-export-as-org, org-org-export-to-org):
* lisp/ox-publish.el (org-publish-org-to):
* lisp/ox-texinfo.el (org-texinfo-export-to-texinfo,
org-texinfo-export-to-info):
* testing/lisp/test-ob-exp.el (test-ob-exp/org-babel-exp-src-blocks/w-no-file):
2013-08-07 04:35:42 -04:00
|
|
|
|
(org-koma-letter-special-contents))
|
|
|
|
|
(org-export-to-file 'koma-letter outfile
|
|
|
|
|
async subtreep visible-only body-only ext-plist)))
|
2012-11-26 02:55:27 -05:00
|
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
|
(defun org-koma-letter-export-to-pdf
|
2012-12-14 10:55:17 -05:00
|
|
|
|
(&optional async subtreep visible-only body-only ext-plist)
|
2012-11-26 02:55:27 -05:00
|
|
|
|
"Export current buffer as a KOMA Scrlttr2 letter (pdf).
|
|
|
|
|
|
|
|
|
|
If narrowing is active in the current buffer, only export its
|
|
|
|
|
narrowed part.
|
|
|
|
|
|
|
|
|
|
If a region is active, export that region.
|
|
|
|
|
|
2012-12-14 10:55:17 -05:00
|
|
|
|
A non-nil optional argument ASYNC means the process should happen
|
|
|
|
|
asynchronously. The resulting file should be accessible through
|
|
|
|
|
the `org-export-stack' interface.
|
|
|
|
|
|
2012-11-26 02:55:27 -05:00
|
|
|
|
When optional argument SUBTREEP is non-nil, export the sub-tree
|
|
|
|
|
at point, extracting information from the headline properties
|
|
|
|
|
first.
|
|
|
|
|
|
|
|
|
|
When optional argument VISIBLE-ONLY is non-nil, don't export
|
|
|
|
|
contents of hidden elements.
|
|
|
|
|
|
|
|
|
|
When optional argument BODY-ONLY is non-nil, only write code
|
|
|
|
|
between \"\\begin{letter}\" and \"\\end{letter}\".
|
|
|
|
|
|
|
|
|
|
EXT-PLIST, when provided, is a property list with external
|
|
|
|
|
parameters overriding Org default settings, but still inferior to
|
|
|
|
|
file-local settings.
|
|
|
|
|
|
|
|
|
|
Return PDF file's name."
|
|
|
|
|
(interactive)
|
Export back-ends: Apply changes to export functions
* contrib/lisp/ox-confluence.el (org-confluence-export-as-confluence):
* contrib/lisp/ox-deck.el (org-deck-export-as-html,
org-deck-export-to-html):
* contrib/lisp/ox-freemind.el (org-freemind-export-to-freemind):
* contrib/lisp/ox-groff.el (org-groff-export-to-groff,
org-groff-export-to-pdf):
* contrib/lisp/ox-koma-letter.el (org-koma-letter-export-as-latex,
org-koma-letter-export-to-latex, org-koma-letter-export-to-pdf):
* contrib/lisp/ox-rss.el (org-rss-export-as-rss,
org-rss-export-to-rss):
* contrib/lisp/ox-s5.el (org-s5-export-as-html,
org-s5-export-to-html):
* contrib/lisp/ox-taskjuggler.el (org-taskjuggler-export):
* lisp/ob-haskell.el:
* lisp/ox-ascii.el (org-ascii-export-as-ascii,
org-ascii-export-to-ascii):
* lisp/ox-beamer.el (org-beamer-export-as-latex,
org-beamer-export-to-latex, org-beamer-export-to-pdf):
* lisp/ox-html.el (org-html-export-as-html, org-html-export-to-html):
* lisp/ox-icalendar.el (org-icalendar-export-to-ics):
* lisp/ox-latex.el (org-latex-export-as-latex,
org-latex-export-to-pdf):
* lisp/ox-man.el (org-man-export-to-man, org-man-export-to-pdf):
* lisp/ox-md.el (org-md-export-as-markdown,
org-md-export-to-markdown):
* lisp/ox-odt.el (org-odt-export-to-odt):
* lisp/ox-org.el (org-org-export-as-org, org-org-export-to-org):
* lisp/ox-publish.el (org-publish-org-to):
* lisp/ox-texinfo.el (org-texinfo-export-to-texinfo,
org-texinfo-export-to-info):
* testing/lisp/test-ob-exp.el (test-ob-exp/org-babel-exp-src-blocks/w-no-file):
2013-08-07 04:35:42 -04:00
|
|
|
|
(let ((file (org-export-output-file-name ".tex" subtreep))
|
|
|
|
|
(org-koma-letter-special-contents))
|
|
|
|
|
(org-export-to-file 'koma-letter file
|
|
|
|
|
async subtreep visible-only body-only ext-plist
|
|
|
|
|
(lambda (file) (org-latex-compile file)))))
|
2012-12-14 10:55:17 -05:00
|
|
|
|
|
2012-11-26 02:55:27 -05:00
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
|
(provide 'ox-koma-letter)
|
|
|
|
|
;;; ox-koma-letter.el ends here
|