all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: David Fox <ddssff@gmail.com>
To: 6800@debbugs.gnu.org
Subject: bug#6800: 23.1; EOT / ^D inserted into comint input string
Date: Thu, 5 Aug 2010 07:58:13 -0700	[thread overview]
Message-ID: <AANLkTi=JgrcVqfxves6yAPjF__g5PU3TL2T94cn2K9h=@mail.gmail.com> (raw)

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

When an input longer than 255 characters is typed into comint (or
shell) an EOT character (ascii 4, ^D) is inserted into the string.
This can cause an error depending how the sub process handles these
extra characters.  For example, GHC doesn't like it when an EOT
appears inside of a string:

 ghci
 > Prelude> putStrLn "<a 241 character string>"
works fine, but
 > Prelude> putStrLn "<a 242 character string>"
<interactive>:1:255: lexical error at character '\EOT'

I inserted a function to break up the input into comint-send-string to work
around the problem:

(require 'comint)

(defun comint-send-string (process string)
  "Like `process-send-string', but also does extra bookkeeping for Comint
mode."
  (if process
      (with-current-buffer (if (processp process)
                   (process-buffer process)
                 (get-buffer process))
    (comint-snapshot-last-prompt))
    (comint-snapshot-last-prompt))
  (my-process-send-string process string))

;; Break up the string so that we don't get EOT characters in our input
stream.
(defun my-process-send-string (process string)
  (if (> (length string) 200)
      (progn (process-send-string process (substring string 0 200))
(my-process-send-string process (substring string 200)))
    (process-send-string process string)))

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

             reply	other threads:[~2010-08-05 14:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-05 14:58 David Fox [this message]
2010-09-11 14:01 ` bug#6800: 23.1; EOT / ^D inserted into comint input string Stefan Monnier
2016-08-12 18:36   ` Alan Third
2016-08-12 18:40     ` David Fox
2016-08-12 18:43       ` Alan Third

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='AANLkTi=JgrcVqfxves6yAPjF__g5PU3TL2T94cn2K9h=@mail.gmail.com' \
    --to=ddssff@gmail.com \
    --cc=6800@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.