emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Rasmus Pank Roulund <rasmus@gmx.us>
To: mylesenglish@gmail.com
Cc: emacs-orgmode@gnu.org
Subject: Re: [PATCH] ox-koma-letter.el: Add support for 'location' koma variable
Date: Thu, 31 Mar 2016 21:56:07 +0200	[thread overview]
Message-ID: <87wpoizajs.fsf@pank.eu> (raw)
In-Reply-To: <87mvr2xeso.fsf@gmail.com> (Myles English's message of "Mon, 15 Feb 2016 13:51:19 +0000")

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

Myles,

Is :with-location something you feel strongly about?  I'm not sure I find
that it makes sense...

I would like to apply the following patch on top of yours.

Thanks,
Rasmus

-- 
I almost cut my hair, it happened just the other day

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ox-koma-letter-Changes-to-LOCATION-handling.patch --]
[-- Type: text/x-diff, Size: 5705 bytes --]

From 43a26688870f6861747a1d333a5844348d3a1749 Mon Sep 17 00:00:00 2001
From: Rasmus <rasmus@gmx.us>
Date: Tue, 29 Mar 2016 18:08:09 +0200
Subject: [PATCH 1/2] ox-koma-letter: Changes to LOCATION handling

* ox-koma-letter.el (options): Parse LOCATION and remove
  :with-location and :inbuffer-with-location.
  (org-koma-letter--get-tagged-contents): Change string handling.
  (org-koma-letter--get-value): Simplify function.
  (org-koma-letter-use-location): remove
---
 contrib/lisp/ox-koma-letter.el | 63 ++++++++++++++++--------------------------
 1 file changed, 24 insertions(+), 39 deletions(-)

diff --git a/contrib/lisp/ox-koma-letter.el b/contrib/lisp/ox-koma-letter.el
index d36e817..a76033d 100644
--- a/contrib/lisp/ox-koma-letter.el
+++ b/contrib/lisp/ox-koma-letter.el
@@ -376,13 +376,6 @@ This option can also be set with the OPTIONS keyword, e.g.:
   :group 'org-export-koma-letter
   :type 'boolean)
 
-(defcustom org-koma-letter-use-location t
-  "Non-nil prints the contents of the letter's extension below the header.
-This option can also be set with the OPTIONS keyword, e.g.:
-\"location:nil\"."
-  :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'."
@@ -436,7 +429,7 @@ e.g. \"title-subject:t\"."
     (:email "EMAIL" nil (org-koma-letter--get-value org-koma-letter-email) t)
     (:to-address "TO_ADDRESS" nil nil newline)
     (:place "PLACE" nil org-koma-letter-place)
-    (:location "LOCATION" nil org-koma-letter-location)
+    (:location "LOCATION" nil org-koma-letter-location parse)
     (:subject "SUBJECT" nil nil parse)
     (:opening "OPENING" nil org-koma-letter-opening parse)
     (:closing "CLOSING" nil org-koma-letter-closing parse)
@@ -453,7 +446,6 @@ e.g. \"title-subject:t\"."
     (:with-foldmarks nil "foldmarks" org-koma-letter-use-foldmarks)
     (:with-phone nil "phone" org-koma-letter-use-phone)
     (:with-place nil "place" org-koma-letter-use-place)
-    (:with-location nil "location" org-koma-letter-use-location)
     (:with-subject nil "subject" org-koma-letter-subject-format)
     (:with-title-as-subject nil "title-subject" org-koma-letter-prefer-subject)
     (:with-headline-opening nil nil org-koma-letter-headline-is-opening-maybe)
@@ -472,7 +464,6 @@ e.g. \"title-subject:t\"."
     (:inbuffer-with-foldmarks nil "foldmarks" 'koma-letter:empty)
     (:inbuffer-with-phone nil "phone" 'koma-letter:empty)
     (:inbuffer-with-place nil "place" 'koma-letter:empty)
-    (:inbuffer-with-location nil "location" 'koma-letter:empty))
   :translate-alist '((export-block . org-koma-letter-export-block)
 		     (export-snippet . org-koma-letter-export-snippet)
 		     (headline . org-koma-letter-headline)
@@ -767,42 +758,36 @@ a communication channel."
           (format "\\KOMAoption{fromphone}{%s}\n"
                   (if (plist-get info :with-phone) "true" "false")))
      ;; Signature.
-     (let* ((head-opening (plist-get info :with-headline-opening))
-	    (signature (funcall heading-or-key-value
-				(if head-opening 'closing nil)
-				:signature
-				(if head-opening 'signature nil))))
-       (and 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"
                   (if (plist-get info :with-backaddress) "true" "false")))
      ;; Place.
-     (let ((place-scoped (funcall check-scope 'with-place))
+     (let ((with-place-set (funcall check-scope 'with-place))
 	   (place-set (funcall check-scope 'place)))
-       (when (or (and place-scoped place-set)
-		 (and (eq scope 'buffer)
-		      (or place-scoped place-set)))
-	 (format "\\setkomavar{place}{%s}\n"
-		 (if (plist-get info :with-place) (plist-get info :place)
-		   ""))))
+       (and (or (and with-place-set place-set)
+		(and (eq scope 'buffer) (or with-place-set place-set)))
+	    (format "\\setkomavar{place}{%s}\n"
+		    (if (plist-get info :with-place) (plist-get info :place)
+		      ""))))
      ;; Location.
-     (let ((heading-val
-	    (org-koma-letter--add-latex-newlines
-	     (org-export-data
-	      (org-koma-letter--get-tagged-contents 'location)
-	      info)))
-	   (with-location-set (funcall check-scope 'with-location))
-	   (location-set (funcall check-scope 'location))
-	   (location (plist-get info :location)))
-       (when (or (and with-location-set (or location-set heading-val))
-		 (and (eq scope 'buffer) (or with-location-set location-set heading-val))
-		 (format "\\setkomavar{location}{%s}\n"
-			 (if (plist-get info :with-location)
-			     (if (plist-get info :special-headings) (or heading-val location "")
-			       (or option location ""))
-			   "")))))
+     (let ((location (funcall heading-or-key-value 'location :location)))
+       (and location
+	    (format "\\setkomavar{location}{%s}\n" location)))
      ;; Folding marks.
      (and (funcall check-scope 'with-foldmarks)
           (let ((foldmarks (plist-get info :with-foldmarks)))
-- 
2.8.0


  parent reply	other threads:[~2016-03-31 19:56 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-27 18:32 [PATCH] ox-koma-letter.el: Add support for 'location' koma variable Myles English
2016-01-27 22:05 ` Rasmus
2016-01-28 11:19   ` Myles English
2016-01-28 12:20     ` Rasmus
2016-01-28 22:00       ` Myles English
2016-01-29 12:16         ` Rasmus
2016-01-29 22:08           ` Myles English
2016-01-29 22:39             ` Rasmus
2016-02-15 13:51               ` Myles English
2016-02-17 22:53                 ` Rasmus
2016-03-31 19:56                 ` Rasmus Pank Roulund [this message]
2016-03-31 23:32                   ` Myles English
2016-04-03 11:33                     ` Rasmus
2016-04-04  0:54                       ` Myles English
2016-04-07  8:09                         ` Rasmus
2016-01-28 20:17   ` Eric S Fraga

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=87wpoizajs.fsf@pank.eu \
    --to=rasmus@gmx.us \
    --cc=emacs-orgmode@gnu.org \
    --cc=mylesenglish@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).