emacs-devel
[Top][All Lists]
Advanced

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

Re: New optional arg to [async-]shell-command[-on-region]


From: Yuri Khan
Subject: Re: New optional arg to [async-]shell-command[-on-region]
Date: Wed, 13 Jul 2016 21:06:18 +0600

On Wed, Jul 13, 2016 at 8:48 PM, Tino Calancha <address@hidden> wrote:

>> I think something went wrong with the grammar here.
>>
>>> -                    (erase-buffer)))
>>> +                    (if keep
>>> +                        (goto-char (point-max))
>>> +                      (erase-buffer))))
>>
>>
>> Is this in a save-excursion? If not, is there a way to preserve the point
>> in the target buffer? (Is that desirable?)
>
> I should drop the `goto-char' call, right?

I believe Clément is not asking you to drop the goto-char. No, he’s
asking you to *think*. And maybe make a UI design decision.

> I added that line in order to insert the output of commad 'i+1' after the
> output from command 'i'.

That is a good goal, and (goto-char (point-max)) achieves it.
Inserting new output right where the point is would be very unnatural.

However, Clément hints that, if the user desires to retain the
previous contents of the buffer, maybe they also want to retain their
position in said buffer. If they do, you’d better save the original
point position and return there after inserting the new command’s
output; this is easiest done with save-excursion.

On the other hand, the user might want to keep old output but skip
straight to the new output. In this case, jumping to the end and then
inserting new output is ok.

On the third hand (there always is a third hand!), if the new output
is longer than a windowful, the user may also like to start at the
beginning of the new output rather than the end.

It is now up to you, as the designer of the new feature, to decide
which of the above behaviors you want to support.



reply via email to

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