aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorJuanma Barranquero2019-10-06 20:53:18 +0200
committerJuanma Barranquero2019-10-06 20:53:18 +0200
commit8de2e69f021b5b2920a07d82c9869bb394171d41 (patch)
tree34b57d6b999d9ec668044b16627b1d773a24f4e5 /lisp
parent29db34e3e0cd5be78b7ab4604050c0ba05835414 (diff)
downloademacs-8de2e69f021b5b2920a07d82c9869bb394171d41.tar.gz
emacs-8de2e69f021b5b2920a07d82c9869bb394171d41.zip
Set alternate faces for some line numbers (bug#27734)
* lisp/faces.el (line-number-major-tick, line-number-minor-tick): New faces. * lisp/cus-start.el (display-line-numbers-major-tick) (display-line-numbers-minor-tick): Add customization info. * lisp/frame.el: Add `display-line-numbers-major-tick' and `display-line-numbers-minor-tick' to list of variables which should trigger redisplay of the current buffer. * src/xdisp.c (syms_of_xdisp) <display-line-numbers-major-tick> <display-line-numbers-major-tick>: Defvar new options. (syms_of_xdisp) <line-number-major-tick, line-number-minor-tick>: Defsym new faces. (maybe_produce_line_number): Use new faces for line numbers that are multiple of `display-line-numbers-major-tick' and `display-line-numbers-minor-tick'. * etc/NEWS (value): Announce new feature. * doc/emacs/display.texi (Display Custom): Describe it. Wording by Robert Pluim <rpluim@gmail.com>
Diffstat (limited to 'lisp')
-rw-r--r--lisp/cus-start.el14
-rw-r--r--lisp/faces.el34
-rw-r--r--lisp/frame.el2
3 files changed, 50 insertions, 0 deletions
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).
2396When `display-line-numbers-major-tick' is positive, highlight
2397the line numbers of lines which are a multiple of its value.
2398This face is used when `display-line-numbers' is non-nil.
2399
2400If you customize the font of this face, make sure it is a
2401monospaced font, otherwise line numbers will not line up,
2402and text lines might move horizontally as you move through
2403the buffer. Similarly, making this face's font different
2404from that of the `line-number' face could produce such
2405unwanted 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).
2413When `display-line-numbers-minor-tick' is positive, highlight
2414the line numbers of lines which are a multiple of its value.
2415This face is used when `display-line-numbers' is non-nil.
2416
2417If you customize the font of this face, make sure it is a
2418monospaced font, otherwise line numbers will not line up,
2419and text lines might move horizontally as you move through
2420the buffer. Similarly, making this face's font different
2421from that of the `line-number' face could produce such
2422unwanted 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