From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Fu Yuan Newsgroups: gmane.emacs.devel Subject: Re: How to add pseudo vector types Date: Tue, 3 Aug 2021 07:53:54 -0400 Message-ID: <70DB6978-5994-478A-8118-4A2EFE5FE379@gmail.com> References: <83fsvqn49m.fsf@gnu.org> Mime-Version: 1.0 (1.0) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="8449"; mail-complaints-to="usenet@ciao.gmane.io" Cc: cpitclaudel@gmail.com, stephen_leake@stephe-leake.org, monnier@iro.umontreal.ca, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Aug 03 13:54:48 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mAt0S-00020Y-OW for ged-emacs-devel@m.gmane-mx.org; Tue, 03 Aug 2021 13:54:48 +0200 Original-Received: from localhost ([::1]:34256 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mAt0Q-0000p6-VU for ged-emacs-devel@m.gmane-mx.org; Tue, 03 Aug 2021 07:54:46 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55502) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mAszf-00006D-Ma for emacs-devel@gnu.org; Tue, 03 Aug 2021 07:53:59 -0400 Original-Received: from mail-qk1-x72c.google.com ([2607:f8b0:4864:20::72c]:40527) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mAsze-0006zz-B3; Tue, 03 Aug 2021 07:53:59 -0400 Original-Received: by mail-qk1-x72c.google.com with SMTP id z24so19528698qkz.7; Tue, 03 Aug 2021 04:53:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=content-transfer-encoding:from:mime-version:subject:date:message-id :references:cc:in-reply-to:to; bh=jtA1Hi1WcLicnvXY9kDv+e355ejni8fZkGEk4NlUv1A=; b=T7eoYgke6NiWgEFPNIV9IS+OKyI+cEv1ZBYSgzwAGqdFSgKEFIV0CroiEJ93qv7O+t LMj2UP1xLBzDLyK+Uwo47f2hs/hUa8DRXHVYE/PkyojjiRMdBGzM6N1GbEMrO5ZSjMEw OButHvyLsaA4TrFYiUuFs+N6nw1/J6TuWW4C5K8tMzVUzQLw6PDJ8N798iDLgGU2KpKU LN6s//KiF8U8yYNEBPYsDAdi89B2DRX8YbGjYaNpEgjK3GLfZR1kM6KjNNuF0QJQT4Tc 6R72BvNlRxYJNP/fC+XkRcsSF+wHtx/4n4961C4167HfMXMoyG8ZM3LK0BZ3oT7tr2KT s+PA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:content-transfer-encoding:from:mime-version :subject:date:message-id:references:cc:in-reply-to:to; bh=jtA1Hi1WcLicnvXY9kDv+e355ejni8fZkGEk4NlUv1A=; b=jWcB9NvGxbq9HqHGXLeU5Czr1W36xB5CWwN9psrEOnGZdwyQTf8hluvOCHZMNnXjpu TsAjiZpTF4faJfeZHEmId393sKqrng/J3sCjUvfCB/AT8Q2A0RrpBQ61Wf+QdNug7QiX t8PFJbCtrKH8KK/yYDjlresJcKD6V6kKKvYrudpJWXrQr1JA8fMa2yUAqvhVK/T+vNss 01TpMv5jhXPtuwvAqZcYyj0GDwKlA3s0zaM4jdBqvJHvojCBnl+pTW8NBY8qcO7Jn5vU D2IzGEnY36DIg6cQfTb4lzXauf25mMh0TPsyUmuEYSSnAQiNFmIes2itSwW3HsqDDOUg p/AQ== X-Gm-Message-State: AOAM533Km+G+95wgELy1RNJOCWIq+vQvPAkqX9gl004dXCXzjzJFx8eB cZJ1/Qn5Xp8VXteG9lLMn7A= X-Google-Smtp-Source: ABdhPJw7ozfeeNeHx+NEgsDUhEs4PvhrQMu3gEHzf/S4DT15JdP2W/rFZtpynSHK0qmfqwqG1PLmqQ== X-Received: by 2002:a05:620a:139b:: with SMTP id k27mr6112533qki.326.1627991636993; Tue, 03 Aug 2021 04:53:56 -0700 (PDT) Original-Received: from ?IPv6:2607:fb90:a902:79bf:ece0:4f2a:436e:c17b? ([2607:fb90:a902:79bf:ece0:4f2a:436e:c17b]) by smtp.gmail.com with ESMTPSA id s12sm6364358qtc.72.2021.08.03.04.53.56 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 03 Aug 2021 04:53:56 -0700 (PDT) In-Reply-To: <83fsvqn49m.fsf@gnu.org> X-Mailer: iPhone Mail (17H35) Received-SPF: pass client-ip=2607:f8b0:4864:20::72c; envelope-from=casouri@gmail.com; helo=mail-qk1-x72c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:271963 Archived-At: > =E5=9C=A8 2021=E5=B9=B48=E6=9C=883=E6=97=A5=EF=BC=8C=E4=B8=8A=E5=8D=887:42= =EF=BC=8CEli Zaretskii =E5=86=99=E9=81=93=EF=BC=9A >=20 > =EF=BB=BF >>=20 >> From: Fu Yuan >> Date: Tue, 3 Aug 2021 06:24:34 -0400 >> Cc: Stephen Leake , >> Cl=C3=A9ment Pit-Claudel , >> Stefan Monnier , emacs-devel@gnu.org >>=20 >> I=E2=80=99m about to change all lisp-facing functions from using byte pos= ition to using point. >=20 > I don't understand how can you do this. Point is set by Lisp, and > generally cannot be changed from C, except for very short durations of > time (or if the C code is the implementation of a Lisp command that > just moved point). If you need to access some buffer position, you > cannot in general use point, because you cannot control where point > is. >=20 >> Point is much easier to work with. >=20 > In what way is it easier? I feel that I'm missing something here. >=20 >> If lisp wants byte positions, they can just convert from point themselves= . >=20 > ??? What do you mean by that? Can you show an example? Oh no, I don=E2=80=99t mean that. I meant that, for example, functions like n= ode_start_byte, which returns the byte position of the beginning of the node= , will now be node_start_pos, which returns a point position. And if I want t= he byte position of the beginning of the node, I can use (position-to-byte (= tree-sitter-node-start-pos node)) Yuan=