From: Michael Mauger Date: Fri, 21 Dec 2012 02:08:29 +0000 (-0500) Subject: * comint.el (comint-redirect-previous-input-string): New variable. X-Git-Tag: emacs-24.3.90~173^2~7^2~541 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=fab6916d0c0e5c0f8a942ed040fe7f5d0013b145;p=emacs.git * comint.el (comint-redirect-previous-input-string): New variable. (comint-redirect-setup, comint-redirect-cleanup) (comint-redirect-preoutput-filter): Use it. Fixes redirection bug. (comint-redirect-preoutput-filter): Fix verbose message. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 342308c335d..9a49ecc49c5 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,10 @@ +2012-12-20 Michael R. Mauger + + * comint.el (comint-redirect-previous-input-string): New variable. + (comint-redirect-setup, comint-redirect-cleanup) + (comint-redirect-preoutput-filter): Use it. Fixes redirection bug. + (comint-redirect-preoutput-filter): Fix verbose message. + 2012-12-20 Michael Albinus * progmodes/grep.el (rgrep): Escape command line. Sometimes, it diff --git a/lisp/comint.el b/lisp/comint.el index cff9afee0df..a01e7e58cd7 100644 --- a/lisp/comint.el +++ b/lisp/comint.el @@ -3490,6 +3490,11 @@ This works by binding `inhibit-read-only' around the insertion. This is useful, for instance, for insertion into Help mode buffers. You probably want to set it locally to the output buffer.") +(defvar comint-redirect-previous-input-string nil + "Last redirected line of text. +Allows detection of the end of the redirection in case the +completion string is split between two output segments.") + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Functions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -3527,6 +3532,9 @@ and does not normally need to be invoked by the end user or programmer." (make-local-variable 'comint-redirect-completed) (setq comint-redirect-completed nil) + (make-local-variable 'comint-redirect-previous-input-string) + (setq comint-redirect-previous-input-string "") + (setq mode-line-process (if mode-line-process (list (concat (elt mode-line-process 0) " Redirection")) @@ -3535,6 +3543,8 @@ and does not normally need to be invoked by the end user or programmer." (defun comint-redirect-cleanup () "End a Comint redirection. See `comint-redirect-send-command'." (interactive) + ;; Release the last redirected string + (setq comint-redirect-previous-input-string nil) ;; Restore the process filter (set-process-filter (get-buffer-process (current-buffer)) comint-redirect-original-filter-function) @@ -3616,18 +3626,21 @@ This function does not need to be invoked by the end user." ;; Message (and comint-redirect-verbose - (message "Redirected output to buffer(s) %s" - (mapconcat 'identity output-buffer-list " "))) + (message "Redirected output to buffer(s) %s" output-buffer-list)) ;; If we see the prompt, tidy up ;; We'll look for the prompt in the original string, so nobody can ;; clobber it - (and (string-match comint-redirect-finished-regexp input-string) + (and (string-match comint-redirect-finished-regexp + (concat comint-redirect-previous-input-string + input-string)) (progn (and comint-redirect-verbose (message "Redirection completed")) (comint-redirect-cleanup) (run-hooks 'comint-redirect-hook))) + (setq comint-redirect-previous-input-string input-string) + ;; Echo input? (if comint-redirect-echo-input filtered-input-string