tmalsburg / helm-bibtex

Search and manage bibliographies in Emacs
GNU General Public License v2.0
457 stars 73 forks source link

Add open-notes/pdf-at-point? #17

Closed paul-g closed 9 years ago

paul-g commented 9 years ago

Hi, thanks for the tool once again!

Recently I needed to do lookups of notes or pdfs given a bibtex key. This is easy with the functions bellow:

(defun open-notes-at-point ()
  "Open notes corresponding to the citation key at point"
  (interactive)
  (find-file (format "%s/%s%s" helm-bibtex-notes-path (word-at-point) helm-bibtex-notes-extension)))

(defun open-pdf-at-point ()
  "Open pdf corresponding to the citation key at point"
  (interactive)
  (find-file 
   (format "%s/%s.pdf" helm-bibtex-library-path (word-at-point))))

Maybe helm-bibtex already has these functions and I missed them somehow?

If not and unless I am missing something, I think it might be convenient to include them since:

  1. (IMHO) these type of lookups are common (e.g. when revising material, writing surveys etc.)
  2. the configuration is already in place
tmalsburg commented 9 years ago

Yes, I agree, this use case isn't covered yet. Here's an alternative way to address it. Let me know what you think. Instead of having the two functions that you propose, we could have a function helm-bibtex-search-word-at-point. If the word-at-point is a bibtex key, this will give you a helm session with only that entry selected. Through the tab key you would have access to actions like opening the notes and the PDF but also to the other actions like opening the URL/DOI in a browser. Another added benefit would be that you could also use this function for words-at-point that are not bibtex keys. For example when the cursor is on the word eyetracking, you could call this function and see all articles that match this term.

paul-g commented 9 years ago

Sure, this is even better. I'd be happy to write a patch during the weekend unless you are interested?

tmalsburg commented 9 years ago

Ah, I just remembered that we already have that feature courtesy of Helm. Just start helm-bibtex and then press M+n. This inserts the word under the cursor. By the way, this works in all helm sources. :)

Thanks for bringing up this issue. I'll try to adopt this usage pattern.

paul-g commented 9 years ago

Nice! Maybe add a note on this in the Usage section of the Readme for those less familiar with Helm like myself :) ?

tmalsburg commented 9 years ago

Good idea.

tmalsburg commented 9 years ago

Added an explanation in 0be9293d76360806b7e01e50cf5a17ba8d06bc28.