From: Dmitry Gutov <dmitry@gutov.dev>
To: Michael Albinus <michael.albinus@gmx.de>
Cc: Eli Zaretskii <eliz@gnu.org>, 71049@debbugs.gnu.org
Subject: bug#71049: async-shell-command ends with "Process *Async Shell Command* finished" when remote "direct-async-process"
Date: Sat, 25 May 2024 16:54:54 +0300 [thread overview]
Message-ID: <25dad14a-397c-4052-908c-121e40bbef51@gutov.dev> (raw)
In-Reply-To: <87wmnidv3u.fsf@gmx.de>
[-- Attachment #1: Type: text/plain, Size: 1524 bytes --]
Hi Michael,
On 25/05/2024 13:49, Michael Albinus wrote:
>> The answer is that async-shell-command uses shell-mode as the major
>> mode for the output buffer. For syntax highlighting, I guess.
>>
>> You make a good point that the shell history for such buffers would
>> usually make no sense - even if the running process takes user input
>> (usually not, but sometimes it might) - its input history would be
>> different from the shell.
>>
>> So maybe we could just move the last form in shell-mode (which
>> initializes comint-input-ring) to 'shell'
> Don't know. (shell-mode) is called in shell-command since bcad49851742
> (1995-07-17). And it is called in tramp-handle-shell-command since
> f5e29b9b70a5 (2011-09-04).
>
> (comint-read-input-ring) is called in shell-mode since
> (1993-10-22). There might be packages which trust on the
> comint-input-ring existence for buffers in shell mode, even if such
> buffers are created by shell-command..
Yes, it would be an incompatibility - so we'll need to consider the
migration path. See the attached patch - I suggest that any callers of
'shell-mode' that need the exact same input-ring setup also call
shell-setup-input-ring (if it's fboundp - a version check).
Or I suppose we could check the value of shell-setup-input-ring and skip
history loading when it is empty. It's a more subtle incompatibility
which might affect (or not) third-party code in similar ways.
Either of the attached patches solves this part of the problem for me,
please take your pick.
[-- Attachment #2: shell-setup-input-ring.diff --]
[-- Type: text/x-patch, Size: 964 bytes --]
diff --git a/lisp/shell.el b/lisp/shell.el
index e6b315ee5c0..d485c8af567 100644
--- a/lisp/shell.el
+++ b/lisp/shell.el
@@ -718,7 +718,10 @@ shell-mode
;; This is not really correct, since the shell buffer does not really
;; edit this directory. But it is useful in the buffer list and menus.
- (setq list-buffers-directory (expand-file-name default-directory))
+ (setq list-buffers-directory (expand-file-name default-directory)))
+
+(defun shell-setup-input-ring ()
+ "Set up `comint-input-ring' for this buffer, for the chosen shell."
;; shell-dependent assignments.
(when (ring-empty-p comint-input-ring)
(let ((remote (file-remote-p default-directory))
@@ -948,6 +951,7 @@ shell
(symbol-value xargs-name)
'("-i")))
(shell-mode)
+ (shell-setup-input-ring)
(when (file-exists-p startfile)
;; Wait until the prompt has appeared.
(while (= start-point (point))
[-- Attachment #3: shell-no-start-prog.diff --]
[-- Type: text/x-patch, Size: 690 bytes --]
diff --git a/lisp/shell.el b/lisp/shell.el
index e6b315ee5c0..ca02d602966 100644
--- a/lisp/shell.el
+++ b/lisp/shell.el
@@ -720,9 +720,10 @@ shell-mode
;; edit this directory. But it is useful in the buffer list and menus.
(setq list-buffers-directory (expand-file-name default-directory))
;; shell-dependent assignments.
- (when (ring-empty-p comint-input-ring)
+ (when (and (ring-empty-p comint-input-ring)
+ shell--start-prog)
(let ((remote (file-remote-p default-directory))
- (shell (or shell--start-prog ""))
+ (shell shell--start-prog)
(hsize (getenv "HISTSIZE"))
(hfile (getenv "HISTFILE")))
(when remote
next prev parent reply other threads:[~2024-05-25 13:54 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-19 0:19 bug#71049: async-shell-command ends with "Process *Async Shell Command* finished" when remote "direct-async-process" Dmitry Gutov
2024-05-19 6:17 ` Eli Zaretskii
2024-05-19 12:40 ` Dmitry Gutov
2024-05-24 11:15 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-24 14:06 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-24 14:50 ` Eli Zaretskii
2024-05-24 16:39 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-24 18:55 ` Eli Zaretskii
2024-05-24 19:20 ` Dmitry Gutov
2024-05-25 10:49 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-25 13:54 ` Dmitry Gutov [this message]
2024-05-25 15:51 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-25 16:17 ` Dmitry Gutov
2024-05-25 17:00 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-25 17:31 ` Dmitry Gutov
2024-05-25 17:44 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-26 14:18 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-29 1:59 ` Dmitry Gutov
2024-05-29 7:41 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-29 11:55 ` Dmitry Gutov
2024-05-29 15:19 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-29 11:53 ` Eli Zaretskii
2024-05-29 11:57 ` Dmitry Gutov
2024-05-29 12:46 ` Eli Zaretskii
2024-05-29 17:26 ` Dmitry Gutov
2024-05-29 17:42 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-29 18:15 ` Dmitry Gutov
2024-05-29 18:38 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-29 20:40 ` Dmitry Gutov
2024-05-30 8:49 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-31 0:24 ` Dmitry Gutov
2024-05-31 5:53 ` Eli Zaretskii
2024-05-31 16:24 ` Dmitry Gutov
2024-05-31 18:05 ` Eli Zaretskii
2024-06-01 1:21 ` Dmitry Gutov
2024-06-01 6:07 ` Eli Zaretskii
2024-06-01 15:33 ` Dmitry Gutov
2024-06-01 15:47 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-02 1:39 ` Dmitry Gutov
2024-06-02 8:36 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-02 14:10 ` Dmitry Gutov
2024-06-02 14:46 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-02 15:01 ` Dmitry Gutov
2024-06-02 17:31 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-31 7:27 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-31 12:13 ` Dmitry Gutov
2024-05-29 18:11 ` Eli Zaretskii
2024-05-25 17:10 ` Eli Zaretskii
2024-05-25 7:23 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-24 17:17 ` Dmitry Gutov
2024-05-24 17:41 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-24 17:50 ` Dmitry Gutov
2024-05-24 18:09 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-25 13:03 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-25 14:40 ` Dmitry Gutov
2024-05-25 15:26 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=25dad14a-397c-4052-908c-121e40bbef51@gutov.dev \
--to=dmitry@gutov.dev \
--cc=71049@debbugs.gnu.org \
--cc=eliz@gnu.org \
--cc=michael.albinus@gmx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.