diff --git a/lisp/bindings.el b/lisp/bindings.el index be44b45136..4d4411e55d 100644 --- a/lisp/bindings.el +++ b/lisp/bindings.el @@ -415,8 +415,8 @@ mode-line-position 'mouse-face 'mode-line-highlight 'help-echo "Line number and Column number\n\ mouse-1: Display Line and Column Mode Menu"))) - (6 ,(propertize - " L%l" + (6 (:propertize + (:eval (if (eobp) " %l" " L%l")) 'local-map mode-line-column-line-number-mode-map 'mouse-face 'mode-line-highlight 'help-echo "Line Number\n\ diff --git a/src/xdisp.c b/src/xdisp.c index 2aceb89c00..600fad0100 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -11579,14 +11579,19 @@ window_buffer_changed (struct window *w) return (BUF_SAVE_MODIFF (b) < BUF_MODIFF (b)) != w->last_had_star; } -/* True if W has %c or %C in its mode line and mode line should be updated. */ +/* True if W has %c or %C in its mode line and mode line should be + updated. or if W has %l in its mode line and point has moved either + to or away from EOB. */ static bool mode_line_update_needed (struct window *w) { - return (w->column_number_displayed != -1 - && !(PT == w->last_point && !window_outdated (w)) - && (w->column_number_displayed != current_column ())); + return ((w->column_number_displayed != -1 + && !(PT == w->last_point && !window_outdated (w)) + && (w->column_number_displayed != current_column ())) + || (line_number_displayed + && ((ZV == w->last_point && PT != ZV) + || (ZV != w->last_point && PT == ZV)))); } /* True if window start of W is frozen and may not be changed during @@ -24395,8 +24400,13 @@ decode_mode_spec (struct window *w, register int c, int field_width, line_number_displayed = true; /* Make the string to show. */ - pint2str (decode_mode_spec_buf, width, topline + nlines); - return decode_mode_spec_buf; + if (PT == BUF_ZV (b)) + return "EOB"; + else + { + pint2str (decode_mode_spec_buf, width, topline + nlines); + return decode_mode_spec_buf; + } no_value: { char *p = decode_mode_spec_buf;