From: Rasmus <rasmus@gmx.us>
To: emacs-orgmode@gnu.org
Subject: Re: ox-koma bug in subtree export
Date: Thu, 16 Jul 2015 00:47:29 +0200 [thread overview]
Message-ID: <878uahyr5q.fsf@gmx.us> (raw)
In-Reply-To: 20150715211317.GO18343@chitra.no-ip.org
[-- Attachment #1: Type: text/plain, Size: 483 bytes --]
Suvayu Ali <fatkasuvayu+linux@gmail.com> writes:
> Something like that would be a lot more logical indeed.
The attached patch allows the Romeo letter to have a heading like this:
* Yours truly, :closing:
Romeo of House Capulet
Outputting:
\setkomavar{signature}{Romeo of house Capulet}
...
\closing{Yours truly,}
I tested it only very briefly. The wiki needs updating if applied.
Rasmus
--
When the facts change, I change my mind. What do you do, sir?
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ox-koma-letter-Add-closing-special-heading.patch --]
[-- Type: text/x-diff, Size: 4114 bytes --]
From 3b61450e916136edda49047b8616ac815da09edf Mon Sep 17 00:00:00 2001
From: Rasmus <rasmus@gmx.us>
Date: Thu, 16 Jul 2015 00:38:06 +0200
Subject: [PATCH] ox-koma-letter: Add closing special heading
* ox-koma-letter.el (org-koma-letter-special-tags-in-letter):
Add closing.
(org-koma-letter-template): Potentially take closing value
from closing spcical heading.
(org-koma-letter--build-settings): Potentially take signature
value from closing special heading.
(org-koma-letter-closing):
(org-koma-letter-signature): Update docstring.
Suggested-by: Suvayu Ali <fatkasuvayu+linux@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/99028>
---
contrib/lisp/ox-koma-letter.el | 44 +++++++++++++++++++++++++++++++++++-------
1 file changed, 37 insertions(+), 7 deletions(-)
diff --git a/contrib/lisp/ox-koma-letter.el b/contrib/lisp/ox-koma-letter.el
index d0a8109..24624ca 100644
--- a/contrib/lisp/ox-koma-letter.el
+++ b/contrib/lisp/ox-koma-letter.el
@@ -204,13 +204,29 @@ then the opening will be implicitly set as the headline title."
(defcustom org-koma-letter-closing ""
"Letter's closing, as a string.
-This option can also be set with the CLOSING keyword."
+This option can also be set with the CLOSING keyword. Moreover,
+when:
+ (1) this value is the empty string;
+ (2) there's no CLOSING keyword or it is empty;
+ (3) `org-koma-letter-headline-is-opening-maybe' is non-nil;
+ (4) the letter contains a headline with the special
+ tag closing;
+then the opening will be set as the title of the closing special
+heading."
:group 'org-export-koma-letter
:type 'string)
(defcustom org-koma-letter-signature ""
"Signature, as a string.
-This option can also be set with the SIGNATURE keyword."
+This option can also be set with the SIGNATURE keyword.
+Moreover, when:
+ (1) this value is the empty string;
+ (2) there's no CLOSING keyword or it is empty;
+ (3) `org-koma-letter-headline-is-opening-maybe' is non-nil;
+ (4) the letter contains a headline with the special
+ tag closing;
+then the signature will be set as the content of the
+closing special heading."
:group 'org-export-koma-letter
:type 'string)
@@ -358,7 +374,7 @@ e.g. \"title-subject:t\"."
:group 'org-export-koma-letter
:type 'boolean)
-(defconst org-koma-letter-special-tags-in-letter '(to from)
+(defconst org-koma-letter-special-tags-in-letter '(to from closing)
"Header tags related to the letter itself.")
(defconst org-koma-letter-special-tags-after-closing '(ps encl cc)
@@ -665,7 +681,17 @@ holding export options."
;; Letter body.
contents
;; Closing.
- (format "\n\\closing{%s}\n" (org-export-data (plist-get info :closing) info))
+ (format "\n\\closing{%s}\n"
+ (org-export-data
+ (or (org-string-nw-p (plist-get info :closing))
+ (when (plist-get info :with-headline-opening)
+ (org-element-map (plist-get info :parse-tree) 'headline
+ (lambda (head)
+ (when (eq (org-koma-letter--special-tag head info)
+ 'closing)
+ (org-element-property :title head)))
+ info t)))
+ info))
(org-koma-letter--special-contents-as-macro
(plist-get info :with-after-closing))
;; Letter end.
@@ -711,10 +737,14 @@ a communication channel."
(format "\\KOMAoption{fromphone}{%s}\n"
(if (plist-get info :with-phone) "true" "false")))
;; Signature.
- (let ((signature (plist-get info :signature)))
+ (let* ((heading-val (and (plist-get info :with-headline-opening)
+ (eq scope 'buffer)
+ (org-koma-letter--get-tagged-contents 'closing)))
+ (signature (or (plist-get info :signature)
+ heading-val)))
(and (org-string-nw-p signature)
- (funcall check-scope 'signature)
- (format "\\setkomavar{signature}{%s}\n" signature)))
+ (or (funcall check-scope 'signature) heading-val)
+ (format "\\setkomavar{signature}{%s}\n" (org-trim signature))))
;; Back address.
(and (funcall check-scope 'with-backaddress)
(format "\\KOMAoption{backaddress}{%s}\n"
--
2.4.5
next prev parent reply other threads:[~2015-07-15 22:47 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-15 11:20 ox-koma bug in subtree export Suvayu Ali
2015-07-15 11:28 ` Suvayu Ali
2015-07-15 11:46 ` Rasmus
2015-07-15 21:13 ` Suvayu Ali
2015-07-15 22:47 ` Rasmus [this message]
2015-07-16 8:54 ` Suvayu Ali
2015-07-16 9:40 ` Rasmus
2015-07-16 10:25 ` Suvayu Ali
2015-07-16 10:44 ` Rasmus
2015-07-16 14:57 ` Suvayu Ali
2015-07-16 20:20 ` Rasmus
2015-07-17 7:31 ` Suvayu Ali
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=878uahyr5q.fsf@gmx.us \
--to=rasmus@gmx.us \
--cc=emacs-orgmode@gnu.org \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.