all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Yuri Khan <yuri.v.khan@gmail.com>
To: Tino Calancha <tino.calancha@gmail.com>
Cc: "Clément Pit--Claudel" <clement.pit@gmail.com>,
	"Emacs developers" <emacs-devel@gnu.org>
Subject: Re: New optional arg to [async-]shell-command[-on-region]
Date: Wed, 13 Jul 2016 21:06:18 +0600	[thread overview]
Message-ID: <CAP_d_8VExY7MCe3T4XzMEOPLOkHpOWUHc6O8MY2KMgc5w93_sg@mail.gmail.com> (raw)
In-Reply-To: <alpine.DEB.2.20.1607132332360.23367@calancha-pc>

On Wed, Jul 13, 2016 at 8:48 PM, Tino Calancha <tino.calancha@gmail.com> 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	other threads:[~2016-07-13 15:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-13 14:09 New optional arg to [async-]shell-command[-on-region] Tino Calancha
2016-07-13 14:29 ` Clément Pit--Claudel
2016-07-13 14:48   ` Tino Calancha
2016-07-13 15:06     ` Yuri Khan [this message]
2016-07-13 15:27       ` Tino Calancha
2016-07-13 15:58         ` Clément Pit--Claudel
2016-07-13 16:02           ` Clément Pit--Claudel
2016-07-28 12:53       ` New opt to allow not erase out buffer between shell cmds Tino Calancha
2016-08-24 15:10         ` Clément Pit--Claudel
2016-08-26  6:43           ` Tino Calancha

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAP_d_8VExY7MCe3T4XzMEOPLOkHpOWUHc6O8MY2KMgc5w93_sg@mail.gmail.com \
    --to=yuri.v.khan@gmail.com \
    --cc=clement.pit@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=tino.calancha@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.