From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?Jostein_Kj=c3=b8nigsen?= Newsgroups: gmane.emacs.devel Subject: Re: tree-sitter: Paths used for loading of language definitions Date: Mon, 17 Oct 2022 09:14:58 +0200 Message-ID: References: <83o7ub51yd.fsf@gnu.org> <83fsfn4xep.fsf@gnu.org> <024de525-07c3-69e8-b5a7-3e2c35287e57@secure.kjonigsen.net> <8444D60E-E075-4A19-B6FC-EE0ADCFE8DAF@gmail.com> Reply-To: jostein@kjonigsen.net Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="------------uiX906iv50rOdIATc9omSdvi" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="35686"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.3 Cc: emacs-devel@gnu.org To: Yuan Fu , jostein@kjonigsen.net Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Oct 17 09:28:16 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 1okKXl-00092J-M8 for ged-emacs-devel@m.gmane-mx.org; Mon, 17 Oct 2022 09:28:16 +0200 Original-Received: from localhost ([::1]:36780 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1okKXk-0002dM-9G for ged-emacs-devel@m.gmane-mx.org; Mon, 17 Oct 2022 03:28:12 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39802) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1okKL3-0004lf-Vj for emacs-devel@gnu.org; Mon, 17 Oct 2022 03:15:06 -0400 Original-Received: from out1-smtp.messagingengine.com ([66.111.4.25]:32943) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1okKL0-0007Ud-Uz for emacs-devel@gnu.org; Mon, 17 Oct 2022 03:15:05 -0400 Original-Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 0486D5C00EB; Mon, 17 Oct 2022 03:15:02 -0400 (EDT) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Mon, 17 Oct 2022 03:15:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= secure.kjonigsen.net; h=cc:cc:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:reply-to:sender:subject:subject:to:to; s=fm2; t= 1665990901; x=1666077301; bh=pBmG/RfJ7NK6vlPBXoOq8g41lPKHghLoDAo WXocIXqs=; b=evWPOmQUQnF6mYq63hECMI6JdHD8026yeH85FsoenXNJOjznNIp Cy6aHdItPTXCGb41EapWTRj7WPxJlr0DF3B1qWoaF3S1BAOUxo738jZio0gG4oT8 Vp6R0NrEREg4IxOO2cL7ZgU+1y+YiJQbFuPXQKxiBtO2yjSqkVwAoN2GfYjt/ZZt 0ziYEsYHCaOUERmgbrsJ/tSnIFdqrpzgO0+SbjMz1JqOxF+QSf0um+io193i0Fdj zQ2j6ItyXe3t+pwHQoVqmsp+/1RKS1ptuZ08t/75c1Y2cUj5t4NdHcxmy3D4HwQ0 f/92lYsK4q81hFa/WN2mEbKIY/YOTJxJ2RQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; t=1665990901; x=1666077301; bh=pBmG/RfJ7NK6v lPBXoOq8g41lPKHghLoDAoWXocIXqs=; b=JOpnJIs/cORtL7lPXmaw1RuZd9icG LfS6EoBJVUKncYEm/02CY0GZEgFiK4OyoTG/gIkD1nrpqrywGcwnh9rDtbx0hppW XXNK4NQ+ByTsqBEOoKxYATh9nd/i2AH2yMlu5C0/AlFV5BEHmv117YPfYL8fkcfL E8ixrooGVJtPrQMUaMV/Wj41a4/b8rvNHLN0+PDQzXmEQHi+72F+i1es9iCqQ9ba YPY7A9SKaESq1SbeeF8LgIBhFSGatM+apOGS5tOUFto7SpzO2dipwQ663uANKrGF dWAj+Ox2rZ62ccKnZNk6hmgtfRMHuBu7gxfstokShyJ0YXb7xFm0wO4ow== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrfeekkedguddukecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurheptgfkffggfghruffvvehfhfgjse grtderredtfeejnecuhfhrohhmpeflohhsthgvihhnpgfmjhppnhhighhsvghnuceojhho shhtvghinhesshgvtghurhgvrdhkjhhonhhighhsvghnrdhnvghtqeenucggtffrrghtth gvrhhnpeehffetffejgfetgfelhfegtdejheeikeejffejgfehjeehfeefgfdvveetteev heenucffohhmrghinhepkhhjnhhighhsvghnrdhnohenucevlhhushhtvghrufhiiigvpe dtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehjohhsthgvihhnsehsvggtuhhrvgdrkhhj ohhnihhgshgvnhdrnhgvth X-ME-Proxy: Feedback-ID: ib2f84088:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 17 Oct 2022 03:15:01 -0400 (EDT) Content-Language: nb-NO In-Reply-To: <8444D60E-E075-4A19-B6FC-EE0ADCFE8DAF@gmail.com> Received-SPF: pass client-ip=66.111.4.25; envelope-from=jostein@secure.kjonigsen.net; helo=out1-smtp.messagingengine.com X-Spam_score_int: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=0.001, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_PASS=-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.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" Xref: news.gmane.io gmane.emacs.devel:297927 Archived-At: This is a multi-part message in MIME format. --------------uiX906iv50rOdIATc9omSdvi Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 17.10.2022 06:27, Yuan Fu wrote: > >> That said, I've noticed something when building the feature/tree-sitter branch, and also while testing other things tree-sitter related... If a language-definition SO is missing... treesit.el in Emacs only reports looking for files and folders typically found within $HOME/.emacs.d/ (that is user-owned files). >> >> Based on that, I'm assuming those are the only locations probed. Is that assumption correct? > It shouldn’t be. Emacs should first look in treesit-extra-load-path, then ~/.emacs.d/tree-sitter, then standard system library locations. The exact locations depend on dlopen. Could you share the error message reported when loading a non-exist language? It should print all the locations it tries (as you observed). > > Yuan textmodes/mhtml-mode.el:29:2: Error: Cannot load language definition: "javascript", ("/home/jostein/.emacs.d/tree-sitter/libtree-sitter-javascript: cannot open shared object file: No such file or directory" "/home/jostein/.emacs.d/tree-sitter/libtree-sitter-javascript.so: cannot open shared object file: No such file or directory" "libtree-sitter-javascript: cannot open shared object file: No such file or directory" "libtree-sitter-javascript.so: cannot open shared object file: No such file or directory") Does that impliy it checks in the standard system library localtion? If so, I guess there's no problem. In that case, sorry for the "noise", but I just wanted to make sure this was packagable and thought one check too much is better than one check too little :) -- Vennlig hilsen *Jostein Kjønigsen* jostein@kjonigsen.net 🍵 jostein@gmail.com https://jostein.kjønigsen.no --------------uiX906iv50rOdIATc9omSdvi Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit


On 17.10.2022 06:27, Yuan Fu wrote:

That said, I've noticed something when building the feature/tree-sitter branch, and also while testing other things tree-sitter related... If a language-definition SO is missing... treesit.el in Emacs only reports looking for files and folders typically found within $HOME/.emacs.d/ (that is user-owned files).

Based on that, I'm assuming those are the only locations probed. Is that assumption correct?
It shouldn’t be. Emacs should first look in treesit-extra-load-path, then ~/.emacs.d/tree-sitter, then standard system library locations. The exact locations depend on dlopen. Could you share the error message reported when loading a non-exist language? It should print all the locations it tries (as you observed).

Yuan

textmodes/mhtml-mode.el:29:2: Error: Cannot load language definition: "javascript", ("/home/jostein/.emacs.d/tree-sitter/libtree-sitter-javascript: cannot open shared object file: No such file or directory" "/home/jostein/.emacs.d/tree-sitter/libtree-sitter-javascript.so: cannot open shared object file: No such file or directory" "libtree-sitter-javascript: cannot open shared object file: No such file or directory" "libtree-sitter-javascript.so: cannot open shared object file: No such file or directory")

Does that impliy it checks in the standard system library localtion? If so, I guess there's no problem.

In that case, sorry for the "noise", but I just wanted to make sure this was packagable and thought one check too much is better than one check too little :)


--------------uiX906iv50rOdIATc9omSdvi--