0

I would like to know if Emacs treats empty portions of the frame as faces. I want to know because I wonder if the background of an Emacs frame is drawn separately of other elements on the screen.

EDIT: I have done some experiments and found that on X11, Emacs uses the function "x_clear_area" to fill in the background color of empty potions of the frame. Background for spaces and non-visible characters is handled by the draw method of the "font_driver" struct (xfont_draw/xftfont_draw).

EDIT2: Now I am very confused, there seem to be multiple places where the background is being drawn. Does anybody know where are all the places this happens on X11 build ?

  • Emacs draws rows during update_window using a combination of the data stored in the window's desired_matrix and current_matrix -- reusing whatever has not changed since the previous redisplay. As to unused area at the end of the glyph row before reaching the window edge, Emacs makes a decision what face to extend to the window edge. A GUI frame can have a parameter known as background-color, which is equivalent to the default face :background attribute: gnu.org/software/emacs/draft/manual/html_node/elisp/… – lawlist Jul 14 at 3:37
  • Thank you, I was very confused browsing the Emacs source code. Just to make sure, does this mean Emacs treats empty potions of the frame equally to any other ? – Strong will Jul 14 at 3:51
  • I am familiar with extend_face_to_end_of_line in xdisp.c in terms of filling the gap between the end of the text area of a glyph row and the end of the display line .... Other than the general case where the color has been filled in by the above-mentioned function, I am unaware of a special use-case for the gap between the end of a glyph row and the end of the display line. Perhaps another forum participant can think of an example ... There is a left margin area and a right margin area, and there are fringes ... gnu.org/software/emacs/manual/html_node/elisp/Window-Sizes.html – lawlist Jul 14 at 4:03
  • See the Elisp manual, node Font and Color Parameters. You can customize option default-frame-parameters to set the default background color you want. – Drew Jul 14 at 5:06
  • Sometimes you can get useful information from C-u C-x = (which gives you face under point), unfortunately, faces can be overlayed, but this will only give you the topmost one. – wvxvw Jul 14 at 15:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.