From 25bc3911615d1160d47287c023545c6e0587739f Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Thu, 6 Jul 2017 20:22:16 +0300 Subject: Implement line numbers that disregard narrowing * src/xdisp.c (display_count_lines_logically): New function, counts line numbers disregarding narrowing. Suggested by Andy Moreton . (maybe_produce_line_number): Call display_count_lines_logically instead of display_count_lines. Adapt BEGV, ZV, etc. to display-line-numbers-widen. (syms_of_xdisp) : New buffer-local variable. * lisp/cus-start.el (standard): Provide a customization form for display-line-numbers-widen. * lisp/frame.el: Add display-line-numbers-widen, display-line-numbers-current-absolute, and display-line-number-width to the list of variables that should trigger redisplay of the current buffer. * doc/emacs/display.texi (Display Custom): Document display-line-numbers-widen. --- lisp/cus-start.el | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'lisp/cus-start.el') diff --git a/lisp/cus-start.el b/lisp/cus-start.el index a89d5dff0cd..017e7f9fa55 100644 --- a/lisp/cus-start.el +++ b/lisp/cus-start.el @@ -608,7 +608,14 @@ since it could result in memory overflow and make Emacs crash." :value t) (const :tag "Display zero as number of current line" :value nil)) - "26.1") + "26.1") + (display-line-numbers-widen display + (choice + (const :tag "Disregard narrowing when calculating line numbers" + :value t) + (const :tag "Count lines from beinning of narrowed region" + :value nil)) + "26.1") ;; xfaces.c (scalable-fonts-allowed display boolean "22.1") ;; xfns.c -- cgit v1.2.3