]> code.delx.au - gnu-emacs/blobdiff - lisp/comint.el
(mail-citation-header): New variable.
[gnu-emacs] / lisp / comint.el
index 01022a33c00066f1a150cd351d6563e221615f41..d38761506de0715e5fe009c32e2246b8c554adea 100644 (file)
@@ -681,8 +681,28 @@ buffer.  The hook `comint-exec-hook' is run after each exec."
        (default-directory
          (if (file-accessible-directory-p default-directory)
              default-directory
-           (char-to-string directory-sep-char))))
-    (apply 'start-process name buffer command switches)))
+           (char-to-string directory-sep-char)))
+       proc decoding encoding changed)
+    (setq proc (apply 'start-process name buffer command switches))
+    (let ((coding-systems (process-coding-system proc)))
+      (setq decoding (car coding-systems)
+           encoding (cdr coding-systems)))
+    ;; If start-process decided to use some coding system for decoding
+    ;; data sent form the process and the coding system doesn't
+    ;; specify EOL conversion, we had better convert CRLF to LF.
+    (if (vectorp (coding-system-eol-type decoding))
+       (setq decoding (coding-system-change-eol-conversion decoding 'dos)
+             changed t))
+    ;; Even if start-process left the coding system for encoding data
+    ;; sent from the process undecided, we had better use the same one
+    ;; as what we use for decoding.  But, we should suppress EOL
+    ;; conversion.
+    (if (and decoding (not encoding))
+       (setq encoding (coding-system-change-eol-conversion decoding 'unix)
+             changed t))
+    (if changed
+       (set-process-coding-system proc decoding encoding))
+    proc))
 \f
 ;; Input history processing in a buffer
 ;; ===========================================================================
@@ -2318,7 +2338,7 @@ is at the beginning of the current input line; but if you have
 used \\[comint-accumulate] to send multiple lines at once,
 the process mark is at the beginning of the accumulated input."
   (interactive)
-  (if (not (eq last-command 'comint-bol-or-mark))
+  (if (not (eq last-command 'comint-bol-or-process-mark))
       (comint-bol nil)
     (comint-goto-process-mark)))