GNU bug report logs - #39067
shell-command-dont-erase-buffer strange behaviour

Previous Next

Package: emacs;

Reported by: madhu <at> cs.unm.edu

Date: Fri, 10 Jan 2020 05:36:02 UTC

Severity: normal

Merged with 42922

Found in version 27.1

Done: Tino Calancha <tino.calancha <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Tino Calancha <tino.calancha <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 39067 <at> debbugs.gnu.org, Madhu <madhu <at> cs.unm.edu>
Subject: bug#39067: shell-command-dont-erase-buffer strange behaviour
Date: Tue, 14 Jan 2020 09:49:14 +0100
Tino Calancha <tino.calancha <at> gmail.com> writes:

Hi Tino,

> Fixed the logic to cover the side case reported in this thread.
>
>> The current implementation in simple.el uses
>> shell-command--save-pos-or-erase and shell-command--set-point-after-cmd,
>> both are internal functions. Could we make them first class citizens,
>> that Tramp could profit from?
> Renamed them to shell-command-save-pos-or-erase, shell-command--set-point-after-cmd.

Thanks!

You plan to bring it into Emacs 27.1. FTR, related Tramp changes will
appear with Emacs 27.2 only. This shouldn't be a problem I guess, in
case there's sombdy concerned, a Tramp ELPA release will make it
available earlier.

I haven't tested yet, but some minor nits:

> --- a/doc/emacs/misc.texi
> +++ b/doc/emacs/misc.texi
> +  By default, the output buffer is erased between shell commands, except
> +when the output goes to the current buffer.  If you change the value
> +of the variable @code{shell-command-dont-erase-buffer} to @code{erase},
> +then the output buffer is always erased.  Any other non-@code{nil}
> +value prevents to erase the output buffer.
> +
> +This variable also controls where to set the point in the output buffer
> +after the command completes; see the documentation of the variable for details.

s/variable/user option/

> --- a/etc/NEWS
> +++ b/etc/NEWS
> +*** New functions shell-command-save-pos-or-erase' and
> +'shell-command-set-point-after-cmd'.

'shell-command-save-pos-or-erase'
Maybe you could be a little bit more verbose, saying that they control
how point is handled between two consecutive shell commands in the same buffer.

> --- a/lisp/simple.el
> +++ b/lisp/simple.el
>  (defcustom shell-command-dont-erase-buffer nil
> +A `nil' value erases the output buffer before execute
> +the shell command, except when the output buffer is the current one.

We don't quote nil.
"execution of the shell command"

> +Other non-nil values prevent the output buffer from be erased and
> +set the point after execute the shell command.

"being"
"execution of the shell command"

> +          ;; sucesive commands knows the position where the new comman start.

;; successive commands know the position where the new command starts.

> +          ;; (unless (and pos (memq sym '(save-point beg-last-out)))

This is superfluous, isn't it?

> --- a/test/lisp/simple-tests.el
> +++ b/test/lisp/simple-tests.el

> +  "The output buffer is erased or not according with `shell-command-dont-erase-buffer'."

"according to" (?)

> +(ert-deftest simple-tests-shell-command-dont-erase-buffer ()
> +  "The point is set at the expected position after execute the command."

"execution of the command"

Best regards, Michael.




This bug report was last modified 4 years and 277 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.