emacs-devel
[Top][All Lists]
Advanced

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

Re: Diff mode faces


From: Juri Linkov
Subject: Re: Diff mode faces
Date: Sun, 19 Jun 2005 16:09:47 +0300
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux)

>> Cc: Eli Zaretskii <address@hidden>, address@hidden
>> From: address@hidden (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/





reply via email to

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