Re: [O] org-export-latex-hyperref-options-format

2014-03-21 Thread Joe Hirn
Thanks for the report. I'm not super familiar with how the texht option
works. I did made the following change base on recommendation from Nicolas
in the :options-alist.

(:latex-hyperref-p nil "texht" org-latex-with-hyperref t)
to
(:latex-hyperref nil nil org-latex-hyperref-template t)

>From Nicolas: "... we can replace "texht" with nil since it doesn't make
much sense to specify a full template from the OPTIONS line."

I believe the patch worked without substituting "texht" with nil in this
line.

I'm not sure if this is a regression or if your document requires updating.
That's not my call. Just chiming in with what's relevant to this side
effect you're experiencing.


On Fri, Mar 21, 2014 at 11:51 AM, Thomas S. Dye  wrote:

> Aloha all,
>
> I noticed yesterday that a legacy document with this option:
>
> #+OPTIONS: texht:nil
>
> is now broken in a recent Org mode from master.
>
> The following lines now appear in the LaTeX export, when they didn't
> before:
>
> \hypersetup{
>  pdfkeywords={},
>   pdfsubject={},
>   pdfcreator={Emacs 24.3.1 (Org mode 8.2.5h)}}
>
> I haven't looked at this patch, but I'm guessing that it is responsible.
>
> It would be great if the texht option could still be supported.  If not,
> can someone offer advice on the best way to set
> org-latex-hyperref-template to achieve the same file-local effect?
>
> All the best,
> Tom
>
>
> Bastien  writes:
>
> > Hi Nicolas,
> >
> > Nicolas Goaziou  writes:
> >
> >> I think this patch is already in master.
> >
> > Indeed, sorry for the noise,
> >
> > PS: let's confirm on the list when a patch gets applied, that
> > helps archiving threads faster.
>
> --
> Thomas S. Dye
> http://www.tsdye.com
>


Re: [O] org-export-latex-hyperref-options-format

2014-02-24 Thread Joe Hirn
Against the latest master:

**BEGIN PATCH*
>From 996e75b3538e60049645a5025a390be603425b8b Mon Sep 17 00:00:00 2001
From: Joe Hirn 
Date: Mon, 24 Feb 2014 15:23:09 -0600
Subject: [PATCH] Allow customization of hyperrefsetup via
 `org-latex-hyperref-template'

* ox-latex.el (org-latex-hyperref-template): Add custom var
`org-latex-hyperref-template' to enable
  customization of the \\hypersetup{...}. The value is a format-spec
  with placeholders for KEYWORDS, DESCRIPTION and CREATOR.

  (org-latex-with-hyperref): Remove custom var
  `org-latex-with-hyperref'. Set `org-latex-hyperref-template' to
  an empty string to disable the \\hypersetup{...} output.

  (org-latex-template): Make use of new `org-latex-hyperref-template'
  when emitting \\hypersetup{...}.

This patch allows the user to emit custom options for the
\\hypersetup{...} options which are used by the \\hyperref package.

Modfied by Joe Hirn with advice from Nicholas Goaziou

TINYCHANGE
---
 lisp/ox-latex.el | 31 ---
 1 file changed, 20 insertions(+), 11 deletions(-)

diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index 50a08f6..8f9dcdd 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -106,7 +106,7 @@
(:latex-class-options "LATEX_CLASS_OPTIONS" nil nil t)
(:latex-header "LATEX_HEADER" nil nil newline)
(:latex-header-extra "LATEX_HEADER_EXTRA" nil nil newline)
-   (:latex-hyperref-p nil "texht" org-latex-with-hyperref t)
+   (:latex-hyperref nil nil org-latex-hyperref-template t)
(:latex-custom-id-labels nil nil org-latex-custom-id-as-label))
   :filters-alist '((:filter-options . org-latex-math-block-options-filter)
(:filter-parse-tree . org-latex-math-block-tree-filter)))
@@ -348,11 +348,19 @@ the toc:nil option, not to those generated with #+TOC
keyword."
   :group 'org-export-latex
   :type 'string)

-(defcustom org-latex-with-hyperref t
-  "Toggle insertion of \\hypersetup{...} in the preamble."
+
+(defcustom org-latex-hyperref-template "\\hypersetup{\n
pdfkeywords={%k},\n  pdfsubject={%d},\n  pdfcreator={%c}}\n"
+  "Template for hyperref package options.
+
+Value is a format string, which can contain the following placeholders:
+
+  %k for KEYWORDS line
+  %d for DESCRIPTION line
+  %c for CREATOR line
+
+An empty string disables the setup."
   :group 'org-export-latex
-  :type 'boolean
-  :safe #'booleanp)
+  :type 'string)

  Headline

@@ -1188,12 +1196,13 @@ holding export options."
  ;; Title
  (format "\\title{%s}\n" title)
  ;; Hyperref options.
- (when (plist-get info :latex-hyperref-p)
-   (format "\\hypersetup{\n  pdfkeywords={%s},\n  pdfsubject={%s},\n
 pdfcreator={%s}}\n"
-   (or (plist-get info :keywords) "")
-   (or (plist-get info :description) "")
-   (if (not (plist-get info :with-creator)) ""
- (plist-get info :creator
+ (format-spec (plist-get info :latex-hyperref)
+  (format-spec-make
+   ?k (or (plist-get info :keywords) "")
+   ?d (or (plist-get info :description)"")
+   ?c (if (plist-get info :with-creator)
+  (plist-get info :creator)
+ "")))
  ;; Document start.
  "\\begin{document}\n\n"
  ;; Title command.
--
1.8.5.4
*** END PATCH *


On Sat, Feb 22, 2014 at 11:02 AM, Bastien  wrote:

> Hi Joe,
>
> Joe Hirn  writes:
>
> > Where can I clone the master branch from?
>
> This should do the trick:
>
> ~$ git clone git://orgmode.org/org-mode.git
>
> Best,
>
> --
>  Bastien
>


Re: [O] org-export-latex-hyperref-options-format

2014-02-22 Thread Joe Hirn
Where can I clone the master branch from? I requested access to clone it
from the contribution page but was told that's reserved for frequent
committers. I generated this patch against the most recent version pulled
down from package.el (version 20140210).


On Sat, Feb 22, 2014 at 3:39 AM, Nicolas Goaziou wrote:

> Hello,
>
> Joe Hirn  writes:
>
> > Here you go.
>
> Thank you for the patch.
>
> Unfortunately, I cannot apply it on master branch. Would you mind
> updating your repository and generate the patch again?
>
>
> Regards,
>
> --
> Nicolas Goaziou
>


Re: [O] org-export-latex-hyperref-options-format

2014-02-21 Thread Joe Hirn
Here you go.

Thanks a lot for all your help. Was really nice working on it with you.


>From af2a8066be01b94504fff9e009617ce186bd9e03 Mon Sep 17 00:00:00 2001
From: Joe Hirn 
Date: Fri, 21 Feb 2014 12:15:58 -0600
Subject: [PATCH] Allow customization of hyperrefsetup via
 `org-latex-hyperref-template'

* ox-latex.el (org-latex-hyperref-template): Add custom var
`org-latex-hyperref-template' to enable
  customization of the \\hypersetup{...}. The value is a format-spec
  with placeholders for KEYWORDS, DESCRIPTION and CREATOR.

  (org-latex-with-hyperref): Remove custom var
  `org-latex-with-hyperref'. Set `org-latex-hyperref-template' to
  an empty string to disable the \\hypersetup{...} output.

  (org-latex-template): Make use of new `org-latex-hyperref-template'
  when emitting \\hypersetup{...}.

This patch allows the user to emit custom options for the
\\hypersetup{...} options which are used by the \\hyperref package.

Modfied by Joe Hirn with advice from Nicholas Goaziou

TINYCHANGE
---
 ox-latex.el | 29 +++--
 1 file changed, 19 insertions(+), 10 deletions(-)

diff --git a/ox-latex.el b/ox-latex.el
index 19f055e..f6e5a09 100644
--- a/ox-latex.el
+++ b/ox-latex.el
@@ -103,7 +103,7 @@
(:latex-class-options "LATEX_CLASS_OPTIONS" nil nil t)
(:latex-header "LATEX_HEADER" nil nil newline)
(:latex-header-extra "LATEX_HEADER_EXTRA" nil nil newline)
-   (:latex-hyperref-p nil "texht" org-latex-with-hyperref t)
+   (:latex-hyperref nil nil org-latex-hyperref-template t)
;; Redefine regular options.
(:date "DATE" nil "\\today" t)))

@@ -341,10 +341,18 @@ the toc:nil option, not to those generated with #+TOC
keyword."
   :group 'org-export-latex
   :type 'string)

-(defcustom org-latex-with-hyperref t
-  "Toggle insertion of \\hypersetup{...} in the preamble."
+(defcustom org-latex-hyperref-template "\\hypersetup{\n
pdfkeywords={%k},\n  pdfsubject={%d},\n  pdfcreator={%c}}\n"
+  "Template for hyperref package options.
+
+Value is a format string, which can contain the following placeholders:
+
+  %k for KEYWORDS line
+  %d for DESCRIPTION line
+  %c for CREATOR line
+
+An empty string disables the setup."
   :group 'org-export-latex
-  :type 'boolean)
+  :type 'string)

  Headline

@@ -1118,12 +1126,13 @@ holding export options."
  ;; Title
  (format "\\title{%s}\n" title)
  ;; Hyperref options.
- (when (plist-get info :latex-hyperref-p)
-   (format "\\hypersetup{\n  pdfkeywords={%s},\n  pdfsubject={%s},\n
 pdfcreator={%s}}\n"
-   (or (plist-get info :keywords) "")
-   (or (plist-get info :description) "")
-   (if (not (plist-get info :with-creator)) ""
- (plist-get info :creator
+ (format-spec (plist-get info :latex-hyperref)
+  (format-spec-make
+   ?k (or (plist-get info :keywords) "")
+   ?d (or (plist-get info :description)"")
+   ?c (if (plist-get info :with-creator)
+  (plist-get info :creator)
+"")))
  ;; Document start.
  "\\begin{document}\n\n"
  ;; Title command.
-- 
1.8.5.4



On Fri, Feb 21, 2014 at 11:28 AM, Nicolas Goaziou wrote:

> Hello,
>
> Joe Hirn  writes:
>
> > With recommended changes.
>
> Thank you. It looks good.
>
> Could you add a commit message (see "Commit messages and ChangeLog
> entries" section in http://orgmode.org/worg/org-contribute.html) and
> send it again, using "git format-patch"?
>
>
> Regards,
>
> --
> Nicolas Goaziou
>


Re: [O] org-export-latex-hyperref-options-format

2014-02-20 Thread Joe Hirn
With recommended changes.

 BEGIN PATCH *
diff --git a/ox-latex.el b/ox-latex.el
index 19f055e..f6e5a09 100644
--- a/ox-latex.el
+++ b/ox-latex.el
@@ -103,7 +103,7 @@
(:latex-class-options "LATEX_CLASS_OPTIONS" nil nil t)
(:latex-header "LATEX_HEADER" nil nil newline)
(:latex-header-extra "LATEX_HEADER_EXTRA" nil nil newline)
-   (:latex-hyperref-p nil "texht" org-latex-with-hyperref t)
+   (:latex-hyperref nil nil org-latex-hyperref-template t)
;; Redefine regular options.
(:date "DATE" nil "\\today" t)))

@@ -341,10 +341,18 @@ the toc:nil option, not to those generated with #+TOC
keyword."
   :group 'org-export-latex
   :type 'string)

-(defcustom org-latex-with-hyperref t
-  "Toggle insertion of \\hypersetup{...} in the preamble."
+(defcustom org-latex-hyperref-template "\\hypersetup{\n
pdfkeywords={%k},\n  pdfsubject={%d},\n  pdfcreator={%c}}\n"
+  "Template for hyperref package options.
+
+Value is a format string, which can contain the following placeholders:
+
+  %k for KEYWORDS line
+  %d for DESCRIPTION line
+  %c for CREATOR line
+
+An empty string disables the setup."
   :group 'org-export-latex
-  :type 'boolean)
+  :type 'string)

  Headline

@@ -1118,12 +1126,13 @@ holding export options."
  ;; Title
  (format "\\title{%s}\n" title)
  ;; Hyperref options.
- (when (plist-get info :latex-hyperref-p)
-   (format "\\hypersetup{\n  pdfkeywords={%s},\n  pdfsubject={%s},\n
 pdfcreator={%s}}\n"
-   (or (plist-get info :keywords) "")
-   (or (plist-get info :description) "")
-   (if (not (plist-get info :with-creator)) ""
- (plist-get info :creator
+ (format-spec (plist-get info :latex-hyperref)
+  (format-spec-make
+   ?k (or (plist-get info :keywords) "")
+   ?d (or (plist-get info :description)"")
+   ?c (if (plist-get info :with-creator)
+  (plist-get info :creator)
+"")))
  ;; Document start.
  "\\begin{document}\n\n"
  ;; Title command.
 END PATCH *


On Thu, Feb 20, 2014 at 3:52 PM, Joe Hirn  wrote:

> I really appreciate your review. Sorry for the pedestrian code submission.
> I don't get candid critical feedback on my e-lisp, so it's great to learn
> more about its idioms and conventions.
>
> I'll incorporate your feedback into a new patch.
>
>
> On Thu, Feb 20, 2014 at 2:51 PM, Nicolas Goaziou wrote:
>
>> Hello,
>>
>> Joe Hirn  writes:
>>
>> > I was able to test this on my local machine and it seems to work as we
>> > discussed.
>> >
>> > If there are any other changes to the patch you'd like to see, please
>> let
>> > me know.
>>
>> Thank you for the patch. Here are a few comments.
>>
>> > -   (:latex-hyperref-p nil "texht" org-latex-with-hyperref t)
>> > +   (:latex-hyperref-p nil "texht" (if org-latex-hyperref-template t) t)
>>
>> I think we can drop the "-p" suffix since this is no longer a predicate.
>> So the property can be named :latex-hyperref.
>>
>> Also we can replace "texht" with nil since it doesn't make much sense to
>> specify a full template from the OPTIONS line.
>>
>> Eventually, the default value should be `org-latex-hyperref-template'.
>>
>> This boils down to the following line:
>>
>>   (:latex-hyperref nil nil org-latex-hyperref-template t)
>>
>> > -(defcustom org-latex-with-hyperref t
>> > -  "Toggle insertion of \\hypersetup{...} in the preamble."
>> > +
>> > +(defcustom org-latex-hyperref-template "\\hypersetup{\n
>> >  pdfkeywords={%k},\n  pdfsubject={%d},\n  pdfcreator={%c}}\n"
>> > +  "The value of \\hyperrefsetup{...} in the preamble. String is a
>> > format-spec which accepts keywords for %k (pdfkeywords), %d
>> > (pdfdescription) and %c (pdfcreator). Set to nil for no
>> \\hyperrefsetup."
>> >:group 'org-export-latex
>> > -  :type 'boolean)
>> > +  :type 'string)
>>
>> The first line of the docstring should contain complete sentences only.
>> I would say something along the lines:
>>
>>   "Template for hyperref package options.
>>
>> Value is a format string, which can contain the following placeholders:
>>
>>   %k for KEYWORDS line
>>   %d for DESCRIPTION line
>>   %c for CREATOR line
>>
>> An empty string disable

Re: [O] org-export-latex-hyperref-options-format

2014-02-20 Thread Joe Hirn
I really appreciate your review. Sorry for the pedestrian code submission.
I don't get candid critical feedback on my e-lisp, so it's great to learn
more about its idioms and conventions.

I'll incorporate your feedback into a new patch.


On Thu, Feb 20, 2014 at 2:51 PM, Nicolas Goaziou wrote:

> Hello,
>
> Joe Hirn  writes:
>
> > I was able to test this on my local machine and it seems to work as we
> > discussed.
> >
> > If there are any other changes to the patch you'd like to see, please let
> > me know.
>
> Thank you for the patch. Here are a few comments.
>
> > -   (:latex-hyperref-p nil "texht" org-latex-with-hyperref t)
> > +   (:latex-hyperref-p nil "texht" (if org-latex-hyperref-template t) t)
>
> I think we can drop the "-p" suffix since this is no longer a predicate.
> So the property can be named :latex-hyperref.
>
> Also we can replace "texht" with nil since it doesn't make much sense to
> specify a full template from the OPTIONS line.
>
> Eventually, the default value should be `org-latex-hyperref-template'.
>
> This boils down to the following line:
>
>   (:latex-hyperref nil nil org-latex-hyperref-template t)
>
> > -(defcustom org-latex-with-hyperref t
> > -  "Toggle insertion of \\hypersetup{...} in the preamble."
> > +
> > +(defcustom org-latex-hyperref-template "\\hypersetup{\n
> >  pdfkeywords={%k},\n  pdfsubject={%d},\n  pdfcreator={%c}}\n"
> > +  "The value of \\hyperrefsetup{...} in the preamble. String is a
> > format-spec which accepts keywords for %k (pdfkeywords), %d
> > (pdfdescription) and %c (pdfcreator). Set to nil for no \\hyperrefsetup."
> >:group 'org-export-latex
> > -  :type 'boolean)
> > +  :type 'string)
>
> The first line of the docstring should contain complete sentences only.
> I would say something along the lines:
>
>   "Template for hyperref package options.
>
> Value is a format string, which can contain the following placeholders:
>
>   %k for KEYWORDS line
>   %d for DESCRIPTION line
>   %c for CREATOR line
>
> An empty string disables the setup."
>
> Since you specify :type as 'string, it is wrong to expect a nil value in
> the variable. Note that nil is not an absolute necessity. We can allow
> to disable the template with an empty string instead.
>
> > +   (format-spec org-latex-hyperref-template
> > +(format-spec-make
> > + ?k (or (plist-get info :keywords) "")
> > + ?d (or (plist-get info :description)"")
> > + ?c (if (plist-get info :with-creator)
> > +(plist-get info :creator)
> > +  ""
>
> You are not using the :latex-hyperref property. This should be:
>
>   (format-spec (plist-get info :latex-hyperref)
>...)
>
>
> Regards,
>
> --
> Nicolas Goaziou
>


Re: [O] org-export-latex-hyperref-options-format

2014-02-20 Thread Joe Hirn
Hi Nicholas.

I was able to test this on my local machine and it seems to work as we
discussed.

If there are any other changes to the patch you'd like to see, please let
me know.

Thanks for your help. I really appreciate it.


BEGIN PATCH**
diff --git a/ox-latex.el b/ox-latex.el
index 19f055e..9ed6372 100644
--- a/ox-latex.el
+++ b/ox-latex.el
@@ -103,7 +103,7 @@
(:latex-class-options "LATEX_CLASS_OPTIONS" nil nil t)
(:latex-header "LATEX_HEADER" nil nil newline)
(:latex-header-extra "LATEX_HEADER_EXTRA" nil nil newline)
-   (:latex-hyperref-p nil "texht" org-latex-with-hyperref t)
+   (:latex-hyperref-p nil "texht" (if org-latex-hyperref-template t) t)
;; Redefine regular options.
(:date "DATE" nil "\\today" t)))

@@ -341,10 +341,11 @@ the toc:nil option, not to those generated with #+TOC
keyword."
   :group 'org-export-latex
   :type 'string)

-(defcustom org-latex-with-hyperref t
-  "Toggle insertion of \\hypersetup{...} in the preamble."
+
+(defcustom org-latex-hyperref-template "\\hypersetup{\n
 pdfkeywords={%k},\n  pdfsubject={%d},\n  pdfcreator={%c}}\n"
+  "The value of \\hyperrefsetup{...} in the preamble. String is a
format-spec which accepts keywords for %k (pdfkeywords), %d
(pdfdescription) and %c (pdfcreator). Set to nil for no \\hyperrefsetup."
   :group 'org-export-latex
-  :type 'boolean)
+  :type 'string)

  Headline

@@ -1119,11 +1120,13 @@ holding export options."
  (format "\\title{%s}\n" title)
  ;; Hyperref options.
  (when (plist-get info :latex-hyperref-p)
-   (format "\\hypersetup{\n  pdfkeywords={%s},\n  pdfsubject={%s},\n
 pdfcreator={%s}}\n"
-   (or (plist-get info :keywords) "")
-   (or (plist-get info :description) "")
-   (if (not (plist-get info :with-creator)) ""
- (plist-get info :creator
+   (format-spec org-latex-hyperref-template
+(format-spec-make
+ ?k (or (plist-get info :keywords) "")
+ ?d (or (plist-get info :description)"")
+ ?c (if (plist-get info :with-creator)
+(plist-get info :creator)
+  ""
  ;; Document start.
  "\\begin{document}\n\n"
  ;; Title command.
END  PATCH**


On Thu, Feb 20, 2014 at 6:34 AM, Joseph Hirn  wrote:

> Ok. I was hesitant to require anything additional but I should be able
> to knock this out.
>
> Thx again.
>
> Sent from my iPhone
>
> > On Feb 20, 2014, at 4:22 AM, Nicolas Goaziou 
> wrote:
> >
> > Hello,
> >
> > Joe Hirn  writes:
> >
> >> Hi just sat down to code this up. I assume the keywords are so we can
> use
> >> data within the plist argument (info) passed to `org-latex-template'.
> But
> >> I'm not exactly sure what you mean by %k for keywords.
> >>
> >> Are you suggesting we could do something like:
> >>
> >> "\\hypersetup{\n  pdfkeywords={%kkeywords},\n
> >> pdfsubject={%kdescription},\n  pdfcreator={%kcreator}}\n"
> >>
> >> If that's the idea, is there a more powerful construct than regex
> matching
> >> for achieving this? Otherwise, can you give me an example of what you
> had
> >> in mind for the keyword placeholders.
> >
> > I'm suggesting to use `format-spec', e.g., something like:
> >
> >  (and org-latex-hyperref-template
> >   (format-spec org-latex-hyperref-template
> >(format-spec-make
> > ?k (or (plist-get info :keywords) "")
> > ?d (or (plist-get info :description) "")
> > ?c (if (not (plist-get info :with-creator)) ""
> >  (plist-get info :creator)
> >
> > Thus, when `org-latex-hyperref-template' is nil, no "\hyperref" command
> > is inserted, otherwise, it is a format string where %k is replaced with
> > KEYWORDS, %d with DESCRIPTION and %c with CREATOR.
> >
> > Default value for the variable would be:
> >
> >  "\\hypersetup{\n  pdfkeywords={%k},\n  pdfsubject={%d},\n
>  pdfcreator={%c}}\n"
> >
> > A (require 'format-spec) will be needed in the beginning of
> > "ox-latex.el".
> >
> >
> > Regards,
> >
> > --
> > Nicolas Goaziou
>


Re: [O] org-export-latex-hyperref-options-format

2014-02-19 Thread Joe Hirn
Hi just sat down to code this up. I assume the keywords are so we can use
data within the plist argument (info) passed to `org-latex-template'. But
I'm not exactly sure what you mean by %k for keywords.

Are you suggesting we could do something like:

"\\hypersetup{\n  pdfkeywords={%kkeywords},\n
 pdfsubject={%kdescription},\n  pdfcreator={%kcreator}}\n"

If that's the idea, is there a more powerful construct than regex matching
for achieving this? Otherwise, can you give me an example of what you had
in mind for the keyword placeholders.

Thanks


On Wed, Feb 19, 2014 at 7:05 AM, Nicolas Goaziou wrote:

> Hello,
>
> Joe Hirn  writes:
>
> > So I understand, you're recommending I disable org-latex-with-hyperref
> and
> > then add my own \\hypersetup. My goal would be to avoid placing a #+
> entry
> > into every .org file I compose. Which var would be the easiest to to
> adjust
> > so I can emit \\hypersetup by default and still access the info map that
> is
> > passed to org-latex-template. I'd like to get the keywords, subject and
> > creator variables that are emitted right now.
>
> On a personal level, if you only need to add keyword-value pairs,
> I think the simplest solution is to add a class in `org-latex-classes',
> where you insert an additional "\hypersetup{...}" command. You don't
> need to change `org-latex-with-hyperref' in this case.
>
> You can also use a (final) filter to install this command if you don't
> want to bother creating a new class.
>
> On a more general level, I'll welcome a solution replacing
> `org-latex-with-hyperref' with `org-latex-hyperref-template', which
> could be either nil (no hyperref command) or a string with some
> placeholders (e.g. %k for keywords).
>
> What do you think?
>
>
> Regards,
>
> --
> Nicolas Goaziou
>


Re: [O] org-export-latex-hyperref-options-format

2014-02-19 Thread Joe Hirn
I think that's a great idea.

Thanks for helping me workaround my individual problem and advice on what
type of patch you're welcoming.

I just happen to have the free time today so I'll try to get a patch to
you.


On Wed, Feb 19, 2014 at 7:05 AM, Nicolas Goaziou wrote:

> Hello,
>
> Joe Hirn  writes:
>
> > So I understand, you're recommending I disable org-latex-with-hyperref
> and
> > then add my own \\hypersetup. My goal would be to avoid placing a #+
> entry
> > into every .org file I compose. Which var would be the easiest to to
> adjust
> > so I can emit \\hypersetup by default and still access the info map that
> is
> > passed to org-latex-template. I'd like to get the keywords, subject and
> > creator variables that are emitted right now.
>
> On a personal level, if you only need to add keyword-value pairs,
> I think the simplest solution is to add a class in `org-latex-classes',
> where you insert an additional "\hypersetup{...}" command. You don't
> need to change `org-latex-with-hyperref' in this case.
>
> You can also use a (final) filter to install this command if you don't
> want to bother creating a new class.
>
> On a more general level, I'll welcome a solution replacing
> `org-latex-with-hyperref' with `org-latex-hyperref-template', which
> could be either nil (no hyperref command) or a string with some
> placeholders (e.g. %k for keywords).
>
> What do you think?
>
>
> Regards,
>
> --
> Nicolas Goaziou
>


Re: [O] org-export-latex-hyperref-options-format

2014-02-17 Thread Joe Hirn
I'm sorry man. That may have came off wrong. Did not mean to sound
ungrateful.

Thanks for offering the workarounds and thanks for responding.

I definitely agree with drawback #2.

So I understand, you're recommending I disable org-latex-with-hyperref and
then add my own \\hypersetup. My goal would be to avoid placing a #+ entry
into every .org file I compose. Which var would be the easiest to to adjust
so I can emit \\hypersetup by default and still access the info map that is
passed to org-latex-template. I'd like to get the keywords, subject and
creator variables that are emitted right now.




On Mon, Feb 17, 2014 at 5:23 PM, Nicolas Goaziou wrote:

> Joe Hirn  writes:
>
> > Hm. That's disappointing. I really prefer the original behavior. I don't
> > want to copy #+latex_header to get this default behavior into each of my
> > org-mode files.
>
> I suggested other ways to handle it.
>
> Anyway your patch has two drawbacks:
>
>   1. It is partly redundant with `org-latex-with-hyperref'.
>
>   2. A mere format string doesn't provide real flexibility (e.g., what if
>  I don't want the pdfkeywords part?) when you want some.  Perhaps
>  something based on `format-spec' would be better.
>
>
> Regards,
>
> --
> Nicolas Goaziou
>


Re: [O] org-export-latex-hyperref-options-format

2014-02-17 Thread Joe Hirn
Hm. That's disappointing. I really prefer the original behavior. I don't
want to copy #+latex_header to get this default behavior into each of my
org-mode files.

I guess I'll just have to maintain this by redefining the entire
org-latex-template function to look at my variable instead of the hard
coded string. A pain but apparently my own option.

Thanks.


On Mon, Feb 17, 2014 at 4:13 PM, Nicolas Goaziou wrote:

> Hello,
>
> Joe Hirn  writes:
>
> > Hello. I recently upgraded to org 8 from the builtin org (7.x) of Emacs
> > 24.3 and lost the ability to customize the \hypersetup block via the
> custom
> > var org-export-latex-hyperref-options-format. Platform is OSX, Emacs
> > installed via homebrew and org-mode updated via package.el.
> >
> > Org 7.x defines the var in org-latex.el. Because it's a builtin, the
> custom
> > var still displays in the 'org-latex-export group when configuring
> options.
> > However, the new export logic from ox-latex.el does not define this
> custom
> > var, nor does it respect the value if it is set. This is doubly confusing
> > because it appears the var is available, but it actually unused.
>
> The problem will go with the next Emacs release.
>
> > I found this thread from September which describes the same issue, but
> the
> > patch did not address adding the custom var back and seems to have died.
> > http://lists.gnu.org/archive/html/emacs-orgmode/2013-09/msg01364.html
>
> Actually, there is a way to ignore hypersetup block. See
> `org-latex-with-hyperref'.
>
> If you really want a custom command, I think it is better to first
> disable it with the variable aforementioned, then include your own
> with #+latex_header or in a custom latex class (see
> `org-latex-classes').
>
> You can also use a filter to change it on the fly, but that would be
> less straightforward.
>
>
> Regards,
>
> --
> Nicolas Goaziou
>


[O] org-export-latex-hyperref-options-format

2014-02-17 Thread Joe Hirn
Hello. I recently upgraded to org 8 from the builtin org (7.x) of Emacs
24.3 and lost the ability to customize the \hypersetup block via the custom
var org-export-latex-hyperref-options-format. Platform is OSX, Emacs
installed via homebrew and org-mode updated via package.el.

Org 7.x defines the var in org-latex.el. Because it's a builtin, the custom
var still displays in the 'org-latex-export group when configuring options.
However, the new export logic from ox-latex.el does not define this custom
var, nor does it respect the value if it is set. This is doubly confusing
because it appears the var is available, but it actually unused.

I found this thread from September which describes the same issue, but the
patch did not address adding the custom var back and seems to have died.
http://lists.gnu.org/archive/html/emacs-orgmode/2013-09/msg01364.html

I've created a patch via git format-patch which adds the custom var to
ox-latex.el and makes use of it. Thanks for considering it.


rom 0df51396b04bd785948032055e48b40787c15d98 Mon Sep 17 00:00:00 2001
From: Joe Hirn 
Date: Mon, 17 Feb 2014 14:39:35 -0600
Subject: [PATCH] add org-export-latex-hyperref-options-format custom var
back
 to latex exporter

---
 ox-latex.el | 13 -
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/ox-latex.el b/ox-latex.el
index 19f055e..9724def 100644
--- a/ox-latex.el
+++ b/ox-latex.el
@@ -186,6 +186,17 @@
   :group 'org-export-latex
   :type '(string :tag "LaTeX class"))

+(defcustom org-export-latex-hyperref-options-format
+  "\\hypersetup{\n  pdfkeywords={%s},\n  pdfsubject={%s},\n
 pdfcreator={Emacs Org-mode version %s}}\n"
+  "A format string for hyperref options.
+When non-nil, it must contain three %s format specifications
+which will respectively be replaced by the document's keywords,
+its description and the Org's version number, as a string.  Set
+this option to the empty string if you don't want to include
+hyperref options altogether."
+  :type 'string
+  :group 'org-export-latex)
+
 (defcustom org-latex-classes
   '(("article"
  "\\documentclass[11pt]{article}"
@@ -1119,7 +1130,7 @@ holding export options."
  (format "\\title{%s}\n" title)
  ;; Hyperref options.
  (when (plist-get info :latex-hyperref-p)
-   (format "\\hypersetup{\n  pdfkeywords={%s},\n  pdfsubject={%s},\n
 pdfcreator={%s}}\n"
+   (format org-export-latex-hyperref-options-format
(or (plist-get info :keywords) "")
(or (plist-get info :description) "")
(if (not (plist-get info :with-creator)) ""
--
1.8.5.4