GNU bug report logs - #9961
non-empty ~/.emacs_SHELLNAME causes multiple shell prompts

Previous Next

Package: emacs;

Reported by: Andreas Röhler <andreas.roehler <at> online.de>

Date: Sat, 5 Nov 2011 15:50:02 UTC

Severity: minor

Merged with 40754

Found in version 27.0.91

Fixed in version 29.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 9961 in the body.
You can then email your comments to 9961 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#9961; Package emacs. (Sat, 05 Nov 2011 15:50:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Andreas Röhler <andreas.roehler <at> online.de>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 05 Nov 2011 15:50:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Andreas Röhler <andreas.roehler <at> online.de>
To: bug-gnu-emacs <at> gnu.org
Subject: Subject: 24.0.91; shell prompt doubled
Date: Sat, 05 Nov 2011 16:46:58 +0100
[Message part 1 (text/plain, inline)]
after M-x shell RET

shell prompt appears twofold like this:

MYNAME <at> MYHOST:~/emacs-20111105-r106290/src> 
MYNAME <at> MYHOST:~/emacs-20111105-r106290/src>

;;;;;;;;;

patch attached seems to fix it

Andreas

;;;;;;;;;

In GNU Emacs 24.0.91.1 (i686-suse-linux-gnu, X toolkit, Xaw3d scroll bars)
 of 2011-11-05 on MYHOST
Windowing system distributor `The X.Org Foundation', version 11.0.10903000
Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: de_DE.UTF-8
  value of $XMODIFIERS: @im=local
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Shell

Minor modes in effect:
  shell-dirtrack-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
M-x s h e l l <return> M-x r e p o r t - e m c <backspace>
a c s - b u f <backspace> g <return>

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.

Load-path shadows:
None found.

Features:
(shadow sort gnus-util mail-extr message format-spec rfc822 mml easymenu
mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045
ietf-drums mm-util mail-prsvr mailabbrev mail-utils gmm-utils mailheader
emacsbug ansi-color shell pcomplete comint regexp-opt ring time-date
tooltip ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar
dnd fontset image fringe lisp-mode register page menu-bar rfn-eshadow
timer select scroll-bar mouse jit-lock font-lock syntax facemenu
font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan
thai tai-viet lao korean japanese hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer loaddefs button faces
cus-face files text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget hashtable-print-readable backquote
make-network-process dbusbind dynamic-setting system-font-setting
font-render-setting x-toolkit x multi-tty emacs)
[shell-prompt-doubled.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9961; Package emacs. (Mon, 07 Nov 2011 22:02:02 GMT) Full text and rfc822 format available.

Message #8 received at 9961 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: 9961 <at> debbugs.gnu.org
Subject: Re: bug#9961: Subject: 24.0.91; shell prompt doubled
Date: Mon, 07 Nov 2011 16:58:36 -0500
The patch (which could not be applied anyway due to copyright reasons)
simply silently makes comint-exec ignore its STARTFILE argument, which
obviously cannot be the correct solution.

This issue occurs since at least Emacs 21.1.
If you have a non-empty ~/.emacs_bash file, eg one that contains just:

#comment

and do M-x shell with the bash shell, then you get an extra N copies of
your prompt, as the N lines of ~/.emacs_bash are fed to the shell by
comint-exec.




Changed bug title to 'non-empty ~/.emacs_SHELLNAME causes multiple shell prompts' from 'Subject: 24.0.91; shell prompt doubled' Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Mon, 07 Nov 2011 22:04:02 GMT) Full text and rfc822 format available.

Severity set to 'minor' from 'normal' Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Mon, 07 Nov 2011 22:04:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9961; Package emacs. (Tue, 25 Aug 2020 13:05:01 GMT) Full text and rfc822 format available.

Message #15 received at 9961 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 9961 <at> debbugs.gnu.org
Subject: Re: bug#9961: Subject: 24.0.91; shell prompt doubled
Date: Tue, 25 Aug 2020 15:04:20 +0200
Glenn Morris <rgm <at> gnu.org> writes:

> This issue occurs since at least Emacs 21.1.
> If you have a non-empty ~/.emacs_bash file, eg one that contains just:
>
> #comment
>
> and do M-x shell with the bash shell, then you get an extra N copies of
> your prompt, as the N lines of ~/.emacs_bash are fed to the shell by
> comint-exec.

This bug is still present in Emacs 28, although it looks a bit different
now:



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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9961; Package emacs. (Tue, 25 Aug 2020 13:14:02 GMT) Full text and rfc822 format available.

Message #18 received at 9961 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 9961 <at> debbugs.gnu.org
Subject: Re: bug#9961: Subject: 24.0.91; shell prompt doubled
Date: Tue, 25 Aug 2020 15:13:37 +0200
[Message part 1 (text/plain, inline)]
(I think I sent this one prematurely once already; sorry.)

Glenn Morris <rgm <at> gnu.org> writes:

> This issue occurs since at least Emacs 21.1.
> If you have a non-empty ~/.emacs_bash file, eg one that contains just:
>
> #comment
>
> and do M-x shell with the bash shell, then you get an extra N copies of
> your prompt, as the N lines of ~/.emacs_bash are fed to the shell by
> comint-exec.

This bug is still present in Emacs 28, although it looks a bit different
now:

[Message part 2 (image/png, inline)]
[Message part 3 (text/plain, inline)]
I poked around to see whether there's any easy way to fix this: Like a
way to say to comint "send this to the process, but discard the output",
but there doesn't seem to be?

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

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9961; Package emacs. (Tue, 25 Aug 2020 13:22:01 GMT) Full text and rfc822 format available.

Message #21 received at 9961 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: rgm <at> gnu.org, 9961 <at> debbugs.gnu.org
Subject: Re: bug#9961: Subject: 24.0.91; shell prompt doubled
Date: Tue, 25 Aug 2020 16:21:04 +0300
> From: Lars Ingebrigtsen <larsi <at> gnus.org>
> Date: Tue, 25 Aug 2020 15:13:37 +0200
> Cc: 9961 <at> debbugs.gnu.org
> 
> I poked around to see whether there's any easy way to fix this: Like a
> way to say to comint "send this to the process, but discard the output",
> but there doesn't seem to be?

Would it work to arrange for a temporary filter function, which would
discard the shell's output while .emacs_bash is being processed?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9961; Package emacs. (Tue, 25 Aug 2020 13:31:01 GMT) Full text and rfc822 format available.

Message #24 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Colin Baxter <m43cap <at> yandex.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#9961: Subject: 24.0.91; shell prompt doubled
Date: Tue, 25 Aug 2020 14:26:37 +0100
>>>>> Lars Ingebrigtsen <larsi <at> gnus.org> writes:

    > (I think I sent this one prematurely once already; sorry.)  Glenn
    > Morris <rgm <at> gnu.org> writes:

    >> This issue occurs since at least Emacs 21.1.  If you have a
    >> non-empty ~/.emacs_bash file, eg one that contains just:
    >> 
    >> #comment
    >> 
    >> and do M-x shell with the bash shell, then you get an extra N
    >> copies of your prompt, as the N lines of ~/.emacs_bash are fed to
    >> the shell by comint-exec.

    > This bug is still present in Emacs 28, although it looks a bit
    > different now:




    > I poked around to see whether there's any easy way to fix this:
    > Like a way to say to comint "send this to the process, but discard
    > the output", but there doesn't seem to be?

This works for me. Create a ~/.emacs_bash as:

 # -*- mode: sh; -*-
 # echo ""
 printf '\r\n%.0s' {1..50} ## This clears screen and puts prompt at bottom



There will only be one prompt. For csh, touch the file ~/.emacs_csh but
keep empty.

Best wishes,

Colin Baxter.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9961; Package emacs. (Tue, 25 Aug 2020 13:32:01 GMT) Full text and rfc822 format available.

Message #27 received at 9961 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: rgm <at> gnu.org, 9961 <at> debbugs.gnu.org
Subject: Re: bug#9961: Subject: 24.0.91; shell prompt doubled
Date: Tue, 25 Aug 2020 15:31:39 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Lars Ingebrigtsen <larsi <at> gnus.org>
>> Date: Tue, 25 Aug 2020 15:13:37 +0200
>> Cc: 9961 <at> debbugs.gnu.org
>> 
>> I poked around to see whether there's any easy way to fix this: Like a
>> way to say to comint "send this to the process, but discard the output",
>> but there doesn't seem to be?
>
> Would it work to arrange for a temporary filter function, which would
> discard the shell's output while .emacs_bash is being processed?

The (somewhat strangely coded function) today just does:

      ;; Feed it the startfile.
      (cond (startfile
	     ;;This is guaranteed to wait long enough
	     ;;but has bad results if the comint does not prompt at all
	     ;;	     (while (= size (buffer-size))
	     ;;	       (sleep-for 1))
	     ;;I hope 1 second is enough!
	     (sleep-for 1)
	     (goto-char (point-max))
	     (insert-file-contents startfile)
	     (setq startfile (buffer-substring (point) (point-max)))
	     (delete-region (point) (point-max))
	     (comint-send-string proc startfile)))

So it sends off the entire init file to bash (or whatever), and doesn't
wait for any response, or know how many commands there are in that file.

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




Forcibly Merged 9961 40754. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sun, 13 Jun 2021 12:32:01 GMT) Full text and rfc822 format available.

bug marked as fixed in version 29.1, send any further explanations to 40754 <at> debbugs.gnu.org and Trevor Spiteri <tspiteri <at> ieee.org> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Thu, 17 Mar 2022 14:05:03 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 15 Apr 2022 11:24:08 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 67 days ago.

Previous Next


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