On Mon, Sep 30, 2019 at 12:21 PM Eli Zaretskii <
address@hidden> wrote:
> Patches welcome.
To quote Barney Stinson, "Challenge accepted!"
> I don't think it should be too hard to write that.
Didn't know you were an optimist.
Ok. The following extremely simple patch (with no documentation, etc, and horrible, *horrible* face names because I couldn't think of anything better) seems to work in the various tests I've done in absolute, visual and relative modes.
Now, I'm not sure about code (try_cursor_movement and try_window_id) that compare the line-number and line-number-current-line faces for optimization. Performance seems to be fine, and I haven't seen any obvious visual glitch.
Also, this in maybe_produce_line_number:
/* Compute point's line number if needed. */
if ((EQ (Vdisplay_line_numbers, Qrelative)
|| EQ (Vdisplay_line_numbers, Qvisual)
|| lnum_face_id != current_lnum_face_id)
&& !it->pt_lnum)
should perhaps compare curremt_lnum_face_id also with the face_ids of the two new faces. ?
diff --git i/lisp/faces.el w/lisp/faces.el
index 9c5ffe1e59..0d9107a6a0 100644
--- i/lisp/faces.el
+++ w/lisp/faces.el
@@ -2391,4 +2391,35 @@ line-number-current-line
:group 'display-line-numbers)
+(defface line-number-ends-5
+ '((t :inherit line-number))
+ "Face for displaying line numbers that end in 5.
+That is, multiple of 5 but not of 10.
+This face is used when `display-line-numbers' is non-nil.
+
+If you customize the font of this face, make sure it is a
+monospaced font, otherwise line numbers will not line up,
+and text lines might move horizontally as you move through
+the buffer. Similarly, making this face's font different
+from that of the `line-number' face could produce such
+unwanted effects."
+ :version "27.1"
+ :group 'basic-faces
+ :group 'display-line-numbers)
+
+(defface line-number-ends-0
+ '((t :inherit line-number))
+ "Face for displaying line numbers that are multiples of 10.
+This face is used when `display-line-numbers' is non-nil.
+
+If you customize the font of this face, make sure it is a
+monospaced font, otherwise line numbers will not line up,
+and text lines might move horizontally as you move through
+the buffer. Similarly, making this face's font different
+from that of the `line-number' face could produce such
+unwanted effects."
+ :version "27.1"
+ :group 'basic-faces
+ :group 'display-line-numbers)
+
;; Definition stolen from display-line-numbers.
(defface fill-column-indicator
diff --git i/src/xdisp.c w/src/xdisp.c
index 95895ec3ac..7d5c0b11f4 100644
--- i/src/xdisp.c
+++ w/src/xdisp.c
@@ -21483,4 +21483,8 @@ maybe_produce_line_number (struct it *it)
int current_lnum_face_id
= merge_faces (it->w, Qline_number_current_line, 0, DEFAULT_FACE_ID);
+ int mul5_lnum_face_id
+ = merge_faces (it->w, Qline_number_ends_5, 0, DEFAULT_FACE_ID);
+ int mul10_lnum_face_id
+ = merge_faces (it->w, Qline_number_ends_0, 0, DEFAULT_FACE_ID);
/* Compute point's line number if needed. */
if ((EQ (Vdisplay_line_numbers, Qrelative)
@@ -21576,4 +21580,8 @@ maybe_produce_line_number (struct it *it)
&& it->what != IT_EOB)
tem_it.face_id = current_lnum_face_id;
+ else if (lnum_to_display % 10 == 0)
+ tem_it.face_id = mul10_lnum_face_id;
+ else if (lnum_to_display % 5 == 0)
+ tem_it.face_id = mul5_lnum_face_id;
else
tem_it.face_id = lnum_face_id;
@@ -32971,4 +32979,6 @@ syms_of_xdisp (void)
DEFSYM (Qline_number, "line-number");
DEFSYM (Qline_number_current_line, "line-number-current-line");
+ DEFSYM (Qline_number_ends_5, "line-number-ends-5");
+ DEFSYM (Qline_number_ends_0, "line-number-ends-0");
/* Name of a text property which disables line-number display. */
DEFSYM (Qdisplay_line_numbers_disable, "display-line-numbers-disable");