unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Emacs only provides a dumb TERM
@ 2004-06-01 23:07 Stefan Monnier
  2004-06-01 23:23 ` Kim F. Storm
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Stefan Monnier @ 2004-06-01 23:07 UTC (permalink / raw)



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

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

* Re: Emacs only provides a dumb TERM
  2004-06-01 23:07 Emacs only provides a dumb TERM Stefan Monnier
@ 2004-06-01 23:23 ` Kim F. Storm
  2004-06-02 17:37 ` Richard Stallman
  2004-08-20 22:40 ` Stefan Monnier
  2 siblings, 0 replies; 5+ messages in thread
From: Kim F. Storm @ 2004-06-01 23:23 UTC (permalink / raw)
  Cc: emacs-devel

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> 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).

> So I suggest the patch below.

Looks good.

-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk

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

* Re: Emacs only provides a dumb TERM
  2004-06-01 23:07 Emacs only provides a dumb TERM Stefan Monnier
  2004-06-01 23:23 ` Kim F. Storm
@ 2004-06-02 17:37 ` Richard Stallman
  2004-08-20 22:40 ` Stefan Monnier
  2 siblings, 0 replies; 5+ messages in thread
From: Richard Stallman @ 2004-06-02 17:37 UTC (permalink / raw)
  Cc: emacs-devel

These changes look good, but some of them are nontrivial and might
cause bugs, and they are unrelated.  So please describe each of the
nontrivial changes carefully in the change log.

I suggest also installing the trivial changes separately.

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

* Re: Emacs only provides a dumb TERM
  2004-06-01 23:07 Emacs only provides a dumb TERM Stefan Monnier
  2004-06-01 23:23 ` Kim F. Storm
  2004-06-02 17:37 ` Richard Stallman
@ 2004-08-20 22:40 ` Stefan Monnier
  2004-08-27 21:08   ` Andreas Schwab
  2 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2004-08-20 22:40 UTC (permalink / raw)


> 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.

Installed.


        Stefan

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

* Re: Emacs only provides a dumb TERM
  2004-08-20 22:40 ` Stefan Monnier
@ 2004-08-27 21:08   ` Andreas Schwab
  0 siblings, 0 replies; 5+ messages in thread
From: Andreas Schwab @ 2004-08-27 21:08 UTC (permalink / raw)
  Cc: emacs-devel

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> 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.
>
> Installed.

This breaks startup on ttys, term/$TERM.el is no longer loaded.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

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

end of thread, other threads:[~2004-08-27 21:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-06-01 23:07 Emacs only provides a dumb TERM Stefan Monnier
2004-06-01 23:23 ` Kim F. Storm
2004-06-02 17:37 ` Richard Stallman
2004-08-20 22:40 ` Stefan Monnier
2004-08-27 21:08   ` Andreas Schwab

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).