From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alan Schmitt Subject: small koma bug Date: Mon, 10 Mar 2014 09:44:10 +0100 Message-ID: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:53194) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WMvot-00040C-8l for emacs-orgmode@gnu.org; Mon, 10 Mar 2014 04:44:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WMvol-0004b1-IH for emacs-orgmode@gnu.org; Mon, 10 Mar 2014 04:44:23 -0400 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:32708) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WMvol-0004an-BY for emacs-orgmode@gnu.org; Mon, 10 Mar 2014 04:44:15 -0400 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: rasmus Cc: emacs-orgmode Hello Rasmus and all, I think I have found a small bug in ox-koma-letter, but to fix it I would like your input. The bug: if "from-address" is not specified in the file, then it will be set unconditionally to the empty string, even if it is specified in an lco file. The reason of the bug is as follows. To set up the from address, we call this: #+begin_src emacs-lisp (let ((from-address (org-koma-letter--determine-to-and-from info 'from))) (and from-address (format "\\setkomavar{fromaddress}{%s}\n" from-address))) #+end_src This uses this function: #+begin_src emacs-lisp (defun org-koma-letter--determine-to-and-from (info key) "Given INFO determine KEY for the letter. KEY should be `to' or `from'. `ox-koma-letter' allows two ways to specify TO and FROM. If both are present return the preferred one as determined by `org-koma-letter-prefer-special-headings'." (let ((option (plist-get info (if (eq key 'to) :to-address :from-address))) (headline (org-koma-letter--get-tagged-contents key))) (replace-regexp-in-string "\n" "\\\\\\\\\n" (org-trim (or (if (plist-get info :special-headings) (or headline option) (or option headline)) ;; Fallback values. (if (eq key 'to) "\\mbox{}" org-koma-letter-from-address)))))) #+end_src Note that in the default case we return "org-koma-letter-from-address", which is set to the empty string by default: #+begin_src emacs-lisp (defcustom org-koma-letter-from-address "" "Sender's address, as a string. This option can also be set with one or more FROM_ADDRESS keywords." :group 'org-export-koma-letter :type 'string) #+end_src As the empty string is considered as "true", we apply the format function in the first code block. I would suggest to have "org-koma-letter-from-address" begin "nil" as default. My question is: is it an allowed value for a string? Thanks, Alan