Comments (10)
Yes, you have to modify helm-bibtex-find-pdf
. This should work:
(defun helm-bibtex-find-pdf (key)
"Searches in all directories in `helm-bibtex-library-path' for
a PDF whose name is the name specified in the ’file’ property of the
BibTeX entry or whose name is KEY + \".pdf\". Returns the first
matching PDF."
(let* ((entry (helm-bibtex-get-entry key))
(fname (helm-bibtex-get-value "File" entry))
(files1 (--map (f-join it fname) (-flatten (list helm-bibtex-library-path))))
(files2 (--map (f-join it (s-concat key ".pdf")) (-flatten (list helm-bibtex-library-path)))))
(-first 'f-exists? (append files1 files2))))
from helm-bibtex.
My code works when the content of the "file" field is just the bare name of the pdf file without directory. This pdf file is then searched in the directories specified in helm-bibtex-library-path
. In order to make it work with the format that you have, you have to make some changes.
from helm-bibtex.
Thanks a lot. I'll work from that; I might also have to reorganize where directories with PDFs hang from, to make the search or the parsing of the directory easier. I just tried it, and I am getting Variable binding depth exceeds max-specpdl-size
even if the pdf is present in the usual way (KEY + pdf); this is a directory with over 4000 subdirectories.
Since the question is basically answered (tweak helm-bibtex-find-pdf
to suit the specific needs) I am closing the issue. If/when I am able to get it to work, I'll report back.
from helm-bibtex.
Not sure about the error message (which I don’t get on the current development version of Emacs) but you can try the following variant:
(defun helm-bibtex-find-pdf (key)
"Searches in all directories in `helm-bibtex-library-path' for
a PDF whose name is KEY + \".pdf\". Returns the first matching PDF."
(let* ((entry (helm-bibtex-get-entry key))
(fname (helm-bibtex-get-value "File" entry))
(files1 (-map (lambda (it) (f-join it fname)) (-flatten (list helm-bibtex-library-path))))
(files2 (-map (lambda (it) (f-join it (s-concat key ".pdf"))) (-flatten (list helm-bibtex-library-path)))))
(-first 'f-exists? (append files1 files2))))
This replaces --map
with -map
because --map
used to make problems in older versions of Emacs. (Which version are you using?)
from helm-bibtex.
Thanks. That does not lead to any problems or errors. I am using version 24.4.1 (from Debian). I still will need to tweek it, because of the format of the file name (with paths, :
and other such things ---they way JabRef or Mendely export them, but that ebib will not handle gracefully, for example).
from helm-bibtex.
You can use s-split to extract the part between the colons:
(car (s-split ":" ":home/ramon/a_directory/some_file_123.pdf:PDF" t))
But the path is not complete (it starts at home) so you have to prepend the path to home before using it.
from helm-bibtex.
Thanks, I didn't know about s-split. Prepending a /
to home/ramon
should be fairly simple with sed
on the bib file.
from helm-bibtex.
In Emacs you can do:
(s-concat "/" path)
from helm-bibtex.
Ooops. Thanks. (Did I say I know no elisp?)
from helm-bibtex.
No problem ;-)
from helm-bibtex.
Related Issues (20)
- No Available actions on helm-bibtex HOT 11
- Error custom-initialize-reset: Symbol’s function definition is void: helm-mode--in-file-completion-p HOT 9
- No available actions in ivy-bibtex HOT 4
- view pdf and edit notes side by side HOT 1
- Why is bibtex-completion-candidates run? HOT 1
- Error (use-package): org-ref/:init: Symbol’s function definition is void: org-cite-register-processor HOT 6
- Dynamic bibtex-completion-library-path HOT 4
- Prenote and Postnote options for citations in org-mode HOT 4
- Symbol’s function definition is void: org-cite-register-processor HOT 7
- bibtex-completion-format-citation-org-cite gives wrong format HOT 2
- org-ref-helm-bibtex-insert-citation results in wrong type argument HOT 3
- helm-bibtex-candidates-formatter not applied (?) HOT 11
- Invalid image type 'svg' HOT 3
- Symbol’s value as variable is void: browse-url-mosaic-program HOT 4
- Inquiry about Automatic Updating of BibTeX Files from Online Databases in Helm-Bibtex. HOT 1
- Set the variable bibtex-completion-bibliography used by helm-bibtex to the dynamical generated bib files list corresponding to the current master tex file. HOT 14
- Trigger bibliography completion list in-situ in TeX source document when typing `\cite{}` command.
- Inquiry about citation commands supported by helm-bibtex package. HOT 11
- The problem related to `(require 'helm-config)` and `(require 'helm-bibtex)`. HOT 9
- What's the mode hook defined in `helm-bibtex` to conditionally activate it when AUCTeX's `LaTeX-mode` is called? HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from helm-bibtex.