> The buffer will be displayed by comint-make-newly-written-buffer-visible, Maybe you could construct a lambda in ‘shell-command’
> which I've added to the default value of comint-preoutput-filter-functions.
> At present the buffer name is hard coded there, so this will only work for
> "*Async Shell Command*".
containing the buffer name dynamically bound to the value of
(or output-buffer "*Async Shell Command*"), then set this lambda
to the process-filter, as we already do in ‘shell-command’ with
(set-process-filter proc 'comint-output-filter)
i.e. something like
(set-process-filter proc `(lambda (process string)
(when ...
(display-buffer ,(or output-buffer "*Async Shell Command*")))))
> So, to allow the user to be able to change the name, I suppose another user
> option would need to be introduced.
If the above solution will work, then we'll need a new customizable variable
like ‘async-shell-command-display-buffer’. And also ‘display-buffer’ in
‘shell-command’ will need to be adjusted in the way recommended by Martin.