emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Joe Hirn
Subject: Re: [O] org-export-latex-hyperref-options-format
Date: Thu, 20 Feb 2014 15:52:03 -0600

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 <address@hidden> wrote:
Hello,

Joe Hirn <address@hidden> 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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]