[Top][All Lists]

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

Re: How to reliably edit a file from within Emacs Lisp and return a stri

From: Jean Louis
Subject: Re: How to reliably edit a file from within Emacs Lisp and return a string?
Date: Sat, 24 Aug 2019 14:41:20 +0200
User-agent: Mutt/1.10.1 (2018-07-13)

* Eli Zaretskii <> [2019-08-24 14:31]:
> That can be done easily, but I cannot resist asking: why do you need
> the intermediate temporary file?  Why not insert the string into a
> buffer, let the user edit that string in a buffer, and then have a
> command in that buffer that tells you the user is done editing?

That is exactly what I am doing now. And I am losing editing.

What I am doing now is using M-C-c to finish recursive-edit. But
problem is that I use other functions of Emacs which are disturbing

If I am ONLY editing words from mind, that would be fine, but I use
Emacs to switch to other buffers, maybe open mutt, maybe launch new
emacsclient from outside, to open other file, to copy staff from other
file to such buffer.

Observation and reality is that my recursive-edit will simply
break. It does not last.

It does not last when I invoke additional emacsclient from outside.

Bufer is *edit-string* so if I am opening this email with emacsclient,
the recursive-edit in the buffer *edit-string* is not any more... The
message is "No recursive edit is in progress".

Any more complex buffer editing without file is not reliable any
more. I can even kill the buffer by thinking that the string will be
read, but it will not be read. I can click M-C-c by expected that
string will be read from buffer, but it is not as recursive-edit was
disturbed for background reasons not known to me.

> As for feeding the string into the database: can you tell in more
> detail how you are doing that?  Are you invoking some external
> program passing it the edited string, for example?

I am just invoking from Emacs Lisp to read the database, to read the
field from database, and then I am editing that field as a string and
feeding it back.

Simple numbers can be edited with (read-number "Prompt: ") and some
short strings I edit from minibuffer, as those are not complex edits.

When I am editing Org file or Markdown from database, it is complex,
requires using other windows, other buffers, and also using
emacsclient to open other files for references.

By opening emacsclient during recursive-edit, such is then

> > Question is basically how to know, from Emacs Lisp, reliably, that
> > process of editing of a buffer finished, so that string can be
> > read from file, thereafter.
> The best way is for the user to tell you so.  Only the user knows
> for sure, right?

I am the user and my staff members.

Eli, do you think I could do that somehow by installing some kind of
timer or async function or something that works in background, which
is checking if the buffer created with find-file is still there?

Then I could read the string from well known file back into the

That is my idea how to solve that.


reply via email to

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