Zen Emacs

Here's a quick patch to set a pleasant background (PNG image) in Emacs. This needs GTK with cairo build (you need the cairo API cairo_image_surface_create_from_png()).


 






 

 

modified   src/xterm.c
@@ -408,6 +408,8 @@ x_end_cr_clip (struct frame *f)
     x_mark_frame_dirty (f);
 }
 
+static cairo_surface_t *image;
+
 void
 x_set_cr_source_with_gc_foreground (struct frame *f, GC gc)
 {
@@ -432,6 +434,10 @@ x_set_cr_source_with_gc_background (struct frame *f, GC gc)
   x_query_colors (f, &color, 1);
   cairo_set_source_rgb (FRAME_CR_CONTEXT (f), color.red / 65535.0,
             color.green / 65535.0, color.blue / 65535.0);
+
+  if (!image)
+     image = cairo_image_surface_create_from_png ("/home/anand/back.png");
+  cairo_set_source_surface(FRAME_CR_CONTEXT (f), image, 0, 0);
 }
 
 static const cairo_user_data_key_t xlib_surface_key, saved_drawable_key;



Emacs uses the foreground and background colors defined for faces. This includes highlighted text (mouse and region faces). If you want to use a different background from the face definition, you need to ensure you only draw that when face background color is same as graphics context background.


Comments

Popular posts from this blog

GNU Emacs as a Comic Book Reader

Mozilla Readability in GNU Emacs

Data Visualization with GNU Emacs