From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Georg W. Otto" Subject: Re: org-ref file path to pdf Date: Tue, 13 Dec 2016 18:59:11 +0000 Message-ID: <861sxb8xkw.fsf@georgotto.de> References: <868trt5j4u.fsf@georgotto.de> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:49345) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cGsIP-0006DS-Ck for emacs-orgmode@gnu.org; Tue, 13 Dec 2016 13:59:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cGsIM-000803-B5 for emacs-orgmode@gnu.org; Tue, 13 Dec 2016 13:59:25 -0500 Received: from [195.159.176.226] (port=48404 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cGsIM-0007zt-4m for emacs-orgmode@gnu.org; Tue, 13 Dec 2016 13:59:22 -0500 Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1cGsIF-0005Jj-35 for emacs-orgmode@gnu.org; Tue, 13 Dec 2016 19:59:15 +0100 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org John Kitchin writes: > I just pushed a feature that might get you back what you want. > > You can now put [[file:%F][%f]] in the org-ref-note-title-format > variable, and it will put (concat org-ref-pdf-directory key ".pdf") in > for %F, and (concat key ".pdf") in for %f. There is unfortunately, no > check if the pdf actually exists though. > > A second option is to write a function to add to a new hook variable: > org-ref-create-notes-hook > > There is an example function in that that adds a cite link (which can > open a pdf), but if you wanted to you could write a function that would > add a file link to a pdf if it could find one. Thanks a lot, this is really helpful. As you suggested I added a function to org-ref-create-notes-hook in my init file: (defun org-ref-add-note-pdf() (setq pdf (concat org-ref-pdf-directory key ".pdf")) (if (file-exists-p pdf) (insert (format "[[file:%s][pdf]]\n\n" pdf)) ;; no pdf found. Prompt for a path, but allow no pdf to ;; be inserted. (let ((pdf (read-file-name "PDF: " nil "no pdf" nil "no pdf"))) (when (not (string= pdf "no pdf")) (insert (format " [[file:%s][pdf]]\n\n" pdf)))) ) ) (add-hook 'org-ref-create-notes-hook 'org-ref-add-note-pdf) This formats the pdf link as intended. My question now concerns the citation link that is defined in the lambda function in org-ref-create-notes-hook. I might want to override this lambda function with my own hook function in order to change the format of the citation link. I haven't found a way to override a lambda function, though. Can you give me a hint how this is done? Cheers, Georg