emacs-devel
[Top][All Lists]
Advanced

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

Re: Fill column indicator functionality


From: Ergus
Subject: Re: Fill column indicator functionality
Date: Mon, 18 Mar 2019 12:42:49 +0100
User-agent: NeoMutt/20180716

Hi Eli:

The question was actually in 2 parts but I explained bad myself:

1) How to  access a specific buffer variable defined in buffer.c from
xdisp.c Obviously there is a connection throw the 'it' struct, but maybe
it is not the proper way to read it.

(BTW: why there is not a header file for xdisp?) That could reduce the
size of xdisp.c moving all the documentation and comments to the header.
that could ease the generation of some doxygen documentation and graphs
useful new for people who will wants to touch that part.

2) The question about caching that was not only because of performance
concerns, but also for code cleanup; because setting the variables in
the redisplay call will localize the 'if' asserts to one place and
reduce some code repeats (the potential reduce of operations /
display_line is just a good side effect in this case.)

The point is that right now we have code in 4 parts in this file and any
correction requires to touch these 4 parts (add_space_at_end ,
extend_face gui part, extend_face tui part and Lisp variable
declarations). If anyone touches this code apart from me, the workflow
could be very error prone, but also there are like 10-15 lines that are
repeated in the 3 places without a real need because the values only
change from time to time.
 if (!NILP (Vdisplay_fill_column_indicator)
     && (it->w->pseudo_window_p == 0)
     && (!NILP (Vdisplay_fill_column_indicator_column))
     && FIXNATP (Vdisplay_fill_column_indicator_character))
   {
      int fill_column_indicator_column = -1;

      if (EQ (Vdisplay_fill_column_indicator_column, Qt))
        fill_column_indicator_column = fill_column;
      else if (FIXNATP (Vdisplay_fill_column_indicator_column))
             fill_column_indicator_column =
               XFIXNAT (Vdisplay_fill_column_indicator_column);

And so on.

On Mon, Mar 18, 2019 at 05:35:43AM +0200, Eli Zaretskii wrote:
Date: Mon, 18 Mar 2019 02:03:13 +0100
From: Ergus <address@hidden>
Cc: address@hidden

The variable fill-column is defined in the buffer.c file. I should
access it in every display_line when display-fill-column is enabled if I
want to keep the difference between display-fill-column-indicator-column
and fill-column. (when display-fill-column-indicator is t).

Whats the better method to do that?

Are you worried about performance?  If so, then don't: accessing a
single variable is not something that would slow down redisplay in any
tangible way.  So I don't recommend any more complex solution that
somehow caches the fill-column value, it isn't justified in this case.




reply via email to

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