emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Inhibit default EMAIL in derived exporter
@ 2013-05-13 18:35 Viktor Rosenfeld
  2013-05-14 17:04 ` [PATCH] Honor properties in derived backends with default nil Viktor Rosenfeld
  2013-05-15 19:24 ` Inhibit default EMAIL in derived exporter Nicolas Goaziou
  0 siblings, 2 replies; 4+ messages in thread
From: Viktor Rosenfeld @ 2013-05-13 18:35 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Nicolas Goaziou

Hi,

commit 16f12e0 changed how the EMAIL option is configured in a derived
exporter that also uses this keyword.

In `contrib/ox-koma-letter.el', the koma-letter exporter configures the default
of the EMAIL option to the variable `org-koma-letter-email'. However, since
commit 16f12e0, if the option is missing, the default is set to
`user-mail-address' which is the default for the standard LaTeX exporter.

The current code causes the following bug in koma-letter exporter: If EMAIL is
missing, and `org-koma-letter-email' is `nil', then the exporter should not set
a email address in the exported LaTeX file. The rationale is that the email
address is configured in an external LCO file (and can be overwritten for an
individual letter, if desired). However, the new behavior causes the email to
be set explicitly, overwriting the value from the LCO file.

Consider the following example:

#+BEGIN_SRC org
#+LATEX_CLASS: my-letter
#+LCO: DefaultAddress
#+END_SRC

The expected LaTeX-code is:

#+BEGIN_SRC latex
\documentclass{scrlttr2}
\LoadLetterOption{DefaultAddress}    % <--- email is set here
% ...
\begin{document}
% ...
\end{document}
#+END_SRC

However, since commit 16f12e0, the generated code is:

#+BEGIN_SRC latex
\documentclass{scrlttr2}
\LoadLetterOption{DefaultAddress}    % <--- email is set here
\setkomavar{fromemail}{he-sk@client204-235.wlan.hu-berlin.de}  % <--- email is overwritten here
% ...
\begin{document}
% ...
\end{document}
#+END_SRC

Is this a bug in the LaTeX exporter or is this the intended behavior? Should I
maybe use another keyword instead of EMAIL? I think I used SENDER instead of
AUTHOR because of a similar conflict.

Cheers,
Viktor

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

* [PATCH] Honor properties in derived backends with default nil
  2013-05-13 18:35 Inhibit default EMAIL in derived exporter Viktor Rosenfeld
@ 2013-05-14 17:04 ` Viktor Rosenfeld
  2013-05-15 19:24 ` Inhibit default EMAIL in derived exporter Nicolas Goaziou
  1 sibling, 0 replies; 4+ messages in thread
From: Viktor Rosenfeld @ 2013-05-14 17:04 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Nicolas Goaziou

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

Hi,

the attached patch fixes the problem. I wasn't sure if the logic simply
reverts the changes in commit 16f12e0 but it passes the test suite.

Cheers,
Viktor

Viktor Rosenfeld wrote:

> Hi,
> 
> commit 16f12e0 changed how the EMAIL option is configured in a derived
> exporter that also uses this keyword.
> 
> In `contrib/ox-koma-letter.el', the koma-letter exporter configures the default
> of the EMAIL option to the variable `org-koma-letter-email'. However, since
> commit 16f12e0, if the option is missing, the default is set to
> `user-mail-address' which is the default for the standard LaTeX exporter.
> 
> The current code causes the following bug in koma-letter exporter: If EMAIL is
> missing, and `org-koma-letter-email' is `nil', then the exporter should not set
> a email address in the exported LaTeX file. The rationale is that the email
> address is configured in an external LCO file (and can be overwritten for an
> individual letter, if desired). However, the new behavior causes the email to
> be set explicitly, overwriting the value from the LCO file.
> 
> Consider the following example:
> 
> #+BEGIN_SRC org
> #+LATEX_CLASS: my-letter
> #+LCO: DefaultAddress
> #+END_SRC
> 
> The expected LaTeX-code is:
> 
> #+BEGIN_SRC latex
> \documentclass{scrlttr2}
> \LoadLetterOption{DefaultAddress}    % <--- email is set here
> % ...
> \begin{document}
> % ...
> \end{document}
> #+END_SRC
> 
> However, since commit 16f12e0, the generated code is:
> 
> #+BEGIN_SRC latex
> \documentclass{scrlttr2}
> \LoadLetterOption{DefaultAddress}    % <--- email is set here
> \setkomavar{fromemail}{he-sk@client204-235.wlan.hu-berlin.de}  % <--- email is overwritten here
> % ...
> \begin{document}
> % ...
> \end{document}
> #+END_SRC
> 
> Is this a bug in the LaTeX exporter or is this the intended behavior? Should I
> maybe use another keyword instead of EMAIL? I think I used SENDER instead of
> AUTHOR because of a similar conflict.
> 
> Cheers,
> Viktor

[-- Attachment #2: 0001-ox.el-Honor-properties-in-derived-backends-with-defa.patch --]
[-- Type: text/plain, Size: 1071 bytes --]

From 29a3d1ece607c6ddfdb18c5096f04fd08556df50 Mon Sep 17 00:00:00 2001
From: Viktor Rosenfeld <listuser36@gmail.com>
Date: Tue, 14 May 2013 18:58:11 +0200
Subject: [PATCH] ox.el: Honor properties in derived backends with default
 `nil'.

	* ox.el (org-export--get-global-options): Only process
	properties once even if their value is `nil'.

TINYCHANGE
---
 lisp/ox.el | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/lisp/ox.el b/lisp/ox.el
index 3a4a130..64bc799 100644
--- a/lisp/ox.el
+++ b/lisp/ox.el
@@ -1726,11 +1726,15 @@ process."
 	 ;; Priority is given to back-end specific options.
 	 (append (and backend (org-export-backend-options backend))
 		 org-export-options-alist))
-	plist)
+	plist
+	seen)
     (mapc
      (lambda (cell)
        (let ((prop (car cell)))
-	 (unless (plist-member plist prop)
+	 (unless (or
+		  (plist-member plist prop)
+		  (member prop seen))
+	   (add-to-list 'seen prop)
 	   (let ((value (eval (nth 3 cell))))
 	     ;; Only set property if default value is non-nil.
 	     (when value
-- 
1.8.2.2


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

* Re: Inhibit default EMAIL in derived exporter
  2013-05-13 18:35 Inhibit default EMAIL in derived exporter Viktor Rosenfeld
  2013-05-14 17:04 ` [PATCH] Honor properties in derived backends with default nil Viktor Rosenfeld
@ 2013-05-15 19:24 ` Nicolas Goaziou
  2013-05-16 14:06   ` Viktor Rosenfeld
  1 sibling, 1 reply; 4+ messages in thread
From: Nicolas Goaziou @ 2013-05-15 19:24 UTC (permalink / raw)
  To: emacs-orgmode

Hello,

Viktor Rosenfeld <listuser36@gmail.com> writes:

> commit 16f12e0 changed how the EMAIL option is configured in a derived
> exporter that also uses this keyword.

I fixed it in maint. Thank you for reporting it.


Regards,

-- 
Nicolas Goaziou

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

* Re: Inhibit default EMAIL in derived exporter
  2013-05-15 19:24 ` Inhibit default EMAIL in derived exporter Nicolas Goaziou
@ 2013-05-16 14:06   ` Viktor Rosenfeld
  0 siblings, 0 replies; 4+ messages in thread
From: Viktor Rosenfeld @ 2013-05-16 14:06 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode

Hi Nicolas,

Nicolas Goaziou wrote:

> > commit 16f12e0 changed how the EMAIL option is configured in a derived
> > exporter that also uses this keyword.
> 
> I fixed it in maint. Thank you for reporting it.

Thank you. Everything works as expected now.

Cheers,
Viktor

> 
> 
> Regards,
> 
> -- 
> Nicolas Goaziou
> 

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

end of thread, other threads:[~2013-05-16 14:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-13 18:35 Inhibit default EMAIL in derived exporter Viktor Rosenfeld
2013-05-14 17:04 ` [PATCH] Honor properties in derived backends with default nil Viktor Rosenfeld
2013-05-15 19:24 ` Inhibit default EMAIL in derived exporter Nicolas Goaziou
2013-05-16 14:06   ` Viktor Rosenfeld

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