3164 |
process)) |
process)) |
3165 |
(proc (get-buffer-process process-buffer))) |
(proc (get-buffer-process process-buffer))) |
3166 |
;; Change to the process buffer |
;; Change to the process buffer |
3167 |
(set-buffer process-buffer) |
(with-current-buffer process-buffer |
3168 |
|
|
3169 |
;; Make sure there's a prompt in the current process buffer |
;; Make sure there's a prompt in the current process buffer |
3170 |
(and comint-redirect-perform-sanity-check |
(and comint-redirect-perform-sanity-check |
3171 |
(save-excursion |
(save-excursion |
3172 |
(goto-char (point-max)) |
(goto-char (point-max)) |
3173 |
(or (re-search-backward comint-prompt-regexp nil t) |
(or (re-search-backward comint-prompt-regexp nil t) |
3174 |
(error "No prompt found or `comint-prompt-regexp' not set properly")))) |
(error "No prompt found or `comint-prompt-regexp' not set properly")))) |
3175 |
|
|
3176 |
;;;;;;;;;;;;;;;;;;;;; |
;;;;;;;;;;;;;;;;;;;;; |
3177 |
;; Set up for redirection |
;; Set up for redirection |
3178 |
;;;;;;;;;;;;;;;;;;;;; |
;;;;;;;;;;;;;;;;;;;;; |
3179 |
(comint-redirect-setup |
(comint-redirect-setup |
3180 |
;; Output Buffer |
;; Output Buffer |
3181 |
output-buffer |
output-buffer |
3182 |
;; Comint Buffer |
;; Comint Buffer |
3183 |
(current-buffer) |
(current-buffer) |
3184 |
;; Finished Regexp |
;; Finished Regexp |
3185 |
comint-prompt-regexp |
comint-prompt-regexp |
3186 |
;; Echo input |
;; Echo input |
3187 |
echo) |
echo) |
3188 |
|
|
3189 |
;;;;;;;;;;;;;;;;;;;;; |
;;;;;;;;;;;;;;;;;;;;; |
3190 |
;; Set the filter |
;; Set the filter |
3191 |
;;;;;;;;;;;;;;;;;;;;; |
;;;;;;;;;;;;;;;;;;;;; |
3192 |
;; Save the old filter |
;; Save the old filter |
3193 |
(setq comint-redirect-original-filter-function |
(setq comint-redirect-original-filter-function |
3194 |
(process-filter proc)) |
(process-filter proc)) |
3195 |
(set-process-filter proc 'comint-redirect-filter) |
(set-process-filter proc 'comint-redirect-filter) |
3196 |
|
|
3197 |
;;;;;;;;;;;;;;;;;;;;; |
;;;;;;;;;;;;;;;;;;;;; |
3198 |
;; Send the command |
;; Send the command |
3199 |
;;;;;;;;;;;;;;;;;;;;; |
;;;;;;;;;;;;;;;;;;;;; |
3200 |
(process-send-string |
(process-send-string |
3201 |
(current-buffer) |
(current-buffer) |
3202 |
(concat command "\n")) |
(concat command "\n")) |
3203 |
|
|
3204 |
;;;;;;;;;;;;;;;;;;;;; |
;;;;;;;;;;;;;;;;;;;;; |
3205 |
;; Show the output |
;; Show the output |
3206 |
;;;;;;;;;;;;;;;;;;;;; |
;;;;;;;;;;;;;;;;;;;;; |
3207 |
(or no-display |
(or no-display |
3208 |
(display-buffer |
(display-buffer |
3209 |
(get-buffer-create |
(get-buffer-create |
3210 |
(if (listp output-buffer) |
(if (listp output-buffer) |
3211 |
(car output-buffer) |
(car output-buffer) |
3212 |
output-buffer)))))) |
output-buffer))))))) |
3213 |
|
|
3214 |
;;;###autoload |
;;;###autoload |
3215 |
(defun comint-redirect-results-list (command regexp regexp-group) |
(defun comint-redirect-results-list (command regexp regexp-group) |