From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#70789: treesit navigate for outlines at bobp Date: Mon, 06 May 2024 09:43:54 +0300 Organization: LINKOV.NET Message-ID: <86jzk7a1pp.fsf@mail.linkov.net> References: <86seywi4kk.fsf@mail.linkov.net> <37B3FE57-8ABA-4C10-8F75-EC7FF1A64B74@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40340"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) Cc: 70789@debbugs.gnu.org To: Yuan Fu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon May 06 09:09:42 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1s3sTm-000ALs-K8 for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 06 May 2024 09:09:42 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s3sTY-0008Cn-O8; Mon, 06 May 2024 03:09:30 -0400 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 1s3sSl-00088L-00 for bug-gnu-emacs@gnu.org; Mon, 06 May 2024 03:08:39 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s3sSk-0004aF-KB for bug-gnu-emacs@gnu.org; Mon, 06 May 2024 03:08:38 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1s3sT8-0005UZ-Ko for bug-gnu-emacs@gnu.org; Mon, 06 May 2024 03:09:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 06 May 2024 07:09:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70789 X-GNU-PR-Package: emacs Original-Received: via spool by 70789-submit@debbugs.gnu.org id=B70789.171497929621071 (code B ref 70789); Mon, 06 May 2024 07:09:02 +0000 Original-Received: (at 70789) by debbugs.gnu.org; 6 May 2024 07:08:16 +0000 Original-Received: from localhost ([127.0.0.1]:36159 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s3sSL-0005Ti-0p for submit@debbugs.gnu.org; Mon, 06 May 2024 03:08:16 -0400 Original-Received: from relay2-d.mail.gandi.net ([2001:4b98:dc4:8::222]:50527) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s3sSE-0005TG-K3 for 70789@debbugs.gnu.org; Mon, 06 May 2024 03:08:11 -0400 Original-Received: by mail.gandi.net (Postfix) with ESMTPSA id 48EAF4000C; Mon, 6 May 2024 07:07:34 +0000 (UTC) In-Reply-To: <37B3FE57-8ABA-4C10-8F75-EC7FF1A64B74@gmail.com> (Yuan Fu's message of "Sun, 5 May 2024 20:11:56 -0700") X-GND-Sasl: juri@linkov.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:284561 Archived-At: >> 'treesit-outline-search' didn't match outlines at the beginning of >> the buffer because unlike 're-search-forward' (used by outline-mode) >> that matches the text that immediately follows point, >> 'treesit-navigate-thing' misses text at point and stars the search >> after point. >> >> So there is a need to handle this difference specially. Therefore this >> patch adds such special-handling of bobp to 'treesit-outline-search’: > > Thanks. Just for me to understand it better, could you show an > example where treesit-navigate-thing misses text at point? Here is an example: 0. emacs -Q 1. C-x C-f test/lisp/progmodes/ruby-mode-resources/ruby-method-params-indent.rb 2. M-x ruby-ts-mode 3. M-: (setq outline-minor-mode-use-buttons t) 4. M-x outline-minor-mode There are no outline buttons because the top thing "class" is at the beginning of the buffer. Then you can insert an empty line before "class", and disable/enable outline-minor-mode again, and outline buttons appear on "class" and "def" lines. Basically this is because (treesit-navigate-thing (point-min) 1 'beg "\\`\\(?:class\\|method\\)\\'") can't find "class" at the beginning of the buffer, but after inserting an empty line before "class" it can find it. > If it does, that should be a bug that treesit-navigate-thing should > fix, right? I'm not sure if this is a bug. Maybe it can be described just as a difference between re-search-forward and treesit-navigate-thing.