diff options
| author | Allen Li | 2017-12-15 11:30:25 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2017-12-15 11:30:25 +0200 |
| commit | 8ed529f0f300487600ac49cff22cce09c45db94b (patch) | |
| tree | 73ae92d652246239b34d9aa1b793a6767d860f14 /lisp | |
| parent | 889f07c352f7e0deccf59353a60a45f2716551d8 (diff) | |
| download | emacs-8ed529f0f300487600ac49cff22cce09c45db94b.tar.gz emacs-8ed529f0f300487600ac49cff22cce09c45db94b.zip | |
Add option to configure comint TERM
* lisp/comint.el (comint-terminfo-terminal): New defcustom.
(comint-term-environment): New function for setting terminal options
(comint-exec-1): Use comint-term-environment. (Bug#29583)
* lisp/progmodes/compile.el (compilation-start): Use comint-term-environment.
* etc/NEWS:
* doc/emacs/misc.texi (Shell Options): Document the new option.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/comint.el | 35 | ||||
| -rw-r--r-- | lisp/progmodes/compile.el | 8 |
2 files changed, 23 insertions, 20 deletions
diff --git a/lisp/comint.el b/lisp/comint.el index dcf1ff794f9..7c56c259c49 100644 --- a/lisp/comint.el +++ b/lisp/comint.el | |||
| @@ -459,6 +459,11 @@ executed once when the buffer is created." | |||
| 459 | :type 'hook | 459 | :type 'hook |
| 460 | :group 'comint) | 460 | :group 'comint) |
| 461 | 461 | ||
| 462 | (defcustom comint-terminfo-terminal "dumb" | ||
| 463 | "Value to use for TERM when the system uses terminfo." | ||
| 464 | :type 'string | ||
| 465 | :group 'comint) | ||
| 466 | |||
| 462 | (defvar comint-mode-map | 467 | (defvar comint-mode-map |
| 463 | (let ((map (make-sparse-keymap))) | 468 | (let ((map (make-sparse-keymap))) |
| 464 | ;; Keys: | 469 | ;; Keys: |
| @@ -817,19 +822,7 @@ series of processes in the same Comint buffer. The hook | |||
| 817 | (defun comint-exec-1 (name buffer command switches) | 822 | (defun comint-exec-1 (name buffer command switches) |
| 818 | (let ((process-environment | 823 | (let ((process-environment |
| 819 | (nconc | 824 | (nconc |
| 820 | ;; If using termcap, we specify `emacs' as the terminal type | 825 | (comint-term-environment) |
| 821 | ;; because that lets us specify a width. | ||
| 822 | ;; If using terminfo, we specify `dumb' because that is | ||
| 823 | ;; a defined terminal type. `emacs' is not a defined terminal type | ||
| 824 | ;; and there is no way for us to define it here. | ||
| 825 | ;; Some programs that use terminfo get very confused | ||
| 826 | ;; if TERM is not a valid terminal type. | ||
| 827 | ;; ;; There is similar code in compile.el. | ||
| 828 | (if (and (boundp 'system-uses-terminfo) system-uses-terminfo) | ||
| 829 | (list "TERM=dumb" "TERMCAP=" | ||
| 830 | (format "COLUMNS=%d" (window-width))) | ||
| 831 | (list "TERM=emacs" | ||
| 832 | (format "TERMCAP=emacs:co#%d:tc=unknown:" (window-width)))) | ||
| 833 | (list (format "INSIDE_EMACS=%s,comint" emacs-version)) | 826 | (list (format "INSIDE_EMACS=%s,comint" emacs-version)) |
| 834 | process-environment)) | 827 | process-environment)) |
| 835 | (default-directory | 828 | (default-directory |
| @@ -858,6 +851,22 @@ series of processes in the same Comint buffer. The hook | |||
| 858 | (set-process-coding-system proc decoding encoding)) | 851 | (set-process-coding-system proc decoding encoding)) |
| 859 | proc)) | 852 | proc)) |
| 860 | 853 | ||
| 854 | (defun comint-term-environment () | ||
| 855 | "Return an environment variable list for terminal configuration." | ||
| 856 | ;; If using termcap, we specify `emacs' as the terminal type | ||
| 857 | ;; because that lets us specify a width. | ||
| 858 | ;; If using terminfo, we default to `dumb' because that is | ||
| 859 | ;; a defined terminal type. `emacs' is not a defined terminal type | ||
| 860 | ;; and there is no way for us to define it here. | ||
| 861 | ;; Some programs that use terminfo get very confused | ||
| 862 | ;; if TERM is not a valid terminal type. | ||
| 863 | (if (and (boundp 'system-uses-terminfo) system-uses-terminfo) | ||
| 864 | (list (format "TERM=%s" comint-terminfo-terminal) | ||
| 865 | "TERMCAP=" | ||
| 866 | (format "COLUMNS=%d" (window-width))) | ||
| 867 | (list "TERM=emacs" | ||
| 868 | (format "TERMCAP=emacs:co#%d:tc=unknown:" (window-width))))) | ||
| 869 | |||
| 861 | (defun comint-nonblank-p (str) | 870 | (defun comint-nonblank-p (str) |
| 862 | "Return non-nil if STR contains non-whitespace syntax." | 871 | "Return non-nil if STR contains non-whitespace syntax." |
| 863 | (not (string-match "\\`\\s *\\'" str))) | 872 | (not (string-match "\\`\\s *\\'" str))) |
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index 4cce47e5d8c..c68001d2366 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el | |||
| @@ -1746,13 +1746,7 @@ Returns the compilation buffer created." | |||
| 1746 | (let ((process-environment | 1746 | (let ((process-environment |
| 1747 | (append | 1747 | (append |
| 1748 | compilation-environment | 1748 | compilation-environment |
| 1749 | (if (if (boundp 'system-uses-terminfo);`If' for compiler warning. | 1749 | (comint-term-environment) |
| 1750 | system-uses-terminfo) | ||
| 1751 | (list "TERM=dumb" "TERMCAP=" | ||
| 1752 | (format "COLUMNS=%d" (window-width))) | ||
| 1753 | (list "TERM=emacs" | ||
| 1754 | (format "TERMCAP=emacs:co#%d:tc=unknown:" | ||
| 1755 | (window-width)))) | ||
| 1756 | (list (format "INSIDE_EMACS=%s,compile" emacs-version)) | 1750 | (list (format "INSIDE_EMACS=%s,compile" emacs-version)) |
| 1757 | (copy-sequence process-environment)))) | 1751 | (copy-sequence process-environment)))) |
| 1758 | (set (make-local-variable 'compilation-arguments) | 1752 | (set (make-local-variable 'compilation-arguments) |