From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Emacs only provides a dumb TERM Date: 01 Jun 2004 19:07:23 -0400 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1086131291 24428 80.91.224.253 (1 Jun 2004 23:08:11 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 1 Jun 2004 23:08:11 +0000 (UTC) Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Wed Jun 02 01:08:02 2004 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1BVIMT-0002Ho-00 for ; Wed, 02 Jun 2004 01:08:01 +0200 Original-Received: from lists.gnu.org ([199.232.76.165]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1BVIMT-000791-00 for ; Wed, 02 Jun 2004 01:08:01 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BVIMj-0004uV-AD for emacs-devel@quimby.gnus.org; Tue, 01 Jun 2004 19:08:17 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1BVIMf-0004tM-BC for emacs-devel@gnu.org; Tue, 01 Jun 2004 19:08:13 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1BVIMb-0004nr-Ng for emacs-devel@gnu.org; Tue, 01 Jun 2004 19:08:12 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BVIMb-0004ng-IR for emacs-devel@gnu.org; Tue, 01 Jun 2004 19:08:09 -0400 Original-Received: from [206.47.199.164] (helo=simmts6-srv.bellnexxia.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1BVILt-0006NE-71 for emacs-devel@gnu.org; Tue, 01 Jun 2004 19:07:25 -0400 Original-Received: from empanada.local ([67.70.165.15]) by simmts6-srv.bellnexxia.net (InterMail vM.5.01.06.05 201-253-122-130-105-20030824) with ESMTP id <20040601230723.NMMU28020.simmts6-srv.bellnexxia.net@empanada.local>; Tue, 1 Jun 2004 19:07:23 -0400 Original-Received: by empanada.local (Postfix, from userid 502) id 3148C1C2444; Tue, 1 Jun 2004 19:07:23 -0400 (EDT) Original-To: emacs-devel@gnu.org Original-Lines: 93 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:24366 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:24366 It has happened several times that processes run by Emacs use funny control sequences thinking they are run in an xterm or some such. This has been fixed in some packages such as compile.el by explicitly setting TERM to "dumb" before running the underlying process. A while back I had suggested to do that globally since it never makes any sense for a subprocess to use the TERM setting that Emacs received (since subprocesses never have direct access to the terminal in which Emacs is running, if any). At that time I'd been told that it was probably a good idea but that we should wait for a better time to make the change. I think now is a good time for that. So I suggest the patch below. Stefan PS: The patch actually includes a few other changes, which are just code simplifications. The most drastic simplification is the load-path loop where I remove the unused `new' var, then remove the redundant (car tail) arg of expand-file-name, and remove the stranegly empty condition-cases, and finally use dolist. --- orig/lisp/startup.el +++ mod/lisp/startup.el @@ -293,8 +293,8 @@ (let* ((this-dir (car dirs)) (contents (directory-files this-dir)) (default-directory this-dir) - (canonicalized (and (eq system-type 'windows-nt) - (untranslated-canonical-name this-dir)))) + (canonicalized (if (fboundp 'untranslated-canonical-name) + (untranslated-canonical-name this-dir)))) ;; The Windows version doesn't report meaningful inode ;; numbers, so use the canonicalized absolute file name of the ;; directory instead. @@ -343,12 +343,14 @@ ;; Give *Messages* the same default-directory as *scratch*, ;; just to keep things predictable. (let ((dir default-directory)) - (save-excursion - (set-buffer (get-buffer "*Messages*")) + (with-current-buffer "*Messages*" (setq default-directory dir))) ;; `user-full-name' is now known; reset its standard-value here. (put 'user-full-name 'standard-value (list (default-value 'user-full-name))) + ;; Subprocesses of Emacs do not have direct access to the terminal, + ;; so unless told otherwise they should only assume a dumb terminal. + (setenv "TERM" "dumb") ;; For root, preserve owner and group when editing files. (if (equal (user-uid) 0) (setq backup-by-copying-when-mismatch t)) @@ -357,19 +357,12 @@ ;; of that dir into load-path, ;; Look for a leim-list.el file too. Loading it will register ;; available input methods. - (let ((tail load-path) - new) - (while tail - (push (car tail) new) - (condition-case nil - (let ((default-directory (car tail))) - (load (expand-file-name "subdirs.el" (car tail)) t t t))) - (condition-case nil - (let ((default-directory (car tail))) - (load (expand-file-name "leim-list.el" (car tail)) t t t))) - (setq tail (cdr tail)))) + (dolist (dir load-path) + (let ((default-directory dir)) + (load (expand-file-name "subdirs.el") t t t)) + (let ((default-directory dir)) + (load (expand-file-name "leim-list.el") t t t))) - (if (not (eq system-type 'vax-vms)) - (progn + (unless (eq system-type 'vax-vms) ;; If the PWD environment variable isn't accurate, delete it. (let ((pwd (getenv "PWD"))) (and (stringp pwd) @@ -382,7 +375,7 @@ "."))) (setq process-environment (delete (concat "PWD=" pwd) - process-environment))))))) + process-environment)))))) (setq default-directory (abbreviate-file-name default-directory)) (let ((menubar-bindings-done nil)) (unwind-protect