unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: xdisp.c:  Suggestion to delete a few unused lines of code ...
@ 2020-04-28 18:57 Keith David Bershatsky
  0 siblings, 0 replies; 4+ messages in thread
From: Keith David Bershatsky @ 2020-04-28 18:57 UTC (permalink / raw)
  To: Keith David Bershatsky; +Cc: emacs-devel

Ooops ... never mind ... my eyes overlooked the closing brace:

          /* Produce line number, if needed.  */
          if (line_number_needed)
    maybe_produce_line_number (it);
===>    }
      else if (it->area == TEXT_AREA)
        {
    

Sorry for any inconvenience as to the erroneous suggestion .....

Keith



^ permalink raw reply	[flat|nested] 4+ messages in thread
* Re: xdisp.c:  Suggestion to delete a few unused lines of code ...
@ 2020-04-28 19:34 Keith David Bershatsky
  0 siblings, 0 replies; 4+ messages in thread
From: Keith David Bershatsky @ 2020-04-28 19:34 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

Thank you Eli for taking the time to review and respond to this particular thread.

You are absolutely correct!

I should have studied the code more ....

As always, your help is greatly appreciated!

Keith

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

> Date: [04-28-2020 12:15:24] <28 Apr 2020 22:15:24 +0300>
> From: Eli Zaretskii <eliz@gnu.org>
> To: Keith David Bershatsky <esq@lawlist.com>
> Cc: emacs-devel@gnu.org
> Subject: Re: xdisp.c:  Suggestion to delete a few unused lines of code ...
> 
> > Date: Tue, 28 Apr 2020 11:46:26 -0700
> > From: Keith David Bershatsky <esq@lawlist.com>
> >
> > In the function display_line within xdisp.c, there is the following code set forth below.  Inasmuch as the first main condition is whether (line_number_needed), the second test within the ELSE IF statement for whether (line_number_needed) will always be negative; i.e., it would have to be negative or else we would never have gotten to the ELSE IF statement ... since the test will always be negative, Emacs will never call maybe_produce_line_number within the ELSE IF section of this code.
> 
> I don't understand why you think the test will always be negative in
> the second case.  The code is really
> 
>   bool line_number_needed = should_produce_line_number (it);
> 
>   if (it->current_x < it->first_visible_x + x_incr)
>     {
>       [...]
>       if (line_number_needed)
> maybe_produce_line_number (it);
>     }
>   else if (it->area == TEXT_AREA)
>     {
>       if (line_number_needed)
> maybe_produce_line_number (it);
>       [...]
>     }
> 
> What this says that we may need to produce the line numbers both when
> we start outside of the visible portion of the window (the 'if'
> clause) and when we start inside the visible portion.



^ permalink raw reply	[flat|nested] 4+ messages in thread
* xdisp.c:  Suggestion to delete a few unused lines of code ...
@ 2020-04-28 18:46 Keith David Bershatsky
  2020-04-28 19:15 ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: Keith David Bershatsky @ 2020-04-28 18:46 UTC (permalink / raw)
  To: Emacs Devel

In the function display_line within xdisp.c, there is the following code set forth below.  Inasmuch as the first main condition is whether (line_number_needed), the second test within the ELSE IF statement for whether (line_number_needed) will always be negative; i.e., it would have to be negative or else we would never have gotten to the ELSE IF statement ... since the test will always be negative, Emacs will never call maybe_produce_line_number within the ELSE IF section of this code.

      /* Produce line number, if needed.  */
      if (line_number_needed)
	maybe_produce_line_number (it);
    }
  else if (it->area == TEXT_AREA)
    {

/* ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; */
/* SUGGESTED DELETION */

      /* Line numbers should precede the line-prefix or wrap-prefix.  */
      if (line_number_needed)
	maybe_produce_line_number (it);

/* ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; */

      /* We only do this when not calling move_it_in_display_line_to
	 above, because that function calls itself handle_line_prefix.  */
      handle_line_prefix (it);
    }
  else
    {
      /* Line-prefix and wrap-prefix are always displayed in the text
	 area.  But if this is the first call to display_line after
	 init_iterator, the iterator might have been set up to write
	 into a marginal area, e.g. if the line begins with some
	 display property that writes to the margins.  So we need to
	 wait with the call to handle_line_prefix until whatever
	 writes to the margin has done its job.  */
      pending_handle_line_prefix = true;
    }



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-04-28 19:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-28 18:57 xdisp.c: Suggestion to delete a few unused lines of code Keith David Bershatsky
  -- strict thread matches above, loose matches on Subject: below --
2020-04-28 19:34 Keith David Bershatsky
2020-04-28 18:46 Keith David Bershatsky
2020-04-28 19:15 ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).