The current line number is displayed in a different face,
@code{line-number-current-line}, so you can make the current line's
number have a distinct appearance, which will help locating the line
-showing point.
+showing point. Additional faces @code{line-number-major-tick} and
+@code{line-number-minor-tick} can be used to highlight the line numbers
+of lines which are a multiple of certain numbers. Customize
+@code{display-line-numbers-major-tick} and
+@code{display-line-numbers-minor-tick} respectively to set those
+numbers.
@vindex visible-bell
If the variable @code{visible-bell} is non-@code{nil}, Emacs attempts
*** When called interactively with a prefix arg 'C-u', 'desktop-read'
now prompts the user for the directory containing the desktop file.
++++
+** display-line-numbers-mode
+*** New faces 'line-number-major-tick' and 'line-number-minor-tick',
+and customizable variables 'display-line-numbers-major-tick' and
+'display-line-numbers-minor-tick' can be used to highlight the line
+numbers of lines multiple of certain numbers.
+
+++
** winner
*** A new variable, 'winner-boring-buffers-regexp', has been added.
(const :tag "Count lines from beginning of narrowed region"
:value nil))
"26.1")
+ (display-line-numbers-major-tick
+ display-line-numbers
+ (choice
+ (const :tag "No line" 0)
+ (integer :tag "Multiples of"
+ :value 10))
+ "27.1")
+ (display-line-numbers-minor-tick
+ display-line-numbers
+ (choice
+ (const :tag "No line" 0)
+ (integer :tag "Multiples of"
+ :value 5))
+ "27.1")
(display-fill-column-indicator
display-fill-column-indicator
:group 'basic-faces
:group 'display-line-numbers)
+(defface line-number-major-tick
+ '((t :inherit line-number))
+ "Face for highlighting \"major ticks\" (as in a ruler).
+When `display-line-numbers-major-tick' is positive, highlight
+the line numbers of lines which are a multiple of its value.
+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-minor-tick
+ '((t :inherit line-number))
+ "Face for highlighting \"minor ticks\" (as in a ruler).
+When `display-line-numbers-minor-tick' is positive, highlight
+the line numbers of lines which are a multiple of its value.
+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
'((t :inherit shadow :weight normal :slant normal
display-line-numbers-width
display-line-numbers-current-absolute
display-line-numbers-widen
+ display-line-numbers-major-tick
+ display-line-numbers-minor-tick
display-fill-column-indicator
display-fill-column-indicator-column
display-fill-column-indicator-character
empty lines beyond EOB. */
&& it->what != IT_EOB)
tem_it.face_id = current_lnum_face_id;
+ else if (display_line_numbers_major_tick > 0
+ && (lnum_to_display % display_line_numbers_major_tick == 0))
+ tem_it.face_id = merge_faces (it->w, Qline_number_major_tick,
+ 0, DEFAULT_FACE_ID);
+ else if (display_line_numbers_minor_tick > 0
+ && (lnum_to_display % display_line_numbers_minor_tick == 0))
+ tem_it.face_id = merge_faces (it->w, Qline_number_minor_tick,
+ 0, DEFAULT_FACE_ID);
else
tem_it.face_id = lnum_face_id;
if (beyond_zv
/* Names of the faces used to display line numbers. */
DEFSYM (Qline_number, "line-number");
DEFSYM (Qline_number_current_line, "line-number-current-line");
+ DEFSYM (Qline_number_major_tick, "line-number-major-tick");
+ DEFSYM (Qline_number_minor_tick, "line-number-minor-tick");
/* Name of a text property which disables line-number display. */
DEFSYM (Qdisplay_line_numbers_disable, "display-line-numbers-disable");
DEFSYM (Qdisplay_fill_column_indicator_character, "display-fill-column-indicator-character");
Fmake_variable_buffer_local (Qdisplay_fill_column_indicator_character);
+ DEFVAR_INT ("display-line-numbers-major-tick", display_line_numbers_major_tick,
+ doc: /* If an integer N > 0, highlight line number of every Nth line.
+The line number is shown with the `line-number-major-tick' face.
+Otherwise, no special highlighting is done every Nth line.
+Note that major ticks take precedence over minor ticks. */);
+ display_line_numbers_major_tick = 0;
+
+ DEFVAR_INT ("display-line-numbers-minor-tick", display_line_numbers_minor_tick,
+ doc: /* If an integer N > 0, highlight line number of every Nth line.
+The line number is shown with the `line-number-minor-tick' face.
+Otherwise, no special highlighting is done every Nth line.
+Note that major ticks take precedence over minor ticks. */);
+ display_line_numbers_minor_tick = 0;
+
DEFVAR_BOOL ("inhibit-eval-during-redisplay", inhibit_eval_during_redisplay,
doc: /* Non-nil means don't eval Lisp during redisplay. */);
inhibit_eval_during_redisplay = false;