X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/fb597fe85a4c5212f54f97124c83b6af30d5d722..efa434d9f2720aa71fbc67fed5897a2f16943fde:/lisp/comint.el diff --git a/lisp/comint.el b/lisp/comint.el index 370564617c..42c2fb8830 100644 --- a/lisp/comint.el +++ b/lisp/comint.el @@ -197,9 +197,9 @@ into the buffer's input ring. See also `comint-magic-space' and This variable is buffer-local." :type '(choice (const :tag "off" nil) - (const :tag "on" t) (const input) - (const history)) + (const history) + (other :tag "on" t)) :group 'comint) (defcustom comint-input-ignoredups nil @@ -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)) ;; Input history processing in a buffer ;; =========================================================================== @@ -1402,7 +1422,8 @@ This function should be in the list `comint-output-filter-functions'." (and (eq scroll 'this) (eq selected window)) (and (eq scroll 'others) (not (eq selected window))) ;; If point was at the end, keep it at end. - (>= (point) comint-last-output-start))) + (and (marker-position comint-last-output-start) + (>= (point) comint-last-output-start)))) (goto-char (process-mark process))) ;; Optionally scroll so that the text ;; ends at the bottom of the window. @@ -2318,7 +2339,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)))