unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#9961: Subject: 24.0.91; shell prompt doubled
@ 2011-11-05 15:46 Andreas Röhler
  2011-11-07 21:58 ` Glenn Morris
  0 siblings, 1 reply; 7+ messages in thread
From: Andreas Röhler @ 2011-11-05 15:46 UTC (permalink / raw)
  To: 9961

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

after M-x shell RET

shell prompt appears twofold like this:

MYNAME@MYHOST:~/emacs-20111105-r106290/src> 
MYNAME@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)

[-- Attachment #2: shell-prompt-doubled.patch --]
[-- Type: text/x-patch, Size: 1106 bytes --]

=== modified file 'lisp/comint.el'
--- lisp/comint.el	2011-10-25 12:33:31 +0000
+++ lisp/comint.el	2011-11-05 15:35:31 +0000
@@ -769,18 +769,19 @@
       (goto-char (point-max))
       (set-marker (process-mark proc) (point))
       ;; Feed it the startfile.
-      (cond (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)))
+	     ;; (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)))
+	     
       (run-hooks 'comint-exec-hook)
       buffer)))
 


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

* bug#9961: Subject: 24.0.91; shell prompt doubled
  2011-11-05 15:46 bug#9961: Subject: 24.0.91; shell prompt doubled Andreas Röhler
@ 2011-11-07 21:58 ` Glenn Morris
  2020-08-25 13:04   ` Lars Ingebrigtsen
  2020-08-25 13:13   ` Lars Ingebrigtsen
  0 siblings, 2 replies; 7+ messages in thread
From: Glenn Morris @ 2011-11-07 21:58 UTC (permalink / raw)
  To: 9961


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.





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

* bug#9961: Subject: 24.0.91; shell prompt doubled
  2011-11-07 21:58 ` Glenn Morris
@ 2020-08-25 13:04   ` Lars Ingebrigtsen
  2020-08-25 13:13   ` Lars Ingebrigtsen
  1 sibling, 0 replies; 7+ messages in thread
From: Lars Ingebrigtsen @ 2020-08-25 13:04 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 9961

Glenn Morris <rgm@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





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

* bug#9961: Subject: 24.0.91; shell prompt doubled
  2011-11-07 21:58 ` Glenn Morris
  2020-08-25 13:04   ` Lars Ingebrigtsen
@ 2020-08-25 13:13   ` Lars Ingebrigtsen
  2020-08-25 13:21     ` Eli Zaretskii
  2020-08-25 13:26     ` Colin Baxter
  1 sibling, 2 replies; 7+ messages in thread
From: Lars Ingebrigtsen @ 2020-08-25 13:13 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 9961

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

(I think I sent this one prematurely once already; sorry.)

Glenn Morris <rgm@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:


[-- Attachment #2: Type: image/png, Size: 25998 bytes --]

[-- Attachment #3: Type: text/plain, Size: 279 bytes --]


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

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

* bug#9961: Subject: 24.0.91; shell prompt doubled
  2020-08-25 13:13   ` Lars Ingebrigtsen
@ 2020-08-25 13:21     ` Eli Zaretskii
  2020-08-25 13:31       ` Lars Ingebrigtsen
  2020-08-25 13:26     ` Colin Baxter
  1 sibling, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2020-08-25 13:21 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: rgm, 9961

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Date: Tue, 25 Aug 2020 15:13:37 +0200
> Cc: 9961@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?





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

* bug#9961: Subject: 24.0.91; shell prompt doubled
  2020-08-25 13:13   ` Lars Ingebrigtsen
  2020-08-25 13:21     ` Eli Zaretskii
@ 2020-08-25 13:26     ` Colin Baxter
  1 sibling, 0 replies; 7+ messages in thread
From: Colin Baxter @ 2020-08-25 13:26 UTC (permalink / raw)
  To: 9961

>>>>> Lars Ingebrigtsen <larsi@gnus.org> writes:

    > (I think I sent this one prematurely once already; sorry.)  Glenn
    > Morris <rgm@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.






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

* bug#9961: Subject: 24.0.91; shell prompt doubled
  2020-08-25 13:21     ` Eli Zaretskii
@ 2020-08-25 13:31       ` Lars Ingebrigtsen
  0 siblings, 0 replies; 7+ messages in thread
From: Lars Ingebrigtsen @ 2020-08-25 13:31 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: rgm, 9961

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Lars Ingebrigtsen <larsi@gnus.org>
>> Date: Tue, 25 Aug 2020 15:13:37 +0200
>> Cc: 9961@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





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

end of thread, other threads:[~2020-08-25 13:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-05 15:46 bug#9961: Subject: 24.0.91; shell prompt doubled Andreas Röhler
2011-11-07 21:58 ` Glenn Morris
2020-08-25 13:04   ` Lars Ingebrigtsen
2020-08-25 13:13   ` Lars Ingebrigtsen
2020-08-25 13:21     ` Eli Zaretskii
2020-08-25 13:31       ` Lars Ingebrigtsen
2020-08-25 13:26     ` Colin Baxter

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).