emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Rasmus <rasmus@gmx.us>
To: alan.schmitt@polytechnique.org
Cc: emacs-orgmode@gnu.org, n.goaziou@gmail.com
Subject: Re: [PATCH][ox-koma-letter] changed-in-buffer, subject, minor fixes
Date: Wed, 05 Feb 2014 02:12:25 +0100	[thread overview]
Message-ID: <874n4e1hxi.fsf@gmx.us> (raw)
In-Reply-To: <m2lhxrc8qi.fsf@polytechnique.org> (Alan Schmitt's message of "Tue, 04 Feb 2014 14:23:17 +0100")

[-- Attachment #1: Type: text/plain, Size: 310 bytes --]

Alan Schmitt <alan.schmitt@polytechnique.org> writes:

> Rasmus: do you want to change these, or should I do it and apply the
> patch? (The former would be simpler, I have to say.)

Attached.  Sorry about the delay.  They should fix Nicholas'
'concerns'.

–Rasmus

-- 
Vote for proprietary math!

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Documentation-fixes-for-ox-koma-script.el.patch --]
[-- Type: text/x-diff, Size: 3215 bytes --]

From 8f3e69f5ca3d0153b6f4c80b74c7aa6f422c86e5 Mon Sep 17 00:00:00 2001
From: Rasmus <w530@pank.eu>
Date: Sat, 25 Jan 2014 14:08:15 +0100
Subject: [PATCH 1/2] Documentation fixes for ox-koma-script.el

* ox-koma-letter.el commentary (org-koma-letter-use-backaddress):
  Better documentation.
---
 contrib/lisp/ox-koma-letter.el | 30 ++++++++++++++++++------------
 1 file changed, 18 insertions(+), 12 deletions(-)

diff --git a/contrib/lisp/ox-koma-letter.el b/contrib/lisp/ox-koma-letter.el
index 7f2cd22..0d15956 100644
--- a/contrib/lisp/ox-koma-letter.el
+++ b/contrib/lisp/ox-koma-letter.el
@@ -34,14 +34,14 @@
 ;; On top of buffer keywords supported by `latex' back-end (see
 ;; `org-latex-options-alist'), this back-end introduces the following
 ;; keywords:
-;;   - "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')
-;;   - and "TO_ADDRESS".  If unspecified this is set to "\mbox{}".
+;;   - 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{}".
 ;;
 ;; TO_ADDRESS and FROM_ADDRESS can also be specified using heading
 ;; with the special tags specified in
@@ -67,8 +67,9 @@
 ;;     (see `org-koma-letter-special-tags-after-letter').
 ;;
 ;; The following variables works differently from the main LaTeX class
-;;   - "AUTHOR": default to user-full-name but may be disabled.  (see org-koma-letter-author),
-;;   - "EMAIL": same as AUTHOR, (see org-koma-letter-email),
+;;   - 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'),
 ;;
 ;; Headlines are in general ignored.  However, headlines with special
 ;; tags can be used for specified contents like postscript (ps),
@@ -105,11 +106,16 @@
 ;;   \[EXTRA]"))
 ;;
 ;; Then, in your Org document, be sure to require the proper class
-;; with :
+;; with:
 ;;
 ;;    #+LATEX_CLASS: my-letter
 ;;
 ;; Or by setting `org-koma-letter-default-class'.
+;;
+;; 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))
 
 ;;; Code:
 
@@ -252,7 +258,7 @@ This option can also be set with the OPTIONS keyword, e.g.:
   :group 'org-export-koma-letter)
 
 (defcustom org-koma-letter-use-backaddress nil
-  "Non-nil prints return address in small line above to address.
+  "Non-nil prints return address in line above to address.
 This option can also be set with the OPTIONS keyword, e.g.:
 \"backaddress:t\"."
   :group 'org-export-koma-letter
-- 
1.8.5.3


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-Allow-separate-subject-and-title-in-ox-koma-letter.patch --]
[-- Type: text/x-diff, Size: 4789 bytes --]

From a55d3611d5ae6b04c64513490d68a9959672c86f Mon Sep 17 00:00:00 2001
From: Rasmus <w530@pank.eu>
Date: Sat, 25 Jan 2014 14:15:03 +0100
Subject: [PATCH 2/2] Allow separate subject and title in ox-koma-letter

* ox-koma-letter.el (org-koma-letter-use-title): New variable.
(org-koma-letter-prefer-subject): New variable.
(org-koma-letter-template): Allow separate subject and title.
---
 contrib/lisp/ox-koma-letter.el | 41 +++++++++++++++++++++++++++++++++++++----
 1 file changed, 37 insertions(+), 4 deletions(-)

diff --git a/contrib/lisp/ox-koma-letter.el b/contrib/lisp/ox-koma-letter.el
index 0d15956..8a3054b 100644
--- a/contrib/lisp/ox-koma-letter.el
+++ b/contrib/lisp/ox-koma-letter.el
@@ -70,6 +70,8 @@
 ;;   - 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'),
+;;   - TITLE: May be the letter title or subject depending on
+;;     `org-koma-letter-prefer-subject'.
 ;;
 ;; Headlines are in general ignored.  However, headlines with special
 ;; tags can be used for specified contents like postscript (ps),
@@ -336,6 +338,16 @@ This option can also be set with the OPTIONS keyword, e.g.:
   :group 'org-export-koma-letter
   :type 'boolean)
 
+(defcustom org-koma-letter-use-title t
+  "Non-nil means use a title in the letter if present.
+This option can also be set with the OPTIONS keyword,
+e.g. \"with-title:nil\".
+
+See also `org-koma-letter-prefer-subject' for the handling of
+title versus subject."
+  :group 'org-export-koma-letter
+  :type 'boolean)
+
 (defcustom org-koma-letter-default-class "default-koma-letter"
   "Default class for `org-koma-letter'.
 The value must be a member of `org-latex-classes'."
@@ -349,6 +361,16 @@ A headline is only used if #+OPENING is not set.  See also
   :group 'org-export-koma-letter
   :type 'boolean)
 
+(defcustom org-koma-letter-prefer-subject nil
+  "Non-nil means title should be interpret as subject if subject is missing.
+This option can also be set with the OPTIONS keyword,
+e.g. \"title-subject:t\".
+
+This may be useful for older documents where the SUBJECT keyword
+was not present."
+    :group 'org-export-koma-letter
+    :type 'boolean)
+
 (defconst org-koma-letter-special-tags-in-letter '(to from)
   "Header tags related to the letter itself.")
 
@@ -378,6 +400,7 @@ A headline is only used if #+OPENING is not set.  See also
     (:opening "OPENING" nil org-koma-letter-opening)
     (:closing "CLOSING" nil org-koma-letter-closing)
     (:signature "SIGNATURE" nil org-koma-letter-signature newline)
+    (:subject "SUBJECT" nil nil space)
     (:special-headings nil "special-headings"
 		       org-koma-letter-prefer-special-headings)
     (:special-tags nil nil (append
@@ -394,6 +417,8 @@ A headline is only used if #+OPENING is not set.  See also
     (:with-phone nil "phone" org-koma-letter-use-phone)
     (:with-place nil "place" org-koma-letter-use-place)
     (:with-subject nil "subject" org-koma-letter-subject-format)
+    (:with-title nil "title" org-koma-letter-use-title)
+    (:with-title-as-subject nil "title-subject" org-koma-letter-prefer-subject)
     ;; Special properties non-nil when a setting happened in buffer.
     ;; They are used to prioritize in-buffer settings over "lco"
     ;; files.  See `org-koma-letter-template'.
@@ -599,7 +624,7 @@ holding export options."
    (format "\\date{%s}\n" (org-export-data (org-export-get-date info) info))
    ;; Document start
    "\\begin{document}\n\n"
-   ;; Subject
+   ;; Subject and title
    (let ((with-subject (plist-get info :with-subject)))
      (when with-subject
        (concat
@@ -607,9 +632,17 @@ holding export options."
 	  (format "\\KOMAoption{subject}{%s}\n"
 		  (if (symbolp with-subject) with-subject
 		    (mapconcat #'symbol-name with-subject ","))))
-	(let ((subject (org-export-data (plist-get info :title) info)))
-	  (and (org-string-nw-p subject)
-	       (format "\\setkomavar{subject}{%s}\n\n" subject))))))
+	(let* ((title-as-subject (plist-get info :with-title-as-subject))
+	       (subject* (org-string-nw-p (org-export-data (plist-get info :subject) info)))
+	       (title* (org-string-nw-p (org-export-data (plist-get info :title) info)))
+	       (subject (if title-as-subject (or subject* title*) subject*))
+	       (title (if title-as-subject (and subject* title*) title*)))
+	  (concat
+	   (and (org-string-nw-p subject)
+		(format "\\setkomavar{subject}{%s}\n" subject))
+	   (and (org-string-nw-p title)
+		(format "\\setkomavar{title}{%s}\n" title))
+	   (when (or (org-string-nw-p title) (org-string-nw-p subject)) "\n"))))))
    ;; Letter start.
    (format "\\begin{letter}{%%\n%s}\n\n"
 	   (org-koma-letter--determine-to-and-from info 'to))
-- 
1.8.5.3


  parent reply	other threads:[~2014-02-05  1:12 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-25  0:15 [PATCH][ox-koma-letter] changed-in-buffer, subject, minor fixes Rasmus
2013-11-25  9:20 ` Michael Strey
     [not found] ` <m2zjop3cgt.fsf@polytechnique.org>
2014-01-18 16:11   ` Rasmus
2014-01-18 16:18     ` Nicolas Goaziou
2014-01-18 19:27       ` Rasmus
2014-01-18 20:05         ` Nicolas Goaziou
2014-01-25 13:44           ` Rasmus
2014-01-25 22:18             ` Nicolas Goaziou
2014-02-04 13:23               ` Alan Schmitt
2014-02-04 17:21                 ` Rasmus Pank Roulund
2014-02-05  1:12                 ` Rasmus [this message]
2014-02-05 12:40                   ` Alan Schmitt
2014-02-05 12:42                     ` Alan Schmitt
2014-02-05 12:48                   ` Alan Schmitt
2014-02-05  2:02                 ` Rasmus
2014-02-05  7:46                   ` Nicolas Goaziou
2014-02-05  9:55                     ` Rasmus
2014-02-05  7:48                   ` Bastien
2014-02-05  7:59                   ` Alan Schmitt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=874n4e1hxi.fsf@gmx.us \
    --to=rasmus@gmx.us \
    --cc=alan.schmitt@polytechnique.org \
    --cc=emacs-orgmode@gnu.org \
    --cc=n.goaziou@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).