help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Non file buffers and default-directory


From: Tim Landscheidt
Subject: Re: Non file buffers and default-directory
Date: Thu, 27 Apr 2023 12:04:48 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)

Eli Zaretskii <eliz@gnu.org> wrote:

>> Thanks for your support.  I'm reading some code now and I start to
>> realize that *just* having an async SMTP sender in Emacs won't be that
>> easy.

>> An example: I'm using Gnus (and message.el) to send mail.  If you look
>> at 'message-send' (lisp/gnus/message.el#4396), that I guess is calling
>> 'smtpmail-send-it' down the line, you'll see that it is "waiting" for a
>> synchronous 'success' to decide what to do next (for example, renaming
>> the buffer from *unsent...* to *sent...*).  This won't work as is with
>> an async SMTP sender.  I imagine that there are other places with code
>> like that and that it could break many workflow.

> I know it is not easy, right?  Basically, the function(s) that
> actually send the email will have to be broken into two: one that
> prepares the message, the other which actually sends it.  It's the
> latter that needs to run from a separate thread.  in addition, there
> should be some callback that marks the message as sent, and does
> whatever else bookkeeping is needed when the send succeeds or fails,
> like, for example, if this is a response, marking the original message
> as one that was replied-to.

Side note: I would love a well-maintained example of an
"asynchronous" user interface in Emacs.

I have a bunch of shell/Perl/Python scripts that I'd like to
convert to Emacs Lisp for a consistent UI that can also be
used over SSH.

For example, I have a script that plays a podcast's audio
file and afterwards asks me if the associated database entry
selected from a list of suggestions should be marked as
heard (and the file archived).  I also use this as part of
sequences, i. e. "$script file1.mp3 && $script file2.mp3".

Now in Emacs, I obviously would want to continue to work on
something else while the audio is playing in the background.
I also don't want that other work to be interrupted in the
sense of a blocking minibuffer prompt when the playback has
finished.  And I also don't want to accidentally quit Emacs
without me being reminded, "hey, that playback has finished,
should it be marked as heard?"  And I want that "bit" to be
usable as part of a sequence, i. e. after answering the
question, the next statement should be executed.

Probably, one can achieve something like this with promises
(e. g., https://github.com/chuntaro/emacs-promise), but as
they are not part of core Emacs and also rather complex, I
don't feel very comfortable to base my workflows on that.

Tim



reply via email to

[Prev in Thread] Current Thread [Next in Thread]