(defun eshell-interactive-print (string)
"Print STRING to the eshell display buffer."
(when string
- (eshell--mark-as-output 0 (length string) string)
- (eshell-interactive-filter nil string)))
+ (eshell-interactive-output-filter nil string)))
(defsubst eshell-begin-on-new-line ()
"This function outputs a newline if not at beginning of line."
(custom-add-option 'eshell-input-filter-functions 'eshell-kill-new)
(defun eshell-interactive-filter (buffer string)
- "Send output (STRING) to the interactive display, using BUFFER.
+ "Send STRING to the interactive display, using BUFFER.
This is done after all necessary filtering has been done."
(unless buffer
(setq buffer (current-buffer)))
(goto-char opoint)
(eshell-run-output-filters))))))
+(defun eshell-interactive-output-filter (buffer string)
+ "Send STRING to the interactive display as command output, using BUFFER.
+This is like `eshell-interactive-filter', but marks the inserted string
+as command output (see `eshell--mark-as-output')."
+ (let ((eshell-output-filter-functions
+ (cons (lambda ()
+ (eshell--mark-as-output eshell-last-output-start
+ eshell-last-output-end))
+ eshell-output-filter-functions)))
+ (eshell-interactive-filter buffer string)))
+
(defun eshell-run-output-filters ()
"Run the `eshell-output-filter-functions' on the current output."
(save-current-buffer
(declare-function eshell-reset "esh-mode" (&optional no-hooks))
(declare-function eshell-send-eof-to-process "esh-mode")
-(declare-function eshell-interactive-filter "esh-mode" (buffer string))
+(declare-function eshell-interactive-output-filter "esh-mode" (buffer string))
(declare-function eshell-set-exit-info "esh-cmd" (status result))
(declare-function eshell-tail-process "esh-cmd")
(when string
(eshell-debug-command 'process
"received output from process `%s'\n\n%s" process string)
- (eshell--mark-as-output 0 (length string) string)
- (eshell-interactive-filter (if process (process-buffer process)
- (current-buffer))
- string)))
+ (eshell-interactive-output-filter (if process (process-buffer process)
+ (current-buffer))
+ string)))
(define-obsolete-function-alias 'eshell-output-filter
#'eshell-interactive-process-filter "30.1")
(eshell-interactive-output-p eshell-error-handle handles)
(not (string-match "^\\(finished\\|exited\\)"
string)))
- (eshell--mark-as-output 0 (length string) string)
- (eshell-interactive-filter (process-buffer proc) string))
+ (eshell-interactive-output-filter (process-buffer proc) string))
(process-put proc :eshell-pending nil)
;; If we're in the middle of handling output from this
;; process then schedule the EOF for later.