X-Loop: help-debbugs@HIDDEN
Subject: bug#79893: Unify hideshow.el and hide-ifdef-mode
Resent-From: Elijah Gabe =?UTF-8?Q?P=C3=A9rez?= <eg642616@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Tue, 25 Nov 2025 20:32:02 +0000
Resent-Message-ID: <handler.79893.B.176410270918467 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: report 79893
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords:
To: 79893 <at> debbugs.gnu.org
X-Debbugs-Original-To: bug-gnu-emacs@HIDDEN
Received: via spool by submit <at> debbugs.gnu.org id=B.176410270918467
(code B ref -1); Tue, 25 Nov 2025 20:32:02 +0000
Received: (at submit) by debbugs.gnu.org; 25 Nov 2025 20:31:49 +0000
Received: from localhost ([127.0.0.1]:42309 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1vNzhU-0004n7-NU
for submit <at> debbugs.gnu.org; Tue, 25 Nov 2025 15:31:49 -0500
Received: from lists.gnu.org ([2001:470:142::17]:38502)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from <eg642616@HIDDEN>)
id 1vMyeo-0004sl-P6
for submit <at> debbugs.gnu.org; Sat, 22 Nov 2025 20:12:51 -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 <eg642616@HIDDEN>)
id 1vMyee-00024A-Io
for bug-gnu-emacs@HIDDEN; Sat, 22 Nov 2025 20:12:41 -0500
Received: from mail-ot1-x343.google.com ([2607:f8b0:4864:20::343])
by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
(Exim 4.90_1) (envelope-from <eg642616@HIDDEN>)
id 1vMyeX-00044e-87
for bug-gnu-emacs@HIDDEN; Sat, 22 Nov 2025 20:12:38 -0500
Received: by mail-ot1-x343.google.com with SMTP id
46e09a7af769-7c78d30649aso2279414a34.2
for <bug-gnu-emacs@HIDDEN>; Sat, 22 Nov 2025 17:12:18 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1763860333; x=1764465133; darn=gnu.org;
h=mime-version:message-id:date:subject:to:from:from:to:cc:subject
:date:message-id:reply-to;
bh=EiB2Zgq/GqhWrxtoGdbZAvc0IRGGqbTOjio31w5XvnM=;
b=UA5g4SUNs0oZYDrCQVat/s5qw90Mf18FDT/yKkxohACMOqUtVjkpAn4lScfRD/oBDo
0SQCrjxSYF37+7YbID+uz71WcEeoTTBRA9kqP9odMLI/RAyt3QU1cUAnrWvHY+JMO8RP
IRL0SKVubUgvW3A1VynoUEQxrhz4gARBG9312QAZhlYt9pARo8tNPGwLywZSx7DsldK8
t6nJIZAxDyBoq4YVXE73ao28xnS0dyXIXoX6DzNuFQap6NpY0sjxwQYiFLoLhRdW3OhF
pl2Nl5mKg/80PMv+4J3JOLwk4rRep3V8C5Cd0/GJ5RUiq1B0FTpwtosIt5/V3rtb2W1K
c1TA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1763860333; x=1764465133;
h=mime-version:message-id:date:subject:to:from:x-gm-gg
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=EiB2Zgq/GqhWrxtoGdbZAvc0IRGGqbTOjio31w5XvnM=;
b=sGyVi7fk7WBCz0vwZ83lAzjVc1J9kx6oMh3Zh8lXH+UOJyKM2R71FDQOVB8eO+iYMv
jWZfQ729AMIRBvV1+Ll0+xKXDX/ElRyvZVyMLsku2CdeYdOq3OtZS14RNHgmdcndziAs
DvapNGTDnAsmsRaIntTkp8LnKYJwXSVvQPtLWZypDnWD1XETSrFbETkit4CTQng7vAF6
7m1mLh83bz8kEgUwhYQ6KWRVcTWRGXXkfqNmwRHY83Sbxj4htIVMtBbJJ1PuLbBrbAW5
XzsUYpM7vGSTpH0AQ54lWaWPyjE/hXJQvWzQnwWbBAKmYogYQ43jpFN0gb9feK0y5OH1
Y4PQ==
X-Gm-Message-State: AOJu0YwXbd2jDLK0kUl0SOPtviPRHr+a92WRGk17TMmBYo2lfsEOytCE
7cMD6us8hBNbwrTCWf+I+dBVI13u37fFvVX864Fgy9YWrsrVDZ8UUrM5t89Bzo0N
X-Gm-Gg: ASbGnctzyKCAx6viBQynR8L0uv2vye/4ZaUhUkKns2ugQ9pA4nLcUowUGQa/CBIXaYx
qfxG7xQL9Z49a5Em/E31+iQ7hOgkYuPbP6WbojsKQtuBoq9tFnS8UZE9G2G3Kuf+FLRutQqarRF
85JT9ax9ZWvRg3kdo/Zn+wD0rcgHrMSq90/AgQRn4fNPkYbqM1B2D84eSCKBJi8faafgSfcYKNq
pIS7cB4aFEONjCCJ6+zXzpZp1SXgj3jNwbD682U3DyWDZtepuFp8/I033ACHOwf0BFbuCMm0e39
+e0cKChiSqJSnd81Ke84QlaDxMMUI8PkWwOtFpmAQ3Y0BQALO4BS0Yc3s+1pj2se706dyl5fF+V
MZ9oz9DihKPQDsSVcVcX3tQj2f/7YfjKrSC6xIrxEyugrjsTNUuKzI2JtW1bMrHuqpflz2h3Hyf
tFXmuc
X-Google-Smtp-Source: AGHT+IHTwupGz8bGR5m/22rTfovLFwrmKQWcWpK291A+ByZ2Byx5Glvj83DCIhdmU/Jkna36eUv6gg==
X-Received: by 2002:a05:6808:148f:b0:450:5e3a:6f1a with SMTP id
5614622812f47-45115a2e7a0mr3069817b6e.20.1763860333403;
Sat, 22 Nov 2025 17:12:13 -0800 (PST)
Received: from fedora ([189.215.160.233]) by smtp.gmail.com with ESMTPSA id
5614622812f47-450fffed253sm2746713b6e.20.2025.11.22.17.12.12
for <bug-gnu-emacs@HIDDEN>
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Sat, 22 Nov 2025 17:12:12 -0800 (PST)
From: Elijah Gabe =?UTF-8?Q?P=C3=A9rez?= <eg642616@HIDDEN>
Date: Sat, 22 Nov 2025 19:12:10 -0600
Message-ID: <877bvhmu1h.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
Received-SPF: pass client-ip=2607:f8b0:4864:20::343;
envelope-from=eg642616@HIDDEN; helo=mail-ot1-x343.google.com
X-Spam_score_int: -17
X-Spam_score: -1.8
X-Spam_bar: -
X-Spam_report: (-1.8 / 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,
FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001,
RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 1.2 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
has NOT identified this incoming email as spam. The original
message has been attached to this so you can view it or label
similar future email. If you have any questions, see
the administrator of that system for details.
Content preview: hideshow via tree-sitter supports hiding/showing #if\|def
macros,
however for non-treesit modes (c-mode and c++-mode) this is not available.
I have been experimenting a bit with hide-ifdef-mode code and I have been
able to implement this functionality for hideshow:
Content analysis details: (1.2 points, 10.0 required)
pts rule name description
---- ---------------------- --------------------------------------------------
-0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/,
no trust [2001:470:142:0:0:0:0:17 listed in] [list.dnswl.org]
1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail)
0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail
provider (eg642616[at]gmail.com)
0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends
in digit (eg642616[at]gmail.com)
-0.0 SPF_HELO_PASS SPF: HELO matches SPF record
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.2 (/)
hideshow via tree-sitter supports hiding/showing #if\|def macros,
however for non-treesit modes (c-mode and c++-mode) this is not
available.
I have been experimenting a bit with hide-ifdef-mode code and I have
been able to implement this functionality for hideshow:
#+begin_src elisp
(defvar cc-hs-ifdef-regexp (concat hif-ifx-regexp "\\|" hif-elif-regexp "\\|" hif-else-regexp))
(setq-local hs-block-start-regexp (concat "\\s(\\|{\\|\"" "\\|" cc-hs-ifdef-regexp)
hs-block-end-regexp (concat "\\s)\\|}\\|\"" "\\|" hif-endif-regexp)
hs-forward-sexp-function (lambda (arg)
(if (looking-at cc-hs-ifdef-regexp)
(progn (hif-ifdef-to-endif)
(end-of-line))
(forward-sexp arg))))
#+end_src
This may require simplify or move some hideif code to cc-mode.
What do you all think about this idea?
Thanks.
--
- E.G via Gnus and Org.
Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) Content-Type: text/plain; charset=utf-8 X-Loop: help-debbugs@HIDDEN From: help-debbugs@HIDDEN (GNU bug Tracking System) To: Elijah Gabe =?UTF-8?Q?P=C3=A9rez?= <eg642616@HIDDEN> Subject: bug#79893: Acknowledgement (Unify hideshow.el and hide-ifdef-mode) Message-ID: <handler.79893.B.176410270918467.ack <at> debbugs.gnu.org> References: <877bvhmu1h.fsf@HIDDEN> X-Gnu-PR-Message: ack 79893 X-Gnu-PR-Package: emacs Reply-To: 79893 <at> debbugs.gnu.org Date: Tue, 25 Nov 2025 20:32:03 +0000 Thank you for filing a new bug report with debbugs.gnu.org. This is an automatically generated reply to let you know your message has been received. Your message is being forwarded to the package maintainers and other interested parties for their attention; they will reply in due course. Your message has been sent to the package maintainer(s): bug-gnu-emacs@HIDDEN If you wish to submit further information on this problem, please send it to 79893 <at> debbugs.gnu.org. Please do not send mail to help-debbugs@HIDDEN unless you wish to report a problem with the Bug-tracking system. --=20 79893: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D79893 GNU Bug Tracking System Contact help-debbugs@HIDDEN with problems
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.