aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Mauger2012-12-20 21:08:29 -0500
committerMichael Mauger2012-12-20 21:08:29 -0500
commitfab6916d0c0e5c0f8a942ed040fe7f5d0013b145 (patch)
tree722c360e300febb9b9a72e32ffcb007472ac78f7
parent13002885275be0499d0131d4d1823d5e5a6a1be6 (diff)
downloademacs-fab6916d0c0e5c0f8a942ed040fe7f5d0013b145.tar.gz
emacs-fab6916d0c0e5c0f8a942ed040fe7f5d0013b145.zip
* 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.
-rw-r--r--lisp/ChangeLog7
-rw-r--r--lisp/comint.el19
2 files changed, 23 insertions, 3 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 342308c335d..9a49ecc49c5 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,10 @@
12012-12-20 Michael R. Mauger <mmaug@yahoo.com>
2
3 * comint.el (comint-redirect-previous-input-string): New variable.
4 (comint-redirect-setup, comint-redirect-cleanup)
5 (comint-redirect-preoutput-filter): Use it. Fixes redirection bug.
6 (comint-redirect-preoutput-filter): Fix verbose message.
7
12012-12-20 Michael Albinus <michael.albinus@gmx.de> 82012-12-20 Michael Albinus <michael.albinus@gmx.de>
2 9
3 * progmodes/grep.el (rgrep): Escape command line. Sometimes, it 10 * 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.
3490This is useful, for instance, for insertion into Help mode buffers. 3490This is useful, for instance, for insertion into Help mode buffers.
3491You probably want to set it locally to the output buffer.") 3491You probably want to set it locally to the output buffer.")
3492 3492
3493(defvar comint-redirect-previous-input-string nil
3494 "Last redirected line of text.
3495Allows detection of the end of the redirection in case the
3496completion string is split between two output segments.")
3497
3493;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 3498;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3494;; Functions 3499;; Functions
3495;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 3500;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -3527,6 +3532,9 @@ and does not normally need to be invoked by the end user or programmer."
3527 (make-local-variable 'comint-redirect-completed) 3532 (make-local-variable 'comint-redirect-completed)
3528 (setq comint-redirect-completed nil) 3533 (setq comint-redirect-completed nil)
3529 3534
3535 (make-local-variable 'comint-redirect-previous-input-string)
3536 (setq comint-redirect-previous-input-string "")
3537
3530 (setq mode-line-process 3538 (setq mode-line-process
3531 (if mode-line-process 3539 (if mode-line-process
3532 (list (concat (elt mode-line-process 0) " Redirection")) 3540 (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."
3535(defun comint-redirect-cleanup () 3543(defun comint-redirect-cleanup ()
3536 "End a Comint redirection. See `comint-redirect-send-command'." 3544 "End a Comint redirection. See `comint-redirect-send-command'."
3537 (interactive) 3545 (interactive)
3546 ;; Release the last redirected string
3547 (setq comint-redirect-previous-input-string nil)
3538 ;; Restore the process filter 3548 ;; Restore the process filter
3539 (set-process-filter (get-buffer-process (current-buffer)) 3549 (set-process-filter (get-buffer-process (current-buffer))
3540 comint-redirect-original-filter-function) 3550 comint-redirect-original-filter-function)
@@ -3616,18 +3626,21 @@ This function does not need to be invoked by the end user."
3616 3626
3617 ;; Message 3627 ;; Message
3618 (and comint-redirect-verbose 3628 (and comint-redirect-verbose
3619 (message "Redirected output to buffer(s) %s" 3629 (message "Redirected output to buffer(s) %s" output-buffer-list))
3620 (mapconcat 'identity output-buffer-list " ")))
3621 3630
3622 ;; If we see the prompt, tidy up 3631 ;; If we see the prompt, tidy up
3623 ;; We'll look for the prompt in the original string, so nobody can 3632 ;; We'll look for the prompt in the original string, so nobody can
3624 ;; clobber it 3633 ;; clobber it
3625 (and (string-match comint-redirect-finished-regexp input-string) 3634 (and (string-match comint-redirect-finished-regexp
3635 (concat comint-redirect-previous-input-string
3636 input-string))
3626 (progn 3637 (progn
3627 (and comint-redirect-verbose 3638 (and comint-redirect-verbose
3628 (message "Redirection completed")) 3639 (message "Redirection completed"))
3629 (comint-redirect-cleanup) 3640 (comint-redirect-cleanup)
3630 (run-hooks 'comint-redirect-hook))) 3641 (run-hooks 'comint-redirect-hook)))
3642 (setq comint-redirect-previous-input-string input-string)
3643
3631 ;; Echo input? 3644 ;; Echo input?
3632 (if comint-redirect-echo-input 3645 (if comint-redirect-echo-input
3633 filtered-input-string 3646 filtered-input-string