From debbugs-submit-bounces@debbugs.gnu.org Thu Nov 25 02:41:07 2021 Received: (at submit) by debbugs.gnu.org; 25 Nov 2021 07:41:07 +0000 Received: from localhost ([127.0.0.1]:55642 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mq9NQ-0002dt-2A for submit@debbugs.gnu.org; Thu, 25 Nov 2021 02:41:07 -0500 Received: from lists.gnu.org ([209.51.188.17]:48144) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mq9NM-0002dJ-30 for submit@debbugs.gnu.org; Thu, 25 Nov 2021 02:41:03 -0500 Received: from eggs.gnu.org ([209.51.188.92]:58876) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mq9NL-0001gi-Mo for bug-gnu-emacs@gnu.org; Thu, 25 Nov 2021 02:40:59 -0500 Received: from relay7-d.mail.gandi.net ([217.70.183.200]:41729) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mq9NJ-0000sy-F6 for bug-gnu-emacs@gnu.org; Thu, 25 Nov 2021 02:40:59 -0500 Received: (Authenticated sender: sadiq@sadiqpk.org) by relay7-d.mail.gandi.net (Postfix) with ESMTPA id 90EF92000A for ; Thu, 25 Nov 2021 07:40:51 +0000 (UTC) MIME-Version: 1.0 Date: Thu, 25 Nov 2021 13:10:51 +0530 From: Mohammed Sadiq To: bug-gnu-emacs@gnu.org Subject: 28.0.60; hs-toggle-hiding does not toggle once folded Message-ID: <178345d38657e8ad3b7cb50b644b1c5c@sadiqpk.org> X-Sender: sadiq@sadiqpk.org Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=217.70.183.200; envelope-from=sadiq@sadiqpk.org; helo=relay7-d.mail.gandi.net 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, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-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.6 (-) 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: -2.6 (--) With hs-minor-mode enabled, I could hide the visibility of a block with hs-toggle-hiding, but using it again doesn't unfold the region. Tested with c-mode and css-mode. In GNU Emacs 28.0.60 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.30, cairo version 1.16.0) of 2021-11-25 built on purism Repository revision: 0854453ec2343cbfac3ac8e233cdc7bd2c8554a9 Repository branch: emacs-28 Windowing system distributor 'The X.Org Foundation', version 11.0.12011000 System Description: Debian GNU/Linux bookworm/sid Configured using: 'configure --with-native-compilation' 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 THREADS TIFF TOOLKIT_SCROLL_BARS X11 XDBE XIM XPM GTK3 ZLIB Important settings: value of $LANG: en_IN value of $XMODIFIERS: @im=ibus locale-coding-system: iso-latin-1-unix Major mode: C/*l Minor modes in effect: tooltip-mode: t global-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 auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t transient-mark-mode: t abbrev-mode: t hs-minor-mode: t Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs rfc822 mml mml-sec epa derived epg rfc6068 epg-config gnus-util rmail rmail-loaddefs auth-source eieio eieio-core eieio-loaddefs password-cache json map text-property-search time-date mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail comp comp-cstr warnings subr-x rx cl-seq cl-macs cl-extra help-mode rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils hideshow vc-git diff-mode easy-mmode vc-dispatcher seq byte-opt gv bytecomp byte-compile cconv cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs cl-loaddefs cl-lib iso-transl tooltip 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 cl-generic 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 simple abbrev obarray cl-preloaded nadvice button loaddefs faces cus-face macroexp files window text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote threads dbusbind inotify lcms2 dynamic-setting system-font-setting font-render-setting cairo move-toolbar gtk x-toolkit x multi-tty make-network-process native-compile emacs) Memory information: ((conses 16 125023 9196) (symbols 48 10111 1) (strings 32 30461 3484) (string-bytes 1 1135663) (vectors 16 20448) (vector-slots 8 388478 20146) (floats 8 31 60) (intervals 56 377 0) (buffers 992 13)) From debbugs-submit-bounces@debbugs.gnu.org Thu Nov 25 05:30:00 2021 Received: (at 52092) by debbugs.gnu.org; 25 Nov 2021 10:30:00 +0000 Received: from localhost ([127.0.0.1]:55874 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mqC0u-0000aq-6g for submit@debbugs.gnu.org; Thu, 25 Nov 2021 05:30:00 -0500 Received: from eggs.gnu.org ([209.51.188.92]:41544) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mqC0t-0000aR-Ea for 52092@debbugs.gnu.org; Thu, 25 Nov 2021 05:29:59 -0500 Received: from [2001:470:142:3::e] (port=35788 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mqC0n-0005QN-Gt; Thu, 25 Nov 2021 05:29:53 -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=628ALGa6NXUJ78uyriIrr79EOHkoMSQ16nbnX5ipt5s=; b=QRmhIjZ+pjkh oorC6hEoQg8Y8muZeCF6gUWFXmErJ0s0qQBVm6SCPgVDGpmpRq4B1b8l7fMh1Tg34E/IXVPC/V8sf 2tKXywedkmbIOg3BM7mf+G/B2H71dlg0kZrS9iPTWMUd+BFhPfoQL4rtKiK+bGW+tuKlzT4k7yeXR nY4wD3Px36Qb1T/cAvWn38X5+JQg6QvP9g5ADjZLUju/hehmiocx8jCswOXWb4DolGj8g8+kPvVjQ PLLhayEygWpOrpvM7p8I4PEjP+wLEfg8+0A35KCEqMYXxSEYoRGdRXJtsANmlwZWldyduAGMi43J7 8wN0sr5vv06PB6qPO2LcXA==; Received: from [87.69.77.57] (port=3955 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mqC0n-0004u6-3I; Thu, 25 Nov 2021 05:29:53 -0500 Date: Thu, 25 Nov 2021 12:29:54 +0200 Message-Id: <834k807ckd.fsf@gnu.org> From: Eli Zaretskii To: Mohammed Sadiq In-Reply-To: <178345d38657e8ad3b7cb50b644b1c5c@sadiqpk.org> (message from Mohammed Sadiq on Thu, 25 Nov 2021 13:10:51 +0530) Subject: Re: bug#52092: 28.0.60; hs-toggle-hiding does not toggle once folded References: <178345d38657e8ad3b7cb50b644b1c5c@sadiqpk.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 52092 Cc: 52092@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 (---) > Date: Thu, 25 Nov 2021 13:10:51 +0530 > From: Mohammed Sadiq > > > With hs-minor-mode enabled, I could hide the visibility of a block with > hs-toggle-hiding, but using it again doesn't unfold the region. > > Tested with c-mode and css-mode. It seems that unhiding works only if you are at the beginning of the hidden block. In C Mode, that means cursor is on the opening brace of the block. The problem seems to be inside hs-already-hidden-p: (defun hs-already-hidden-p () "Return non-nil if point is in an already-hidden block, otherwise nil." (save-excursion (let ((c-reg (hs-inside-comment-p))) (if (and c-reg (nth 0 c-reg)) ;; point is inside a comment, and that comment is hideable (goto-char (nth 0 c-reg)) (end-of-line) That call to end-of-line moves point outside of the braces _unless_ point is on the left brace that starts the hidden block. That movement then makes it appear as if we are in the outer block, not in the one that you've just hidden. I don't know enough about hideshow.el and don't use it enough to propose a robust enough solution for this which won't break some use case out there. From debbugs-submit-bounces@debbugs.gnu.org Thu Dec 02 20:12:28 2021 Received: (at control) by debbugs.gnu.org; 3 Dec 2021 01:12:28 +0000 Received: from localhost ([127.0.0.1]:49733 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1msx7j-00061K-Vz for submit@debbugs.gnu.org; Thu, 02 Dec 2021 20:12:28 -0500 Received: from mail-pj1-f48.google.com ([209.85.216.48]:40954) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1msx7h-000613-2E for control@debbugs.gnu.org; Thu, 02 Dec 2021 20:12:26 -0500 Received: by mail-pj1-f48.google.com with SMTP id gf14-20020a17090ac7ce00b001a7a2a0b5c3so3874478pjb.5 for ; Thu, 02 Dec 2021 17:12:25 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:mime-version:date:message-id:subject:to; bh=laj/Kh5TcuFQJDVDg8zgj0E1d3T+CB2hdTSnIJqX+B4=; b=bprUj+GS6yRHFoCztOgZY5v1AtNBWHvP/GmweSZfnnMA13BWLTW/91xMSfh6xde10R 3EKdnxaA6nNzG0roPW/N1n01dTWcQbPpU62h68Ewfk5wVninH3AYbBgiJgcLyqOlq2tF 8cqj/bvweuK9LMTljGqfGT8fUeuy+xAdo7Us+63uagTwWoJZq2fVkvyUIPGVjduAXp27 pm1marfft0Z0ETU5eb4HqVWvFKnPPSez/4ZOhv4t/kqHPvcvOTZhvdmODua8khz8tD0c L9PzJ9Ue9V6EhZgDCM7YEMbS+WxYIDzMaJXQrqRBsPZ0h/tsvdKiFMF1kwRIu10vFitH mnNQ== X-Gm-Message-State: AOAM533pjbZKVyxWP3eXeQkSUKKZX2N6WS3mi9HCSKXophS8Skd9H04B aFKSeTvDFUlK8MQ6cVSCrdZF7mBCPkKMAMUjSRI/DOJs X-Google-Smtp-Source: ABdhPJymA098ZPnn7T7QvMKIXwqGnooILvBG1gF1k7lzn+aP/4xsiZm4DA2rULQqXwpbr1dwh4aak3cphmoroj+ykJ8= X-Received: by 2002:a17:90a:4414:: with SMTP id s20mr10190417pjg.132.1638493939436; Thu, 02 Dec 2021 17:12:19 -0800 (PST) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Thu, 2 Dec 2021 17:12:18 -0800 From: Stefan Kangas MIME-Version: 1.0 Date: Thu, 2 Dec 2021 17:12:18 -0800 Message-ID: Subject: control message for bug #52092 To: control@debbugs.gnu.org Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.5 (/) X-Debbugs-Envelope-To: control 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.5 (/) tags 52092 + help quit From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 19 02:32:12 2022 Received: (at 52092) by debbugs.gnu.org; 19 Sep 2022 06:32:12 +0000 Received: from localhost ([127.0.0.1]:51970 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oaAKB-00034K-MW for submit@debbugs.gnu.org; Mon, 19 Sep 2022 02:32:12 -0400 Received: from mail-pj1-f45.google.com ([209.85.216.45]:52750) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oaAKA-000349-Q3 for 52092@debbugs.gnu.org; Mon, 19 Sep 2022 02:32:11 -0400 Received: by mail-pj1-f45.google.com with SMTP id go6so22609692pjb.2 for <52092@debbugs.gnu.org>; Sun, 18 Sep 2022 23:32:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:user-agent:subject:cc:to:from:message-id:date:from:to :cc:subject:date; bh=RG6RUUo4q+I8vKvN5FscFLchVEPjqIeVcG58il/LH9s=; b=nL/F4NE4HNnFT0RdRtA9PZhNzEWHHNvdYS5u4b1OxmazVJ4JukfdcnMQbHeFzFitNI jV+RTxD8v4WFLODLe1JS58PKzanJl1DMBD1PLQsVSY5UcEZyJEiFcFelCIsbqNPsW1In 2lGNE6yj09DIOd3yJDCKVA5gq7JryUji8MNNlaeMqZJEcFYn7QyB3MC8HckyyxyQUMOl Ea0L5m+La1+ZNG37aWNeaBKUDUGYo/39Sz27zgifF8OMnwxGhstommgHqj/SnOvCdVGt 6g6uLw81uYuN6deHSWuIjSMKWu1kgslzftX3HYa3unTF7qs72mmEHNEboWcbEHaEOaFy mPvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:user-agent:subject:cc:to:from:message-id:date :x-gm-message-state:from:to:cc:subject:date; bh=RG6RUUo4q+I8vKvN5FscFLchVEPjqIeVcG58il/LH9s=; b=NEO9n8kaYjq2HPU+bpCtl1zB+V59UmkxwPFzVOVmEWPO00rw8Y78abOX7/BWnH1f18 zZcejPuaQIGyN2V5RpWwmTIpbtCy+dv7pCwzXa+0HETzcIj1G4YSIg28H3rKV5QigHnz xU/nGbb95rXBhO/eVT0GTPFumGifn7KWE6W1gJYjhwYQyC4z20Oq9PCkMsUhDdb1YgYD erJWDbi/QdS5uGZBbV7RUOGlK/o3O+cuP6b1rbGERCIPc4uSlCZzooJny5c29lSaeuUu HoSM6HZU4s6Nsv4NgelIR7rvaWTWhiCcGnKabU6QEJGfLSAuSGIr6lisOopZvRiXNRM9 gA9w== X-Gm-Message-State: ACrzQf18RfRqFxaID8qVAoylnqKF4r3Hj2VO2Olh5ToVxO+ScWB7skXl Jncol9fm+jTaLZKeiA4KDWw= X-Google-Smtp-Source: AMsMyM5O1Bk4J07FIDQVGB5tNv/BVKV39ZRDb8w7v5H8ZZfALUDUm+motNQgM9ir1fS0IMr8KegunA== X-Received: by 2002:a17:90b:1d02:b0:203:2d73:8efb with SMTP id on2-20020a17090b1d0200b002032d738efbmr23323435pjb.214.1663569124955; Sun, 18 Sep 2022 23:32:04 -0700 (PDT) Received: from localhost (58x12x133x161.ap58.ftth.ucom.ne.jp. [58.12.133.161]) by smtp.gmail.com with ESMTPSA id z7-20020a1709028f8700b001708c4ebbaesm19155182plo.309.2022.09.18.23.32.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Sep 2022 23:32:04 -0700 (PDT) Date: Mon, 19 Sep 2022 15:31:56 +0900 Message-ID: From: kobarity To: Eli Zaretskii , Mohammed Sadiq , 52092@debbugs.gnu.org Subject: Re: bug#52092: 28.0.60; hs-toggle-hiding does not toggle once folded 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/29.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_Sep_19_15:31:56_2022-1" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 52092 Cc: Stefan Monnier 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_Sep_19_15:31:56_2022-1 Content-Type: text/plain; charset=US-ASCII Mohammed Sadiq wrote: > With hs-minor-mode enabled, I could hide the visibility of a block with > hs-toggle-hiding, but using it again doesn't unfold the region. There is another problem related to this issue. `hs-toggle-hiding' is also bound to shift mouse-2, but it toggles the block where the current point is located instead of the block where mouse is clicked. The problem is described below: 1. emacs -Q 2. Open the following C mode file. #+begin_src C int main() { sub(); } int sub() { printf("sub\n"); } #+end_src 3. M-x hs-minor-mode 4. Move the point to the "printf" line in the "sub" function. 5. Shift mouse-2 in the function "main". The function body of "sub" is hidden instead of "main". This is not I expected. This behavior was introduced by the following commit. Is this intended behavior? commit d0e9113de9783094b4da7f6aeee131194653c325 Author: Stefan Monnier Date: Sun May 19 09:36:22 2019 -0400 * lisp/progmodes/hideshow.el: Simplify mouse binding; Use lexical-binding (hs-set-up-overlay, hs-adjust-block-beginning): Use non-nil default for function variables, so `add-function` can be used on them. (hs-toggle-hiding): Make it work for mouse bindings as well. (hs-minor-mode-map): Use it for the mouse binding. (hs-grok-mode-type): Use bound-and-true-p. (hs-life-goes-on): Use `declare` for the debug spec. (hs-mouse-toggle-hiding): Make it an obsolete alias. (posn-set-point (event-end e)) was added to `hs-toggle-hiding' by this commit. This is the main cause of bug#52092. When the point is inside the hidden block, (posn-set-point (event-end e)) moves the point to the first shown character (e.g. closing "}"), resulting in the failure to show the block. This is not needed for keyboard operations. Although this is necessary for mouse operations, current code does not handle mouse events because "e" is not specified in `interactive'. So I think `hs-mouse-toggle-hiding' should be revived to separate `posn-set-point' from `hs-toggle-hiding' if the above behavior is not intentional. As for the `hs-already-hidden-p', the current implementation returns nil when the point is at closing "}". Although this is not a big problem for keyboard operations, this is harmful for mouse to show the hidden block because `posn-set-point' sets the point at closing "}" as described above. Current implementation only checks if the end of the line is inside a block. I suggest to add a check if the beginning of the line is inside a block to be able detect a hidden block when the point is at the line of closing "}". Attached is a patch to fix bug#52092 and the above behavior. I'm not sure if it is okay to cancel `define-obsolete-function-alias'. Regards, --Multipart_Mon_Sep_19_15:31:56_2022-1 Content-Type: application/octet-stream; type=patch; name="0001-Fix-hs-toggle-hiding-behaviors.patch" Content-Disposition: attachment; filename="0001-Fix-hs-toggle-hiding-behaviors.patch" Content-Transfer-Encoding: 7bit >From 902fd35281c394173a9688c4b149f3b909f491c8 Mon Sep 17 00:00:00 2001 From: kobarity Date: Mon, 19 Sep 2022 13:43:33 +0900 Subject: [PATCH] Fix hs-toggle-hiding behaviors * lisp/progmodes/hideshow.el (hs-minor-mode-map): Change shift mouse-2 binding to `hs-mouse-toggle-hiding'. (hs-find-block-beginning-match): New function to be used in `hs-already-hidden-p'. (hs-already-hidden-p): Add check if beginning of line is inside a block. (hs-toggle-hiding): Move mouse specific processing to `hs-mouse-toggle-hiding'. (hs-mouse-toggle-hiding): Revived function for mouse binding. * test/lisp/progmodes/hideshow-tests.el (hideshow-tests-with-temp-buffer-selected): New helper macro. (hideshow-tests-make-event-at): New helper function. (hideshow-already-hidden-p-1): New test. (hideshow-toggle-hiding-1): New test. (hideshow-mouse-toggle-hiding-1): New test (bug#52092). --- lisp/progmodes/hideshow.el | 39 ++++++---- test/lisp/progmodes/hideshow-tests.el | 106 ++++++++++++++++++++++++++ 2 files changed, 132 insertions(+), 13 deletions(-) diff --git a/lisp/progmodes/hideshow.el b/lisp/progmodes/hideshow.el index c0796fc2ee..1cdb93138e 100644 --- a/lisp/progmodes/hideshow.el +++ b/lisp/progmodes/hideshow.el @@ -37,7 +37,7 @@ ;; hs-show-all C-c @ C-M-s ;; hs-hide-level C-c @ C-l ;; hs-toggle-hiding C-c @ C-c -;; hs-toggle-hiding [(shift mouse-2)] +;; hs-mouse-toggle-hiding [(shift mouse-2)] ;; hs-hide-initial-comment-block ;; ;; Blocks are defined per mode. In c-mode, c++-mode and java-mode, they @@ -361,7 +361,7 @@ hs-minor-mode-map (define-key map "\C-c@\C-t" 'hs-hide-all) (define-key map "\C-c@\C-d" 'hs-hide-block) (define-key map "\C-c@\C-e" 'hs-toggle-hiding) - (define-key map [(shift mouse-2)] 'hs-toggle-hiding) + (define-key map [(shift mouse-2)] 'hs-mouse-toggle-hiding) map) "Keymap for hideshow minor mode.") @@ -786,6 +786,14 @@ hs-life-goes-on (case-fold-search t)) ,@body))) +(defun hs-find-block-beginning-match () + "Reposition point at the end of match of the block-start regexp. +Return point, or nil if original point was not in a block." + (when (and (funcall hs-find-block-beginning-func) + (funcall hs-looking-at-block-start-p-func)) + ;; point is inside a block + (goto-char (match-end 0)))) + (defun hs-overlay-at (position) "Return hideshow overlay at POSITION, or nil if none to be found." (let ((overlays (overlays-at position)) @@ -802,12 +810,11 @@ hs-already-hidden-p (if (and c-reg (nth 0 c-reg)) ;; point is inside a comment, and that comment is hideable (goto-char (nth 0 c-reg)) - (end-of-line) - (when (and (not c-reg) - (funcall hs-find-block-beginning-func) - (funcall hs-looking-at-block-start-p-func)) - ;; point is inside a block - (goto-char (match-end 0))))) + (when (not c-reg) + (end-of-line) + (when (not (hs-find-block-beginning-match)) + (beginning-of-line) + (hs-find-block-beginning-match))))) (end-of-line) (hs-overlay-at (point)))) @@ -944,18 +951,24 @@ hs-hide-level (message "Hiding blocks ... done")) (run-hooks 'hs-hide-hook))) -(defun hs-toggle-hiding (&optional e) +(defun hs-toggle-hiding () "Toggle hiding/showing of a block. -See `hs-hide-block' and `hs-show-block'. -Argument E should be the event that triggered this action." +See `hs-hide-block' and `hs-show-block'." (interactive) (hs-life-goes-on - (posn-set-point (event-end e)) (if (hs-already-hidden-p) (hs-show-block) (hs-hide-block)))) -(define-obsolete-function-alias 'hs-mouse-toggle-hiding #'hs-toggle-hiding "27.1") +(defun hs-mouse-toggle-hiding (e) + "Toggle hiding/showing of a block. +This command should be bound to a mouse key. +Argument E is a mouse event used by `event-end'. +See `hs-hide-block' and `hs-show-block'." + (interactive "@e") + (hs-life-goes-on + (posn-set-point (event-end e)) + (hs-toggle-hiding))) (defun hs-hide-initial-comment-block () "Hide the first block of comments in a file. diff --git a/test/lisp/progmodes/hideshow-tests.el b/test/lisp/progmodes/hideshow-tests.el index ee2a0c7c4c..d4bcd3c164 100644 --- a/test/lisp/progmodes/hideshow-tests.el +++ b/test/lisp/progmodes/hideshow-tests.el @@ -41,6 +41,18 @@ hideshow-tests-with-temp-buffer (goto-char (point-min)) ,@body)) +(defmacro hideshow-tests-with-temp-buffer-selected (mode contents &rest body) + "Create and switch to a `hs-minor-mode' enabled MODE temp buffer with CONTENTS. +BODY is code to be executed within the temp buffer. Point is +always located at the beginning of buffer." + (declare (indent 1) (debug t)) + `(ert-with-test-buffer-selected () + (,mode) + (hs-minor-mode 1) + (insert ,contents) + (goto-char (point-min)) + ,@body)) + (defun hideshow-tests-look-at (string &optional num restore-point) "Move point at beginning of STRING in the current buffer. Optional argument NUM defaults to 1 and is an integer indicating @@ -96,6 +108,39 @@ hideshow-tests-visible-string (overlay-end overlay)))) (buffer-substring-no-properties (point-min) (point-max))))) +(defun hideshow-tests-make-event-at (string) + "Make dummy mouse event at beginning of STRING." + (save-excursion + (let ((pos (hideshow-tests-look-at string))) + (vector + `('S-mouse-2 + (,(get-buffer-window) ,pos (1 . 1) 0 nil ,pos (1 . 1) + nil (1 . 1) (1 . 1))))))) + +(ert-deftest hideshow-already-hidden-p-1 () + (let ((contents " +int +main() +{ + printf(\"Hello\\n\"); +} +")) + (hideshow-tests-with-temp-buffer + c-mode + contents + (hideshow-tests-look-at "printf") + (should (not (hs-already-hidden-p))) + (hs-hide-block) + (goto-char (point-min)) + (hideshow-tests-look-at "{") + (should (hs-already-hidden-p)) + (forward-line -1) + (should (not (hs-already-hidden-p))) + (hideshow-tests-look-at "}") + (should (hs-already-hidden-p)) + (forward-line) + (should (not (hs-already-hidden-p)))))) + (ert-deftest hideshow-hide-block-1 () "Should hide current block." (let ((contents " @@ -263,6 +308,67 @@ hideshow-hide-level-2 } ")))) +(ert-deftest hideshow-toggle-hiding-1 () + "Should toggle hiding/showing of a block." + (let ((contents " +int +main() +{ + printf(\"Hello\\n\"); +} +")) + (hideshow-tests-with-temp-buffer + c-mode + contents + (hideshow-tests-look-at "printf") + (hs-toggle-hiding) + (should (string= + (hideshow-tests-visible-string) + " +int +main() +{} +")) + (hs-toggle-hiding) + (should (string= (hideshow-tests-visible-string) contents))))) + +(ert-deftest hideshow-mouse-toggle-hiding-1 () + "Should toggle hiding/showing of a block by mouse events." + (let ((contents " +int +main() +{ + printf(\"Hello\\n\"); +} +") + (hidden " +int +main() +{} +")) + (hideshow-tests-with-temp-buffer-selected + c-mode + contents + ;; Should not hide the block when clicked outside of the block. + (call-interactively + #'hs-mouse-toggle-hiding nil (hideshow-tests-make-event-at "int")) + (should (string= (hideshow-tests-visible-string) contents)) + ;; Should hide the block when clicked inside of the block. + (goto-char (point-min)) + (call-interactively + #'hs-mouse-toggle-hiding nil (hideshow-tests-make-event-at "printf")) + (should (string= (hideshow-tests-visible-string) hidden)) + ;; Should not show the block when clicked outside of the block. + (goto-char (point-min)) + (call-interactively + #'hs-mouse-toggle-hiding nil (hideshow-tests-make-event-at "int")) + (should (string= (hideshow-tests-visible-string) hidden)) + ;; Should show the block when clicked inside of the block. + (goto-char (point-min)) + (call-interactively + #'hs-mouse-toggle-hiding nil (hideshow-tests-make-event-at "}")) + (should (string= (hideshow-tests-visible-string) contents))))) + (provide 'hideshow-tests) ;;; hideshow-tests.el ends here -- 2.34.1 --Multipart_Mon_Sep_19_15:31:56_2022-1-- From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 23 18:01:15 2022 Received: (at 52092) by debbugs.gnu.org; 23 Sep 2022 22:01:15 +0000 Received: from localhost ([127.0.0.1]:41873 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1obqjS-0000r3-PT for submit@debbugs.gnu.org; Fri, 23 Sep 2022 18:01:15 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:1800) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1obqjR-0000qq-NY for 52092@debbugs.gnu.org; Fri, 23 Sep 2022 18:01:14 -0400 Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 0528F1000EF; Fri, 23 Sep 2022 18:01:08 -0400 (EDT) Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 2F8E9100169; Fri, 23 Sep 2022 18:01:06 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1663970466; bh=t/Q4U0xkYze3uqdfftIvLr//maI74hiPCwblw9qkF9A=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=NADRZpm7FFr3rE68hwiQNQuQhIlEOm5s16CROmBP2ATCiQ/0wQDL8y6wLQsgQ2X2s SVJgPYgrGF1bbDTIIRlSXkMjkTMLm4sIi/Hy+mKQH1ow/j0UtkvS/K7HuEL0MaJrQj gDAUlDKD0vIY2NtsXY4ER863VxxBL4JqVE1BEwzD351g2l1MXdihy6eVgsDBGiObM6 zYOkHamkofLWRQOA9ULozMRmhasE8+GM/W4hXOCBR4UywlAr3DwN7BtsB7EUXhwF9K 1n5p7/JiGLChrckIXXOtAXJ2Q2loK4SYkz/9POOngy3tdZRALyq0ESR5WQ+kWMob+A 8YIqSwlaPekMg== Received: from alfajor (unknown [45.44.229.252]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 0E5491208FE; Fri, 23 Sep 2022 18:01:06 -0400 (EDT) From: Stefan Monnier To: kobarity Subject: Re: bug#52092: 28.0.60; hs-toggle-hiding does not toggle once folded In-Reply-To: (kobarity@gmail.com's message of "Mon, 19 Sep 2022 15:31:56 +0900") Message-ID: References: Date: Fri, 23 Sep 2022 18:01:05 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.071 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 52092 Cc: 52092@debbugs.gnu.org, Eli Zaretskii , Mohammed Sadiq 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 (---) > 1. emacs -Q > 2. Open the following C mode file. > > #+begin_src C > int > main() { > sub(); > } > > int > sub() { > printf("sub\n"); > } > #+end_src > > 3. M-x hs-minor-mode > 4. Move the point to the "printf" line in the "sub" function. > 5. Shift mouse-2 in the function "main". > The function body of "sub" is hidden instead of "main". This is > not I expected. Hmm... indeed it's a trivial oversight in my patch, sorry. The patch below should fix it. > (posn-set-point (event-end e)) was added to `hs-toggle-hiding' by this > commit. This is the main cause of bug#52092. Indeed, thanks. I had no idea that (posn-point (posn-at-point POS)) doesn't return POS if POS is within an invisible chunk of text and instead returns the next visible position. I'll have to think about how best to fix the consequence. Stefan diff --git a/lisp/progmodes/hideshow.el b/lisp/progmodes/hideshow.el index c0796fc2eeb..8dd8c7e182c 100644 --- a/lisp/progmodes/hideshow.el +++ b/lisp/progmodes/hideshow.el @@ -948,7 +948,7 @@ hs-toggle-hiding "Toggle hiding/showing of a block. See `hs-hide-block' and `hs-show-block'. Argument E should be the event that triggered this action." - (interactive) + (interactive (list last-nonmenu-event)) (hs-life-goes-on (posn-set-point (event-end e)) (if (hs-already-hidden-p) From debbugs-submit-bounces@debbugs.gnu.org Sat Sep 24 02:00:09 2022 Received: (at 52092) by debbugs.gnu.org; 24 Sep 2022 06:00:09 +0000 Received: from localhost ([127.0.0.1]:42122 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1obyCv-0004l9-CG for submit@debbugs.gnu.org; Sat, 24 Sep 2022 02:00:09 -0400 Received: from mail-pj1-f47.google.com ([209.85.216.47]:54931) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1obyCt-0004jO-2x for 52092@debbugs.gnu.org; Sat, 24 Sep 2022 02:00:07 -0400 Received: by mail-pj1-f47.google.com with SMTP id y11so1840386pjv.4 for <52092@debbugs.gnu.org>; Fri, 23 Sep 2022 23:00:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:user-agent:references:in-reply-to:subject:cc:to:from :message-id:date:from:to:cc:subject:date; bh=PSFD/JAYoWYPLM9C3/39w5WE8BBv7VodDFvRGd4NX7Y=; b=V6XZP/TPq8/41KBvD4pUI+xeqVK3tyRaMuhNy8G57eeheLwTdG6bcT7VJN8Ze4+Fdm jBuzLX/EAzzUileiPr/NtE0UyGY4KDozs1zEIOQVj02UQISQ3Jhsm5/WcyMUeungrsv2 n406ZJlqst4vud4uNnp6GLO0ENYgDUQYHA/2pV6xaVLdLmCBQuU5B9aHnnj8xZc01mVd FNh5isxps+g4zERBf/o2Qr9Q2So+IIFMrzyTg0zsJPh11YV9kbJg673llpBzSphl1GLW 1ubPXpRWjyeeHmU6W/LOu6nkndoRrRyiHWUZIVgXuj5mYz7/t6wlhk/iv4fK0J/Ooxtr vaTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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; bh=PSFD/JAYoWYPLM9C3/39w5WE8BBv7VodDFvRGd4NX7Y=; b=XB8AvPN1AbQU15M9PvDS6oqdJpctV7C21DIBXFhZNGij7zH18P1w9dXGwj2o5khGh5 6l2Lk1zmE/5GI8zDgKyVkcL5RWLQDBy7VHsOQT8i28zvfC8mA2P8mJwqpssPKNeRoPey ya2qlAv4g+uxkEgC7yC/vUkT1Qu9rrBGP0/gcyEHjCyC5Dr7ojyo1L8FiD7yCW0TiuWb UHwUaspA6vS3pfi5n9MqLCnXdncVx1uozwzYL5C1472G5lmp0fqHAhrBVLYpo/hhG7GG ZZnYJg5Cr3eHeocqAsbBc9GYoU8noN967RRi9XyVB5P2PAWPRDTKU0rMxh2sb5PWW3gR RfJQ== X-Gm-Message-State: ACrzQf1VBESZeuDbE/e2InnjANOWcdW5wQugI1hfTSTEptGC1xtzdWOE L+YUMSlz86i1ckPpjHx3lUg= X-Google-Smtp-Source: AMsMyM5KIgnrS8yPF5BMfFzpduEqdetokn/ZLv9/V2cWvHSDDJet6F8cgJPz4Odpx4X9Dzwg/K+KGw== X-Received: by 2002:a17:903:25c4:b0:178:b625:e9f6 with SMTP id jc4-20020a17090325c400b00178b625e9f6mr12061268plb.120.1663999200997; Fri, 23 Sep 2022 23:00:00 -0700 (PDT) Received: from localhost (58x12x133x161.ap58.ftth.ucom.ne.jp. [58.12.133.161]) by smtp.gmail.com with ESMTPSA id 17-20020a170902e9d100b001755e4278a6sm6892737plk.261.2022.09.23.22.59.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Sep 2022 23:00:00 -0700 (PDT) Date: Sat, 24 Sep 2022 14:59:56 +0900 Message-ID: From: kobarity To: Stefan Monnier Subject: Re: bug#52092: 28.0.60; hs-toggle-hiding does not toggle once folded In-Reply-To: References: 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/29.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: 52092 Cc: 52092@debbugs.gnu.org, Eli Zaretskii , Mohammed Sadiq 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 (-) Stefan Monnier wrote: > The patch below should fix it. Thanks, I didn't know `last-nonmenu-event'. I confirmed that the patch enables the mouse to hide the clicked block. > I had no idea that (posn-point (posn-at-point POS)) doesn't return POS > if POS is within an invisible chunk of text and instead returns the next > visible position. > > I'll have to think about how best to fix the consequence. Thank you for consideration. Regards, From debbugs-submit-bounces@debbugs.gnu.org Sat Sep 24 02:18:20 2022 Received: (at 52092) by debbugs.gnu.org; 24 Sep 2022 06:18:20 +0000 Received: from localhost ([127.0.0.1]:42133 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1obyUW-0005BH-BQ for submit@debbugs.gnu.org; Sat, 24 Sep 2022 02:18:20 -0400 Received: from eggs.gnu.org ([209.51.188.92]:58690) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1obyUT-0005B0-99 for 52092@debbugs.gnu.org; Sat, 24 Sep 2022 02:18:18 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:55194) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1obyUN-0004uR-A0; Sat, 24 Sep 2022 02:18:11 -0400 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=cdK+dvCgfwZcsKc+dHUlnKieS+Oo8lz1swEevXd1Sq4=; b=gXrZTZy5M6xj+01PqCX3 y8DMYKDoSkbbUahgsER6f+jQmIx5DxR1eK1JDMiSp3rudV3ztXKQ0IXbbWstu8PX0TxCBRR7C5NiR uJX2rk04QpIb/R9KlTdfX0YJtkoGZ3GAZnKPRODUaJ1QUTLjJWjdBeNV+MGCQ9F70vXhio5sZ7cvq GiQdZBcIB89iiZx35QbgB9mpVGMldfAe1/eC245h1SBefUn9mHaAdr7uVlUgEZZ/mzchkgrP9KBda iA7r6mhIgQyBtc+tBE2p1Yfk85VYK/zw+GjLCKRI8epsDAqFAC7Mi7dMtsnf/ebz3pQSLyoPIfPRM qNSPqIgEBJ//qg==; Received: from [87.69.77.57] (port=2798 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1obyUJ-0001y4-GI; Sat, 24 Sep 2022 02:18:09 -0400 Date: Sat, 24 Sep 2022 09:17:53 +0300 Message-Id: <83v8pdnvn2.fsf@gnu.org> From: Eli Zaretskii To: Stefan Monnier In-Reply-To: (message from Stefan Monnier on Fri, 23 Sep 2022 18:01:05 -0400) Subject: Re: bug#52092: 28.0.60; hs-toggle-hiding does not toggle once folded References: MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 52092 Cc: 52092@debbugs.gnu.org, kobarity@gmail.com, sadiq@sadiqpk.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: Stefan Monnier > Cc: Eli Zaretskii , Mohammed Sadiq , > 52092@debbugs.gnu.org > Date: Fri, 23 Sep 2022 18:01:05 -0400 > > I had no idea that (posn-point (posn-at-point POS)) doesn't return POS > if POS is within an invisible chunk of text and instead returns the next > visible position. posn-at-point uses display routines, so it cannot report on invisible POS, because the display code skips invisible text. The doc string kinda hints on that: Return nil if POS is not visible in WINDOW. Otherwise, the return value is similar to that returned by ‘event-start’ for a mouse click at the upper left corner of the glyph corresponding to POS: You cannot click a mouse on a glyph corresponding to invisible text, can you? We could make this more clear in the documentation. I think this usually isn't a problem because this function is not called for POS calculated in some way, as opposed to positions actually displayed, or nil. From debbugs-submit-bounces@debbugs.gnu.org Sat Sep 24 11:10:38 2022 Received: (at 52092-done) by debbugs.gnu.org; 24 Sep 2022 15:10:38 +0000 Received: from localhost ([127.0.0.1]:44968 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oc6ne-0005UI-EB for submit@debbugs.gnu.org; Sat, 24 Sep 2022 11:10:38 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:54516) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oc6na-0005Ty-IL for 52092-done@debbugs.gnu.org; Sat, 24 Sep 2022 11:10:37 -0400 Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 289F710013B; Sat, 24 Sep 2022 11:10:29 -0400 (EDT) Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 611431000F3; Sat, 24 Sep 2022 11:10:27 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1664032227; bh=rGVVNzctMfEwiUgQZWySYLfT9V8sxiTH1vAyK3wuPnM=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=c9TapdTKSrYCilQE8aiR70VYLFm3Dw/HQPafYdPC5Mq6NAIzb+WwBvhL6PE0OCJv4 9kE66U0aAneACqnGRmuNFAKf+55GPsTiecu9QXJd3Sajcg389y74DjpEJBUq1x2swS SsRLmZgBOg0zGgPQvxK7PljPZ+UanJg+p47iHJEx7Ox1MIotU/Z7C5x4K7a0EGhYDB bPMejLZ+wk/MYMie+HuTcssKZa/fqbP3XiEpaexY9lLidf8DxukDOcbUKVwpIzZQ2V KSmzuwAXVLCz1fSq/AdH8WJfTs2pG7gWYT9Kq9hWxL/x9S3+s3PKCy/yL4r1yYOIiL ixRZnSQF4qnjw== Received: from pastel (unknown [45.72.225.122]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 0A2C31205D7; Sat, 24 Sep 2022 11:10:27 -0400 (EDT) From: Stefan Monnier To: kobarity Subject: Re: bug#52092: 28.0.60; hs-toggle-hiding does not toggle once folded In-Reply-To: (kobarity@gmail.com's message of "Sat, 24 Sep 2022 14:59:56 +0900") Message-ID: References: Date: Sat, 24 Sep 2022 11:10:26 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.052 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 52092-done Cc: Dan Nicolaescu , Thien-Thi Nguyen , Eli Zaretskii , 52092-done@debbugs.gnu.org, Mohammed Sadiq 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 (---) [ Added Thien-Thi and Dan to the Cc since they're listed as maintainers of `hideshow.el`. ] kobarity [2022-09-24 14:59:56] wrote: > Stefan Monnier wrote: >> The patch below should fix it. > Thanks, I didn't know `last-nonmenu-event'. I confirmed that the > patch enables the mouse to hide the clicked block. I pushed it to the `emacs-28` branch, because it's fixing a stupid regression. >> I had no idea that (posn-point (posn-at-point POS)) doesn't return POS >> if POS is within an invisible chunk of text and instead returns the next >> visible position. >> >> I'll have to think about how best to fix the consequence. > > Thank you for consideration. I pushed to `master` a patch which makes `event-end` return a position that's always at `point` for keyboard events, even if `point` is hidden. That should bring back the previous behavior (it's not safe enough for the `emacs-28` branch, sadly). But I think your patch is still an improvement since it makes `hs-toggle-hiding` work even when point is right after the hidden block. I also like the additional tests you provide. So I adjusted it to the new code and pushed it to `master`. Thank you, Stefan From debbugs-submit-bounces@debbugs.gnu.org Sat Sep 24 11:11:39 2022 Received: (at 52092) by debbugs.gnu.org; 24 Sep 2022 15:11:39 +0000 Received: from localhost ([127.0.0.1]:44976 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oc6oc-0005WF-Sx for submit@debbugs.gnu.org; Sat, 24 Sep 2022 11:11:39 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:37254) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oc6ob-0005W0-4g for 52092@debbugs.gnu.org; Sat, 24 Sep 2022 11:11:37 -0400 Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id C40F4807C3; Sat, 24 Sep 2022 11:11:31 -0400 (EDT) Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 4E61F80394; Sat, 24 Sep 2022 11:11:30 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1664032290; bh=bLvo3ZQICeVHBd4kf+Vyqsh2OLDCKC951dxSE+PRV5Y=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=nkuWriGO/lL7NANgwABpY/BjUfxI+Ayx4HVdW8eKl2PLw+v2K6dIgSscI3wmVJjVI 6oO+WLid8D0BaWBs5z18T96dmj/61gyTgHux/Q+VGa/R2Dv+9KrupsTqBd63mpx8RC ON7kPpUAvxqSSll+uCO1NadGXMHnHVhZ8dDp1bhjfSyrw+TXtO0FI+ly5Z39y/pxQQ 66sBF+serijE3ZzmMvQV3GXYYiTmykueeNOwXR5G21IylTGOXAaXIC9OuBuXqbsvyr QtX+WJFo0mVbClm1b0KZCRKasBp6gqvQWaQH+/OPu26t6iTK+uuR/YYkxxTta3JNEm wt4k2NmaQFn0Q== Received: from pastel (unknown [45.72.225.122]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 1E1871202A8; Sat, 24 Sep 2022 11:11:30 -0400 (EDT) From: Stefan Monnier To: Eli Zaretskii Subject: Re: bug#52092: 28.0.60; hs-toggle-hiding does not toggle once folded In-Reply-To: <83v8pdnvn2.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 24 Sep 2022 09:17:53 +0300") Message-ID: References: <83v8pdnvn2.fsf@gnu.org> Date: Sat, 24 Sep 2022 11:11:29 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.063 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 52092 Cc: 52092@debbugs.gnu.org, kobarity@gmail.com, sadiq@sadiqpk.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 (---) > posn-at-point uses display routines, so it cannot report on invisible > POS, because the display code skips invisible text. The doc string > kinda hints on that: Yes, it makes a lot of sense. In the case of `event-end` and `event-start` that's not what we want, tho, so I tweaked those functions accordingly. Stefan From debbugs-submit-bounces@debbugs.gnu.org Sat Sep 24 22:27:12 2022 Received: (at 52092) by debbugs.gnu.org; 25 Sep 2022 02:27:12 +0000 Received: from localhost ([127.0.0.1]:45602 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ocHMN-0002Gc-OD for submit@debbugs.gnu.org; Sat, 24 Sep 2022 22:27:11 -0400 Received: from mail-pl1-f172.google.com ([209.85.214.172]:34717) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ocHMK-0002GM-Mc for 52092@debbugs.gnu.org; Sat, 24 Sep 2022 22:27:10 -0400 Received: by mail-pl1-f172.google.com with SMTP id w13so3417442plp.1 for <52092@debbugs.gnu.org>; Sat, 24 Sep 2022 19:27:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:user-agent:references:in-reply-to:subject:cc:to:from :message-id:date:from:to:cc:subject:date; bh=/jQCqUeS5XEw7qdNXerD/ZSIFEZn6UhAFoTg6Wy/tIQ=; b=o3RIEqiSG3IWHJCyIGPFdla0yAL21iCXF1xBcLLclB6BaDHxbKFoIi6KFPVfTou1Wp OQyMXeTHGwQeNZc6ZiL6ta70qtB1ncwkl9EoyKFo6asbD9wQNcXY5RhOGfr1CaCtoeKC EHwd5BB9VqrXLa+cMhZNO9WhtZdsVWR/jAcv4tNq7A6i4sBE5OAep2mnauwNIlAnXCkU mtidMnb40KsykxvHjhR9hhWUkqZRWT3GgKooi9zS2Ser0O0DofQdqZb9jdYYhdnYwi3r 2HWZSPDqCsyADWCM0Oz/XO3XeHWT8/eg8aBytpzCXiTYGH6mXnqDVwOyt8o+wyGpQvua YJqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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; bh=/jQCqUeS5XEw7qdNXerD/ZSIFEZn6UhAFoTg6Wy/tIQ=; b=e14Pz3+FKgvZaRGHj/AbZq/3VVfdAyHoevdUW2T2UHod9ICgCUdKrNd5I9qassy1FN RmQ5XO5DIR1ClTzVNFqo0Mxjwn5svFV+BTIlhtDknNlBdZjVqZB1QuCeocSWJ08LGWh9 d5OQ/EmkoTw+isFhmSzUavyLVy3p3zlOKxtIMUaN4YaHU0jansiyE6vt2E5+o0+HTeTE 63Bku68a62qgcv4DFYcgNE+HOU7DpkyZ9idXKr2qt+obZlDmjoMMQUf8kQnB+NhSnbZj 0Aqiub1AchfopViv3zkDirxZk7YAZ0sA7TEZNtTN29AQQ/NK1k90+Cad3bf+bCjWl+XC BEsw== X-Gm-Message-State: ACrzQf00DTfuc7ZD54oVOcJ19ucIAqhN7KwrJhvzAoEHZey+F+cW+v4n HKubdlX/cJ47vI7d5RdmUkc= X-Google-Smtp-Source: AMsMyM6EvowrKtCjhjNqRiH4VCHYiYAwQwyoFfQeAKk0A2KA/fYSBui+iP96+uhSOjoJmZjXL9rmqA== X-Received: by 2002:a17:902:e850:b0:178:64f:a57d with SMTP id t16-20020a170902e85000b00178064fa57dmr16255771plg.110.1664072822632; Sat, 24 Sep 2022 19:27:02 -0700 (PDT) Received: from localhost (58x12x133x161.ap58.ftth.ucom.ne.jp. [58.12.133.161]) by smtp.gmail.com with ESMTPSA id t4-20020a1709027fc400b00176dd41320dsm8345354plb.119.2022.09.24.19.26.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Sep 2022 19:27:01 -0700 (PDT) Date: Sun, 25 Sep 2022 11:26:35 +0900 Message-ID: From: kobarity To: Stefan Monnier Subject: Re: bug#52092: 28.0.60; hs-toggle-hiding does not toggle once folded In-Reply-To: References: 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/29.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: 52092 Cc: 52092@debbugs.gnu.org, Eli Zaretskii , Dan Nicolaescu , Mohammed Sadiq , Thien-Thi Nguyen 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 (-) Stefan Monnier wrote: > I pushed to `master` a patch which makes `event-end` return a position > that's always at `point` for keyboard events, even if `point` is hidden. > That should bring back the previous behavior (it's not safe enough for > the `emacs-28` branch, sadly). > > But I think your patch is still an improvement since it makes > `hs-toggle-hiding` work even when point is right after the hidden block. > I also like the additional tests you provide. > So I adjusted it to the new code and pushed it to `master`. I confirmed that everything works as expected. Thank you for fixing the issue and improving my patch. Regards, From unknown Sun Jun 15 08:36:28 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, 23 Oct 2022 11:24:14 +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