Hello, Moritz Kiefer <moritz.kie...@gmail.com> writes:
> This is my first attempt at elisp so it's probably terrible code It's not. Thanks for the patch. Some comments follow. > * lisp/ox-latex.el (org-latex--inline-image): Use page > number (:search-option) of pdf links as page option in includegraphics Missing full stop. You also need to add "TINYCHANGE" on a line below if you don't have signed FSF papers yet. > --- > lisp/ox-latex.el | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el > index ceea302..edbde70 100644 > --- a/lisp/ox-latex.el > +++ b/lisp/ox-latex.el > @@ -1861,6 +1861,10 @@ used as a communication channel." > (setq options (concat options ",width=" width))) > (when (org-string-nw-p height) > (setq options (concat options ",height=" height))) > + (when (and (equal filetype "pdf") > + (string-match "\\`[0-9]+\\'" (org-element-property > :search-option link)) > + (not (string-match "page=" options))) > + (setq options (concat options ",page=" (org-element-property > :search-option link)))) I suggest to let-bind SEARCH-OPTION instead of calling `org-element-property' twice. Also, it's better to use `org-string-match-p' instead of `string-match' since you don't use match-data anyway. Eventually, you need to check if SEARCH-OPTION is non-nil, as (string-match REGEXP nil) throws an error. (let ((search-option (org-element-property :search-option link))) (when (and search-option (equal filetype "pdf") (org-string-match-p "\\`[0-9]+\\'" search-option) ...) ...)) Regards, -- Nicolas Goaziou 0x80A93738