emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Rasmus <rasmus@gmx.us>
To: emacs-orgmode@gnu.org
Subject: Re: [patch] ox-koma-letter.el: clean-up/semantic bug [4/4]
Date: Wed, 22 May 2013 01:23:33 +0200	[thread overview]
Message-ID: <87vc6b9atm.fsf@pank.eu> (raw)
In-Reply-To: 20130521195413.GA58739@kenny.local

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

Viktor Rosenfeld <listuser36@gmail.com> writes:

> Or 5, keep the change from SENDER to AUTHOR but revert the default
> values to `org-koma-letter-*' variables. (Right now the AUTHOR and EMAIL
> lines could be removed because they duplicate the derived latex
> backend.)

I once had a teacher who talked about the optimal degree of
conservatism (as well speaking positively about being in the infamoues
ivory tower).  5. is fine with me.  So I guess the deal is
  1. default value is the same as in ox-latex.
  2. . . . but it's kept in a seperete variable ox-kl variable.


> The default LaTeX exporter does not have LCO files. Sure you can simply
> \input a latex file but there is no dedicated support for this in Org
> mode, is there? 

only through #+LATEX: \input{.} I guess (or something similar).

> I think that switching from SENDER to AUTHOR, keeping the
> `org-koma-letter-{author,email}' variables in the KOMA backend, but
> setting them per default to `user-full-name' and `user-mail-address',
> would solve both your problems and let me keep LCO files. I would then
> simply set these `org-koma-letter-*' variables to `nil' and document
> this setup in the docstring. I'll see tomorrow if this is feasable.

Does the attached patch work for you (also with ps tags?)

–Rasmus

-- 
Dung makes an excellent fertilizer

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0005-Variables-for-author-and-email-for-ox-koma-letter-an.patch --]
[-- Type: text/x-patch, Size: 6291 bytes --]

From 92b07bac2d707f01e48796778453b67a9ecd1daa Mon Sep 17 00:00:00 2001
From: "rasmus.pank" <rasmus.pank@gmail.com>
Date: Wed, 22 May 2013 01:16:54 +0200
Subject: [PATCH 5/5] Variables for author and email for ox-koma-letter and a
 bug fix.

* ox-koma-letter.el (koma-letter): reintroduced koma-letter
specif author and email.
* ox-koma-letter.el (koma-letter): set
org-koma-special-content to nil when exporting

The former is needed so that author/email can be set in a LCO file.

TINYCHANGE
---
 contrib/lisp/ox-koma-letter.el | 49 +++++++++++++++++++++++-------------------
 1 file changed, 27 insertions(+), 22 deletions(-)

diff --git a/contrib/lisp/ox-koma-letter.el b/contrib/lisp/ox-koma-letter.el
index 020df52..92cf13a 100644
--- a/contrib/lisp/ox-koma-letter.el
+++ b/contrib/lisp/ox-koma-letter.el
@@ -109,6 +109,12 @@
   :group 'org-export-koma-letter
   :type 'string)
 
+(defcustom org-koma-letter-email user-mail-address
+  "The default email address stored in the letter." )
+
+(defcustom org-koma-letter-author user-full-name
+  "The default name of the sender." )
+
 (defcustom org-koma-letter-signature "\\usekomavar{fromname}"
   "String used as the signature."
   :group 'org-export-koma-letter
@@ -143,7 +149,6 @@ English manual of 2012-07-22)"
   :group 'org-export-koma-letter)
 
 
-
 (defcustom org-koma-letter-use-backaddress t
   "Print return address in small line above to address."
   :group 'org-export-koma-letter
@@ -179,7 +184,6 @@ Use `foldmarks:true' to activate default fold marks or
   :group 'org-export-koma-letter
   :type 'string)
 
-
 (defconst org-koma-letter-special-tags-after-closing
   '("PS" "ENCL" "CC")
   "Headers tags to be inserted after closing")
@@ -193,7 +197,7 @@ Use `foldmarks:true' to activate default fold marks or
 	  org-koma-letter-special-tags-after-closing)
   "Header tags with special meaning")
 
-(defvar org-koma-letter-special-content nil "holds special
+(defvar org-koma-letter-special-contents nil "holds special
 content temporarily.")
 
 
@@ -203,10 +207,10 @@ content temporarily.")
 (org-export-define-derived-backend 'koma-letter 'latex
   :options-alist
   '((:lco "LCO" nil org-koma-letter-class-option-file)
-    (:sender "AUTHOR" nil user-full-name t)
+    (:sender "AUTHOR" nil org-koma-letter-author)
     (:from-address "FROM_ADDRESS" nil org-koma-letter-from-address newline)
     (:phone-number "PHONE_NUMBER" nil org-koma-letter-phone-number)
-    (:email "EMAIL" nil user-mail-address t)
+    (:email "EMAIL" nil org-koma-letter-email)
     (:to-address "TO_ADDRESS" nil nil newline)
     (:place "PLACE" nil org-koma-letter-place)
     (:opening "OPENING" nil org-koma-letter-opening)
@@ -275,29 +279,31 @@ channel."
 ;; Thanks, Luis!
 
 (defun org-koma-letter--get-tagged-content  (tag info)
-  (cdr  (assoc tag org-koma-letter-special-content)))
+  (cdr  (assoc tag org-koma-letter-special-contents)))
 
 
-(defun org-koma-letter-headline (headline conents info)
+(defun org-koma-letter-headline (headline contents info)
   "Transcode a HEADLINE element from Org to LaTeX.
 CONTENTS holds the contents of the headline.  INFO is a plist
 holding contextual informatio.n
 
 Note that if a headline is tagged with a tag from
 `org-koma-letter-special-tags' it will not be exported, but
-stored in `org-koma-letter-special-content' and included at the
+stored in `org-koma-letter-special-contents' and included at the
 appropriate place."
   (let*
       ((tags (and (plist-get info :with-tags)
 		 (org-export-get-tags headline info))))
-    (if (member (car tags) org-koma-letter-special-tags)
-    	(cond ((member (car tags) '("PS" "ps"))
-    	       (progn
-    		 (push (cons (car tags) (concat (plist-get info :ps-prefix) contents))
-    		       org-koma-letter-special-content) nil))
-    	      (t (progn
-    		   (push (cons (car tags) contents)
-    			 org-koma-letter-special-content) nil)))
+    (if (member  (upcase (car tags))
+		 org-koma-letter-special-tags)
+    	;; (cond ((member (car tags) '("PS" "ps"))
+    	;;        (progn
+    	;; 	 (push (cons (car tags) (concat (plist-get info :ps-prefix) contents))
+    	;; 	       org-koma-letter-special-contents) nil))
+	(progn
+	  (push (cons (upcase (car tags)) contents)
+		      org-koma-letter-special-contents)
+	  nil)
       contents)))
 
 
@@ -307,10 +313,9 @@ appropriate place."
   "Return complete document string after KOMA Scrlttr2 conversion.
 CONTENTS is the transcoded contents string.  INFO is a plist
 holding export options."
-  ;; FIXME: instead of setq'ing org-koma-letter-special-content and
+  ;; FIXME: instead of setq'ing org-koma-letter-special-contents and
   ;; callying varioues stuff it might be nice to put a big let* around the templace
   ;; as in org-groff...
-  (setq org-koma-letter-special-content nil)
   (concat
    ;; Time-stamp.
    (and (plist-get info :time-stamp-file)
@@ -412,15 +417,14 @@ holding export options."
    (format "\n\\closing{%s}\n\n" (plist-get info :closing))
    (let (after-closing)
      (dolist (ac org-koma-letter-special-tags-after-closing after-closing)
-       (let ((x (org-koma-letter--get-tagged-content ac info)))
+       (let ((x (org-koma-letter--get-tagged-content (upcase ac) info)))
 	 (when x (setq after-closing
 		       (concat after-closing
 			       ;; sometimes LaTeX complains about newlines
 			       ;; at the end of macros.  Remove them.
 			       (replace-regexp-in-string
 				"\n+$" ""
-				(format "\\%s{%s}" (downcase ac) x)))))
-	 )))
+				(format "\\%s{%s}" (downcase ac) x))))))))
    ;; Letter end.
    "\\end{letter}\n"
    (let ((x (org-koma-letter--get-tagged-content "AFTER_LETTER" info)))
@@ -464,6 +468,7 @@ Export is done in a buffer named \"*Org KOMA-LETTER Export*\".  It
 will be displayed if `org-export-show-temporary-export-buffer' is
 non-nil."
   (interactive)
+  (let (org-koma-letter-special-contents)
   (if async
       (org-export-async-start
 	  (lambda (output)
@@ -480,7 +485,7 @@ non-nil."
 		   subtreep visible-only body-only ext-plist)))
       (with-current-buffer outbuf (LaTeX-mode))
       (when org-export-show-temporary-export-buffer
-	(switch-to-buffer-other-window outbuf)))))
+	(switch-to-buffer-other-window outbuf))))))
 
 ;;;###autoload
 (defun org-koma-letter-export-to-latex
-- 
1.8.2.3


  reply	other threads:[~2013-05-21 23:23 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-20  0:28 [patch] ox-koma-letter.el: credit [1/4] Rasmus
2013-05-20  0:40 ` [patch] ox-koma-letter.el: subject changes [2/4] Rasmus
2013-05-20 15:49   ` Alan Schmitt
2013-05-20 18:23     ` Rasmus
2013-05-21  7:24       ` Alan Schmitt
2013-05-21 15:52         ` Viktor Rosenfeld
2013-05-21 17:48           ` Rasmus
2013-05-20  0:51 ` [patch] ox-koma-letter.el: credit [3/4] Rasmus
2013-05-20 15:52   ` Alan Schmitt
2013-05-21 16:56   ` Viktor Rosenfeld
2013-05-21 17:35     ` Rasmus
2013-05-21 20:06       ` Viktor Rosenfeld
     [not found]         ` <87zjvo7xkl.fsf@pank.eu>
     [not found]           ` <20130522145312.GB61443@kenny.local>
2013-05-22 17:16             ` Rasmus
2013-05-22 17:38               ` Viktor Rosenfeld
2013-05-20  0:54 ` [patch] ox-koma-letter.el: clean-up/semantic bug [4/4] Rasmus
     [not found]   ` <m2ehd1tziq.fsf@polytechnique.org>
2013-05-21  9:05     ` Rasmus
2013-05-21 11:32       ` Alan Schmitt
2013-05-21 12:22         ` Rasmus
2013-05-21 17:02           ` Viktor Rosenfeld
2013-05-21 18:13             ` Rasmus
2013-05-21 19:54               ` Viktor Rosenfeld
2013-05-21 23:23                 ` Rasmus [this message]
2013-05-22 14:39                   ` Viktor Rosenfeld
2013-05-22 22:06                     ` [PATCH] ox-koma-letter.el: Reintroduce variables removed in commit 832c6fd with proper defaults (was Re: [patch] ox-koma-letter.el: clean-up/semantic bug [4/4]) Viktor Rosenfeld
2013-05-25  5:13                       ` Robert Klein
2013-05-25  8:05                         ` Viktor Rosenfeld
2013-05-25  9:20                           ` Alan Schmitt
2013-05-25 13:57                             ` Rasmus
2013-05-25 17:03                               ` Viktor Rosenfeld
2013-05-25 17:48                                 ` [PATCH][ox-koma-letter]: sender, email and cleanup (was: [PATCH] ox-koma-letter.el: Reintroduce variables removed in commit 832c6fd with proper defaults) Rasmus
2013-05-25 21:27                                   ` [PATCH][ox-koma-letter]: sender, email and cleanup Rasmus
2013-05-26 10:58                                     ` Viktor Rosenfeld
2013-05-26 14:38                                       ` Rasmus
2013-05-26 10:54                                   ` [PATCH][ox-koma-letter]: sender, email and cleanup (was: [PATCH] ox-koma-letter.el: Reintroduce variables removed in commit 832c6fd with proper defaults) Viktor Rosenfeld
2013-05-26 14:36                                     ` [PATCH][ox-koma-letter]: sender, email and cleanup Rasmus
2013-05-27  6:25                                       ` Alan Schmitt
2013-05-27  9:22                                         ` Xavier Garrido
2013-05-27  9:51                                           ` Rasmus
2013-05-27 18:31                                           ` Viktor Rosenfeld
2013-05-27 20:42                                             ` Xavier Garrido
2013-05-26 14:51                                     ` Rasmus
2013-05-25 20:51                               ` [PATCH] ox-koma-letter.el: Reintroduce variables removed in commit 832c6fd with proper defaults (was Re: [patch] ox-koma-letter.el: clean-up/semantic bug [4/4]) Robert Klein
2013-05-25 21:41                                 ` [PATCH] ox-koma-letter.el: Reintroduce variables removed in commit 832c6fd with proper defaults Rasmus
2013-05-26 11:04                                 ` [PATCH] ox-koma-letter.el: Reintroduce variables removed in commit 832c6fd with proper defaults (was Re: [patch] ox-koma-letter.el: clean-up/semantic bug [4/4]) Viktor Rosenfeld
2013-05-20 15:44 ` [patch] ox-koma-letter.el: credit [1/4] Alan Schmitt
2013-05-20 15:49   ` Rasmus
2013-05-20 16:01     ` Alan Schmitt
2013-05-21 17:06 ` Viktor Rosenfeld

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=87vc6b9atm.fsf@pank.eu \
    --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).