emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Rasmus <rasmus@gmx.us>
To: emacs-orgmode@gnu.org
Subject: [patch, koma-letter] Change of subject behavior
Date: Tue, 17 Mar 2015 18:37:19 +0100	[thread overview]
Message-ID: <87d247h6eo.fsf@gmx.us> (raw)

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

Hi,

I want to change the subject inference in ox-koma-letter to only happen on
top-level headlines.

Thus, in the following example the opening would be "opening" and not "h1"
as it is currently.

* opening
** h1

Typically, "h1" is just there to help me organize the letter.

Any objections?

—Rasmus

-- 
Together we will make the possible totalllly impossible!

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ox-koma-letter-Stricter-subject-inference.patch --]
[-- Type: text/x-diff, Size: 1146 bytes --]

From 2ce18b7f061109f0006fb1b823029d35fee4f9a9 Mon Sep 17 00:00:00 2001
From: Rasmus <rasmus@gmx.us>
Date: Tue, 17 Mar 2015 18:32:26 +0100
Subject: [PATCH] ox-koma-letter: Stricter subject inference

* ox-koma-letter.el (org-koma-letter-headline): Subject can
  only be inferred from top-level heading.
---
 contrib/lisp/ox-koma-letter.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/contrib/lisp/ox-koma-letter.el b/contrib/lisp/ox-koma-letter.el
index 1b5dd17..1e905a9 100644
--- a/contrib/lisp/ox-koma-letter.el
+++ b/contrib/lisp/ox-koma-letter.el
@@ -561,7 +561,8 @@ appropriate place."
 		 (push (cons tag contents) org-koma-letter-special-contents)))
     ;; Opening is not defined yet: use headline's title.
     (when (and org-koma-letter-headline-is-opening-maybe
-	       (not (org-string-nw-p (plist-get info :opening))))
+	       (not (org-string-nw-p (plist-get info :opening)))
+	       (eq 1 (org-export-get-relative-level headline info)))
       (plist-put info :opening
 		 (org-export-data (org-element-property :title headline) info)))
     ;; In any case, insert contents in letter's body.
-- 
2.3.3


             reply	other threads:[~2015-03-17 17:37 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-17 17:37 Rasmus [this message]
2015-03-17 21:00 ` [patch, koma-letter] Change of subject behavior Nicolas Goaziou
2015-03-17 22:48   ` Rasmus
2015-03-17 23:08     ` Nicolas Goaziou
2015-03-17 23:41       ` Rasmus
2015-03-18 11:41         ` Nicolas Goaziou
2015-03-18 12:39           ` Rasmus
2015-03-18 20:27             ` Nicolas Goaziou
2015-03-19 11:35               ` Rasmus
2015-03-19 23:15                 ` Nicolas Goaziou
2015-03-20 20:22                   ` Rasmus

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=87d247h6eo.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 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).