Subject: Line number faces should check for remapping of the default face
From: Dario Gjorgjevski <[email-masked]>
To: [email-masked]
Date: Sat, 27 Apr 2019 14:52:10 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Currently, the line number faces do not check for remapping of the
default face and use its attributes directly.  In the default
configuration, this has no adverse effects since the `line-number' face
inherits from `default' explicitly, so any remapping is considered there.

However, there is no need to have `line-number' inherit from `default'
explicitly since it already merges DEFAULT_FACE_ID.  Instead, we can
check for remapping of DEFAULT_FACE_ID prior to merging the faces.

The patch shown below accomplishes that.

diff --git a/src/xdisp.c b/src/xdisp.c
index d52d1333a0..1e7e31fb8a 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -21176,9 +21176,10 @@ maybe_produce_line_number (struct it *it)
   char lnum_buf[INT_STRLEN_BOUND (ptrdiff_t) + 1];
   bool beyond_zv = IT_BYTEPOS (*it) >= ZV_BYTE ? true : false;
   ptrdiff_t lnum_offset = -1; /* to produce 1-based line numbers */
-  int lnum_face_id = merge_faces (it->w, Qline_number, 0, DEFAULT_FACE_ID);
+  int base_face_id = lookup_basic_face (it->w, it->f, DEFAULT_FACE_ID);
+  int lnum_face_id = merge_faces (it->w, Qline_number, 0, base_face_id);
   int current_lnum_face_id
-    = merge_faces (it->w, Qline_number_current_line, 0, DEFAULT_FACE_ID);
+    = merge_faces (it->w, Qline_number_current_line, 0, base_face_id);
   /* Compute point's line number if needed.  */
   if ((EQ (Vdisplay_line_numbers, Qrelative)
        || EQ (Vdisplay_line_numbers, Qvisual)

-- 
Dario Gjorgjevski :: +389 (0)70 784 142