all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Emacs 21.3.50.1 (CVS sources) MacOS X tex-mode bug
@ 2005-01-17  0:34 Chip Coldwell
  2005-01-17 16:08 ` Stefan Monnier
  0 siblings, 1 reply; 13+ messages in thread
From: Chip Coldwell @ 2005-01-17  0:34 UTC (permalink / raw)



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"

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2005-02-25  6:19 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-17  0:34 Emacs 21.3.50.1 (CVS sources) MacOS X tex-mode bug Chip Coldwell
2005-01-17 16:08 ` Stefan Monnier
2005-01-17 17:41   ` Steven Tamm
2005-01-17 18:59     ` Stefan Monnier
2005-01-18  4:08       ` Steven Tamm
2005-01-18 11:14         ` YAMAMOTO Mitsuharu
2005-01-18 17:31           ` Steven Tamm
2005-02-25  6:19           ` YAMAMOTO Mitsuharu
2005-01-19  0:49   ` Richard Stallman
2005-01-19 19:16     ` Steven Tamm
2005-01-20 21:32       ` Richard Stallman
2005-01-21  6:20       ` Nozomu Ando
2005-01-21 19:40         ` Steven Tamm

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.