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: Jean Louis
Subject: Re: How to reliably edit a file from within Emacs Lisp and return a string?
Date: Sat, 24 Aug 2019 19:07:43 +0200
User-agent: Mutt/1.10.1 (2018-07-13)

* Yuri Khan <yuri.v.khan@gmail.com> [2019-08-24 18:19]:
> 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 don't know what is the alternative that you think of. If you think
of editing everything on the screen, even then user can make a
mistake.

I have currently completion-read which can be transformed into helm,
by helm-mode, and helm-mode combinations.

Look here the demonstration how it is done:
https://gnu.support/images/2019/08/2019-08-24/2019-08-24-18:49:43.ogv

> I can see two other workflows that would be better for the user.
> 
> 1: You present the whole record in a single buffer.

I understand what you mean. There are too many tables with too many
records, and it would not fit on single screen, not practical.

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

That is about the same what I have now, just using helm.

Problem is not with small descriptions, titles, names, numbers, that
is really least problem, as situation is like this:

User looking into other buffer, or paper, or phone, entering contact
name. This information exists outside. In case of mistake, information
can be re-edited, as information anyway arrives from outside.

Some notes are coming from email messages, if the note is not well
edited or becomes empty, it can be re-edited as information exists
outside.

Problem is currently with pages, like few thousands pages, which I
have been editing from common lisp, launching emacsclient, editing
pages, emacsclient returns back, I could read string from file.

I cannot do same from within Emacs. I am now thinking even invoking
somehow external lisp or just anything that can launch externally the
emacsclient with waiting stage, and then read back the string. This
could be one solution, I need to figure out how to do it.

Or other solution for me could be to figure out how not to cancel
(recursive-edit) with launches of emacsclient in background.

Jean



reply via email to

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