From e1ab360024404fe6548505ab76616cfc42edf0cc Mon Sep 17 00:00:00 2001 From: Zhengyi Fu Date: Mon, 18 May 2026 10:31:20 +0800 Subject: [PATCH] Advice shell-command process filter instead of replacing it When `async-shell-command-display-buffer' is nil, the display of the shell command buffer is delayed until there is output. This is achieved by adding a function to the process filter. Previously we replaced that filter, which prevented the intended delayed display. Use `add-function' to append our filter instead. Co-authored-by: Jonas Bernoulli Decision to drop support for Emacs 26 and 27, so `add-function' can be used. --- lisp/with-editor.el | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lisp/with-editor.el b/lisp/with-editor.el index 9045e92..57ca1cc 100644 --- a/lisp/with-editor.el +++ b/lisp/with-editor.el @@ -8,7 +8,7 @@ ;; Package-Version: 3.5.0 ;; Package-Requires: ( -;; (emacs "26.1") +;; (emacs "28.1") ;; (compat "31.0") ;; (cond-let "1.0")) @@ -922,10 +922,9 @@ Also take care of that for `with-editor-[async-]shell-command'." (or output-buffer (get-buffer "*Async Shell Command*"))))) (prog1 process - (set-process-filter process - (lambda (proc str) - (comint-output-filter proc str) - (with-editor-process-filter proc str t)))))) + (add-function :after (process-filter process) + (lambda (proc str) + (with-editor-process-filter proc str t)))))) ((funcall fn command output-buffer error-buffer))))) ;;; _