]> git.eshelyaron.com Git - emacs.git/commitdiff
* comint.el (comint-redirect-previous-input-string): New variable.
authorMichael Mauger <mmaug@yahoo.com>
Fri, 21 Dec 2012 02:08:29 +0000 (21:08 -0500)
committerMichael Mauger <mmaug@yahoo.com>
Fri, 21 Dec 2012 02:08:29 +0000 (21:08 -0500)
(comint-redirect-setup, comint-redirect-cleanup)
(comint-redirect-preoutput-filter): Use it.  Fixes redirection bug.
(comint-redirect-preoutput-filter): Fix verbose message.

lisp/ChangeLog
lisp/comint.el

index 342308c335d7363d76e205e379ae9bd269260770..9a49ecc49c50e651473f6632cbec3441e7363299 100644 (file)
@@ -1,3 +1,10 @@
+2012-12-20  Michael R. Mauger  <mmaug@yahoo.com>
+
+       * 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  <michael.albinus@gmx.de>
 
        * progmodes/grep.el (rgrep): Escape command line.  Sometimes, it
index cff9afee0dffa0c1096a47eb57e4d89b75f34e68..a01e7e58cd7d6a2d2f1ce9e0949d6ca597c2048c 100644 (file)
@@ -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