From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuan Fu Newsgroups: gmane.emacs.devel Subject: Re: How to add pseudo vector types Date: Fri, 23 Jul 2021 16:22:59 -0400 Message-ID: References: <83h7gw6pyj.fsf@gnu.org> <45EBF16A-C953-42C7-97D1-3A2BFEF7DD01@gmail.com> <83y2a764oy.fsf@gnu.org> <83v95b60fn.fsf@gnu.org> <00DD5BFE-D14E-449A-9319-E7B725DEBFB3@gmail.com> <83r1fz5xr9.fsf@gnu.org> <1AAB1BCC-362B-4249-B785-4E0530E15C60@gmail.com> <83czri67h0.fsf@gnu.org> <46BBFF88-76C3-4818-8805-5437409BEA93@gmail.com> <83wnpq46uk.fsf@gnu.org> <533BD53B-4E85-4E9E-B46A-346A5BBAD0F5@gmail.com> <258CB68D-1CC1-42C8-BDCD-2A8A8099B783@gmail.com> <1a776770-50b7-93cd-6591-c9a5b3a56eb8@gmail.com> <8335s64v10.fsf@gnu.org> <5380C92B-6C15-4490-A1E0-1C3132DBB16A@gmail.com> <83k0li2shw.fsf@gnu.org> <83eebq2mpy.fsf@gnu.org> <83lf5w26e3.fsf@gnu.org> Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.60.0.2.21\)) 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="20143"; mail-complaints-to="usenet@ciao.gmane.io" Cc: =?utf-8?Q?Cl=C3=A9ment_Pit-Claudel?= , Stefan Monnier , emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Jul 23 22:23:51 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 1m71i3-00058h-EP for ged-emacs-devel@m.gmane-mx.org; Fri, 23 Jul 2021 22:23:51 +0200 Original-Received: from localhost ([::1]:44518 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m71i1-0004Kc-DH for ged-emacs-devel@m.gmane-mx.org; Fri, 23 Jul 2021 16:23:49 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:46622) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m71hJ-0003YQ-52 for emacs-devel@gnu.org; Fri, 23 Jul 2021 16:23:05 -0400 Original-Received: from mail-qv1-xf2a.google.com ([2607:f8b0:4864:20::f2a]:45683) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m71hH-0000mL-56; Fri, 23 Jul 2021 16:23:04 -0400 Original-Received: by mail-qv1-xf2a.google.com with SMTP id cv7so1892083qvb.12; Fri, 23 Jul 2021 13:23:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=bIqMb2xQ1gi2LVd9wW2PpUr9CIBupOUonGJ5K387uvY=; b=kP/otdsMB7qXx66VDbNTapXv6Ljx2XTMuZ3ULgulzkAYuMurVpi8HT378NEqtcZf5G 2sK6eR14zgsTcwwlfUkfxQiwG8iAekvz3O6uCLQOhlPnvx/IrknXKAkq6hqBfLx2bbhQ OO575CiYqd9iRTeHpTsAnOKFdTtBPuVF8ntXMjxjx7WSnsmY7ggN30zjkTTNb2ipeneL bEI8YaxJsMtaSTqI/e0gbBGqju6Oj5N2EEKtSh4zIpY1m/lcqC0Iwbv3fhx7laHHuPun aQ7rc1zOx/IVyq0+kLC3EiluFwjnO5MXlStBO+jmkOzUBNxK3QpWfN0jvKgvxOUbu0HJ BVMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=bIqMb2xQ1gi2LVd9wW2PpUr9CIBupOUonGJ5K387uvY=; b=QI6KK8ki67fX7+GyNVUx/hPMlUJAEa6ubcqBvKlZN77t9hYHABzlrhuBth4WqgYISd ygVYfgCu6CgralJcIwI5z4ovLnADebfGyVDi985sApayBujNXjqt3D+WK8umDCqpM0Wv K+XW1FGAa3NU/Fe6kkYQ2disfxk5YOLUoWKI17+1Pxj3DFI33fue310CQuiRdKSWvomT QNi8KeuFhZjg9r05tu9WRlhz1VySsaDWfwTLjhs5MJ8Ia/jRiskmfyOszuunBY3294AQ hpmiN/0yC3pMFgUBkl2017whQrumibUDT0uP9XVOw2LarS6zaeorFp8tEX0Il2VLld9Z 5I4Q== X-Gm-Message-State: AOAM532NWUQBNH06WtZ4rrUrh4W7mXMmQRBKEBhew74WIQ//6c+NWnBx we0h4rzer/SLA8ZXNcfHS3d/InKx/sz9kA== X-Google-Smtp-Source: ABdhPJwsC1VQMch1kQHzF63si4C0PXtxeSKfpSIX7L1XRNToAVSBjFsRP3UHwV5wniWuneEVa4DICg== X-Received: by 2002:ad4:5d62:: with SMTP id fn2mr6342341qvb.61.1627071781726; Fri, 23 Jul 2021 13:23:01 -0700 (PDT) Original-Received: from 2603-7080-0302-635e-501b-d938-5abe-a221.res6.spectrum.com (2603-7080-0302-635e-501b-d938-5abe-a221.res6.spectrum.com. [2603:7080:302:635e:501b:d938:5abe:a221]) by smtp.gmail.com with ESMTPSA id d7sm12183408qth.70.2021.07.23.13.23.00 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Jul 2021 13:23:01 -0700 (PDT) In-Reply-To: <83lf5w26e3.fsf@gnu.org> X-Mailer: Apple Mail (2.3654.60.0.2.21) Received-SPF: pass client-ip=2607:f8b0:4864:20::f2a; envelope-from=casouri@gmail.com; helo=mail-qv1-xf2a.google.com X-Spam_score_int: -1 X-Spam_score: -0.2 X-Spam_bar: / X-Spam_report: (-0.2 / 5.0 requ) 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:271509 Archived-At: >=20 > We must replace this function, if only because the MS-Windows build of > Emacs uses a custom malloc implementation. Does TS allow the client > to use its own malloc? Yes, in that case, we need to embed tree-sitter into Emacs, instead of = using it as a dynamic library, I think. // Allow clients to override allocation functions #ifndef ts_malloc #define ts_malloc ts_malloc_default #endif #ifndef ts_calloc #define ts_calloc ts_calloc_default #endif #ifndef ts_realloc #define ts_realloc ts_realloc_default #endif #ifndef ts_free #define ts_free ts_free_default #endif How do we handle such thing in Emacs? >=20 >>>> Also, we don=E2=80=99t call change hooks in replace_range_2, why? >>>=20 >>> Because it is called in a loop, one character at a time. The caller >>> of replace_range_2 calls these hooks for the entire region, once. >>>=20 >>>> Should I update tree-sitter trees in that function, or should I = not? >>>=20 >>> The only caller is casify_region, so you could update there. >>=20 >> casify_region doesn=E2=80=99t have access to byte positions. >=20 > You can compute them using CHAR_TO_BYTE. Ok. I=E2=80=99ll do that. Yuan=