fuxialexander / org-pdftools

A custom org link type for pdf-tools
GNU General Public License v3.0
331 stars 35 forks source link

Make org-pdftools-complete-link matches only pdf #72

Closed Charlie-Gordon closed 2 years ago

Charlie-Gordon commented 3 years ago

Small changes to the org-pdftools-complete-link function, by temporarily replace the read-file-name-function variable to make org-link-complete-file use the function it points to instead, which, you can see what I've added to the function's body was two anonymous functions, pdf-or-dir-p and a wrapper function whose whole purpose is to pass every arguement to the replaced function but with the PREDICATE being pdf-or-dir-p. The result is the minibuffer that org-link-complete-file called only provides a completion for directory and pdf files, ignoring everything else.