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

[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: Eli Zaretskii
Subject: Re: How to reliably edit a file from within Emacs Lisp and return a string?
Date: Sat, 24 Aug 2019 19:11:22 +0300

> Date: Sat, 24 Aug 2019 17:51:03 +0200
> From: Jean Louis <bugs@gnu.support>
> Cc: help-gnu-emacs@gnu.org
> 
> A database table can have many fields:
> 
> page-title
> 
> page-description
> 
> page-body
> 
> Program may iterate over fields. After each editing of title, the
> program moves back to the initial iteration of fields or main program
> loop. After editing of title, I move back to the above list. Then I
> edit description, I should be able to move back.

Is the program iterating over the fields in some predefined order?

Also, are you feeding back each field individually, or do you need to
have them all edited before feeding them back as a single record?

> If hook is installed, it just ensured to read back the string into
> database, but it escapes the main loop, program execution basically
> and there, as nothing is holding it.

You are just now beginning to describe the details I asked for several
messages ago, and they do make a difference.

One possibility would be to let the user edit all the fields in the
same buffer; then killing that buffer would be your signal that
everything is ready to be fed back, and you could do that feeding in
the hook function itself.  Not sure this makes sense in the context of
your applications; I asked followup questions above to be able to
figure that out.

> It could be solved if I could hold on find-file, and to know that
> find-file finished its job, so that Emacs Lisp can continue after
> find-file

That isn't workable, since find-file finishes its job once it has the
file's contents in a buffer.  The user didn't yet edit the buffer, so
it is not yet time for you to do anything.  Your mental model seems to
be that find-file only returns when the user finishes editing and
saves the edits, but that's not how this works in reality.



reply via email to

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