From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Arni Magnusson Newsgroups: gmane.emacs.bugs Subject: bug#6202: Async shell command, switching mode, and sleep-for Date: Sun, 16 May 2010 15:01:55 +0000 (UTC) Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII X-Trace: dough.gmane.org 1274024312 19980 80.91.229.12 (16 May 2010 15:38:32 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 16 May 2010 15:38:32 +0000 (UTC) To: 6202@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun May 16 17:38:27 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 1ODfv7-0002N5-Io for geb-bug-gnu-emacs@m.gmane.org; Sun, 16 May 2010 17:38:26 +0200 Original-Received: from localhost ([127.0.0.1]:56596 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ODfv6-0000W5-R9 for geb-bug-gnu-emacs@m.gmane.org; Sun, 16 May 2010 11:38:24 -0400 Original-Received: from [140.186.70.92] (port=58619 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ODfuy-0000Kt-43 for bug-gnu-emacs@gnu.org; Sun, 16 May 2010 11:38:17 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1ODfjx-0000ez-MC for bug-gnu-emacs@gnu.org; Sun, 16 May 2010 11:26:57 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:39599) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1ODfjx-0000es-KA for bug-gnu-emacs@gnu.org; Sun, 16 May 2010 11:26:53 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1ODfMr-00027E-UL; Sun, 16 May 2010 11:03:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Arni Magnusson 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 15:03:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 6202 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.12740221438120 (code B ref -1); Sun, 16 May 2010 15:03:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 16 May 2010 15:02: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 1ODfME-00026v-IN for submit@debbugs.gnu.org; Sun, 16 May 2010 11:02:23 -0400 Original-Received: from mx10.gnu.org ([199.232.76.166]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1ODfMA-00026o-OH for submit@debbugs.gnu.org; Sun, 16 May 2010 11:02:21 -0400 Original-Received: from lists.gnu.org ([199.232.76.165]:40408) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1ODfM1-0003Mb-PQ for submit@debbugs.gnu.org; Sun, 16 May 2010 11:02:09 -0400 Original-Received: from [140.186.70.92] (port=36394 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ODfM0-0001Lr-36 for bug-gnu-emacs@gnu.org; Sun, 16 May 2010 11:02:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1ODfLy-0005ru-5q for bug-gnu-emacs@gnu.org; Sun, 16 May 2010 11:02:07 -0400 Original-Received: from hafgarpur.hafro.is ([130.208.64.48]:44368) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1ODfLx-0005qv-QI for bug-gnu-emacs@gnu.org; Sun, 16 May 2010 11:02:06 -0400 X-Virus-Scanned: amavisd-new at hafro.is Original-Received: from hafstormur.hafro.is (hafstormur [130.208.66.52]) by hafgarpur.hafro.is (8.14.2/8.14.2/hafro-2.46) with ESMTP id o4GF1tVM027225 for ; Sun, 16 May 2010 15:01:56 GMT Original-Received: from hafstormur.hafro.is (localhost [127.0.0.1]) by hafstormur.hafro.is (8.14.3/8.14.3/hafro-1.6) with ESMTP id o4GF1tNs010556 for ; Sun, 16 May 2010 15:01:55 GMT Original-Received: from localhost (arnima@localhost) by hafstormur.hafro.is (8.14.3/8.14.3/hafro-0.3) with ESMTP id o4GF1txj010552 for ; Sun, 16 May 2010 15:01:55 GMT X-Authentication-Warning: hafstormur.hafro.is: arnima owned process doing -bs User-Agent: Alpine 2.00 (LFD 1167 2008-08-23) X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Sun, 16 May 2010 11:03:01 -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:36968 Archived-At: I maintain a major mode, where some functions have broken between Emacs 23.1 and 23.2, and I believe the current Emacs behavior could be described as a bug. What I want to do is to run a shell command asynchronously (so I can watch the output scroll by in a secondary window while continuing my work), but the output should not be syntax-highlighted. By default, the output is shown in `shell-mode', where negative numbers are highlighted in `font-lock-comment-face', 123 -456 789 but I want these three numbers to be shown in the `default' face. 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. I also stumbled upon a separate issue, where the above function (after uncommenting the `sleep-for' line) makes Emacs dutifully freeze for 3 seconds in Linux, but not in Windows. This bug/limitation is not mentioned on the help page for `sleep-for'. Thanks in advance for looking at these issues, Arni 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'.