emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: line-number-mode at EOB (was: Native display of line numbers, improv


From: Eli Zaretskii
Subject: Re: line-number-mode at EOB (was: Native display of line numbers, improved)
Date: Tue, 18 Jul 2017 17:55:41 +0300

> From: Stephen Berman <address@hidden>
> Cc: address@hidden
> Date: Tue, 18 Jul 2017 00:20:10 +0200
> 
> > By that reasoning, line-number-mode (the %l construct) should be changed
> > so as not to display a number when point is at EOB.  Perhaps it should
> > display "EOB" or "END" instead.
> 
> I attempted to implement this change in the mode line display (see
> attached patch) and the result, while admittedly only "minor aesthetic
> sugar", seems to me not too bad: it makes line-number-mode consistent
> not only with vertically displayed line numbers but also with
> `count-words-region' (and hence with `count-lines').  What do others
> think?

Hmm... I don't understand why you needed to change the format spec to
%l, and also why the change in mode_line_update_needed.  Isn't it
enough to just produce "EOB" instead of a number?

>  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))));

The last 2 lines can be written more succinctly as

              && ((ZV == w->last_point) != (PT == ZV))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]