unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#50186: Shell in emacs very annoying using zsh
@ 2021-08-24  2:28 ���η� via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-08-25 11:49 ` Lars Ingebrigtsen
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: ���η� via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-08-24  2:28 UTC (permalink / raw)
  To: 50186

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="gb18030", Size: 308 bytes --]

When use zsh instead of bash, shell become very annoying.


Even if I do not edit the shell buffer, but changing its size, there will be extra lines generated in the buffer, which is not expected.


GNU Emacs 27.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.20, cairo version 1.16.0) of 2020-09-20

[-- Attachment #2: Type: text/html, Size: 428 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#50186: Shell in emacs very annoying using zsh
  2021-08-24  2:28 bug#50186: Shell in emacs very annoying using zsh ���η� via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2021-08-25 11:49 ` Lars Ingebrigtsen
  2021-08-26  8:47 ` bug#50186: More details about " ���η� via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-08-27  7:01 ` bug#50186: Multi-line prompt is the reason ���η� via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2 siblings, 0 replies; 12+ messages in thread
From: Lars Ingebrigtsen @ 2021-08-25 11:49 UTC (permalink / raw)
  To: orbitingflea; +Cc: 50186

<orbitingflea@qq.com> writes:

> When use zsh instead of bash, shell become very annoying.
>
> Even if I do not edit the shell buffer, but changing its size, there will be extra
> lines generated in the buffer, which is not expected.

Do you have a recipe to reproduce the problem, starting from "emacs -Q"?
It would also be helpful with some screenshots.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#50186: More details about bug#50186: Shell in emacs very annoying using zsh
  2021-08-24  2:28 bug#50186: Shell in emacs very annoying using zsh ���η� via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-08-25 11:49 ` Lars Ingebrigtsen
@ 2021-08-26  8:47 ` ���η� via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-08-26 14:54   ` Michael Heerdegen
  2021-08-27  6:10   ` Juri Linkov
  2021-08-27  7:01 ` bug#50186: Multi-line prompt is the reason ���η� via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2 siblings, 2 replies; 12+ messages in thread
From: ���η� via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-08-26  8:47 UTC (permalink / raw)
  To: 50186


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.1: Type: text/plain; charset="gb18030", Size: 1133 bytes --]

When use zsh instead of bash, shell become very annoying. Even if I do not edit the shell buffer, but changing its size, there will be extra lines generated in the buffer, which is not expected.



Here is a recipe to reproduce the bug. See attached for screenshots.


(1) Starting from emacs -Q.


&nbsp; [1.png in attached]


(2) M-x shell. Here my default shell is zsh, and I also have oh-my-zsh installed.


&nbsp; [2.png in attached]


You can see there are multi-line "leading info" (sorry for my poor English, I mean the characters on the left of the cursor before you enter a command in the shell, showing the username and the current directory; I don't know what it is called in English), but in bash there is only one line instead. I guess this is the key of the problem.


By the way, maybe there are different "schemes" or "styles" for zsh, for some of them there will be multi-line leading info.


(3) Repeat C-x 1, C-x 2, C-x 1, C-x 2, ...


&nbsp; [3.png &amp; 4.png in attached]


There will be more and more lines in the shell, which is unexpected, because you did not edit the buffer.

[-- Attachment #1.2: Type: text/html, Size: 3221 bytes --]

[-- Attachment #2: bug-zsh-emacs-screenshots.zip --]
[-- Type: application/octet-stream, Size: 281888 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#50186: More details about bug#50186: Shell in emacs very annoying using zsh
  2021-08-26  8:47 ` bug#50186: More details about " ���η� via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2021-08-26 14:54   ` Michael Heerdegen
  2021-08-27  6:10   ` Juri Linkov
  1 sibling, 0 replies; 12+ messages in thread
From: Michael Heerdegen @ 2021-08-26 14:54 UTC (permalink / raw)
  To: 50186; +Cc: orbitingflea

Hello,

> When use zsh instead of bash, shell become very annoying. Even if I do
> not edit the shell buffer, but changing its size, there will be extra
> lines generated in the buffer, which is not expected.

Could it be that zsh requires a terminal emulator?

Michael.





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#50186: Shell in emacs very annoying using zsh
  2021-08-26  8:47 ` bug#50186: More details about " ���η� via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-08-26 14:54   ` Michael Heerdegen
@ 2021-08-27  6:10   ` Juri Linkov
  2021-08-27 10:58     ` Michael Heerdegen
  1 sibling, 1 reply; 12+ messages in thread
From: Juri Linkov @ 2021-08-27  6:10 UTC (permalink / raw)
  To: 50186; +Cc: orbitingflea

> You can see there are multi-line "leading info" (sorry for my poor English,
> I mean the characters on the left of the cursor before you enter a command
> in the shell, showing the username and the current directory; I don't know
> what it is called in English), but in bash there is only one line instead.
> I guess this is the key of the problem.

This is called "prompt", and you can change such multi-line prompt in zsh

  PROMPT=$'%~\n%# '

simply by removing \n.  Then the prompt will stay on one line.

In bash there are different shell variable names for prompt,
for example, PS1='\w\n$ ' where you can remove \n too.





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#50186: Multi-line prompt is the reason
  2021-08-24  2:28 bug#50186: Shell in emacs very annoying using zsh ���η� via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-08-25 11:49 ` Lars Ingebrigtsen
  2021-08-26  8:47 ` bug#50186: More details about " ���η� via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2021-08-27  7:01 ` ���η� via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2 siblings, 0 replies; 12+ messages in thread
From: ���η� via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-08-27  7:01 UTC (permalink / raw)
  To: 50186

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="gb18030", Size: 172 bytes --]

Zsh worked well if the prompt is in a single line. The bug comes from multi-line prompt, i.e., when emacs shell used with multi-line prompt, unexpected lines are generated.

[-- Attachment #2: Type: text/html, Size: 172 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#50186: Shell in emacs very annoying using zsh
  2021-08-27  6:10   ` Juri Linkov
@ 2021-08-27 10:58     ` Michael Heerdegen
       [not found]       ` <tencent_3B44F9B2833A45DF08C3C394D62CB0C29506@qq.com>
  2021-08-27 16:57       ` Juri Linkov
  0 siblings, 2 replies; 12+ messages in thread
From: Michael Heerdegen @ 2021-08-27 10:58 UTC (permalink / raw)
  To: Juri Linkov; +Cc: orbitingflea, 50186

Juri Linkov <juri@linkov.net> writes:

> This is called "prompt", and you can change such multi-line prompt in zsh
>
>   PROMPT=$'%~\n%# '
>
> simply by removing \n.  Then the prompt will stay on one line.

And is it a known limitation of shell that multi-line prompts cause
problems?

Michael.





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#50186: Shell in emacs very annoying using zsh
       [not found]       ` <tencent_3B44F9B2833A45DF08C3C394D62CB0C29506@qq.com>
@ 2021-08-27 14:54         ` Michael Heerdegen
  0 siblings, 0 replies; 12+ messages in thread
From: Michael Heerdegen @ 2021-08-27 14:54 UTC (permalink / raw)
  To: 周任飞; +Cc: 50186

"周任飞" <orbitingflea@qq.com> writes:

> Hello,
>
> > And is it a known limitation of shell that multi-line prompts cause
> > problems?
>
> No. When I use the terminal outside emacs, it works very well.
> Here's the screenshot:

Sorry for the confusion: my question was whether someone knows if this
is a known limitation in the Emacs shell mode.

Michael.





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#50186: Shell in emacs very annoying using zsh
  2021-08-27 10:58     ` Michael Heerdegen
       [not found]       ` <tencent_3B44F9B2833A45DF08C3C394D62CB0C29506@qq.com>
@ 2021-08-27 16:57       ` Juri Linkov
  2021-08-28  9:26         ` ���η� via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 1 reply; 12+ messages in thread
From: Juri Linkov @ 2021-08-27 16:57 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: orbitingflea, 50186

>> This is called "prompt", and you can change such multi-line prompt in zsh
>>
>>   PROMPT=$'%~\n%# '
>>
>> simply by removing \n.  Then the prompt will stay on one line.
>
> And is it a known limitation of shell that multi-line prompts cause
> problems?

Actually, I see no problems with multi-line prompts in Emacs.
I tried to use "\n" in PS1 in bash, and then run M-x shell.
No problems noticed :)





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#50186: Shell in emacs very annoying using zsh
  2021-08-27 16:57       ` Juri Linkov
@ 2021-08-28  9:26         ` ���η� via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-08-28 16:28           ` Eduardo Ochs
  0 siblings, 1 reply; 12+ messages in thread
From: ���η� via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-08-28  9:26 UTC (permalink / raw)
  To: Juri Linkov; +Cc: orbitingflea, 50186

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="gb18030", Size: 685 bytes --]

Hello Juri,


&gt; Actually, I see no problems with multi-line prompts in Emacs.
&gt; I tried to use "\n" in PS1 in bash, and then run M-x shell.
&gt; No problems noticed :)


Wow! That's surprising to me.
Maybe I should show my zsh config file that generating this bug:


export ZSH="/home/friend/.oh-my-zsh"
ZSH_THEME="ys"
plugins=(git)
source $ZSH/oh-my-zsh.sh
export DISPLAY=`cat /etc/resolv.conf | grep nameserver | awk '{print $2}'`:0.0
export PATH="/home/friend/.local/bin:$PATH"



Here I used "ys" theme of oh-my-zsh, and it has multi-line prompt.
By the way, I tested bash with multi-line prompt, as you said. No problem.
So the problem comes from zsh?

[-- Attachment #2: Type: text/html, Size: 930 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#50186: Shell in emacs very annoying using zsh
  2021-08-28  9:26         ` ���η� via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2021-08-28 16:28           ` Eduardo Ochs
  2021-08-29  2:16             ` 周任飞 via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 12+ messages in thread
From: Eduardo Ochs @ 2021-08-28 16:28 UTC (permalink / raw)
  To: ���ηÉ; +Cc: 50186, Juri Linkov

[-- Attachment #1: Type: text/plain, Size: 1415 bytes --]

Zsh is one of the programs that I need to run with
`comint-process-echoes' set to t in the comint buffer...

?ηÉ/orbitingflea, can you define these two functions,

  (defun det () (interactive) (setq comint-process-echoes t))
  (defun den () (interactive) (setq comint-process-echoes nil))

and then use Zsh a bit with comint-process-echoes set to true and a
bit with comint-process-echoes set to nil - use `M-x det' and `M-x
den' to change the value - to see if something changes?

  [[]],
    Eduardo Ochs
    http://angg.twu.net/#eev



On Sat, 28 Aug 2021 at 13:06, ���ηÉ via Bug reports for GNU Emacs, the
Swiss army knife of text editors <bug-gnu-emacs@gnu.org> wrote:

> Hello Juri,
>
> > Actually, I see no problems with multi-line prompts in Emacs.
> > I tried to use "\n" in PS1 in bash, and then run M-x shell.
> > No problems noticed :)
>
> Wow! That's surprising to me.
> Maybe I should show my zsh config file that generating this bug:
>
> export ZSH="/home/friend/.oh-my-zsh"
> ZSH_THEME="ys"
> plugins=(git)
> source $ZSH/oh-my-zsh.sh
> export DISPLAY=`cat /etc/resolv.conf | grep nameserver | awk '{print
> $2}'`:0.0
> export PATH="/home/friend/.local/bin:$PATH"
>
> Here I used "ys" theme of oh-my-zsh, and it has multi-line prompt.
> By the way, I tested bash with multi-line prompt, as you said. No problem.
> So the problem comes from zsh?
>

[-- Attachment #2: Type: text/html, Size: 2022 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#50186: Shell in emacs very annoying using zsh
  2021-08-28 16:28           ` Eduardo Ochs
@ 2021-08-29  2:16             ` 周任飞 via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; 12+ messages in thread
From: 周任飞 via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-08-29  2:16 UTC (permalink / raw)
  To: Eduardo Ochs; +Cc: 50186, Juri Linkov

[-- Attachment #1: Type: text/plain, Size: 453 bytes --]

Hello Eduardo Ochs,


&gt; and then use Zsh a bit with comint-process-echoes set to true and a
&gt; bit with comint-process-echoes set to nil - use `M-x det' and `M-x
&gt; den' to change the value - to see if something changes?



First I noticed that comint-process-echoes is not defined in shell mode.
Then I switched the shell buffer to comint mode. Then, in both det and
den settings, the problem still happens.


--------
Zhou Renfei

[-- Attachment #2: Type: text/html, Size: 641 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2021-08-29  2:16 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-08-24  2:28 bug#50186: Shell in emacs very annoying using zsh ���η� via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-08-25 11:49 ` Lars Ingebrigtsen
2021-08-26  8:47 ` bug#50186: More details about " ���η� via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-08-26 14:54   ` Michael Heerdegen
2021-08-27  6:10   ` Juri Linkov
2021-08-27 10:58     ` Michael Heerdegen
     [not found]       ` <tencent_3B44F9B2833A45DF08C3C394D62CB0C29506@qq.com>
2021-08-27 14:54         ` Michael Heerdegen
2021-08-27 16:57       ` Juri Linkov
2021-08-28  9:26         ` ���η� via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-08-28 16:28           ` Eduardo Ochs
2021-08-29  2:16             ` 周任飞 via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-08-27  7:01 ` bug#50186: Multi-line prompt is the reason ���η� via Bug reports for GNU Emacs, the Swiss army knife of text editors

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).