From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rasmus Pank Roulund Subject: Re: [PATCH] ox-koma-letter.el: Add support for 'location' koma variable Date: Thu, 31 Mar 2016 21:56:07 +0200 Message-ID: <87wpoizajs.fsf@pank.eu> References: <87egd2ho08.fsf@gmail.com> <87vb6eekzj.fsf@gmx.us> <87d1smgdcw.fsf@gmail.com> <87k2mtdhem.fsf@gmx.us> <87a8npgy92.fsf@gmail.com> <87bn84a8e4.fsf@gmx.us> <878u38ghth.fsf@gmail.com> <87vb6c6mdh.fsf@gmx.us> <87mvr2xeso.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:48197) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1alihV-0002P6-Ol for emacs-orgmode@gnu.org; Thu, 31 Mar 2016 15:56:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1alihS-0003Ca-EA for emacs-orgmode@gnu.org; Thu, 31 Mar 2016 15:56:17 -0400 Received: from eumx.net ([91.82.101.43]:50364 helo=owm.eumx.net) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1alihR-0003CN-Ux for emacs-orgmode@gnu.org; Thu, 31 Mar 2016 15:56:14 -0400 In-Reply-To: <87mvr2xeso.fsf@gmail.com> (Myles English's message of "Mon, 15 Feb 2016 13:51:19 +0000") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: mylesenglish@gmail.com Cc: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain 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 --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-ox-koma-letter-Changes-to-LOCATION-handling.patch >From 43a26688870f6861747a1d333a5844348d3a1749 Mon Sep 17 00:00:00 2001 From: Rasmus 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 --=-=-=--