From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#6202: Async shell command, switching mode, and sleep-for Date: Sun, 16 May 2010 16:48:14 -0400 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1274043417 13298 80.91.229.12 (16 May 2010 20:56:57 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 16 May 2010 20:56:57 +0000 (UTC) Cc: 6202@debbugs.gnu.org To: Arni Magnusson Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun May 16 22:56:55 2010 connect(): No such file or directory Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ODktL-00038n-0p for geb-bug-gnu-emacs@m.gmane.org; Sun, 16 May 2010 22:56:55 +0200 Original-Received: from localhost ([127.0.0.1]:45901 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ODktK-0000zy-Fq for geb-bug-gnu-emacs@m.gmane.org; Sun, 16 May 2010 16:56:54 -0400 Original-Received: from [140.186.70.92] (port=49275 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ODktE-0000z2-Qj for bug-gnu-emacs@gnu.org; Sun, 16 May 2010 16:56:49 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1ODktC-0003Tc-Ss for bug-gnu-emacs@gnu.org; Sun, 16 May 2010 16:56:48 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:52222) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1ODktC-0003TX-Oy for bug-gnu-emacs@gnu.org; Sun, 16 May 2010 16:56:46 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1ODkli-00053P-F4; Sun, 16 May 2010 16:49:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 16 May 2010 20:49:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 6202 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 6202-submit@debbugs.gnu.org id=B6202.127404290319413 (code B ref 6202); Sun, 16 May 2010 20:49:02 +0000 Original-Received: (at 6202) by debbugs.gnu.org; 16 May 2010 20:48:23 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1ODkl4-000534-ME for submit@debbugs.gnu.org; Sun, 16 May 2010 16:48:23 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181] helo=ironport2-out.pppoe.ca) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1ODkl2-00052s-GY for 6202@debbugs.gnu.org; Sun, 16 May 2010 16:48:21 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvsEAFb370tMCrUO/2dsb2JhbACeAXK5TIUQBIwv X-IronPort-AV: E=Sophos;i="4.53,242,1272859200"; d="scan'208";a="64316791" Original-Received: from 76-10-181-14.dsl.teksavvy.com (HELO alfajor.home) ([76.10.181.14]) by ironport2-out.pppoe.ca with ESMTP; 16 May 2010 16:48:15 -0400 Original-Received: by alfajor.home (Postfix, from userid 20848) id B9152BA817; Sun, 16 May 2010 16:48:14 -0400 (EDT) In-Reply-To: (Arni Magnusson's message of "Sun, 16 May 2010 15:01:55 +0000 (UTC)") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Sun, 16 May 2010 16:49:02 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:36975 Archived-At: > My approach is to switch the secondary window to `fundamental-mode' to > ensure that nothing is syntax-highlighted. The following example uses the > shell command "set", because it produces some output Linux and Windows, > although it does not demonstrate negative numbers: > (defun foo () > (interactive) > (shell-command "set &") > (select-window (get-buffer-window "*Async Shell Command*")) > ;; (sleep-for 3) > (fundamental-mode) > (other-window 1)) > My window and buffer control is slightly more sophisticated, but the > function above focuses on the problem. This function works in Emacs 23.1, > but in Emacs 23.2 the secondary window is empty, and the shell command > output is not found in any buffer. The same problem occurs when switching to > some other mode than `fundamental-mode'. The same problem also occurs when > replacing the ampersand `shell-command' with the new `async-shell-command'. > While debugging the problem, I found that the function does work in Emacs > 23.2 if `sleep-for' is called before switching to `fundamental-mode', so the > foo function above can be "fixed" by uncommenting that line. Sleeping for > 0.001 seconds is not enough, though. This does look like a bug, indeed, and I can't begin to imagine what the problem might be (and don't have time to investigate now). > P.S. It would of course be nice if the `*-shell-command' functions would > have an optional argument to specify a mode other than the currently > hardwired `shell-mode'. I strongly recommend to stay away from shell-command and friends in Lisp code (they're mostly used and meant for interactive use), and use start-process instead. Stefan