From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Chip Coldwell Newsgroups: gmane.emacs.devel Subject: Emacs 21.3.50.1 (CVS sources) MacOS X tex-mode bug Date: Sun, 16 Jan 2005 19:34:02 -0500 (Eastern Standard Time) Message-ID: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Trace: sea.gmane.org 1105922873 13909 80.91.229.6 (17 Jan 2005 00:47:53 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 17 Jan 2005 00:47:53 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jan 17 01:47:45 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1CqL3Z-0007hi-00 for ; Mon, 17 Jan 2005 01:47:45 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1CqLFO-0001e0-Ji for ged-emacs-devel@m.gmane.org; Sun, 16 Jan 2005 19:59:58 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1CqLCt-0000bU-QZ for emacs-devel@gnu.org; Sun, 16 Jan 2005 19:57:24 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1CqLCj-0000VN-8p for emacs-devel@gnu.org; Sun, 16 Jan 2005 19:57:14 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1CqLCf-0000Nz-2D for emacs-devel@gnu.org; Sun, 16 Jan 2005 19:57:09 -0500 Original-Received: from [128.103.101.20] (helo=physics.harvard.edu) by monty-python.gnu.org with esmtp (TLSv1:RC4-SHA:128) (Exim 4.34) id 1CqKrp-0007DC-CG for emacs-devel@gnu.org; Sun, 16 Jan 2005 19:35:37 -0500 Original-Received: from pool-68-162-239-222.bos.east.verizon.net ([68.162.239.222] helo=ibm-a31) by physics.harvard.edu with asmtp (TLS-1.0:RSA_ARCFOUR_MD5:16) (Exim 4.34) id 1CqKrp-0004rI-10 for emacs-devel@gnu.org; Sun, 16 Jan 2005 19:35:37 -0500 Original-To: emacs-devel@gnu.org X-X-Sender: coldwell@physics.harvard.edu X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:32277 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:32277 I realize that I should expect problems if I choose to live on the bleeding edge, but I figure I might as well report this problem just in case the developers aren't already aware of it. The problem is with Emacs 21.3.50.1 that I checked out from CVS sources and compiled using the emacs/mac/make-package shell script on the Macintosh OS X (10.3.7). If I am editing in tex-mode and I run the function 'tex-file' (by default bound to C-c C-f) emacs goes into an infinite loop. The loop is in the function lisp/tex-mode.el:tex-start-shell (defun tex-start-shell () (with-current-buffer (make-comint "tex-shell" (or tex-shell-file-name (getenv "ESHELL") shell-file-name) nil) (let ((proc (get-process "tex-shell"))) (set-process-sentinel proc 'tex-shell-sentinel) (set-process-query-on-exit-flag proc nil) (tex-shell) (while (zerop (buffer-size)) (sleep-for 1))))) The function creates a shell using "make-comint", then waits for the shell to start in the loop at the bottom. Presumably, when the shell has started, it will issue a prompt and the (buffer-size) procedure will return non-zero and break out of the loop. The problem is that it never does. I am informed by Andreas Schwab that ptys are broken on Mac OS X, and therefore process-connection-type is set to nil so instead of allocating a pseudo-terminal to communicate with the sub-process emacs uses a pipe. The shell discovers that its not connected to a terminal and runs as non-interactive, suppressing the prompts and causing the infinite loop I describe above. My proposed solution is a tiny patch: --- emacs/lisp/textmodes/tex-mode.el.~1.153.~ Sat Dec 11 17:00:38 2004 +++ emacs/lisp/textmodes/tex-mode.el Sun Jan 16 13:59:50 2005 @@ -1495,7 +1495,8 @@ (make-comint "tex-shell" (or tex-shell-file-name (getenv "ESHELL") shell-file-name) - nil) + nil + "-i") (let ((proc (get-process "tex-shell"))) (set-process-sentinel proc 'tex-shell-sentinel) (set-process-query-on-exit-flag proc nil) This adds the "-i" switch to the command line that exec's the shell, causing it to run interactively. I have tested this on Mac OS X and it did solve the problem. A very similar "-i" switch appears in lisp/shell.el ("M-x shell"). Chip -- Charles M. "Chip" Coldwell "Turn on, log in, tune out"