Skip to content

Instantly share code, notes, and snippets.

@mardukbp
Created September 16, 2013 03:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mardukbp/6576377 to your computer and use it in GitHub Desktop.
Save mardukbp/6576377 to your computer and use it in GitHub Desktop.
Attach PDF from ebib to email in mu4e/gnus
(defun ebib-attach-file ()
"Attach file to gnus/mu4e composition buffer"
(interactive)
(ebib-execute-when
((entries)
(let ((filename (to-raw (car (ebib-get-field-value ebib-standard-file-field
(edb-cur-entry ebib-cur-db))))))
(if filename
(ebib-dired-attach filename)
(error "Field `%s' is empty" ebib-standard-file-field))))
((default)
(beep))))
(defun ebib-dired-attach (file)
"Attach FILENAME using gnus-dired-attach."
(let ((file-full-path
(or (locate-file file ebib-file-search-dirs)
(locate-file (file-name-nondirectory file) ebib-file-search-dirs)
(expand-file-name file))))
(if (file-exists-p file-full-path)
(progn
(gnus-dired-attach (cons file-full-path '()))
(ebib-lower))
(error "File not found: `%s'" file-full-path))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment