From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dan Nicolaescu Newsgroups: gmane.emacs.devel Subject: Re: support for rxvt-unicode in rxvt.el Date: Wed, 21 Sep 2005 09:29:09 -0700 Message-ID: <200509211629.j8LGTCKE019350@scanner2.ics.uci.edu> References: <20050921132431.GA5008@host91-100.pool871.interbusiness.it> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1127320606 25268 80.91.229.2 (21 Sep 2005 16:36:46 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 21 Sep 2005 16:36:46 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Sep 21 18:36:45 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EI7a7-0002eL-PW for ged-emacs-devel@m.gmane.org; Wed, 21 Sep 2005 18:36:28 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EI7a7-0003Ne-93 for ged-emacs-devel@m.gmane.org; Wed, 21 Sep 2005 12:36:27 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EI7Yu-0002hh-D3 for emacs-devel@gnu.org; Wed, 21 Sep 2005 12:35:12 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EI7Ym-0002dj-Ut for emacs-devel@gnu.org; Wed, 21 Sep 2005 12:35:05 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EI7Yj-0002XG-8P for emacs-devel@gnu.org; Wed, 21 Sep 2005 12:35:01 -0400 Original-Received: from [128.195.1.36] (helo=scanner2.ics.uci.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EI7Ua-0001zW-Iq for emacs-devel@gnu.org; Wed, 21 Sep 2005 12:30:44 -0400 Original-Received: from vino.ics.uci.edu (dann@vino.ics.uci.edu [128.195.11.198]) by scanner2.ics.uci.edu (8.12.10/8.12.10) with ESMTP id j8LGTCKE019350; Wed, 21 Sep 2005 09:29:12 -0700 (PDT) Original-To: Emanuele Giaquinta Original-Lines: 67 X-ICS-MailScanner: Found to be clean X-ICS-MailScanner-SpamCheck: not spam (whitelisted), SpamAssassin (score=-99.323, required 5, J_CHICKENPOX_42, TW_RX, USER_IN_WHITELIST) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:43132 Archived-At: > --- 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...