emacs-devel
[Top][All Lists]
Advanced

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

Re: 'struct window' cleanup #3


From: Dmitry Antipov
Subject: Re: 'struct window' cleanup #3
Date: Sun, 01 Jul 2012 19:05:31 +0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120614 Thunderbird/13.0.1

One more minor simplification: W->region_showing may be only nil or t,
so it may be reduced to a bitfield.

Hard case:

  if (((!NILP (Vtransient_mark_mode)
        && !NILP (BVAR (XBUFFER (w->buffer), mark_active)))
       != !NILP (w->region_showing))
      || (!NILP (w->region_showing)
          && !EQ (w->region_showing,
                  Fmarker_position (BVAR (XBUFFER (w->buffer), mark)))))

There are two possible cases:

  - both w->region_showing and Fmarker_position (BVAR (XBUFFER (w->buffer), 
mark))
    are nil;
  - w->region_showing is t and Fmarker_position (BVAR (XBUFFER (w->buffer), 
mark))
    is a number, so !EQ (...) is always non-zero.

So if-statement may be simplified to:

  if (((!NILP (Vtransient_mark_mode)
        && !NILP (BVAR (XBUFFER (w->buffer), mark_active)))
       != w->region_showing) || w->region_showing)

Dmitry

Attachment: region_showing.patch
Description: Text document


reply via email to

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