diff options
| -rw-r--r-- | doc/emacs/display.texi | 7 | ||||
| -rw-r--r-- | etc/NEWS | 7 | ||||
| -rw-r--r-- | lisp/cus-start.el | 14 | ||||
| -rw-r--r-- | lisp/faces.el | 34 | ||||
| -rw-r--r-- | lisp/frame.el | 2 | ||||
| -rw-r--r-- | src/xdisp.c | 24 |
6 files changed, 87 insertions, 1 deletions
diff --git a/doc/emacs/display.texi b/doc/emacs/display.texi index 84363d0f0d2..406feb8c127 100644 --- a/doc/emacs/display.texi +++ b/doc/emacs/display.texi | |||
| @@ -1871,7 +1871,12 @@ The line numbers are displayed in a special face @code{line-number}. | |||
| 1871 | The current line number is displayed in a different face, | 1871 | The current line number is displayed in a different face, |
| 1872 | @code{line-number-current-line}, so you can make the current line's | 1872 | @code{line-number-current-line}, so you can make the current line's |
| 1873 | number have a distinct appearance, which will help locating the line | 1873 | number have a distinct appearance, which will help locating the line |
| 1874 | showing point. | 1874 | showing point. Additional faces @code{line-number-major-tick} and |
| 1875 | @code{line-number-minor-tick} can be used to highlight the line numbers | ||
| 1876 | of lines which are a multiple of certain numbers. Customize | ||
| 1877 | @code{display-line-numbers-major-tick} and | ||
| 1878 | @code{display-line-numbers-minor-tick} respectively to set those | ||
| 1879 | numbers. | ||
| 1875 | 1880 | ||
| 1876 | @vindex visible-bell | 1881 | @vindex visible-bell |
| 1877 | If the variable @code{visible-bell} is non-@code{nil}, Emacs attempts | 1882 | If the variable @code{visible-bell} is non-@code{nil}, Emacs attempts |
| @@ -559,6 +559,13 @@ network connection information (in addition to the host name). | |||
| 559 | now prompts the user for the directory containing the desktop file. | 559 | now prompts the user for the directory containing the desktop file. |
| 560 | 560 | ||
| 561 | +++ | 561 | +++ |
| 562 | ** display-line-numbers-mode | ||
| 563 | *** New faces 'line-number-major-tick' and 'line-number-minor-tick', | ||
| 564 | and customizable variables 'display-line-numbers-major-tick' and | ||
| 565 | 'display-line-numbers-minor-tick' can be used to highlight the line | ||
| 566 | numbers of lines multiple of certain numbers. | ||
| 567 | |||
| 568 | +++ | ||
| 562 | ** winner | 569 | ** winner |
| 563 | *** A new variable, 'winner-boring-buffers-regexp', has been added. | 570 | *** A new variable, 'winner-boring-buffers-regexp', has been added. |
| 564 | 571 | ||
diff --git a/lisp/cus-start.el b/lisp/cus-start.el index e61c1954a1f..89a96a9f51c 100644 --- a/lisp/cus-start.el +++ b/lisp/cus-start.el | |||
| @@ -655,6 +655,20 @@ since it could result in memory overflow and make Emacs crash." | |||
| 655 | (const :tag "Count lines from beginning of narrowed region" | 655 | (const :tag "Count lines from beginning of narrowed region" |
| 656 | :value nil)) | 656 | :value nil)) |
| 657 | "26.1") | 657 | "26.1") |
| 658 | (display-line-numbers-major-tick | ||
| 659 | display-line-numbers | ||
| 660 | (choice | ||
| 661 | (const :tag "No line" 0) | ||
| 662 | (integer :tag "Multiples of" | ||
| 663 | :value 10)) | ||
| 664 | "27.1") | ||
| 665 | (display-line-numbers-minor-tick | ||
| 666 | display-line-numbers | ||
| 667 | (choice | ||
| 668 | (const :tag "No line" 0) | ||
| 669 | (integer :tag "Multiples of" | ||
| 670 | :value 5)) | ||
| 671 | "27.1") | ||
| 658 | 672 | ||
| 659 | (display-fill-column-indicator | 673 | (display-fill-column-indicator |
| 660 | display-fill-column-indicator | 674 | display-fill-column-indicator |
diff --git a/lisp/faces.el b/lisp/faces.el index 9c5ffe1e590..58b6349ccfd 100644 --- a/lisp/faces.el +++ b/lisp/faces.el | |||
| @@ -2390,6 +2390,40 @@ unwanted effects." | |||
| 2390 | :group 'basic-faces | 2390 | :group 'basic-faces |
| 2391 | :group 'display-line-numbers) | 2391 | :group 'display-line-numbers) |
| 2392 | 2392 | ||
| 2393 | (defface line-number-major-tick | ||
| 2394 | '((t :inherit line-number)) | ||
| 2395 | "Face for highlighting \"major ticks\" (as in a ruler). | ||
| 2396 | When `display-line-numbers-major-tick' is positive, highlight | ||
| 2397 | the line numbers of lines which are a multiple of its value. | ||
| 2398 | This face is used when `display-line-numbers' is non-nil. | ||
| 2399 | |||
| 2400 | If you customize the font of this face, make sure it is a | ||
| 2401 | monospaced font, otherwise line numbers will not line up, | ||
| 2402 | and text lines might move horizontally as you move through | ||
| 2403 | the buffer. Similarly, making this face's font different | ||
| 2404 | from that of the `line-number' face could produce such | ||
| 2405 | unwanted effects." | ||
| 2406 | :version "27.1" | ||
| 2407 | :group 'basic-faces | ||
| 2408 | :group 'display-line-numbers) | ||
| 2409 | |||
| 2410 | (defface line-number-minor-tick | ||
| 2411 | '((t :inherit line-number)) | ||
| 2412 | "Face for highlighting \"minor ticks\" (as in a ruler). | ||
| 2413 | When `display-line-numbers-minor-tick' is positive, highlight | ||
| 2414 | the line numbers of lines which are a multiple of its value. | ||
| 2415 | This face is used when `display-line-numbers' is non-nil. | ||
| 2416 | |||
| 2417 | If you customize the font of this face, make sure it is a | ||
| 2418 | monospaced font, otherwise line numbers will not line up, | ||
| 2419 | and text lines might move horizontally as you move through | ||
| 2420 | the buffer. Similarly, making this face's font different | ||
| 2421 | from that of the `line-number' face could produce such | ||
| 2422 | unwanted effects." | ||
| 2423 | :version "27.1" | ||
| 2424 | :group 'basic-faces | ||
| 2425 | :group 'display-line-numbers) | ||
| 2426 | |||
| 2393 | ;; Definition stolen from display-line-numbers. | 2427 | ;; Definition stolen from display-line-numbers. |
| 2394 | (defface fill-column-indicator | 2428 | (defface fill-column-indicator |
| 2395 | '((t :inherit shadow :weight normal :slant normal | 2429 | '((t :inherit shadow :weight normal :slant normal |
diff --git a/lisp/frame.el b/lisp/frame.el index 0c68fc378b9..51b3b621ff4 100644 --- a/lisp/frame.el +++ b/lisp/frame.el | |||
| @@ -2724,6 +2724,8 @@ See also `toggle-frame-maximized'." | |||
| 2724 | display-line-numbers-width | 2724 | display-line-numbers-width |
| 2725 | display-line-numbers-current-absolute | 2725 | display-line-numbers-current-absolute |
| 2726 | display-line-numbers-widen | 2726 | display-line-numbers-widen |
| 2727 | display-line-numbers-major-tick | ||
| 2728 | display-line-numbers-minor-tick | ||
| 2727 | display-fill-column-indicator | 2729 | display-fill-column-indicator |
| 2728 | display-fill-column-indicator-column | 2730 | display-fill-column-indicator-column |
| 2729 | display-fill-column-indicator-character | 2731 | display-fill-column-indicator-character |
diff --git a/src/xdisp.c b/src/xdisp.c index 8aa38c8034c..1f3a8136f8b 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -22664,6 +22664,14 @@ maybe_produce_line_number (struct it *it) | |||
| 22664 | empty lines beyond EOB. */ | 22664 | empty lines beyond EOB. */ |
| 22665 | && it->what != IT_EOB) | 22665 | && it->what != IT_EOB) |
| 22666 | tem_it.face_id = current_lnum_face_id; | 22666 | tem_it.face_id = current_lnum_face_id; |
| 22667 | else if (display_line_numbers_major_tick > 0 | ||
| 22668 | && (lnum_to_display % display_line_numbers_major_tick == 0)) | ||
| 22669 | tem_it.face_id = merge_faces (it->w, Qline_number_major_tick, | ||
| 22670 | 0, DEFAULT_FACE_ID); | ||
| 22671 | else if (display_line_numbers_minor_tick > 0 | ||
| 22672 | && (lnum_to_display % display_line_numbers_minor_tick == 0)) | ||
| 22673 | tem_it.face_id = merge_faces (it->w, Qline_number_minor_tick, | ||
| 22674 | 0, DEFAULT_FACE_ID); | ||
| 22667 | else | 22675 | else |
| 22668 | tem_it.face_id = lnum_face_id; | 22676 | tem_it.face_id = lnum_face_id; |
| 22669 | if (beyond_zv | 22677 | if (beyond_zv |
| @@ -34125,6 +34133,8 @@ be let-bound around code that needs to disable messages temporarily. */); | |||
| 34125 | /* Names of the faces used to display line numbers. */ | 34133 | /* Names of the faces used to display line numbers. */ |
| 34126 | DEFSYM (Qline_number, "line-number"); | 34134 | DEFSYM (Qline_number, "line-number"); |
| 34127 | DEFSYM (Qline_number_current_line, "line-number-current-line"); | 34135 | DEFSYM (Qline_number_current_line, "line-number-current-line"); |
| 34136 | DEFSYM (Qline_number_major_tick, "line-number-major-tick"); | ||
| 34137 | DEFSYM (Qline_number_minor_tick, "line-number-minor-tick"); | ||
| 34128 | /* Name of a text property which disables line-number display. */ | 34138 | /* Name of a text property which disables line-number display. */ |
| 34129 | DEFSYM (Qdisplay_line_numbers_disable, "display-line-numbers-disable"); | 34139 | DEFSYM (Qdisplay_line_numbers_disable, "display-line-numbers-disable"); |
| 34130 | 34140 | ||
| @@ -34760,6 +34770,20 @@ if the font in fill-column-indicator face does not support Unicode characters. | |||
| 34760 | DEFSYM (Qdisplay_fill_column_indicator_character, "display-fill-column-indicator-character"); | 34770 | DEFSYM (Qdisplay_fill_column_indicator_character, "display-fill-column-indicator-character"); |
| 34761 | Fmake_variable_buffer_local (Qdisplay_fill_column_indicator_character); | 34771 | Fmake_variable_buffer_local (Qdisplay_fill_column_indicator_character); |
| 34762 | 34772 | ||
| 34773 | DEFVAR_INT ("display-line-numbers-major-tick", display_line_numbers_major_tick, | ||
| 34774 | doc: /* If an integer N > 0, highlight line number of every Nth line. | ||
| 34775 | The line number is shown with the `line-number-major-tick' face. | ||
| 34776 | Otherwise, no special highlighting is done every Nth line. | ||
| 34777 | Note that major ticks take precedence over minor ticks. */); | ||
| 34778 | display_line_numbers_major_tick = 0; | ||
| 34779 | |||
| 34780 | DEFVAR_INT ("display-line-numbers-minor-tick", display_line_numbers_minor_tick, | ||
| 34781 | doc: /* If an integer N > 0, highlight line number of every Nth line. | ||
| 34782 | The line number is shown with the `line-number-minor-tick' face. | ||
| 34783 | Otherwise, no special highlighting is done every Nth line. | ||
| 34784 | Note that major ticks take precedence over minor ticks. */); | ||
| 34785 | display_line_numbers_minor_tick = 0; | ||
| 34786 | |||
| 34763 | DEFVAR_BOOL ("inhibit-eval-during-redisplay", inhibit_eval_during_redisplay, | 34787 | DEFVAR_BOOL ("inhibit-eval-during-redisplay", inhibit_eval_during_redisplay, |
| 34764 | doc: /* Non-nil means don't eval Lisp during redisplay. */); | 34788 | doc: /* Non-nil means don't eval Lisp during redisplay. */); |
| 34765 | inhibit_eval_during_redisplay = false; | 34789 | inhibit_eval_during_redisplay = false; |