Subject: bug#9961: Subject: 24.0.91; shell prompt doubled

From: Lars Ingebrigtsen <[email-masked]>
Date: Tue, 25 Aug 2020 15:31:39 +0200

Eli Zaretskii <[email-masked]> writes:

>> From: Lars Ingebrigtsen <[email-masked]>
>> Date: Tue, 25 Aug 2020 15:13:37 +0200
>> Cc: [email-masked]
>> 
>> 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