From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Rudi Schlatte Newsgroups: gmane.emacs.devel Subject: Re: toml-ts-mode: first draft Date: Tue, 13 Dec 2022 15:22:11 +0100 Message-ID: <7ADCEF96-42B0-433B-B42D-3CE3D1E39955@constantly.at> References: <4E261A68-AB14-48A5-B19C-8981CB003F33@secure.kjonigsen.net> <86a63unfvp.fsf@mail.linkov.net> <83cz8pu9cr.fsf@gnu.org> <0f74be1a-8502-ce66-6101-2b3f060295c5@secure.kjonigsen.net> <7825A406-3F21-4E38-9E9B-B429B9E81B4E@gmail.com> <83cz8nphin.fsf@gnu.org> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.200.110.1.12\)) 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="10026"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Dec 13 15:46:17 2022 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 1p56Xx-0002Ow-KP for ged-emacs-devel@m.gmane-mx.org; Tue, 13 Dec 2022 15:46:17 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p56X2-0006oc-6l; Tue, 13 Dec 2022 09:45:21 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p56B2-0001s6-OF for emacs-devel@gnu.org; Tue, 13 Dec 2022 09:22:43 -0500 Original-Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p56Ax-0003Ia-Dh; Tue, 13 Dec 2022 09:22:36 -0500 Original-Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 0FBFB5C007B; Tue, 13 Dec 2022 09:22:26 -0500 (EST) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Tue, 13 Dec 2022 09:22:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1670941346; x= 1671027746; bh=RuVZ7lHXbZJ4MHbLTEFMKfRR1TxzKNWkNL68rNRGC/c=; b=i SHCzdzThPbrP3AD0TBDBjzyPMnNQo2yzbghhF6l9OoL2Edb1IRZIDO2Gp1iOJBxR eS1JiBZn87FKvfKia+2/V7IXGgntwr2LfhFFUBDr0LgKtLDpn4Q1P1fPrOk/Yd3b bKz++Npi/1HzwylJa31I+KS65CR10T5kvVfGHgx6VLeuiBN0s432DJGP/tZVLK8N 1pft2mlmmGECaNqgasIAG/povfTn7kKUjgiSXi/C4s+ib4pbz7xwQxGYo8h4F22l 1nQBGH4vk1jxKrEOWaJLUMTt4X+NDDiFkOUVsGWA1tV3SDN7gd09IZXlAgcYxwPK DaAtKCgNyv4YM7WECIITQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfedtgdeifecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpegtggfuhfgjffevgffkfhfvofesthhqmhdthhdtjeenucfhrhhomheptfhuughi ucfutghhlhgrthhtvgcuoehruhguihestghonhhsthgrnhhtlhihrdgrtheqnecuggftrf grthhtvghrnhepfeeltedtvedtgfekudeuvdeutddukeekgffgueeggeelkedvtddvheet tdeljeejnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomh eprhhuughisegtohhnshhtrghnthhlhidrrght X-ME-Proxy: Feedback-ID: i5b4840b3:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 13 Dec 2022 09:22:24 -0500 (EST) In-Reply-To: <83cz8nphin.fsf@gnu.org> X-Mailer: Apple Mail (2.3731.200.110.1.12) Received-SPF: none client-ip=66.111.4.26; envelope-from=rudi@constantly.at; helo=out2-smtp.messagingengine.com X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Tue, 13 Dec 2022 09:45:07 -0500 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:301320 Archived-At: > On 13 Dec 2022, at 14:20, Eli Zaretskii wrote: >=20 >> From: Rudolf Schlatte >> Date: Tue, 13 Dec 2022 11:45:42 +0100 >>=20 >> Yuan Fu writes: >>=20 >>>=20 >>> + (unless (treesit-ready-p 'toml) >>> + (error "Tree-sitter for TOML isn't avilable=E2=80=9D)) >>>=20 >>> Treesit-ready-p already raises a warning when something goes wrong. = So >>> you want to either pass the QUIET argument or let it do the barking >>> ;-) >>=20 >> I'd expect predicates (functions ending -p) to return T or NIL only = and >> not have side effects. >=20 > Did you read the doc string of this function? I think it explains why > this predicate can sometimes emit a warning and sometimes not. It has > more than one modus operandi. [Attention conservation notice: this is only nitpicking about a function = name; please do feel free to not answer this message] The current docstring (as in the end of this mail) tells me that this = predicate takes a second argument and has various side effects, and I = can see how all these behaviors are useful. But it seems the authors of = a number of tree sitter-using modes did something like (unless (treesit-ready-p =E2=80=98my-language) (warn =E2=80=9CDidn=E2=80=99t find tree-sitter=E2=80=9D)) which tells me that the authors expected treesit-ready-p to behave like = other predicate functions, i.e., return NIL or T without side effects. = I theorize that this will be a recurring issue, and that using a = function name not ending in `-p=E2=80=99 (e.g., (treesit-ensure-ready = =E2=80=98my-language =E2=80=98message)) would remove this = millimeter-high barrier. But again: nitpicking, please ignore freely :) Rudi "Check whether tree-sitter is ready to be used for MODE and LANGUAGE. LANGUAGE is the language symbol to check for availability. It can also be a list of language symbols. If tree-sitter is not ready, emit a warning and return nil. If the user has chosen to activate tree-sitter for LANGUAGE and tree-sitter is ready, return non-nil. If QUIET is t, don't emit a warning in either case; if quiet is `message', display a message instead of emitting a warning.=E2=80=9D