From unknown Fri Jun 20 07:16:07 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#75387 <75387@debbugs.gnu.org> To: bug#75387 <75387@debbugs.gnu.org> Subject: Status: 29.4; hideshow: hs-hide-level hides multiple top-level blocks as one Reply-To: bug#75387 <75387@debbugs.gnu.org> Date: Fri, 20 Jun 2025 14:16:07 +0000 retitle 75387 29.4; hideshow: hs-hide-level hides multiple top-level blocks= as one reassign 75387 emacs submitter 75387 Christoph Groth severity 75387 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 05 13:53:33 2025 Received: (at submit) by debbugs.gnu.org; 5 Jan 2025 18:53:33 +0000 Received: from localhost ([127.0.0.1]:35228 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tUVki-00031a-N7 for submit@debbugs.gnu.org; Sun, 05 Jan 2025 13:53:33 -0500 Received: from lists.gnu.org ([2001:470:142::17]:44606) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tUVkf-000316-Kq for submit@debbugs.gnu.org; Sun, 05 Jan 2025 13:53:32 -0500 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 1tUVkY-0001Ja-VZ for bug-gnu-emacs@gnu.org; Sun, 05 Jan 2025 13:53:22 -0500 Received: from mailgate01.uberspace.is ([95.143.172.20]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tUVkW-00047I-2O for bug-gnu-emacs@gnu.org; Sun, 05 Jan 2025 13:53:22 -0500 Received: from dia.uberspace.de (dia.uberspace.de [185.26.156.221]) by mailgate01.uberspace.is (Postfix) with ESMTPS id E1DD6606BB for ; Sun, 5 Jan 2025 19:53:10 +0100 (CET) Received: (qmail 3626 invoked by uid 989); 5 Jan 2025 18:53:10 -0000 Authentication-Results: dia.uberspace.de; auth=pass (plain) Received: from unknown (HELO unkown) (::1) by dia.uberspace.de (Haraka/3.0.1) with ESMTPSA; Sun, 05 Jan 2025 19:53:10 +0100 From: Christoph Groth To: bug-gnu-emacs@gnu.org Subject: 29.4; hideshow: hs-hide-level hides multiple top-level blocks as one Date: Sun, 05 Jan 2025 19:53:04 +0100 Message-ID: <87ed1hw0rz.fsf@drac> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Rspamd-Bar: - X-Rspamd-Report: BAYES_HAM(-1.979891) MID_RHS_NOT_FQDN(0.5) MIME_GOOD(-0.1) X-Rspamd-Score: -1.579891 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=grothesque.org; s=uberspace; h=from:to:subject:date; bh=Z5E0vTJopfMtR0zR+cSqVstkhg0qr9IZpdivd6kN/2k=; b=Sr9FPrtGfkMJTq9fRh1SCLbcplDHALl8XbIeJOJwp8EBMls9tIi6AVe3sY2GsJIrNyumlqU8/s GC352NUaWHGH6pzYfUje8Mu2TMq8IJUWm2Jgp6NxIygENDu+6n/sh/xrQtF31Oam/q7OnAJ49ddR hzdfbR4E/aOjTTTiy1hm+8s2uxhiwWKN0mDs5I3mnzo6WQp2GMcaGzk1QWP3BZc5hj/Sdp7Ymwt2 uH2zFbKz9V5owlvfA3hEFdyuDowH/95BJQNs74lrl9J/SRdkRNyKs2+nUH0XaE6sxRK+xLSZsb1K EwWsgmILK8z+64Wl84nPW4l2tGpymWSnfbbx7DzygyVKE0/wOIVNJutNJAfUKhnBFQwvWPbRHazB Mk5ancrByJuNtRE+jn2umZt9WPDaEJxN3kOY7b3EuXMAjJUAF6xoEZuHCllNFwJLumoUpvPpldvx oth2oZ+sWsTICU2x1KmS+BxPWrIa7QORUAcEvpgot5rYb9XxFOw1eZ7sRbkNwGfuS0sgbnxFk9Xt xeXYukxdK3OO0/EBS2P/ad4zilLbFOPyMLTDkedItOWHzdL1Ci+PHgcngm3puKMBCbWpAVcFWd+u 6i/qlhxf0L/6pzxeuRZVySMq1AWNK1FxBiPLN2G0wIWajzRuAbVuMD57SNFDgMsSBA0QgFR8F/O8 4= Received-SPF: pass client-ip=95.143.172.20; envelope-from=christoph@grothesque.org; helo=mailgate01.uberspace.is 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, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) Hello, I noticed the following problem when using a homemade function that allows me to cycle hideshow visibility in a way similar to org-mode. The issue, however, is independent of any customization (it appears with emacs -Q as well). I can reproduce the issue with the following source file https://gitlab.kwant-project.org/kwant/kwant/-/raw/0d679b3efecd145d13e3174c60d829a7c3cd4374/kwant/builder.py I tried simplifying that file to isolate the issue, but did not arrive at something more useful than the original. To demonstrate the issue: (1) Download the above file. (2) Open it with emacs -Q builder.py. Point is not moved. (3) M-x hs-minor-mode RET (4) M-x hs-hide-level RET The result is that the buffer shows only two hidden blocks, with the buffer ending in @total_ordering class SiteFamily(metaclass=abc.ABCMeta):... This is incorrect, since there are many other classes and top-level functions in the file. Each should appear as a separate top-level block. If M-x hs-hide-all is run instead of step (4) the hiding works as expected, many more top-level hidden blocks appear. M-x hd-hide-level also produces the expected effect if the second block created by (4) is un-hidden in some way. For example if the following two steps are added to the above sequence: (5) M-x hs-show-all RET (6) M-x hs-hide-level RET I would expect that hs-hide-level always produces the same result when called with point at the same position in a buffer. I hope that this somewhat obscure observation allows to fix some inconsistency. Thanks, Christoph --- In GNU Emacs 29.4 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.38, cairo version 1.16.0) of 2024-12-15, modified by Debian built on sbuild Windowing system distributor 'The X.Org Foundation', version 11.0.12101007 System Description: Debian GNU/Linux 12 (bookworm) Configured using: 'configure --build x86_64-linux-gnu --prefix=/usr --sharedstatedir=/var/lib --libexecdir=/usr/libexec --localstatedir=/var/lib --infodir=/usr/share/info --mandir=/usr/share/man --with-libsystemd --with-pop=yes --enable-locallisppath=/etc/emacs:/usr/local/share/emacs/29.4/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/29.4/site-lisp:/usr/share/emacs/site-lisp --with-sound=alsa --without-gconf --with-mailutils --with-native-compilation --build x86_64-linux-gnu --prefix=/usr --sharedstatedir=/var/lib --libexecdir=/usr/libexec --localstatedir=/var/lib --infodir=/usr/share/info --mandir=/usr/share/man --with-libsystemd --with-pop=yes --enable-locallisppath=/etc/emacs:/usr/local/share/emacs/29.4/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/29.4/site-lisp:/usr/share/emacs/site-lisp --with-sound=alsa --without-gconf --with-mailutils --with-native-compilation --with-cairo --with-x=yes --with-x-toolkit=gtk3 --with-toolkit-scroll-bars 'CFLAGS=-g -O2 -ffile-prefix-map=/build/reproducible-path/emacs-29.4+1=. -fstack-protector-strong -Wformat -Werror=format-security -Wall' 'CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2' LDFLAGS=-Wl,-z,relro' Configured features: ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER WEBP X11 XDBE XIM XINPUT2 XPM GTK3 ZLIB Important settings: value of $LC_MESSAGES: en_US.UTF-8 value of $LANG: en_DK.UTF-8 locale-coding-system: utf-8-unix Major mode: Lisp Interaction Minor modes in effect: tooltip-mode: t global-eldoc-mode: t eldoc-mode: t show-paren-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t line-number-mode: t indent-tabs-mode: t transient-mark-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug message mailcap yank-media puny dired dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg rfc6068 epg-config gnus-util text-property-search time-date mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader cl-loaddefs comp comp-cstr warnings icons subr-x rx cl-seq cl-macs gv cl-extra help-mode bytecomp byte-compile cl-lib sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils rmc iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic indonesian philippine cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite emoji-zwj charscript charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp files window text-properties overlay sha1 md5 base64 format env code-pages mule custom widget keymap hashtable-print-readable backquote threads dbusbind inotify lcms2 dynamic-setting system-font-setting font-render-setting cairo move-toolbar gtk x-toolkit xinput2 x multi-tty make-network-process native-compile emacs) Memory information: ((conses 16 77057 13062) (symbols 48 7444 0) (strings 32 19535 1545) (string-bytes 1 584589) (vectors 16 15338) (vector-slots 8 328476 18154) (floats 8 27 46) (intervals 56 275 0) (buffers 984 11)) From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 12 04:43:27 2025 Received: (at 75387) by debbugs.gnu.org; 12 Jan 2025 09:43:27 +0000 Received: from localhost ([127.0.0.1]:46151 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tWuVC-0000RD-Tm for submit@debbugs.gnu.org; Sun, 12 Jan 2025 04:43:27 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59070) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tWuVB-0000Qu-1i for 75387@debbugs.gnu.org; Sun, 12 Jan 2025 04:43:25 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tWuV5-0000qi-42; Sun, 12 Jan 2025 04:43:19 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=hMt+posYx5d9Yzm7TFnFxRm43OaeN1lCkzNUKpzZ4JE=; b=i1FHn5mb6LsD 376BmOQQXlIfqEiq3gQJmKeHOaK7Vx+pDqcunaxMNPosOR/XZFXzVtA0VXNzEDDoiB7k1e8IJoH5l XHaL2KV6pA7U6f9QGtIs1RtyOuajvK2C4t8BOHk1SqUjF364zRuETVZMBb4f7V+S+56aWE8KenABz bi7ywOOJapImBPDtSYlqSXlqpRLUlF0bZHLfvngb3wGHRkFSEe82SGTlDlxBroWqfagwqW3Pnbixo yfPN6cfKFDFdtCIhGG5iAyFRlOSgXK0A2yYZAeRjkNsjKwsp9gN61n3v5hKMUDXr24xYzKBS+R8oY LpH3JFpaRc+7CrC/i5+Adw==; Date: Sun, 12 Jan 2025 11:42:58 +0200 Message-Id: <86ikqkxt99.fsf@gnu.org> From: Eli Zaretskii To: Christoph Groth , kobarity In-Reply-To: <87ed1hw0rz.fsf@drac> (message from Christoph Groth on Sun, 05 Jan 2025 19:53:04 +0100) Subject: Re: bug#75387: 29.4; hideshow: hs-hide-level hides multiple top-level blocks as one References: <87ed1hw0rz.fsf@drac> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 75387 Cc: 75387@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Christoph Groth > Date: Sun, 05 Jan 2025 19:53:04 +0100 > > I noticed the following problem when using a homemade function that > allows me to cycle hideshow visibility in a way similar to org-mode. > The issue, however, is independent of any customization (it appears with > emacs -Q as well). > > I can reproduce the issue with the following source file > > https://gitlab.kwant-project.org/kwant/kwant/-/raw/0d679b3efecd145d13e3174c60d829a7c3cd4374/kwant/builder.py > > I tried simplifying that file to isolate the issue, but did not arrive at > something more useful than the original. To demonstrate the issue: > > (1) Download the above file. > (2) Open it with emacs -Q builder.py. Point is not moved. > (3) M-x hs-minor-mode RET > (4) M-x hs-hide-level RET > > The result is that the buffer shows only two hidden blocks, with the > buffer ending in > > @total_ordering > class SiteFamily(metaclass=abc.ABCMeta):... > > This is incorrect, since there are many other classes and top-level > functions in the file. Each should appear as a separate top-level > block. Hm... the doc string of hs-hide-level says: Hide all blocks ARG levels below this block. So what is "this block" when point is at position 1 in this buffer? If I move point to here: @total_ordering class SiteFamily(metaclass=abc.ABCMeta): and invoke hs-hide-level, then all the "def" blocks inside this one are hidden, as expected. And note that the command only hides blocks that are inside the current block, not those inside other blocks of the same level. So this could be a documentation issue, whereby the doc string doesn't explain clearly enough what the command does. kobarity, any comments? From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 12 19:46:18 2025 Received: (at 75387) by debbugs.gnu.org; 13 Jan 2025 00:46:18 +0000 Received: from localhost ([127.0.0.1]:49565 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tX8aw-00037L-0Q for submit@debbugs.gnu.org; Sun, 12 Jan 2025 19:46:18 -0500 Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]:55353) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1tX8as-00036p-Jc for 75387@debbugs.gnu.org; Sun, 12 Jan 2025 19:46:15 -0500 Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-21636268e43so85937745ad.2 for <75387@debbugs.gnu.org>; Sun, 12 Jan 2025 16:46:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736729168; x=1737333968; darn=debbugs.gnu.org; h=mime-version:user-agent:references:in-reply-to:subject:cc:to:from :message-id:date:from:to:cc:subject:date:message-id:reply-to; bh=/zz5+CsPX4ZA6K2oeAsRVbJeYIdaKzGmrCEbAg4FcJU=; b=Noc/lHF501REUr3fqzLwxnZswY34icse6wuQc1TnXsxmUc26MLvdp/M0cs68+rm32c 1E8TF0nHsSdPOb0Tw6BbcinrerYs1ZsaNwfl7wK61FCNAy7NvdhnURciwrxzn/pKcE3q nyZAu5N0UdK0OiHRwQ5T60TPICHXaOsnaN+tB2RyXIdZNKOVXbblaoOl+KqRJOWLEoTZ MgUf3DFoK4dqPVOVSvkrQHAExsnj4KveJ8Kdh3R2p+gisG/gjrPrB1ZH0ZIYKP3ljIPG e4P1EfNWK4JvvatNE4eDeHd0vD/CTVwo/1pSZsSHjmLE0LOzRwcfIlwRLe8v1OCwbI8A V+UA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736729168; x=1737333968; h=mime-version:user-agent:references:in-reply-to:subject:cc:to:from :message-id:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=/zz5+CsPX4ZA6K2oeAsRVbJeYIdaKzGmrCEbAg4FcJU=; b=q/RD7Nm+VzonDlljrcJJXYsIEUotwu12u+Dg4Jfa3nvahKEWC/G1yi/atJf19cZaly kfAoyTbdFnpcQbw0f8XawP73XeQasgUaRafbZULFB+S3QQR/Gv67/tKL46+dkDKfkHdo EHpL/moOB02ePfqIaYXYLomMpoAeW0q3j0NDxmwUJy0hirA3A902fcBfj7sZeEAL9/di FB+Mc4viCulHDdH7cpks8LVoE2m4JI3RbfZ2IafR5jPw8iL3B78qHFijsX2xKAITExCY feOVmtaGCrLpdSWtedmBLXofEmSEKPzyxCO89BvQCR084TgCLb9bu65mJADQW1Bjde3+ RvUw== X-Gm-Message-State: AOJu0YxnLcC90Bcf9F1D/XEdLrAcxCN0HG6qnPz2ZUScxh/UvVygcVE5 cgL8Mlc4HC6rSXyfMg8AS6IPDafWIs2Elx7Wg4Z/TbBWTFqJYMTz X-Gm-Gg: ASbGncuZ6Xc8FYyAqVs8zjYWKcV6jFhi8qSgHWxlQqMXHvITa3Hq78tgABV+OMC92xr 3SbknhxnJMHmaRxM4FooV2JbL6/SH5BN+APcJzBRG9LtYlvv+l8fbRP+tffb1Y41UgPFLPTNhGC ZErnAtGU8CUwFTT3jHfeLJxaXgtQrPM4oLgKadClHFI3xoo/4otNzQe+h08hSfSfeFZ2wTub3BU dx/GC3nB5SBLI+vcwC/O6QoihMlrem7Vvug2kKPoZrepy3tbhsYcgFRtl0hxDy1IQfRZQZvLeCF rGaM/n/XdDM= X-Google-Smtp-Source: AGHT+IEHFEqz8L0KIV5blXeyh70kix6GP/VO4D/UEsne3e0G+SLF3kJXjAs+TqhopWVO1vPjWBZ35Q== X-Received: by 2002:a17:902:db09:b0:216:4e9f:4ec9 with SMTP id d9443c01a7336-21a83ffc207mr290085735ad.38.1736729168314; Sun, 12 Jan 2025 16:46:08 -0800 (PST) Received: from localhost (58x12x133x161.ap58.ftth.ucom.ne.jp. [58.12.133.161]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-21a9f22e477sm43399385ad.167.2025.01.12.16.46.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Jan 2025 16:46:08 -0800 (PST) Date: Mon, 13 Jan 2025 09:46:09 +0900 Message-ID: From: kobarity To: Christoph Groth , Eli Zaretskii Subject: Re: bug#75387: 29.4; hideshow: hs-hide-level hides multiple top-level blocks as one In-Reply-To: <8734hnalgg.fsf@drac> References: <87ed1hw0rz.fsf@drac> <86ikqkxt99.fsf@gnu.org> <8734hnalgg.fsf@drac> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?ISO-8859-4?Q?Goj=F2?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/31.0.50 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=ISO-2022-JP X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 75387 Cc: 75387@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Christoph Groth wrote: > > Eli Zaretskii wrote: > > Hm... the doc string of hs-hide-level says: > > > > Hide all blocks ARG levels below this block. > > > > So what is "this block" when point is at position 1 in this buffer? > > In my understanding position 1 corresponds to $B!H(Boutermost level$B!I(B. Hiding > all blocks below this level should give the same result as calling > hs-hide-all. And indeed this is what I observe after the initial hiccup > (e.g. after having invoked hs-hide-all and then hs-show-all). > > > If I move point to here: > > > > @total_ordering > > class SiteFamily(metaclass=abc.ABCMeta): > > > > and invoke hs-hide-level, then all the "def" blocks inside this one > > are hidden, as expected. And note that the command only hides blocks > > that are inside the current block, not those inside other blocks of > > the same level. > > Did you try this immediately after opening the file with find-file? The > problem I observe only manifests itself until (at most) a full cycle of > hide-all then show-all. > > If (after freshly loading the file - should there be a buffer visiting > the file, I first kill it) I move point to the $B!H(B@$B!I(B before > total_ordering, and invoke hs-hide-level, then I see the following (only > showing the lower part of the buffer where something is hidden): > > ---------------------------------------------------------------- > ################ Sites and site families > > class Site(tuple):... > > > @total_ordering > class SiteFamily(metaclass=abc.ABCMeta):... > --------------- end of buffer ---------------------------------- > > But if I do this after invoking hs-hide-all and then hs-show-all, all > top-level blocks are visible but hidden (as expected). > > If, after freshly loading the file, I position point on the $B!H(Bc$B!I(B of > $B!H(Bclass SiteFamily$B!I(B, and then invoke hs-hide-level, the methods of that > class are hidden, but also top-level blocks that follow it (for example > the function validate_hopping). > > On the other hand, when I invoke hs-hide-level at the same place but > after $B!H(Bcycling$B!I(B at least once (=hs-hide-all followed by hs-show-all), > only the methods of the class are hidden, and following top level blocks > remain unhidden (as I would expect). > > > So this could be a documentation issue, whereby the doc string doesn't > > explain clearly enough what the command does. > > The behavior I observe depends on whether the file has been freshly > opened or already $B!H(Bcycled$B!I(B. But any correct behavior should not differ > between a fresh buffer and one where blocks were hidden and then > completely unhidden. Therefore I think that there is a problem > somewhere, at least in Emacs 29.4 that I use. I have no idea whether > this is in hideshow.all or in some other component like python.el. I confirmed the same behavior. This is not a problem in hideshow.el. Only immediately after the file is read, `python-nav-end-of-block' behaves unexpectedly. 1. emacs -Q 2. Find file builder.py 3. Search "class SiteFamily" and go there 4. M-x python-nav-end-of-block 5. Search "class Symmetry" and go there 6. M-x python-nav-end-of-block The point moves to the end of the buffer, which is not an expected behavior. However, repeating the steps 5 and 6 does not produce this issue. This is the direct cause of the problem of `hs-hide-level'. This problem does not occur when I run `font-lock-debug-fontify' after reading the file, so it might be related to font-lock code in python.el, but it seems that disabling font-lock does not solve this issue. I will continue to look into this, but it may take some time. From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 13 08:47:07 2025 Received: (at 75387) by debbugs.gnu.org; 13 Jan 2025 13:47:07 +0000 Received: from localhost ([127.0.0.1]:50711 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tXKmZ-0004a6-2Z for submit@debbugs.gnu.org; Mon, 13 Jan 2025 08:47:07 -0500 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]:52314) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1tXKmW-0004ZV-O1 for 75387@debbugs.gnu.org; Mon, 13 Jan 2025 08:47:05 -0500 Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-2165cb60719so75456545ad.0 for <75387@debbugs.gnu.org>; Mon, 13 Jan 2025 05:47:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736776018; x=1737380818; darn=debbugs.gnu.org; h=mime-version:user-agent:references:in-reply-to:subject:cc:to:from :message-id:date:from:to:cc:subject:date:message-id:reply-to; bh=fG9XbIZwEtYdaEyxXEUmYYoXi1icTQY/JfpVEnFSvH4=; b=G9BUoIgkKQIZs5R2jdci1qgFzFb5bqFT+85DLHTnTlCkGiuo6rDB6rnuWcd3oRiIwm BlyT6gPC9+MPijDat4oy2jWPPTbednlV6T/Yfwi0soBQhoE8pnszRzglT4xmw9LQeLQf gHXKsRa7HH49KROUuRLHnXhEV8iNjdu7U3pxsfQgThoGMW0dCuOVzdKa4IXO67thdXuu Y98Xvw4UlVL4GINMD2nl78RHi1ETEm5JDL6tlX/IGm3KMqoBNA9yXwhCjrEJjEmJg5Cm B33uOnV5c/UKQAlFIYl/FK6e7mMkegdIzgnW/CZsdxwN0SbABoEiEV5lDEDEyjKAKMfr mQ8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736776018; x=1737380818; h=mime-version:user-agent:references:in-reply-to:subject:cc:to:from :message-id:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=fG9XbIZwEtYdaEyxXEUmYYoXi1icTQY/JfpVEnFSvH4=; b=xMQHU8MWKCPsCx76ohEYsQaNPlgufMpjjYMqIbtFcKhEayBdDvG5twWzC4b+QU60HZ RGhp8QRp3K0GmeKypOocMCswL54q4wtXuLPz1wPN1OweGpcWAiRsYMiq5YOw9fjbkW12 IraAb94Ge9eSNjQq+QUvVsPy5T3fzT+0/r6bkYo+1EV7fipQJTSUXleqScXd50vO3uqD 71cCjp36wCwijNHu1ym1syh5ZSz4DjZWNNwI89f2853TzZdx64l9riESYG7fOPcSVjjW Ulvb/Jtw/nJqM+BKmszCDr9rfofFlLuqzo6cBEGJpVZ8BIb3ms8NWwQ//F9RYZ18Dvgp ngkQ== X-Gm-Message-State: AOJu0Yzwd+B79UlltMJvFi4It9JTmCJFyXz8pw6qrXAv7UwF3pUmMC5x RuAqakbB30YXakRmP89x92z1PVjfkSYTBf2hMnSeVpRMxyxq4nac X-Gm-Gg: ASbGncvA1wvhKNx8lsGgZLqvD8wg3WosflLdKVabQlZq4XiNkobtTngdica5HJPy31p rJhkvcvCjgxkWNmrKg1KDRnjg36UW7hW1e02kXkB1V3FzgzM9KHQtEW7PQUoj1mXoTnRfeFyEc5 mlHM3HgTzA3/GgRNhDoUaNGZdKcYYcOwHvaYDFRHsD9jS190jDZjAtoZ8bIGspwrpcpIBkkfGqP PdCXnsZjAl4KbCaZ3pB7UFyok4Fb32F+aoTc9blsnx/dZrhpF5Nypobw8t4jtji56ihvcTzipci 5XctOxCYvF4= X-Google-Smtp-Source: AGHT+IF8KtqiiGpt34GILY5MySqF/fSdMltwQ+s1L+fwZZDFobpxJcmeeFCa/IqfIgIL+PqLmMiicg== X-Received: by 2002:a05:6a00:2c86:b0:71e:e4f:3e58 with SMTP id d2e1a72fcca58-72d21fbcf06mr27584514b3a.17.1736776018356; Mon, 13 Jan 2025 05:46:58 -0800 (PST) Received: from localhost (58x12x133x161.ap58.ftth.ucom.ne.jp. [58.12.133.161]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72d40658cd0sm5831437b3a.113.2025.01.13.05.46.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jan 2025 05:46:57 -0800 (PST) Date: Mon, 13 Jan 2025 22:46:54 +0900 Message-ID: From: kobarity To: Christoph Groth , Eli Zaretskii Subject: Re: bug#75387: 29.4; hideshow: hs-hide-level hides multiple top-level blocks as one In-Reply-To: References: <87ed1hw0rz.fsf@drac> <86ikqkxt99.fsf@gnu.org> <8734hnalgg.fsf@drac> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?ISO-8859-4?Q?Goj=F2?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/31.0.50 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: multipart/mixed; boundary="Multipart_Mon_Jan_13_22:46:54_2025-1" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 75387 Cc: 75387@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --Multipart_Mon_Jan_13_22:46:54_2025-1 Content-Type: text/plain; charset=US-ASCII kobarity wrote: > I confirmed the same behavior. This is not a problem in hideshow.el. > Only immediately after the file is read, `python-nav-end-of-block' > behaves unexpectedly. > > 1. emacs -Q > 2. Find file builder.py > 3. Search "class SiteFamily" and go there > 4. M-x python-nav-end-of-block > 5. Search "class Symmetry" and go there > 6. M-x python-nav-end-of-block > > The point moves to the end of the buffer, which is not an expected > behavior. However, repeating the steps 5 and 6 does not produce this > issue. > > This is the direct cause of the problem of `hs-hide-level'. > > This problem does not occur when I run `font-lock-debug-fontify' after > reading the file, so it might be related to font-lock code in > python.el, but it seems that disabling font-lock does not solve this > issue. I will continue to look into this, but it may take some time. I think I've found the root cause. `python-nav-end-of-statement' may fail to find the end of a long triple-quoted string when the buffer is "fresh". It uses the following code to find the end of a triple-quoted string: (re-search-forward (rx (syntax string-delimiter)) nil t) However, the syntax is not always fully propertized. If the end of the long multi-line string and beyond are not yet propertized, the above search fails and `python-nav-end-of-statement' moves the point to the end of the buffer. In case of builder.py, `python-nav-end-of-statement' fails to find the end of the long docstring. This results in `python-nav-end-of-block' moving point to the end of the buffer, which causes `hs-hide-level' to hide multiple blocks as one. Attached is a patch to fix this issue. I changed the above search to searching for triple-quotes and checking syntax. Checking syntax involves `syntax-ppss' and syntax properties up to the point are updated. --Multipart_Mon_Jan_13_22:46:54_2025-1 Content-Type: application/octet-stream; type=patch; name="0001-Fix-string-end-search-in-python-nav-end-of-statement.patch" Content-Disposition: attachment; filename="0001-Fix-string-end-search-in-python-nav-end-of-statement.patch" Content-Transfer-Encoding: 7bit >From 6b3c34d272639f97ecb4043124db54501be20520 Mon Sep 17 00:00:00 2001 From: kobarity Date: Mon, 13 Jan 2025 22:38:42 +0900 Subject: [PATCH] Fix string end search in python-nav-end-of-statement * lisp/progmodes/python.el (python-nav-end-of-statement): Change to look for string delimiter characters and check syntax, instead of looking for string-delimiter syntax. * test/lisp/progmodes/python-tests.el (python-nav-end-of-statement-5): New test. (Bug#75387) --- lisp/progmodes/python.el | 7 +++++-- test/lisp/progmodes/python-tests.el | 24 ++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 16c296a8f86..73eec88977c 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -2328,8 +2328,11 @@ python-nav-end-of-statement (setq last-string-end (or (if (eq t (nth 3 (syntax-ppss))) - (re-search-forward - (rx (syntax string-delimiter)) nil t) + (cl-loop + while (re-search-forward + (rx (or "\"\"\"" "'''")) nil t) + unless (python-syntax-context 'string) + return (point)) (ignore-error scan-error (goto-char string-start) (python-nav--lisp-forward-sexp) diff --git a/test/lisp/progmodes/python-tests.el b/test/lisp/progmodes/python-tests.el index ec0a836cb8f..898e2b036e0 100644 --- a/test/lisp/progmodes/python-tests.el +++ b/test/lisp/progmodes/python-tests.el @@ -3204,6 +3204,30 @@ python-nav-end-of-statement-4 (python-tests-look-at "c'") (pos-eol)))))) +(ert-deftest python-nav-end-of-statement-5 () + "Test long multi-line string (Bug#75387)." + (let* ((line (format "%s\n" (make-string 80 ?a))) + (lines (apply #'concat (make-list 50 line)))) + (python-tests-with-temp-buffer + (concat + " +s = ''' +" + lines + "\\'''" + lines + "''' +a = 1 +") + (python-tests-look-at "s = '''") + (should (= (save-excursion + (python-nav-end-of-statement) + (point)) + (save-excursion + (python-tests-look-at "a = 1") + (forward-line -1) + (pos-eol))))))) + (ert-deftest python-nav-forward-statement-1 () (python-tests-with-temp-buffer " -- 2.43.0 --Multipart_Mon_Jan_13_22:46:54_2025-1-- From debbugs-submit-bounces@debbugs.gnu.org Sat Jan 18 09:17:37 2025 Received: (at 75387) by debbugs.gnu.org; 18 Jan 2025 14:17:37 +0000 Received: from localhost ([127.0.0.1]:40760 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tZ9do-0001uW-RQ for submit@debbugs.gnu.org; Sat, 18 Jan 2025 09:17:37 -0500 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]:48544) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1tZ9dm-0001uH-BC for 75387@debbugs.gnu.org; Sat, 18 Jan 2025 09:17:34 -0500 Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-21bc1512a63so60725505ad.1 for <75387@debbugs.gnu.org>; Sat, 18 Jan 2025 06:17:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737209848; x=1737814648; darn=debbugs.gnu.org; h=mime-version:user-agent:references:in-reply-to:subject:cc:to:from :message-id:date:from:to:cc:subject:date:message-id:reply-to; bh=1VyOalLB8PFjUhYOhWYAAmsdKzvg/+gVPo5KnACxDV0=; b=QtBP6gYc2cy6jyvF51rw/d4NYdbFMb2MHNdVI2vFiRS80YGZNhIciGhdnKsHrKCYiD F+dBBGFKF4yBoYqCuPVFh09KCpqMB1Code5zS33Caw5kECZe0i1UwO84e9FJqHlkYWqu 9DmbwQ/Oqv4obb98ISKjWohE+PhYZKl2T8VJ+zYjCzMFQf7Nax0F+/iauHZvQ66qqaso wLEngmk8NYgtn8BoJYh2lOBLy8xrKmTt8MIuGVy7w8K61LfxcZC8ZWpXo+l/d3D2hG0s xHyPjyaSeXo7PujE80dVUx8UdypPyMyeAbG0Dpw4AEeccGsO0CT+jUpfJZVGunhvzEdF VSHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737209848; x=1737814648; h=mime-version:user-agent:references:in-reply-to:subject:cc:to:from :message-id:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=1VyOalLB8PFjUhYOhWYAAmsdKzvg/+gVPo5KnACxDV0=; b=ld7biE4v1rLnmqiJD2gGdnuEUqeYDqk9d9A4kkLA1847T+df3fpLS/FJF48x5+hacG ynaeG9BXpmbogrbjfWGuzKpjdk27Br4lYhvH3Im/D2hcoxrapU2q/B0rTjy0D6IeRaqb LSUImN2j7kPfpVHaToFRdIAlC5UWYaZuUw4cGpYmC/cdrn9JzsGhFK+sboMz93dvmb7N U1+kV3tPq/sXI00GsrgCNuDuvyh42uwVVl9RdBu11SeLPvxOaJe6nDmfoFx5rw3tY1Qc bmO+admhyDqWvblGLNdtL4bAq9qGSH+eo1EHJhtTfX2K7D4nsSSRFQbv74ax+IEGZ9r/ 1uRg== X-Gm-Message-State: AOJu0YwabQA9e3ho6AJshhNQRMrDMlZt75ny6G5uQ4YEmhoCgJMmTpHJ F55UD5Q3TmYx47hXGiSvK97bPUZK6/A/3ImuWt44fwr5AFEbHP9YBzOinw== X-Gm-Gg: ASbGncs7DF7vdZ9axDZty/XqY2LrFM1P+jOxiJJiJicXPym3d4JwNKqzE4aX5qTMdTk uTbyGc+KJCUp9cL7lC/2NERlIQcnDH6D4GhU1ZyHJ30PKuSRgDmtnpD1OBu4DG7NpgvDw5/DydM owJ+YtsxJpmTzFQn4kitjSclzWDH4u4wLgc9+nFkeTaw7/qiSVOFAivOX/j6S5D1wrX3YTYroMe 3Hhxm1OZTdDkpgAxh2Nn8mjkZMvEwtRuKwz9gEm6ZBXxVXETw1Fjy/SYDCaOt0mAuXgNl8G1sT3 MfhlwmY16W98oSO2+BIROa+M X-Google-Smtp-Source: AGHT+IHH4DRqpb+m/KY9Q/AjxWfJOjy85/UroZXVp6vCP+NSJ8HPeJt9AasevH9KqKLSSs9rMyTf1g== X-Received: by 2002:a17:902:ea05:b0:216:3d72:1712 with SMTP id d9443c01a7336-21c3579359cmr106922745ad.48.1737209848018; Sat, 18 Jan 2025 06:17:28 -0800 (PST) Received: from localhost (58x12x133x161.ap58.ftth.ucom.ne.jp. [58.12.133.161]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-21c2ceb8330sm32478205ad.59.2025.01.18.06.17.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Jan 2025 06:17:27 -0800 (PST) Date: Sat, 18 Jan 2025 23:17:07 +0900 Message-ID: From: kobarity To: Christoph Groth , Eli Zaretskii Subject: Re: bug#75387: 29.4; hideshow: hs-hide-level hides multiple top-level blocks as one In-Reply-To: References: <87ed1hw0rz.fsf@drac> <86ikqkxt99.fsf@gnu.org> <8734hnalgg.fsf@drac> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?ISO-8859-4?Q?Goj=F2?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/31.0.50 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 75387 Cc: 75387@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) kobarity wrote: > kobarity wrote: > > I confirmed the same behavior. This is not a problem in hideshow.el. > > Only immediately after the file is read, `python-nav-end-of-block' > > behaves unexpectedly. > > > > 1. emacs -Q > > 2. Find file builder.py > > 3. Search "class SiteFamily" and go there > > 4. M-x python-nav-end-of-block > > 5. Search "class Symmetry" and go there > > 6. M-x python-nav-end-of-block > > > > The point moves to the end of the buffer, which is not an expected > > behavior. However, repeating the steps 5 and 6 does not produce this > > issue. > > > > This is the direct cause of the problem of `hs-hide-level'. > > > > This problem does not occur when I run `font-lock-debug-fontify' after > > reading the file, so it might be related to font-lock code in > > python.el, but it seems that disabling font-lock does not solve this > > issue. I will continue to look into this, but it may take some time. > > I think I've found the root cause. `python-nav-end-of-statement' may > fail to find the end of a long triple-quoted string when the buffer is > "fresh". It uses the following code to find the end of a > triple-quoted string: > > (re-search-forward (rx (syntax string-delimiter)) nil t) > > However, the syntax is not always fully propertized. If the end of > the long multi-line string and beyond are not yet propertized, the > above search fails and `python-nav-end-of-statement' moves the point > to the end of the buffer. > > In case of builder.py, `python-nav-end-of-statement' fails to find the > end of the long docstring. This results in `python-nav-end-of-block' > moving point to the end of the buffer, which causes `hs-hide-level' to > hide multiple blocks as one. > > Attached is a patch to fix this issue. I changed the above search to > searching for triple-quotes and checking syntax. Checking syntax > involves `syntax-ppss' and syntax properties up to the point are > updated. Hi Christoph, could you test my patch? From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 01 06:52:22 2025 Received: (at 75387) by debbugs.gnu.org; 1 Feb 2025 11:52:22 +0000 Received: from localhost ([127.0.0.1]:56766 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1teC2w-0005PH-AI for submit@debbugs.gnu.org; Sat, 01 Feb 2025 06:52:22 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:48852) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1teC2t-0005P4-TS for 75387@debbugs.gnu.org; Sat, 01 Feb 2025 06:52:20 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1teC2n-0006Ig-IH; Sat, 01 Feb 2025 06:52:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=XGDP+ihw0qBTM61Gt7g+EQZO2XhXoCHdX8cNJLep+Jg=; b=lnyLvrbBg7fi Y2msdWRCy7FrIakSOQ52f6/f5iw+C2ipBR8vrfYt+wAr/q/c4fpq0RraId4Zj8Bv/+f3hr6P49zfi kox/IIG5uvXmqeiAh6Qgk6BibzrvLWsT/qrLO50zdXeOeOWbp3KTDeTA6uDelGm2Pgzxly6kn4I5Q S0G7fjkCOsn7+JPE0+MkgI5POX3wMm7gG1PA1oqHl5v2+MIoxV/4OnxyrvGIm6Qf4Neq2v33GHxRW 1vGJWiZidx9daNOvTtdg4VtakKSbFLn//mceV07di4jdcKhfqC/AIkvje0Uo3NzaPWp/Uexn2/XUa o7UGtsvr0lZFKEVLCuAvvw==; Date: Sat, 01 Feb 2025 13:52:11 +0200 Message-Id: <86r04hg9w4.fsf@gnu.org> From: Eli Zaretskii To: christoph@grothesque.org, kobarity In-Reply-To: (message from kobarity on Sat, 18 Jan 2025 23:17:07 +0900) Subject: Re: bug#75387: 29.4; hideshow: hs-hide-level hides multiple top-level blocks as one References: <87ed1hw0rz.fsf@drac> <86ikqkxt99.fsf@gnu.org> <8734hnalgg.fsf@drac> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 75387 Cc: 75387@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Ping! Christoph, could you please respond? > Date: Sat, 18 Jan 2025 23:17:07 +0900 > From: kobarity > Cc: 75387@debbugs.gnu.org > > kobarity wrote: > > kobarity wrote: > > > I confirmed the same behavior. This is not a problem in hideshow.el. > > > Only immediately after the file is read, `python-nav-end-of-block' > > > behaves unexpectedly. > > > > > > 1. emacs -Q > > > 2. Find file builder.py > > > 3. Search "class SiteFamily" and go there > > > 4. M-x python-nav-end-of-block > > > 5. Search "class Symmetry" and go there > > > 6. M-x python-nav-end-of-block > > > > > > The point moves to the end of the buffer, which is not an expected > > > behavior. However, repeating the steps 5 and 6 does not produce this > > > issue. > > > > > > This is the direct cause of the problem of `hs-hide-level'. > > > > > > This problem does not occur when I run `font-lock-debug-fontify' after > > > reading the file, so it might be related to font-lock code in > > > python.el, but it seems that disabling font-lock does not solve this > > > issue. I will continue to look into this, but it may take some time. > > > > I think I've found the root cause. `python-nav-end-of-statement' may > > fail to find the end of a long triple-quoted string when the buffer is > > "fresh". It uses the following code to find the end of a > > triple-quoted string: > > > > (re-search-forward (rx (syntax string-delimiter)) nil t) > > > > However, the syntax is not always fully propertized. If the end of > > the long multi-line string and beyond are not yet propertized, the > > above search fails and `python-nav-end-of-statement' moves the point > > to the end of the buffer. > > > > In case of builder.py, `python-nav-end-of-statement' fails to find the > > end of the long docstring. This results in `python-nav-end-of-block' > > moving point to the end of the buffer, which causes `hs-hide-level' to > > hide multiple blocks as one. > > > > Attached is a patch to fix this issue. I changed the above search to > > searching for triple-quotes and checking syntax. Checking syntax > > involves `syntax-ppss' and syntax properties up to the point are > > updated. > > Hi Christoph, could you test my patch? > From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 02 17:41:46 2025 Received: (at 75387) by debbugs.gnu.org; 2 Feb 2025 22:41:46 +0000 Received: from localhost ([127.0.0.1]:36601 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1teiev-0002jJ-RV for submit@debbugs.gnu.org; Sun, 02 Feb 2025 17:41:46 -0500 Received: from mailgate02.uberspace.is ([2a00:d0c0:200:0:1c7b:a6ff:fee0:8ea4]:52770) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1teiet-0002ix-6A for 75387@debbugs.gnu.org; Sun, 02 Feb 2025 17:41:44 -0500 Received: from dia.uberspace.de (dia.uberspace.de [185.26.156.221]) by mailgate02.uberspace.is (Postfix) with ESMTPS id 73AA41803A4 for <75387@debbugs.gnu.org>; Sun, 2 Feb 2025 23:41:33 +0100 (CET) Received: (qmail 15490 invoked by uid 989); 2 Feb 2025 22:41:33 -0000 Authentication-Results: dia.uberspace.de; auth=pass (plain) Received: from unknown (HELO unkown) (::1) by dia.uberspace.de (Haraka/3.0.1) with ESMTPSA; Sun, 02 Feb 2025 23:41:33 +0100 From: Christoph Groth To: kobarity Subject: Re: bug#75387: 29.4; hideshow: hs-hide-level hides multiple top-level blocks as one In-Reply-To: (kobarity@gmail.com's message of "Mon, 13 Jan 2025 22:46:54 +0900") References: <87ed1hw0rz.fsf@drac> <86ikqkxt99.fsf@gnu.org> <8734hnalgg.fsf@drac> Date: Sun, 02 Feb 2025 23:41:28 +0100 Message-ID: <875xlsj7fr.fsf@grothesque.org> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Rspamd-Bar: -- X-Rspamd-Report: BAYES_HAM(-2.137018) MIME_GOOD(-0.1) X-Rspamd-Score: -2.237018 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=grothesque.org; s=uberspace; h=from:to:cc:subject:date; bh=mg2Ct5Tn3O22d1MgqJH8goX9/2bJdy20BFyvo1FjfHQ=; b=jkIjuL4V7p0fcpN6akJhw/0BpiAHZnpcc+aGvYG0smxX+vdbWXkvkpTr+kIUpW7kE5F/YvhhN+ 6ph8Mur7c1dg5QHI8xVroCQdB2/uG0RSk5r6sI0djPTF6qn5XqBPGsD6XlrSLhkE6O+3ydfZhRJc L5nYUAq8yS2BJunwJfXvdBB/dLFK9NtAmtrhuZiauctIPyYDYqhb006vPaAchDQm1u+1vurSuaZz 2OjK9sI01aEXo2kswxrdRSVqbXbPXJKjWf0kH+7v81SEVX1GG5gYRao0eXECpObkzeTLl13GCQqM 8oOGttuRWOvVX3nqX0vvM0pxLhb+skXB8SvcGk53tWmzszUNAtKa8tSAqd5eocPehEUjjWc0S2xp 1hBVw9nSUt4iC2MVx/IhuIbdytEIhTfFZI9Mr4agH1EmWZf6ZnkWBTMjeuf47sqPClhyntGyFsZy CIyegmYPGz39a3QmGKVR4yNW/lZSA5nj7KAMUA3G+YWU82cmOVzI1I3AwfE9PU3/oW8f2mV8Ge01 pvy7pMMALeOk34L5jUFzW9ajdZGU9eAJEdLjkOMdeRMSXR+Wcww66r+Z/EhbEdnd5xUTBxfYNX9K e9XuAjrRWcAT4qmHU6LSs4RQ+NoMMlOL3NISmPpYp4whhbGM53xmN9pPnDsdouET0gyZeaxK/T0d 8= X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 75387 Cc: Eli Zaretskii , 75387@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) kobarity wrote: > I think I've found the root cause. `python-nav-end-of-statement' may > fail to find the end of a long triple-quoted string when the buffer is > "fresh". It uses the following code to find the end of > a triple-quoted string: > > (...) > > Attached is a patch to fix this issue. I changed the above search to > searching for triple-quotes and checking syntax. Checking syntax > involves `syntax-ppss' and syntax properties up to the point are > updated. I verified that the patch indeed solves the issue for me and does not seem to introduce any other problem. These were the steps that I followed: =E2=80=A2 In my Emacs 29.4 from Debian stable, I copied the function python-nav-end-of-statement to *scratch*. =E2=80=A2 There, I manually applied the change from the patch. =E2=80=A2 I evaluated the function definition. =E2=80=A2 I tried to reproduce the issue in a =E2=80=9Cfresh=E2=80=9D build= er.py buffer, but it no longer appears. Thanks Christoph From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 03 17:34:08 2025 Received: (at 75387) by debbugs.gnu.org; 3 Feb 2025 22:34:08 +0000 Received: from localhost ([127.0.0.1]:41701 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tf516-0004KX-7I for submit@debbugs.gnu.org; Mon, 03 Feb 2025 17:34:08 -0500 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]:46442) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1tf514-0004Jz-KK for 75387@debbugs.gnu.org; Mon, 03 Feb 2025 17:34:07 -0500 Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-21649a7bcdcso85947515ad.1 for <75387@debbugs.gnu.org>; Mon, 03 Feb 2025 14:34:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1738622040; x=1739226840; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:user-agent:references :in-reply-to:subject:cc:to:from:message-id:date:from:to:cc:subject :date:message-id:reply-to; bh=jkqNNgUcLs+PJuxmOQQar/5rPNDQ4jS8vTJHxOzYpmQ=; b=WhDYQ900+hcz2nTZrhZUo3684ohRDfuOwL5uIBTfMsf+6E5az2Ulb2FsEFmsNJl+b7 C9nyDC6Oe8okTaVQjzcPsz2r4E3f/+lu057vf+ULpsD1PLESlPsaYDcatFgfX7T5uAlZ NbG218XB7uTife94gsN+SDifi/MUbhhf3gEyFBY3zVjPz3HH8tF+L0JUryJaZfcBa4mV Tcf4LreYyHHVQ/HHLqNzESGmTI1TUiyhgRIHMc/TjgJL1t9ZzGmFqBxvCtaMscIj1Gk+ YoUzMkaZ23oVd8NbAOQNGF3f5s/q0gQjW/AomkfP/bhgw4ug3poM4ajfSNUEENZSneiV m/OQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738622040; x=1739226840; h=content-transfer-encoding:mime-version:user-agent:references :in-reply-to:subject:cc:to:from:message-id:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=jkqNNgUcLs+PJuxmOQQar/5rPNDQ4jS8vTJHxOzYpmQ=; b=c0ECIfCnAMr3mWoZzo6uLh91+l3D7M+c7LMzGv8rieQDOA6N2f9HEAlMP1cWetrf/v uzAOkjG6qcvc4I5HJaAS5fd95snS2JdElHXJYWNNb1Sw2amTIwQ9GXGfBG/iOCspziDq 5Hu5N00oA+FNgYNfigHQr7xyt3oO/Nlh1pjMcKdjsTuyun6i+PCWA9V8L7THKFiH+jFn XLLvU6iP7z9x4Ubqn3oAJlcXATSHMJZh0IKisPNBNztXiItFsBWTlm21Zuy09SAPc0Qp 3pivu8ikcei3mUlxkhnhfBVsztscRbk816l48CXo480n7Y4rNkClxXoPVt14wToA9Vue KXBg== X-Forwarded-Encrypted: i=1; AJvYcCVTtko1d44Fr6GnwK4RIdKmK+O6ppp+YS7+pHKg11vvQXN8LzCoLkXmIF9IesL5xLWrXjGVMg==@debbugs.gnu.org X-Gm-Message-State: AOJu0YymfFaAqCQxQtweN8IxIfAzhGzQttJ0uc/BVT5shzkOFqasZcHu IUqUMYpMQ99Bu1joNvDmyF7t00c48r9lYkLhV7XI/E53FDF3o2wd X-Gm-Gg: ASbGnctxYSMznTZPWyUtOXfmZDvcK9WudC4V7sVbbnt0BAnyRD3DVnkc2sUkqg/rEO5 lqZPCFmy3H1HMlY3KJvrKSx6X12akEKvTSacJ/onWMOOdIc/J73rPkeHb3Ri9EW+cScOhqn5KPc wjGhQKvK1Uv9fSqswTWCiJrF1r6wZjSrbadbT+GIqdN7RMOxA9CTx36LdXdkWEl0uqWbcoNZM/Z Fy6VOxEvVfz2zP4xsAZah0f3JUiteJ57AOowC57B3cIYG05Ydr1eLdCZ3YcMsKTiIyMW6q11zdI s1ZswQ5kqhPaWHh+QUiKCW0yczD6TaITocIHJYiq4jhqsg== X-Google-Smtp-Source: AGHT+IF3K9vjENgWNHmYrQHpBOF/SntDM3Yr1vVoXwjWYVk1p3vyQ2bP1VngJJAtGLAwBJrlXh8yVg== X-Received: by 2002:a17:902:d551:b0:216:5556:8b46 with SMTP id d9443c01a7336-21dd7e0728fmr397063725ad.49.1738622040408; Mon, 03 Feb 2025 14:34:00 -0800 (PST) Received: from localhost (58x12x133x161.ap58.ftth.ucom.ne.jp. [58.12.133.161]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-21de32ef974sm82499095ad.137.2025.02.03.14.33.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Feb 2025 14:34:00 -0800 (PST) Date: Tue, 04 Feb 2025 07:34:00 +0900 Message-ID: From: kobarity To: Christoph Groth Subject: Re: bug#75387: 29.4; hideshow: hs-hide-level hides multiple top-level blocks as one In-Reply-To: <875xlsj7fr.fsf@grothesque.org> References: <87ed1hw0rz.fsf@drac> <86ikqkxt99.fsf@gnu.org> <8734hnalgg.fsf@drac> <875xlsj7fr.fsf@grothesque.org> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?ISO-8859-4?Q?Goj=F2?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/31.0.50 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 75387 Cc: Eli Zaretskii , 75387@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Christoph Groth wrote: >=20 > kobarity wrote: >=20 > > I think I've found the root cause. `python-nav-end-of-statement' may > > fail to find the end of a long triple-quoted string when the buffer is > > "fresh". It uses the following code to find the end of > > a triple-quoted string: > > > > (...) > > > > Attached is a patch to fix this issue. I changed the above search to > > searching for triple-quotes and checking syntax. Checking syntax > > involves `syntax-ppss' and syntax properties up to the point are > > updated. >=20 > I verified that the patch indeed solves the issue for me and > does not seem to introduce any other problem. >=20 > These were the steps that I followed: >=20 > =E2=80=A2 In my Emacs 29.4 from Debian stable, I copied the function > python-nav-end-of-statement to *scratch*. >=20 > =E2=80=A2 There, I manually applied the change from the patch. >=20 > =E2=80=A2 I evaluated the function definition. >=20 > =E2=80=A2 I tried to reproduce the issue in a =E2=80=9Cfresh=E2=80=9D bui= lder.py buffer, but it > no longer appears. >=20 > Thanks > Christoph Thank you for testing the patch. From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 15 06:26:38 2025 Received: (at 75387-done) by debbugs.gnu.org; 15 Feb 2025 11:26:39 +0000 Received: from localhost ([127.0.0.1]:53620 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tjGJi-0005eo-Eg for submit@debbugs.gnu.org; Sat, 15 Feb 2025 06:26:38 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:50998) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tjGJf-0005eY-Ms for 75387-done@debbugs.gnu.org; Sat, 15 Feb 2025 06:26:36 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tjGJZ-00021q-A5; Sat, 15 Feb 2025 06:26:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=X+hYu5q92/RaOF6vBHxPIhrzZDaQM5cRoH+fCfiTITw=; b=i4fEGGwCJsvAHiu+e+uP 8Jecu7OThgzZ4CquACmubyG2Hh7eQhZOlc9rZWeCtorb+SQhZ9hZvp/KrvarmfFVteWkXIVTN0VEU yPR9v1OnktNAf0eymRNPySod4U5SrfTYyJJufz/7qJjS6bdJlsi0Kijli7/Wf35+mjVFZrOdLp6oM SMjJ08/FncxZS3MjOU4GraKdOUt/FNmNjKF7HYaFEXq0Yv30nK0zporY2G+we5GdpWzbnAQtjwFMv /si7QP3uHJJeew+A25qVemIPx87hn0xd/3JYFRHg9ZCMU1WnsZtx5WsGRQd+I7bAKAkVlU0JTYQAe dCjaE2P4dCFDIg==; Date: Sat, 15 Feb 2025 13:26:26 +0200 Message-Id: <86ldu7e9el.fsf@gnu.org> From: Eli Zaretskii To: Christoph Groth In-Reply-To: <875xlsj7fr.fsf@grothesque.org> (message from Christoph Groth on Sun, 02 Feb 2025 23:41:28 +0100) Subject: Re: bug#75387: 29.4; hideshow: hs-hide-level hides multiple top-level blocks as one References: <87ed1hw0rz.fsf@drac> <86ikqkxt99.fsf@gnu.org> <8734hnalgg.fsf@drac> <875xlsj7fr.fsf@grothesque.org> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 75387-done Cc: kobarity@gmail.com, 75387-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Christoph Groth > Cc: Eli Zaretskii , 75387@debbugs.gnu.org > Date: Sun, 02 Feb 2025 23:41:28 +0100 > > kobarity wrote: > > > I think I've found the root cause. `python-nav-end-of-statement' may > > fail to find the end of a long triple-quoted string when the buffer is > > "fresh". It uses the following code to find the end of > > a triple-quoted string: > > > > (...) > > > > Attached is a patch to fix this issue. I changed the above search to > > searching for triple-quotes and checking syntax. Checking syntax > > involves `syntax-ppss' and syntax properties up to the point are > > updated. > > I verified that the patch indeed solves the issue for me and > does not seem to introduce any other problem. > > These were the steps that I followed: > > • In my Emacs 29.4 from Debian stable, I copied the function > python-nav-end-of-statement to *scratch*. > > • There, I manually applied the change from the patch. > > • I evaluated the function definition. > > • I tried to reproduce the issue in a “fresh” builder.py buffer, but it > no longer appears. Thanks, I've now installed the patch on the master branch, and I'm therefore closing this bug. From unknown Fri Jun 20 07:16:07 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sun, 16 Mar 2025 11:24:28 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator