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: Yuri Khan
Subject: Re: How to reliably edit a file from within Emacs Lisp and return a string?
Date: Sat, 24 Aug 2019 23:18:33 +0700

On Sat, Aug 24, 2019 at 10:51 PM Jean Louis <bugs@gnu.support> wrote:

> 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.
>
> 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.

It looks like you want to guide the user through editing each field of
a database record in sequence, so that they edit the title first,
then, when they indicate they are done with the title, you make them
edit the description, and when they are finished with that, you ask
them to edit the body.

This is not a pleasant user experience. What if I make a mistake in
the title but notice it only after I have pressed the “finish editing”
key on the title? How do I go back from description to the title?


I can see two other workflows that would be better for the user.

1: You present the whole record in a single buffer. Invent some syntax
that lets you delimit the fields. When the user indicates they are
done editing the record, go throug the buffer and parse out each
field, then update the record in the database. (Close analog: A mail
message buffer with From, To, Subject and Body as separate fields in a
single buffer.)

2: Present a record buffer that lists out all fields. When the user
positions the point on a field and presses RET, open a new buffer that
lets them edit this field. When they finish editing the selected
field, update the record and close the field buffer. They end up back
in the record buffer and can select another field for editing. (Close
analog: Dired for a directory, letting you edit each file
independently.)

In any case, your program does not drive the workflow. The user does.



reply via email to

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