From: Joe Hirn <joseph.hirn@gmail.com>
To: Nicolas Goaziou <n.goaziou@gmail.com>
Cc: "emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Subject: Re: org-export-latex-hyperref-options-format
Date: Thu, 20 Feb 2014 16:53:25 -0600 [thread overview]
Message-ID: <CALY_e1q5tqVOT3mkf-PrkjwR=Z8sZo40JFX1MTGdG9aNPPr7wQ@mail.gmail.com> (raw)
In-Reply-To: <CALY_e1puF1G+tb5h=WJ+w1HNFjEXKA08723YuZrKgu5=fGCQsA@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 5146 bytes --]
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 <joseph.hirn@gmail.com> 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 <n.goaziou@gmail.com>wrote:
>
>> Hello,
>>
>> Joe Hirn <joseph.hirn@gmail.com> 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
>>
>
>
[-- Attachment #2: Type: text/html, Size: 7702 bytes --]
next prev parent reply other threads:[~2014-02-20 22:53 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-17 20:41 org-export-latex-hyperref-options-format Joe Hirn
2014-02-17 22:13 ` org-export-latex-hyperref-options-format Nicolas Goaziou
2014-02-17 22:59 ` org-export-latex-hyperref-options-format Joe Hirn
2014-02-17 23:23 ` org-export-latex-hyperref-options-format Nicolas Goaziou
2014-02-17 23:42 ` org-export-latex-hyperref-options-format Joe Hirn
2014-02-19 13:05 ` org-export-latex-hyperref-options-format Nicolas Goaziou
2014-02-19 16:21 ` org-export-latex-hyperref-options-format Joe Hirn
2014-02-19 22:43 ` org-export-latex-hyperref-options-format Joe Hirn
2014-02-20 10:22 ` org-export-latex-hyperref-options-format Nicolas Goaziou
2014-02-20 12:34 ` org-export-latex-hyperref-options-format Joseph Hirn
2014-02-20 17:58 ` org-export-latex-hyperref-options-format Joe Hirn
2014-02-20 20:51 ` org-export-latex-hyperref-options-format Nicolas Goaziou
2014-02-20 21:52 ` org-export-latex-hyperref-options-format Joe Hirn
2014-02-20 22:53 ` Joe Hirn [this message]
2014-02-21 17:28 ` org-export-latex-hyperref-options-format Nicolas Goaziou
2014-02-21 18:35 ` org-export-latex-hyperref-options-format Joe Hirn
2014-02-22 9:39 ` org-export-latex-hyperref-options-format Nicolas Goaziou
2014-02-22 16:42 ` org-export-latex-hyperref-options-format Joe Hirn
2014-02-22 17:02 ` org-export-latex-hyperref-options-format Bastien
2014-02-24 21:51 ` org-export-latex-hyperref-options-format Joe Hirn
2014-03-21 8:00 ` org-export-latex-hyperref-options-format Bastien
2014-03-21 13:03 ` org-export-latex-hyperref-options-format Nicolas Goaziou
2014-03-21 13:06 ` org-export-latex-hyperref-options-format Bastien
2014-03-21 16:51 ` org-export-latex-hyperref-options-format Thomas S. Dye
2014-03-21 17:11 ` org-export-latex-hyperref-options-format Joe Hirn
2014-03-21 17:23 ` org-export-latex-hyperref-options-format Nicolas Goaziou
2014-03-21 18:38 ` org-export-latex-hyperref-options-format Thomas S. Dye
2014-03-21 21:19 ` org-export-latex-hyperref-options-format Nick Dokos
2014-03-21 21:47 ` org-export-latex-hyperref-options-format Thomas S. Dye
2014-03-21 22:19 ` org-export-latex-hyperref-options-format Charles Millar
2014-03-21 22:39 ` org-export-latex-hyperref-options-format Nick Dokos
2014-03-22 18:26 ` org-export-latex-hyperref-options-format Thomas S. Dye
2014-03-23 21:39 ` org-export-latex-hyperref-options-format Thomas S. Dye
2014-02-17 23:25 ` org-export-latex-hyperref-options-format Rasmus
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='CALY_e1q5tqVOT3mkf-PrkjwR=Z8sZo40JFX1MTGdG9aNPPr7wQ@mail.gmail.com' \
--to=joseph.hirn@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=n.goaziou@gmail.com \
/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).