all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org,  casouri@gmail.com
Subject: Re: master c69858b3f0: ; * lisp/treesit.el (treesit-ready-p): Guard against empty buffers.
Date: Wed, 23 Nov 2022 07:40:31 -0500	[thread overview]
Message-ID: <jwvleo1voej.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <83o7sxzwhn.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 23 Nov 2022 14:27:48 +0200")

>> > -      (when (> (position-bytes (1- (point-max))) treesit-max-buffer-size)
>> > +      (when (> (position-bytes (max (point-min) (1- (point-max))))
>> > +               treesit-max-buffer-size)
>> 
>> I'd expect `treesit-max-buffer-size` to be compared to `buffer-size`
>> rather than to buffer positions.
>
> Please tell more: what problems do you see with the above, and why?  It is
> not easy to guess what's on your mind.

I see 4 very minor problems:

- the code is more complex than the obvious
  (> (buffer-size) treesit-max-buffer-size)
- as a result of that complexity, we see that its original version had
  a bug :-)
- it uses `position-bytes` which is an unusual function (because it
  exposes details of the internal representation).

But my question was not so much pointing out a problem but trying to
understand why we chose the more complex code.


        Stefan




  reply	other threads:[~2022-11-23 12:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <166916717199.12853.3816069320355351676@vcs2.savannah.gnu.org>
     [not found] ` <20221123013252.46814C004B6@vcs2.savannah.gnu.org>
2022-11-23  1:51   ` master c69858b3f0: ; * lisp/treesit.el (treesit-ready-p): Guard against empty buffers Stefan Monnier
2022-11-23  2:18     ` Yuan Fu
2022-11-23 12:27     ` Eli Zaretskii
2022-11-23 12:40       ` Stefan Monnier [this message]
2022-11-23 13:38         ` Eli Zaretskii
2022-11-23 14:57           ` Stefan Monnier
2022-11-23 15:25             ` 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

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

  git send-email \
    --in-reply-to=jwvleo1voej.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=casouri@gmail.com \
    --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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.