attach file found with helm-locate

27 views
Skip to first unread message

Tamas Papp

unread,
Sep 13, 2017, 10:07:50 AM9/13/17
to mu-discuss
Hi,

I have started using helm recently and find it very convenient. If I am
writing a message or replying to one in mu4e, is it possible to
helm-locate a file and attach it?

best,

Tamas

Dirk-Jan C. Binnema

unread,
Sep 14, 2017, 1:06:37 PM9/14/17
to mu-di...@googlegroups.com
This is a bit barbaric:

--8<---------------cut here---------------start------------->8---
(defun my-helm-locate-attach-file (arg)
(interactive "P")
(helm-locate arg)
(mml-attach-file (car kill-ring)))
--8<---------------cut here---------------end--------------->8---

The crude part is especially in the fact you need to press
C-u C-c C-k
after selecting the desired file in helm.

Anyway, hopefully this inspires a more elegant solution :)

Kind regards,
Dirk.

--
Dirk-Jan C. Binnema Helsinki, Finland
e:dj...@djcbsoftware.nl w:www.djcbsoftware.nl
pgp: D09C E664 897D 7D39 5047 A178 E96A C7A1 017D DA3C

Josiah Schwab

unread,
Sep 14, 2017, 3:52:36 PM9/14/17
to mu-di...@googlegroups.com
Hi Tamas,

> I have started using helm recently and find it very convenient. If I
> am writing a message or replying to one in mu4e, is it possible to
> helm-locate a file and attach it?

I sometimes attach files via an action for helm-find-files, using some
snippets I got from the following r/emacs post.

https://www.reddit.com/r/emacs/comments/3l3ukg/mu4e_and_helm_attachments/

I think one should be able to set up a similar action for helm-locate,
perhaps using helm-add-action-to-source to modify helm-sources-locate.
(I'm unsure about this last part.)

Hope that helps,
Josiah

Tamas Papp

unread,
Sep 16, 2017, 4:49:12 AM9/16/17
to mu-discuss
Found that all it takes is

(helm-add-action-to-source "Attach to Email" #'mml-attach-file
helm-source-locate)

This was among the other excellent things at

https://martinralbrecht.wordpress.com/2016/05/30/handling-email-with-emacs/

which is a goldmine of great ideas.

best,

Tamas

Eduardo Mercovich

unread,
Sep 16, 2017, 3:03:21 PM9/16/17
to mu-di...@googlegroups.com
Hello Tamas.

> Found that all it takes is
> (helm-add-action-to-source "Attach to Email" #'mml-attach-file
> helm-source-locate)
> [...]
Wonderful. Thanks a lot for this tip... :)

--
Eduardo Mercovich

Donde se cruzan tus talentos
con las necesidades del mundo,
ahí está tu vocación.
(Anónimo)
Reply all
Reply to author
Forward
0 new messages