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: Emanuele Giaquinta
Subject: Re: support for rxvt-unicode in rxvt.el
Date: Wed, 21 Sep 2005 21:54:48 +0200

On 9/21/05, Stefan Monnier <address@hidden> wrote:

> Such key sequences have been added to xterm.el because at some point they've
> been found to be necessary.  Maybe nowadays they're redundant.  If they're
> not necessary for rxvt.el, better not add them.  Removing them from xterm.el
> is more delicate since we'd need to know for sure that they're
> always unnecessary, otherwise we might (re)introduce bugs.

Fine, follows an updated patch.
BTW I've noticed Dan has changed the definitions of white and
brightblack in rxvt.el; Dan, what is the reason for this change? The
previous ones were the definitions of rxvt.

--- rxvt.el     2005-09-21 13:02:55.000000000 +0200
+++ rxvt.el     2005-09-21 21:39:13.000000000 +0200
@@ -146,8 +146,8 @@
     (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])
@@ -210,6 +210,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))))
     ;; Modifying color mappings means realized faces don't use the
     ;; right colors, so clear them.
     (clear-face-cache)))




reply via email to

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