(@code{shell-pushd-dunique}). The values you choose should match the
underlying shell, of course.
+@vindex comint-terminfo-terminal
+Comint mode sets the @env{TERM} environment variable to a safe default
+value, but this value disables some useful features. For example,
+color is disabled for applications that use @env{TERM} to determine if
+color is supported. Therefore, Emacs provides an option
+@code{comint-terminfo-terminal}, which you can set to a terminal that
+is present in your system's terminfo database, in order to take
+advantage of advanced features of that terminal.
+
@node Terminal emulator
@subsection Emacs Terminal Emulator
@findex term
*** New user option 'comint-move-point-for-matching-input' to control
where to place point after 'C-c M-r' and 'C-c M-s'.
++++
+*** New user option 'comint-terminfo-terminal'.
+This option allows control of the value of the TERM environment
+variable Emacs puts into the environment of the Comint mode and its
+derivatives, such as Shell mode and Compilation Shell minor-mode. The
+default is "dumb", for compatibility with previous behavior.
+
** Compilation mode
---
:type 'hook
:group 'comint)
+(defcustom comint-terminfo-terminal "dumb"
+ "Value to use for TERM when the system uses terminfo."
+ :type 'string
+ :group 'comint)
+
(defvar comint-mode-map
(let ((map (make-sparse-keymap)))
;; Keys:
(defun comint-exec-1 (name buffer command switches)
(let ((process-environment
(nconc
- ;; If using termcap, we specify `emacs' as the terminal type
- ;; because that lets us specify a width.
- ;; If using terminfo, we specify `dumb' because that is
- ;; a defined terminal type. `emacs' is not a defined terminal type
- ;; and there is no way for us to define it here.
- ;; Some programs that use terminfo get very confused
- ;; if TERM is not a valid terminal type.
- ;; ;; There is similar code in compile.el.
- (if (and (boundp 'system-uses-terminfo) system-uses-terminfo)
- (list "TERM=dumb" "TERMCAP="
- (format "COLUMNS=%d" (window-width)))
- (list "TERM=emacs"
- (format "TERMCAP=emacs:co#%d:tc=unknown:" (window-width))))
+ (comint-term-environment)
(list (format "INSIDE_EMACS=%s,comint" emacs-version))
process-environment))
(default-directory
(set-process-coding-system proc decoding encoding))
proc))
+(defun comint-term-environment ()
+ "Return an environment variable list for terminal configuration."
+ ;; If using termcap, we specify `emacs' as the terminal type
+ ;; because that lets us specify a width.
+ ;; If using terminfo, we default to `dumb' because that is
+ ;; a defined terminal type. `emacs' is not a defined terminal type
+ ;; and there is no way for us to define it here.
+ ;; Some programs that use terminfo get very confused
+ ;; if TERM is not a valid terminal type.
+ (if (and (boundp 'system-uses-terminfo) system-uses-terminfo)
+ (list (format "TERM=%s" comint-terminfo-terminal)
+ "TERMCAP="
+ (format "COLUMNS=%d" (window-width)))
+ (list "TERM=emacs"
+ (format "TERMCAP=emacs:co#%d:tc=unknown:" (window-width)))))
+
(defun comint-nonblank-p (str)
"Return non-nil if STR contains non-whitespace syntax."
(not (string-match "\\`\\s *\\'" str)))
(let ((process-environment
(append
compilation-environment
- (if (if (boundp 'system-uses-terminfo);`If' for compiler warning.
- system-uses-terminfo)
- (list "TERM=dumb" "TERMCAP="
- (format "COLUMNS=%d" (window-width)))
- (list "TERM=emacs"
- (format "TERMCAP=emacs:co#%d:tc=unknown:"
- (window-width))))
+ (comint-term-environment)
(list (format "INSIDE_EMACS=%s,compile" emacs-version))
(copy-sequence process-environment))))
(set (make-local-variable 'compilation-arguments)