[Top][All Lists]

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

Re: Add function eshell/clear to clear current eshell buffer

From: Ted Zlatanov
Subject: Re: Add function eshell/clear to clear current eshell buffer
Date: Sat, 18 Apr 2015 09:31:35 -0400
User-agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/25.0.50 (gnu/linux)

On Sat, 18 Apr 2015 15:39:19 +0300 Eli Zaretskii <address@hidden> wrote: 

>> From: Ted Zlatanov <address@hidden>
>> Date: Sat, 18 Apr 2015 07:12:22 -0400
>> >> > +(defun eshell/clear ()
>> >> > +  "Clear the eshell-buffer"
>> >> 
>> >> Now this command does not clear the eshell buffer any more, but the
>> >> eshell window.  I think the doc string should say so because this has
>> >> security implications: The user may think some info is gone but actually
>> >> it’s only no longer visible.
EZ> The same happens with a few terminal emulators, so users should
EZ> already be expecting that possibility
>> But eshell is not a terminal emulator.  It's a shell.  Emacs provides
>> the text UI around it.

EZ> I don't see the significance of this observation for the issue at
EZ> hand.  Eshell is an implementation of a shell in Emacs Lisp, and as
EZ> such, Emacs is part of it.  Therefore, we should compare what Eshell's
EZ> command do with what shells+emulators do.

I think Emacs' concepts of windows and buffers should override the
typical terminal emulators' concepts of window and scrollback buffer.
Since Emacs typically doesn't clear just the window in normal usage,
it's strange to do it here (especially by inserting blank lines).

>> I would rename `eshell/clear' to `eshell/clear-view' and also provide
>> `eshell/clear-buffer', if that's OK with Vibhav and everyone else?

EZ> Eshell should have commands named like corresponding shell commands.
EZ> Having commands with no namesakes in popular shells makes very little
EZ> sense to me.

>From the man page:

      clear clears your screen if this is possible, including its
      scrollback buffer (if the extended "E3" capability is defined).
      clear looks in the environment for the terminal type and then in
      the terminfo database to determine how to clear the screen.

So, unless we come up with some E3 equivalent, I think it should be two
commands or in some other way apparent that there's two operation modes
to the `clear' eshell command.

For simplicity, how about `eshell/clear' for the window and
`eshell/clear-scrollback' for the whole buffer (also invoked with
universal-prefix on `eshell/clear')? The scrollback clear should IMO
also make sure undo is enabled, but the text is not in any registers.


reply via email to

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