emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* ox-koma bug in subtree export
@ 2015-07-15 11:20 Suvayu Ali
  2015-07-15 11:28 ` Suvayu Ali
  2015-07-15 11:46 ` Rasmus
  0 siblings, 2 replies; 12+ messages in thread
From: Suvayu Ali @ 2015-07-15 11:20 UTC (permalink / raw)
  To: Emacs Org mode

Hi,

I'm using subtree export to write letters using ox-koma.  Everything
works except, all the closing statements from different subtrees get
accumulated when I export one of the subtrees.

So with the attached Org file, when I export either of the subtrees, I
get a closing line like this: \closing{Regards, Kind Regards,}.

This used to work before.  That said, I never found it quite consistent
when using `#+closing:'.  I would have thought one should use a headline
like: to, enclosed, etc.

Is this a bug?

Cheers,

-- 
Suvayu

Open source is the future. It sets us free.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: ox-koma bug in subtree export
  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
  1 sibling, 0 replies; 12+ messages in thread
From: Suvayu Ali @ 2015-07-15 11:28 UTC (permalink / raw)
  To: Emacs Org mode

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

On Wed, Jul 15, 2015 at 01:20:57PM +0200, Suvayu Ali wrote:
> 
> I'm using subtree export to write letters using ox-koma.  Everything
> works except, all the closing statements from different subtrees get
> accumulated when I export one of the subtrees.
> 
> So with the attached Org file, when I export either of the subtrees, I
> get a closing line like this: \closing{Regards, Kind Regards,}.
> 
> This used to work before.  That said, I never found it quite consistent
> when using `#+closing:'.  I would have thought one should use a headline
> like: to, enclosed, etc.
> 
> Is this a bug?

Of course I forgot to attach the file!

-- 
Suvayu

Open source is the future. It sets us free.

[-- Attachment #2: koma-bug.org --]
[-- Type: text/plain, Size: 632 bytes --]


* letter 1
  :PROPERTIES:
  :EXPORT_FILE_NAME: letter_1.pdf
  :EXPORT_LATEX_CLASS: scrlttr2
  :EXPORT_OPTIONS: ':t foldmarks:nil
  :EXPORT_TITLE:
  :EXPORT_SUBJECT: Some subject
  :EXPORT_LCO: DIN
  :END:
** To									 :to:
Mr. Foo Bar
Some place, Else

** Dear Mr. Bar,
Lots of stuff

#+closing: Regards,

* letter 2
  :PROPERTIES:
  :EXPORT_FILE_NAME: letter_2.pdf
  :EXPORT_LATEX_CLASS: scrlttr2
  :EXPORT_OPTIONS: ':t foldmarks:nil
  :EXPORT_TITLE:
  :EXPORT_SUBJECT: Some other subject
  :EXPORT_LCO: DIN
  :END:
** To 									 :to:
Miss Foo Baz
Some place, Else

** Dear Miss Baz,
Lot more stuff

#+closing: Kind Regards,


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: ox-koma bug in subtree export
  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
  1 sibling, 1 reply; 12+ messages in thread
From: Rasmus @ 2015-07-15 11:46 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

Suvayu Ali <fatkasuvayu+linux@gmail.com> writes:

> I'm using subtree export to write letters using ox-koma.  Everything
> works except, all the closing statements from different subtrees get
> accumulated when I export one of the subtrees.
>
> So with the attached Org file, when I export either of the subtrees, I
> get a closing line like this: \closing{Regards, Kind Regards,}.

For your purpose you can add an :export_closing: property to your
top-level heading.

* letter 1
  :PROPERTIES:
  :export_subject: Some subject
  :export_closing: Regards,
  :END:

> This used to work before.  That said, I never found it quite consistent
> when using `#+closing:'.  I would have thought one should use a headline
> like: to, enclosed, etc.

Maybe:

   * Regards,    :closing:
     Signature

> Is this a bug?

From you example, I'd say 'no'.  Keywords are shared.  E.g. if you have

     #+latex_header: my important package

You'd want it to be loaded even when using a subtree.
[OTOH, #+title is changed in subtree export....]

Rasmus

-- 
C is for Cookie

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: ox-koma bug in subtree export
  2015-07-15 11:46 ` Rasmus
@ 2015-07-15 21:13   ` Suvayu Ali
  2015-07-15 22:47     ` Rasmus
  0 siblings, 1 reply; 12+ messages in thread
From: Suvayu Ali @ 2015-07-15 21:13 UTC (permalink / raw)
  To: emacs-orgmode

On Wed, Jul 15, 2015 at 01:46:59PM +0200, Rasmus wrote:
> Suvayu Ali <fatkasuvayu+linux@gmail.com> writes:
> 
> > I'm using subtree export to write letters using ox-koma.  Everything
> > works except, all the closing statements from different subtrees get
> > accumulated when I export one of the subtrees.
> >
> > So with the attached Org file, when I export either of the subtrees, I
> > get a closing line like this: \closing{Regards, Kind Regards,}.
> 
> For your purpose you can add an :export_closing: property to your
> top-level heading.
> 
> * letter 1
>   :PROPERTIES:
>   :export_subject: Some subject
>   :export_closing: Regards,
>   :END:

Great, this works very well.

> > This used to work before.  That said, I never found it quite consistent
> > when using `#+closing:'.  I would have thought one should use a headline
> > like: to, enclosed, etc.
> 
> Maybe:
> 
>    * Regards,    :closing:
>      Signature

Something like that would be a lot more logical indeed.

> > Is this a bug?
> 
> From you example, I'd say 'no'.  Keywords are shared.  E.g. if you have
> 
>      #+latex_header: my important package
> 
> You'd want it to be loaded even when using a subtree.
> [OTOH, #+title is changed in subtree export....]

Hmm, makes sense.  I wonder how it was working though.

Thanks a lot.

-- 
Suvayu

Open source is the future. It sets us free.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: ox-koma bug in subtree export
  2015-07-15 21:13   ` Suvayu Ali
@ 2015-07-15 22:47     ` Rasmus
  2015-07-16  8:54       ` Suvayu Ali
  0 siblings, 1 reply; 12+ messages in thread
From: Rasmus @ 2015-07-15 22:47 UTC (permalink / raw)
  To: emacs-orgmode

[-- 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


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: ox-koma bug in subtree export
  2015-07-15 22:47     ` Rasmus
@ 2015-07-16  8:54       ` Suvayu Ali
  2015-07-16  9:40         ` Rasmus
  0 siblings, 1 reply; 12+ messages in thread
From: Suvayu Ali @ 2015-07-16  8:54 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

On Thu, Jul 16, 2015 at 12:47:29AM +0200, Rasmus wrote:
> 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,}

The closing bit works well, the signature however does not work for me.
Do I need any special config to enable it?

Cheers,

-- 
Suvayu

Open source is the future. It sets us free.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: ox-koma bug in subtree export
  2015-07-16  8:54       ` Suvayu Ali
@ 2015-07-16  9:40         ` Rasmus
  2015-07-16 10:25           ` Suvayu Ali
  0 siblings, 1 reply; 12+ messages in thread
From: Rasmus @ 2015-07-16  9:40 UTC (permalink / raw)
  To: emacs-orgmode

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

Suvayu Ali <fatkasuvayu+linux@gmail.com> writes:

> The closing bit works well, the signature however does not work for me.
> Do I need any special config to enable it?

Maybe it was not robust enough.  Try this patch.

Rasmus

Example:

* Preamble                                                         :noexport:
#+TITLE:  Mis-shapen chaos of well-seeming forms!
#+SUBJECT: Or: Org-mode and KOMA-Script Letters
#+DATE: <1580-07-03 Thu>
#+BIND: org-export-date-timestamp-format "%Y"

#+AUTHOR: Romeo
#+PLACE: Verona, Italy

#+LCO: DINmtext

#+OPTIONS: after-closing-order:(ps cc encl) ':t backaddress:t subject:centered

#+LATEX_HEADER: \setkomavar{firsthead}{}

* To-address of the lovely Juliet                                        :to:
Juliet
House of Capulet
Verona

* From                                                                 :from:
House of Montague
Verona

* Dear Juliet,

#+BEGIN_VERSE
Then plainly know my heart's dear love is set
On the fair daughter of rich Capulet:
As mine on hers, so hers is set on mine;
And all combin'd, save what thou must combine
By holy marriage: when, and where, and how
We met, we woo'd, and made exchange of vow,
I'll tell thee as we pass; but this I pray,
That thou consent to marry us to-day.
#+END_VERSE

* Yours truly, 							    :closing:
  Romeo of house Montague


-- 
Not everything that goes around comes back around, you know

[-- 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


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: ox-koma bug in subtree export
  2015-07-16  9:40         ` Rasmus
@ 2015-07-16 10:25           ` Suvayu Ali
  2015-07-16 10:44             ` Rasmus
  0 siblings, 1 reply; 12+ messages in thread
From: Suvayu Ali @ 2015-07-16 10:25 UTC (permalink / raw)
  To: emacs-orgmode

On Thu, Jul 16, 2015 at 11:40:06AM +0200, Rasmus wrote:
> Suvayu Ali <fatkasuvayu+linux@gmail.com> writes:
> 
> > The closing bit works well, the signature however does not work for me.
> > Do I need any special config to enable it?
> 
> Maybe it was not robust enough.  Try this patch.

 [...chomp...chomp...chomp...]

> * Yours truly, 							    :closing:
>   Romeo of house Montague

Strange, I tried subtree export with my example, and a normal file
export with yours, neither exports the signature, closing works fine.

Cheers,

-- 
Suvayu

Open source is the future. It sets us free.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: ox-koma bug in subtree export
  2015-07-16 10:25           ` Suvayu Ali
@ 2015-07-16 10:44             ` Rasmus
  2015-07-16 14:57               ` Suvayu Ali
  0 siblings, 1 reply; 12+ messages in thread
From: Rasmus @ 2015-07-16 10:44 UTC (permalink / raw)
  To: emacs-orgmode

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

Suvayu Ali <fatkasuvayu+linux@gmail.com> writes:

> Strange, I tried subtree export with my example, and a normal file
> export with yours, neither exports the signature, closing works fine.

I think I didnt't run format-patch correctly....  Sorry!  I'm trying to
get used to do things that I'd normally do from the terminal (like
format-patch) from magit.

I checked and it work from your previous example.

Rasmus

-- 
⠠⠵

[-- 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: 4299 bytes --]

From 115d9903c14ff610e86205b834131b38be181697 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 | 52 +++++++++++++++++++++++++++++++++++-------
 1 file changed, 44 insertions(+), 8 deletions(-)

diff --git a/contrib/lisp/ox-koma-letter.el b/contrib/lisp/ox-koma-letter.el
index d0a8109..64f1f7f 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,20 @@ a communication channel."
           (format "\\KOMAoption{fromphone}{%s}\n"
                   (if (plist-get info :with-phone) "true" "false")))
      ;; Signature.
-     (let ((signature (plist-get info :signature)))
-       (and (org-string-nw-p signature)
-            (funcall check-scope 'signature)
-            (format "\\setkomavar{signature}{%s}\n" signature)))
+     (let* ((heading-val
+	     (and (plist-get info :with-headline-opening)
+		  (org-string-nw-p
+		   (org-trim
+		    (org-export-data
+		     (org-koma-letter--get-tagged-contents 'closing)
+		     info)))))
+	    (signature (org-string-nw-p (plist-get info :signature)))
+	    (signature-scope (funcall check-scope 'signature)))
+       (and (or (and signature signature-scope)
+		heading-val)
+	    (not (and (eq scope 'global) heading-val))
+	    (format "\\setkomavar{signature}{%s}\n"
+		    (if signature-scope signature heading-val))))
      ;; Back address.
      (and (funcall check-scope 'with-backaddress)
           (format "\\KOMAoption{backaddress}{%s}\n"
-- 
2.4.5


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: ox-koma bug in subtree export
  2015-07-16 10:44             ` Rasmus
@ 2015-07-16 14:57               ` Suvayu Ali
  2015-07-16 20:20                 ` Rasmus
  0 siblings, 1 reply; 12+ messages in thread
From: Suvayu Ali @ 2015-07-16 14:57 UTC (permalink / raw)
  To: emacs-orgmode

On Thu, Jul 16, 2015 at 12:44:26PM +0200, Rasmus wrote:
> Suvayu Ali <fatkasuvayu+linux@gmail.com> writes:
> 
> > Strange, I tried subtree export with my example, and a normal file
> > export with yours, neither exports the signature, closing works fine.
> 
> I think I didnt't run format-patch correctly....  Sorry!  I'm trying to
> get used to do things that I'd normally do from the terminal (like
> format-patch) from magit.

No worries.

> 
> I checked and it work from your previous example.

Worked nicely for both examples, normal export and subtree export.

:)

-- 
Suvayu

Open source is the future. It sets us free.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: ox-koma bug in subtree export
  2015-07-16 14:57               ` Suvayu Ali
@ 2015-07-16 20:20                 ` Rasmus
  2015-07-17  7:31                   ` Suvayu Ali
  0 siblings, 1 reply; 12+ messages in thread
From: Rasmus @ 2015-07-16 20:20 UTC (permalink / raw)
  To: emacs-orgmode

Suvayu Ali <fatkasuvayu+linux@gmail.com> writes:

>> I checked and it work from your previous example.
>
> Worked nicely for both examples, normal export and subtree export.

Pushed in a9855380931885d0dbfcbb8fcc6622850ac4bbda.  The Worg page is also
updated.

Rasmus

-- 
Dung makes an excellent fertilizer

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: ox-koma bug in subtree export
  2015-07-16 20:20                 ` Rasmus
@ 2015-07-17  7:31                   ` Suvayu Ali
  0 siblings, 0 replies; 12+ messages in thread
From: Suvayu Ali @ 2015-07-17  7:31 UTC (permalink / raw)
  To: emacs-orgmode

On Thu, Jul 16, 2015 at 10:20:27PM +0200, Rasmus wrote:
> Suvayu Ali <fatkasuvayu+linux@gmail.com> writes:
> 
> >> I checked and it work from your previous example.
> >
> > Worked nicely for both examples, normal export and subtree export.
> 
> Pushed in a9855380931885d0dbfcbb8fcc6622850ac4bbda.  The Worg page is also
> updated.

Thanks!

-- 
Suvayu

Open source is the future. It sets us free.

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2015-07-17  7:31 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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).