emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: support for rxvt-unicode in rxvt.el


From: Dan Nicolaescu
Subject: Re: support for rxvt-unicode in rxvt.el
Date: Wed, 21 Sep 2005 09:29:09 -0700

>  --- rxvt.el  2005-09-21 13:02:55.000000000 +0200
>  +++ rxvt.el  2005-09-21 14:47:44.000000000 +0200
>  @@ -146,13 +146,19 @@
>       (define-key map "\e[3$" [S-delete])
>       (define-key map "\e[5$" [S-prior])
>       (define-key map "\e[6$" [S-next])
>  -    (define-key map "\e[8$" [S-end])
>       (define-key map "\e[7$" [S-home])
>  +    (define-key map "\e[8$" [S-end])
>       (define-key map "\e[d" [S-left])
>       (define-key map "\e[c" [S-right])
>       (define-key map "\e[a" [S-up])
>       (define-key map "\e[b" [S-down])
>   
>  +    ;; rxvt-unicode uses these key definitions for the cursor keys
>  +    (define-key map "\eOA" [up])
>  +    (define-key map "\eOB" [down])
>  +    (define-key map "\eOC" [right])
>  +    (define-key map "\eOD" [left])
>  +
>       ;; Use inheritance to let the main keymap override those defaults.
>       ;; This way we don't override terminfo-derived settings or settings
>       ;; made in the .emacs file.
>  @@ -210,6 +216,36 @@
>         (setq colors (cdr colors)
>           color (car colors)
>           ncolors (1- ncolors)))
>  +    (when (and (> ncolors 0) (= ncolors 72))  ; rxvt-unicode
>  +      ;; 64 non-gray colors
>  +      (let ((levels '(0 139 205 255))
>  +        (r 0) (g 0) (b 0))
>  +    (while (> ncolors 8)
>  +      (tty-color-define (format "color-%d" (- 88 ncolors))
>  +                        (- 88 ncolors)
>  +                        (mapcar 'rxvt-rgb-convert-to-16bit
>  +                                (list (nth r levels)
>  +                                      (nth g levels)
>  +                                      (nth b levels))))
>  +      (setq b (1+ b))
>  +      (if (> b 3)
>  +          (setq g (1+ g)
>  +                b 0))
>  +      (if (> g 3)
>  +          (setq r (1+ r)
>  +                g 0))
>  +      (setq ncolors (1- ncolors))))
>  +      ;; Now the 8 gray colors
>  +      (while (> ncolors 0)
>  +    (setq color (rxvt-rgb-convert-to-16bit
>  +                 (floor
>  +                  (if (= ncolors 8)
>  +                      46.36363636
>  +                    (+ (* (- 8 ncolors) 23.18181818) 69.54545454)))))
>  +    (tty-color-define (format "color-%d" (- 88 ncolors))
>  +                      (- 88 ncolors)
>  +                      (list color color color))
>  +    (setq ncolors (1- ncolors))))

If these are all the changes you need, then probably you don't need a
new term/rxvt-unicode.el file. 
The up, down, right and left key should be set from the rxvt-unicode terminfo
entry, so you don't need those define-keys. So if you just add the
color setting code to rxvt.el then everything should work. Can you
verify that the above is indeed true? 
IMHO it is better to avoid code duplication... 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]