On Tue, Oct 23, 2018 at 2:32 PM John Kitchin <jkitc...@andrew.cmu.edu>
wrote:

> I think that what you really want to do here is modify org-mime-compose so
> that you can use the send-actions argument to message-mail. In
> scimax-email.el I use that to be able to turn an org-heading into an email,
> send it, and then jump back to the heading to insert some information about
> the email into the heading properties after it is sent. A lot of the
> information gets passed via global variables. Maybe there is a better way
> to do that, I wrote that code a long time ago.
>
>
I'm trying to use mu4e~compose-mail instead of message-compose, I guess
mostly because I want to be able to use the mu4e email address completion
features in the `To:` header.  And it wouldalso be nice to save the email
to the appropriate mu folder.   But I didn't seem to be able to make mu4e
bounce back to my buffer no matter what I do, and though mu4e~compose-mail
accepts a return-action argument it doesn't actually use it :-(.


> Otherwise, you need to figure out how to use something like a macro that
> captures the current-buffer and creates a lambda function with that
> information in it, and attaches it to the message-buffer hook somehow. For
> example this will display a message-box for me after the message is sent.
>
> (let ((f `(lambda ()
>     (message-box "Came from %s" ,(current-buffer)))))
>   (message-mail)
>   (add-hook 'kill-buffer-hook f nil t))
>
> Some important notes is this hook is added in local mode, so it only
> affects that email buffer.
>
>
Can you explain to me what yo umean by "added in local mode" -- how is that
achieved?

Meanwhile, htis is what I've done and it seems to work:

(eval (car (read-from-string
            (concat
             "(advice-add 'mu4e~switch-back-to-mu4e-buffer  :after
                            (lambda ()
                              (switch-to-buffer
                               (get-buffer \""
             (buffer-name)
             "\" ))
                              (advice-remove
'mu4e~switch-back-to-mu4e-buffer \"om-temp-advice\"))
                            '((name . \"om-temp-advice\")))"))))

seems a little baroque. Maybe what you have there is way better.  I don't
really undertand backquotes and leading ocmmas even now.




> John
>
> -----------------------------------
> Professor John Kitchin
> Doherty Hall A207F
> Department of Chemical Engineering
> Carnegie Mellon University
> Pittsburgh, PA 15213
> 412-268-7803
> @johnkitchin
> http://kitchingroup.cheme.cmu.edu
>
>
>
> On Tue, Oct 23, 2018 at 1:40 PM Matt Price <mopto...@gmail.com> wrote:
>
>> Hey, I guess this is OT.
>>
>> I'm trying to advice org-mime-org-buffer-htmlize so that it returns to
>> the org buffer when its done. I want to do something like this:
>>
>> (let ((thisbuffer (current-buffer))
>>  (advice-add
>>      'mu4e-sent-handler
>>      :after (lambda (docid props)
>>               (switch-to-buffer thisbuffer)
>>               (advice-remove 'mu4e-sent-handler 'om-sent-advice)
>>               ) '((name . 'om-sent-advice)))
>>
>> but by the time the hook is run, the (let) has long since lapsed, and
>> thisbuffer is no longer defined. Can I force evaluation of the variable
>> during definition?
>>
>> Thanks,
>> m
>>
>

Reply via email to