unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Evgeny Zajcev <lg.zevlg@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Alan Third <alan@idiocy.org>, emacs-devel <emacs-devel@gnu.org>
Subject: Re: Hollow cursor under images
Date: Tue, 28 Jan 2020 11:46:15 +0300	[thread overview]
Message-ID: <CAO=W_ZqpC2BrhmUTTgmSpom8EsNbK8uwNimVeTiQGKbCb-FQog@mail.gmail.com> (raw)
In-Reply-To: <83k15coil1.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 2889 bytes --]

пн, 27 янв. 2020 г. в 21:33, Eli Zaretskii <eliz@gnu.org>:

> > From: Evgeny Zajcev <lg.zevlg@gmail.com>
> > Date: Mon, 27 Jan 2020 15:54:56 +0300
> > Cc: Eli Zaretskii <eliz@gnu.org>, emacs-devel <emacs-devel@gnu.org>
> >
> > This patch implements (box . WIDTH) cursor type, allowing user to define
> his own notion for "Large" image
>
> Thanks.  This needs a NEWS entry and also an update for the ELisp
> manual.  See also a few comments below.
>
> > From 6406d198e9f3f5b2d93987ed0fd4fe22bd590624 Mon Sep 17 00:00:00 2001
> > From: Zajcev Evgeny <zevlg@yandex.ru>
> > Date: Mon, 27 Jan 2020 15:49:46 +0300
> > Subject: [PATCH] * Support for (box . WIDTH) `cursor-type'
> >
> > Before this commit, block cursor becomes hollow under "large" masked
> > images.  Notion for "large" was hardcoded to be image larger then
> > 32x32 in any dimension.
> >
> > This patch allows user to define his own notion for "large" image,
> > taking full control of block cursor look under masked images.
> >
> > With cursor-type equal to `box' cursor will always be block under
> > masked images.  This differs from former behavior for box cursor.
> > To get former behavior, set `cursor-type' to (box . 32)
>
> Please include in the log message a ChangeLog-style list of files and
> functions where you are making changes.
>
> > +  (box . WIDTH)   display a filled box cursor, but make it
> > +                  hollow if cursor is under masked image larger then
> > +                  WIDTH in either dimention.
>                                      ^^^^^^^^^
> "dimension"
>
> Also, please make it clear that WIDTH is measured in pixels.
>
> > +Except for (box . WIDTH) case.
>
> This is not a complete sentence, please clarify it.
>
> > +  if (CONSP (arg)
> > +      && EQ (XCAR (arg), Qbox)
> > +      && RANGED_FIXNUMP (0, XCDR (arg), INT_MAX))
> > +    {
> > +      *width = XFIXNUM (XCDR (arg));
>
> This calls XFIXNUM no less than 3 times.  I wonder if we could tweak
> the code to do that only once.
>
>
Just for my info.  Should not such tweaks be done by compiler optimizer?
No value is declared as volatile, it is pretty clear that there is no need
to call XFIXNUM 3 times.  It is written in sources just for the readability.

I'm afraid tweaking things in such way in source code will make code look
ugly and less obvious

> +      return FILLED_BOX_CURSOR;
> > +    }
> > +
> >    if (EQ (arg, Qhollow))
> >      return HOLLOW_BOX_CURSOR;
>
> If the condition above is not fulfilled, you then make the code do 5
> more gratuitous comparisons, before it falls back on
> HOLLOW_BOX_CURSOR.  It is much better to return HOLLOW_BOX_CURSOR
> right away if the conditions for FILLED_BOX_CURSOR weren't satisfied,
> it makes the code which implements this feature much easier to read
> and understand.
>


-- 
lg

[-- Attachment #2: Type: text/html, Size: 4023 bytes --]

  reply	other threads:[~2020-01-28  8:46 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-04 18:14 Hollow cursor under images Evgeny Zajcev
2019-03-04 19:05 ` Eli Zaretskii
2019-03-04 20:04   ` Evgeny Zajcev
2019-03-04 20:22     ` Eli Zaretskii
2019-03-04 20:27       ` Evgeny Zajcev
2019-03-05  3:24         ` Eli Zaretskii
2019-03-04 22:36     ` Alan Third
2019-03-05 10:19       ` Evgeny Zajcev
2019-09-14 11:48         ` Evgeny Zajcev
2020-01-27 12:54           ` Evgeny Zajcev
2020-01-27 18:33             ` Eli Zaretskii
2020-01-28  8:46               ` Evgeny Zajcev [this message]
2020-01-28 18:16                 ` Eli Zaretskii
2020-01-28 11:55               ` Evgeny Zajcev
2020-01-28 18:22                 ` Eli Zaretskii
2020-02-03 11:24                   ` Evgeny Zajcev
2020-02-07 10:12                     ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAO=W_ZqpC2BrhmUTTgmSpom8EsNbK8uwNimVeTiQGKbCb-FQog@mail.gmail.com' \
    --to=lg.zevlg@gmail.com \
    --cc=alan@idiocy.org \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).