diff options
| author | Dan Nicolaescu | 2005-07-22 18:40:15 +0000 |
|---|---|---|
| committer | Dan Nicolaescu | 2005-07-22 18:40:15 +0000 |
| commit | 6a55dae2625af1e47376cd54115236abc874d288 (patch) | |
| tree | 8c8f80f94f72f3f08350986d3d41cc6b70549535 | |
| parent | 19292318e867a5c47b94591c43a3c2a751cc70d2 (diff) | |
| download | emacs-6a55dae2625af1e47376cd54115236abc874d288.tar.gz emacs-6a55dae2625af1e47376cd54115236abc874d288.zip | |
Load term/rxvt if the terminal is actually an
rxvt terminal.
(xterm-rxvt-set-background-mode): Remove, not used anymore.
| -rw-r--r-- | lisp/ChangeLog | 4 | ||||
| -rw-r--r-- | lisp/term/xterm.el | 36 |
2 files changed, 12 insertions, 28 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 4a685e22355..5c741ba6c4e 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,9 @@ | |||
| 1 | 2005-07-22 Dan Nicolaescu <dann@ics.uci.edu> | 1 | 2005-07-22 Dan Nicolaescu <dann@ics.uci.edu> |
| 2 | 2 | ||
| 3 | * term/xterm.el: Load term/rxvt if the terminal is actually an | ||
| 4 | rxvt terminal. | ||
| 5 | (xterm-rxvt-set-background-mode): Remove, not used anymore. | ||
| 6 | |||
| 3 | * term/rxvt.el (function-key-map): Use substitute-key-definition | 7 | * term/rxvt.el (function-key-map): Use substitute-key-definition |
| 4 | to bind {C,S,C-S}-{f1-f10}. Add a few missing key bindings. | 8 | to bind {C,S,C-S}-{f1-f10}. Add a few missing key bindings. |
| 5 | 9 | ||
diff --git a/lisp/term/xterm.el b/lisp/term/xterm.el index 17d7cde0e8a..1d700b727d3 100644 --- a/lisp/term/xterm.el +++ b/lisp/term/xterm.el | |||
| @@ -26,6 +26,13 @@ | |||
| 26 | 26 | ||
| 27 | ;;; Code: | 27 | ;;; Code: |
| 28 | 28 | ||
| 29 | ;;; rxvt terminals sometimes set the TERM variable to "xterm", but | ||
| 30 | ;;; rxvt's keybindings that are incompatible with xterm's. It is | ||
| 31 | ;;; better in that case to load rxvt's terminal initialization file. | ||
| 32 | (if (and (getenv "COLORTERM") | ||
| 33 | (string-match "\\`rxvt" (getenv "COLORTERM"))) | ||
| 34 | (load "term/rxvt") | ||
| 35 | |||
| 29 | ;;; The terminal intialization C code file might have initialized | 36 | ;;; The terminal intialization C code file might have initialized |
| 30 | ;;; function keys F13->F60 from the termcap/terminfo information. On | 37 | ;;; function keys F13->F60 from the termcap/terminfo information. On |
| 31 | ;;; a PC-style keyboard these keys correspond to | 38 | ;;; a PC-style keyboard these keys correspond to |
| @@ -359,38 +366,11 @@ versions of xterm." | |||
| 359 | ;; right colors, so clear them. | 366 | ;; right colors, so clear them. |
| 360 | (clear-face-cache))) | 367 | (clear-face-cache))) |
| 361 | 368 | ||
| 362 | ;; rxvt puts the default colors into an environment variable | ||
| 363 | ;; COLORFGBG. We use this to set the background mode in a more | ||
| 364 | ;; intelligent way than the default guesswork in startup.el. | ||
| 365 | (defun xterm-rxvt-set-background-mode () | ||
| 366 | "Set background mode as appropriate for the default rxvt colors." | ||
| 367 | (let ((fgbg (getenv "COLORFGBG")) | ||
| 368 | bg rgb) | ||
| 369 | (setq default-frame-background-mode 'light) | ||
| 370 | (when (and fgbg | ||
| 371 | (string-match ".*;\\([0-9][0-9]?\\)\\'" fgbg)) | ||
| 372 | (setq bg (string-to-number (substring fgbg (match-beginning 1)))) | ||
| 373 | ;; The next line assumes that xterm-standard-colors are ordered | ||
| 374 | ;; by the color index in the ascending order! | ||
| 375 | (setq rgb (car (cddr (nth bg xterm-standard-colors)))) | ||
| 376 | ;; See the commentary in frame-set-background-mode about the | ||
| 377 | ;; computation below. | ||
| 378 | (if (< (apply '+ rgb) | ||
| 379 | ;; The following line assumes that white is the 15th | ||
| 380 | ;; color in xterm-standard-colors. | ||
| 381 | (* (apply '+ (car (cddr (nth 15 xterm-standard-colors)))) 0.6)) | ||
| 382 | (setq default-frame-background-mode 'dark))) | ||
| 383 | (frame-set-background-mode (selected-frame)))) | ||
| 384 | |||
| 385 | ;; Do it! | 369 | ;; Do it! |
| 386 | (xterm-register-default-colors) | 370 | (xterm-register-default-colors) |
| 387 | ;; If this xterm is actually a disguised rxvt, be more intelligent about | ||
| 388 | ;; determining the background mode. | ||
| 389 | (and (getenv "COLORTERM") | ||
| 390 | (string-match "\\`rxvt" (getenv "COLORTERM")) | ||
| 391 | (xterm-rxvt-set-background-mode)) | ||
| 392 | ;; This recomputes all the default faces given the colors we've just set up. | 371 | ;; This recomputes all the default faces given the colors we've just set up. |
| 393 | (tty-set-up-initial-frame-faces) | 372 | (tty-set-up-initial-frame-faces) |
| 394 | 373 | ||
| 374 | ) | ||
| 395 | ;; arch-tag: 12e7ebdd-1e6c-4b25-b0f9-35ace25e855a | 375 | ;; arch-tag: 12e7ebdd-1e6c-4b25-b0f9-35ace25e855a |
| 396 | ;;; xterm.el ends here | 376 | ;;; xterm.el ends here |