helm-bibtex icon indicating copy to clipboard operation
helm-bibtex copied to clipboard

copy multiple PFDs of selections

Open DrWaleedAYousef opened this issue 6 years ago • 6 comments

When I select multiple entries, how can I copy their PDFs to a particular directory (similar to F6 that is used to copy their bibtex to a particular file)

Thanks so much

DrWaleedAYousef avatar Jan 20 '18 15:01 DrWaleedAYousef

This feature does not exist at the moment but it wouldn't be to hard to add a new action for this. If you want to try implementing this, I'd be happy to give you feedback on your code.

tmalsburg avatar Jan 20 '18 16:01 tmalsburg

Unfortunately l am not fluent in lisp. Do you have a fast recipe to do my job

On Jan 20, 2018 6:35 PM, "Titus von der Malsburg" [email protected] wrote:

This feature does not exist at the moment but it wouldn't be to hard to add a new action for this. If you want to try implementing this, I'd be happy to give you feedback on your code.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/tmalsburg/helm-bibtex/issues/224#issuecomment-359183977, or mute the thread https://github.com/notifications/unsubscribe-auth/ALpbzQVLuO_kcMxSoQc7Rslobkzt4H-Nks5tMhXZgaJpZM4Rle4e .

DrWaleedAYousef avatar Jan 20 '18 16:01 DrWaleedAYousef

This may be useful someday. Here's a first sketch.

(helm-add-action-to-source
 "Rename PDFs" 'helm-bibtex-rename-pdfs
 helm-source-bibtex 1)

(defun helm-bibtex-rename-pdfs (_candidate)
  "Rename selected candidates to a new location."
  (let* ((keys (helm-marked-candidates))
	 (pdfs (mapcar (lambda (key)
			 (concat
			  bibtex-completion-library-path
			  key
			  bibtex-completion-pdf-extension))
		       keys))
	 (dir (read-directory-name "Select new directory: ")))
    (when (yes-or-no-p (format "Move files to %s?" dir))
      (mapcar (lambda (pdf)
		(rename-file pdf dir))
	      pdfs)
      (message "Done"))))

jagrg avatar Jan 20 '18 22:01 jagrg

Thank you, Jonathan! This is indeed very useful.

tmalsburg avatar Jan 21 '18 10:01 tmalsburg

Hi, I use above codes in my emacs config file, but have an error as follows, Wrong type argument: characterp, "/home/fg/MEGA/bibtex-pdfs" Please help me.

fu123456 avatar Aug 26 '18 07:08 fu123456

Are you using Files field in your bibtex entries? Try changing the pdfs part to:

(pdfs (mapcar (lambda (key)
	  (car (bibtex-completion-find-pdf key)))
	      keys))

jagrg avatar Aug 26 '18 11:08 jagrg