/[emacs]/emacs/lisp/term/xterm.el
ViewVC logotype

Diff of /emacs/lisp/term/xterm.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.18 by lute, Mon Jul 4 16:49:24 2005 UTC revision 1.19 by dann, Fri Jul 22 18:40:14 2005 UTC
# Line 26  Line 26 
26    
27  ;;; Code:  ;;; Code:
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    
36  ;;; The terminal intialization C code file might have initialized  ;;; The terminal intialization C code file might have initialized
37  ;;; function keys F13->F60 from the termcap/terminfo information.  On  ;;; function keys F13->F60 from the termcap/terminfo information.  On
38  ;;; a PC-style keyboard these keys correspond to  ;;; a PC-style keyboard these keys correspond to
# Line 359  versions of xterm." Line 366  versions of xterm."
366      ;; right colors, so clear them.      ;; right colors, so clear them.
367      (clear-face-cache)))      (clear-face-cache)))
368    
 ;; rxvt puts the default colors into an environment variable  
 ;; COLORFGBG.  We use this to set the background mode in a more  
 ;; intelligent way than the default guesswork in startup.el.  
 (defun xterm-rxvt-set-background-mode ()  
   "Set background mode as appropriate for the default rxvt colors."  
   (let ((fgbg (getenv "COLORFGBG"))  
         bg rgb)  
     (setq default-frame-background-mode 'light)  
     (when (and fgbg  
                (string-match ".*;\\([0-9][0-9]?\\)\\'" fgbg))  
       (setq bg (string-to-number (substring fgbg (match-beginning 1))))  
       ;; The next line assumes that xterm-standard-colors are ordered  
       ;; by the color index in the ascending order!  
       (setq rgb (car (cddr (nth bg xterm-standard-colors))))  
       ;; See the commentary in frame-set-background-mode about the  
       ;; computation below.  
       (if (< (apply '+ rgb)  
              ;; The following line assumes that white is the 15th  
              ;; color in xterm-standard-colors.  
              (* (apply '+ (car (cddr (nth 15 xterm-standard-colors)))) 0.6))  
           (setq default-frame-background-mode 'dark)))  
     (frame-set-background-mode (selected-frame))))  
   
369  ;; Do it!  ;; Do it!
370  (xterm-register-default-colors)  (xterm-register-default-colors)
 ;; If this xterm is actually a disguised rxvt, be more intelligent about  
 ;; determining the background mode.  
 (and (getenv "COLORTERM")  
      (string-match "\\`rxvt" (getenv "COLORTERM"))  
      (xterm-rxvt-set-background-mode))  
371  ;; This recomputes all the default faces given the colors we've just set up.  ;; This recomputes all the default faces given the colors we've just set up.
372  (tty-set-up-initial-frame-faces)  (tty-set-up-initial-frame-faces)
373    
374    )
375  ;; arch-tag: 12e7ebdd-1e6c-4b25-b0f9-35ace25e855a  ;; arch-tag: 12e7ebdd-1e6c-4b25-b0f9-35ace25e855a
376  ;;; xterm.el ends here  ;;; xterm.el ends here

Legend:
Removed from v.1.18  
changed lines
  Added in v.1.19

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26