From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Re: Diff mode faces Date: Sun, 19 Jun 2005 16:09:47 +0300 Organization: JURTA Message-ID: <87psuiqzcj.fsf@jurta.org> References: <87oea5urwm.fsf@jurta.org> <87psujj0h0.fsf@jurta.org> <86hdfv1y9b.fsf@blue.stonehenge.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1119187684 6161 80.91.229.2 (19 Jun 2005 13:28:04 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 19 Jun 2005 13:28:04 +0000 (UTC) Cc: emacs-devel@gnu.org, merlyn@stonehenge.com Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jun 19 15:28:01 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1Djzpx-00036I-4C for ged-emacs-devel@m.gmane.org; Sun, 19 Jun 2005 15:27:45 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Djzvy-0001pA-HM for ged-emacs-devel@m.gmane.org; Sun, 19 Jun 2005 09:33:58 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DjzuC-0001IT-TZ for emacs-devel@gnu.org; Sun, 19 Jun 2005 09:32:10 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Djzu0-0001Bm-0C for emacs-devel@gnu.org; Sun, 19 Jun 2005 09:32:00 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Djztx-00018D-Gb for emacs-devel@gnu.org; Sun, 19 Jun 2005 09:31:53 -0400 Original-Received: from [194.126.101.111] (helo=mail.neti.ee) by monty-python.gnu.org with esmtp (Exim 4.34) id 1Djzkg-0003mL-IG; Sun, 19 Jun 2005 09:22:18 -0400 Original-Received: from mail.neti.ee (80-235-34-231-dsl.mus.estpak.ee [80.235.34.231]) by Relayhost1.neti.ee (Postfix) with ESMTP id 9E3073C4E; Sun, 19 Jun 2005 16:19:49 +0300 (EEST) Original-To: Eli Zaretskii In-Reply-To: (Eli Zaretskii's message of "Sat, 18 Jun 2005 18:46:38 +0200") User-Agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux) X-Virus-Scanned: by amavisd-new-2.2.1 (20041222) (Debian) at neti.ee 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:39109 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:39109 >> Cc: Eli Zaretskii , emacs-devel@gnu.org >> From: merlyn@stonehenge.com (Randal L. Schwartz) >> Date: 18 Jun 2005 08:27:12 -0700 >> >> Is there no way to switch automatically to a proper set of darker >> colors when the main text is black instead of white? > > Yes, it's called background-mode. I see there is one problem with background-mode on tty. Unlike X, on tty Emacs doesn't adjust background-mode after changing the background color with any of the known methods: `set-background-color' command, or customizing the background color of the default face. It seems the correct place to fix this is `modify-frame-parameters'. The call to Qframe_update_face_colors is duplicated from the function `update_face_from_frame_parameter' in the patch below. With this change `frame-set-background-mode' gets called, so it updates background-mode after every change of the background color on tty. Index: src/frame.c =================================================================== RCS file: /cvsroot/emacs/emacs/src/frame.c,v retrieving revision 1.316 diff -u -r1.316 frame.c --- src/frame.c 10 Jun 2005 02:22:11 -0000 1.316 +++ src/frame.c 19 Jun 2005 11:42:05 -0000 @@ -2313,6 +2313,13 @@ prop = parms[i]; val = values[i]; store_frame_param (f, prop, val); + + if (EQ (prop, Qbackground_color)) { + /* Changing the background color might change the background + mode, so that we have to load new defface specs. Call + frame-update-face-colors to do that. */ + call1 (Qframe_update_face_colors, frame); + } } } Index: src/dispextern.h =================================================================== RCS file: /cvsroot/emacs/emacs/src/dispextern.h,v retrieving revision 1.202 diff -u -r1.202 dispextern.h --- src/dispextern.h 17 Jun 2005 14:02:03 -0000 1.202 +++ src/dispextern.h 19 Jun 2005 11:43:31 -0000 @@ -2793,6 +2793,7 @@ int merge_faces P_ ((struct frame *, Lisp_Object, int, int)); int compute_char_face P_ ((struct frame *, int, Lisp_Object)); void free_all_realized_faces P_ ((Lisp_Object)); +extern Lisp_Object Qframe_update_face_colors; extern Lisp_Object Qforeground_color, Qbackground_color; extern char unspecified_fg[], unspecified_bg[]; void free_realized_multibyte_face P_ ((struct frame *, int)); -- Juri Linkov http://www.jurta.org/emacs/