From unknown Sat Jun 21 12:15:58 2025 X-Loop: help-debbugs@gnu.org Subject: bug#48752: 28.0.50; Feature request: Hook hide-ifdef into font-lock Resent-From: Ergus Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 30 May 2021 20:27:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 48752 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 48752@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.162240639817946 (code B ref -1); Sun, 30 May 2021 20:27:01 +0000 Received: (at submit) by debbugs.gnu.org; 30 May 2021 20:26:38 +0000 Received: from localhost ([127.0.0.1]:60434 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lnS17-0004fN-Gz for submit@debbugs.gnu.org; Sun, 30 May 2021 16:26:38 -0400 Received: from lists.gnu.org ([209.51.188.17]:49576) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lnS15-0004fF-9w for submit@debbugs.gnu.org; Sun, 30 May 2021 16:26:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54054) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lnS14-0007DZ-LT for bug-gnu-emacs@gnu.org; Sun, 30 May 2021 16:26:35 -0400 Received: from sonic314-14.consmr.mail.bf2.yahoo.com ([74.6.132.124]:39235) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lnS11-00049p-9a for bug-gnu-emacs@gnu.org; Sun, 30 May 2021 16:26:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048; t=1622406389; bh=VXRsWM7P37ZvjOL6Ypto+sQstG7IGl6dfpUcPVB24DA=; h=Date:From:To:Subject:References:From:Subject:Reply-To; b=fUFVd9oB9Hi6OzuoSba/HkKryhKP850TL6vzVgjGKGxLdjvXtP+HuotDHK59xhtEHzgh+sY3S6UQr2W9WxbnxnjF82nva9WFKQCzsTNu4Yd2G418IPFepe7fd4xP8uW3Ha7iAg503orVWgVgrLsOo1FoMnmRE8oR/c1U6Wsqmf4Grdn8YXRmoF9wDrv/sGc0sM/8231sESUFFb6Z1qfslKKesYl27w+IxvUuk0pQUXXlOgPG1SIKJxEgbOiCW1SI787p6lYaXVDLpsUXRqCXxFslWKSRYFami/WNX5mCpARXqpzCF7t8y3u/WH35HKWhDtIOTTWunUgzwM/qGg1j8Q== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1622406389; bh=O6huw1VxwkmDvLyzEGosT6c0IpMAYYOLH+NcZHYFs1U=; h=X-Sonic-MF:Date:From:To:Subject:From:Subject; b=Jwdp/UO8t48oMN1snWO3bcv3BxB+v/ES+/4Bt0tM/o5yvwRRdfpzcdGpgAN4v9NgwtAZjrwYxqI58NdbTMJt/e6Vt+L7Qv/WVeNQvsa+6tYLbdk0ok5JGalIrVrWS2TVKCmNrQE2bTfZasDBVFdfqhzuOn3kr/ydfpn3enI8jccoh35Zk0o2wLqc2n1hNTQYaZx64myfCXnastti/e2/e+SwH73m7i5nGU9sT/mdqkP26jo2zrNimvWnA4oUGVZ4Vr1TTFRQiHAllk3aVif7L29esWWiZtmsH4WfLDeij3kqNgWmmw338jmFi5nRUZyge6TyK/OH6k81hd+CXv1HkQ== X-YMail-OSG: EpaqL0kVM1ntgpGN4Aimh_uAuBhkApsxepXYs3xwpsRvHx_5.cvLY668LJ5HhbR VCMZowLxE9a.lTavw1sscQVT5o94QXzJoSfviYbTNXW0Hk_bZcziHSiAsHiZqfWukIKQWMqIujzm sUc_sTvPLL0YJtvRmXSgX3tmDz6MYlb0eol9TLZDoRt0Y1wU4V3cQfS.m7B39ME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NA.cWJC_hbmSXrGcIybJ56tZsj65Hf2JSTVtc2.FviKfnIewGeB52YYhwyOx.IDNRwz.3Ls UJucUs2amk..1ndxDj3w- X-Sonic-MF: Received: from sonic.gate.mail.ne1.yahoo.com by sonic314.consmr.mail.bf2.yahoo.com with HTTP; Sun, 30 May 2021 20:26:29 +0000 Received: by kubenode529.mail-prod1.omega.ir2.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID 095aad0fb5070ac7033c1e8a4f6a3f72; Sun, 30 May 2021 20:26:26 +0000 (UTC) Date: Sun, 30 May 2021 22:26:06 +0200 From: Ergus Message-ID: <20210530202606.qlopn6lmwzfa75z5@Ergus> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline References: <20210530202606.qlopn6lmwzfa75z5.ref@Ergus> X-Mailer: WebService/1.1.18368 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.aol Content-Length: 8042 Received-SPF: pass client-ip=74.6.132.124; envelope-from=spacibba@aol.com; helo=sonic314-14.consmr.mail.bf2.yahoo.com 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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.3 (-) 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.3 (--) The use of hide-ifdef is a bit outdated and it requires to manually call: `M-x hide-ifdefs` to update the buffer #if 0 #endif M-x hide-ifdef-mode M-x hide-ifdef-toggle-shadowing does not shadows/hides the region . It requires to explicitly call: M-x hide-ifdefs. Then if we change #if 0 -> #if 1; the shadow does not disappears/appears either until we call: M-x hide-ifdefs again. This part may be automatized. Calling hide-ifdefs every time is annoying and unneeded. Vim and most of other editors already do the re-fontification automatically. So we can take that behavior as a good starting point. Emacs is smart enough to recognize when the user modifies a cpp-macro. And multi-line code highlight is simple like /* */ does... I think font lock already has all the functionalities we need to add this feature in a more dynamic way. But some time ago (2008) there was a message in the mailing list advising not to implement hide-ifdef with font-lock due to performance concerns... but I am not sure if those are applicable still today. In GNU Emacs 28.0.50 (build 28, x86_64-pc-linux-gnu, GTK+ Version 3.24.29, cairo version 1.17.4) of 2021-05-29 built on Ergus Repository revision: e3fc16fd71a46990503a71b11a2ad592e99d9edb Repository branch: master System Description: Arch Linux Configured using: 'configure --prefix=/home/ergo/.local/ --with-mailutils --with-json --with-x-toolkit=gtk3 --with-xft --with-wide-int --with-modules --with-cairo --with-harfbuzz --with-native-compilation' Configured features: ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG JSON LCMS2 LIBSYSTEMD LIBXML2 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_US.UTF-8 locale-coding-system: utf-8-unix Major mode: Lisp Interaction Minor modes in effect: global-auto-revert-mode: t xclip-mode: t yas-global-mode: t yas-minor-mode: t show-paren-mode: t repeat-mode: t flyspell-mode: t company-mode: t flycheck-mode: t counsel-mode: t ivy-mode: t electric-pair-mode: t composable-mark-mode: t composable-mode: t xterm-mouse-mode: t winner-mode: t save-place-mode: t which-key-mode: t override-global-mode: t delete-selection-mode: t savehist-mode: t global-display-fill-column-indicator-mode: t display-fill-column-indicator-mode: t global-display-line-numbers-mode: t display-line-numbers-mode: t eldoc-mode: t mouse-wheel-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 size-indication-mode: t column-number-mode: t line-number-mode: t transient-mark-mode: t Load-path shadows: /usr/share/emacs/site-lisp/cmake-mode hides /home/ergo/.emacs.d/elpa/cmake-mode-20210104.1831/cmake-mode /usr/share/emacs/site-lisp/notmuch-crypto hides /home/ergo/.emacs.d/elpa/notmuch-20210515.1210/notmuch-crypto /usr/share/emacs/site-lisp/notmuch-compat hides /home/ergo/.emacs.d/elpa/notmuch-20210515.1210/notmuch-compat /usr/share/emacs/site-lisp/notmuch-hello hides /home/ergo/.emacs.d/elpa/notmuch-20210515.1210/notmuch-hello /usr/share/emacs/site-lisp/notmuch hides /home/ergo/.emacs.d/elpa/notmuch-20210515.1210/notmuch /usr/share/emacs/site-lisp/notmuch-show hides /home/ergo/.emacs.d/elpa/notmuch-20210515.1210/notmuch-show /usr/share/emacs/site-lisp/notmuch-maildir-fcc hides /home/ergo/.emacs.d/elpa/notmuch-20210515.1210/notmuch-maildir-fcc /usr/share/emacs/site-lisp/coolj hides /home/ergo/.emacs.d/elpa/notmuch-20210515.1210/coolj /usr/share/emacs/site-lisp/notmuch-draft hides /home/ergo/.emacs.d/elpa/notmuch-20210515.1210/notmuch-draft /usr/share/emacs/site-lisp/notmuch-tree hides /home/ergo/.emacs.d/elpa/notmuch-20210515.1210/notmuch-tree /usr/share/emacs/site-lisp/notmuch-parser hides /home/ergo/.emacs.d/elpa/notmuch-20210515.1210/notmuch-parser /usr/share/emacs/site-lisp/notmuch-lib hides /home/ergo/.emacs.d/elpa/notmuch-20210515.1210/notmuch-lib /usr/share/emacs/site-lisp/notmuch-mua hides /home/ergo/.emacs.d/elpa/notmuch-20210515.1210/notmuch-mua /usr/share/emacs/site-lisp/notmuch-message hides /home/ergo/.emacs.d/elpa/notmuch-20210515.1210/notmuch-message /usr/share/emacs/site-lisp/notmuch-address hides /home/ergo/.emacs.d/elpa/notmuch-20210515.1210/notmuch-address /usr/share/emacs/site-lisp/notmuch-wash hides /home/ergo/.emacs.d/elpa/notmuch-20210515.1210/notmuch-wash /usr/share/emacs/site-lisp/notmuch-tag hides /home/ergo/.emacs.d/elpa/notmuch-20210515.1210/notmuch-tag /usr/share/emacs/site-lisp/notmuch-print hides /home/ergo/.emacs.d/elpa/notmuch-20210515.1210/notmuch-print /usr/share/emacs/site-lisp/notmuch-query hides /home/ergo/.emacs.d/elpa/notmuch-20210515.1210/notmuch-query /usr/share/emacs/site-lisp/notmuch-jump hides /home/ergo/.emacs.d/elpa/notmuch-20210515.1210/notmuch-jump /usr/share/emacs/site-lisp/notmuch-company hides /home/ergo/.emacs.d/elpa/notmuch-20210515.1210/notmuch-company /home/ergo/.emacs.d/elpa/transient-20210525.1141/transient hides /home/ergo/.local/share/emacs/28.0.50/lisp/transient Features: (shadow sort notmuch-company notmuch-lib notmuch-version notmuch-compat mm-view mml-smime smime dig mailcap mail-extr emacsbug message rmc puny rfc822 mml mml-sec epa derived epg epg-config gnus-util rmail rmail-loaddefs auth-source password-cache time-date mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils autorevert filenotify xclip yasnippet-snippets yasnippet thingatpt amx comp comp-cstr warnings s paren repeat flyspell-correct-ivy flyspell-correct flyspell ispell company-keywords company-gtags company-dabbrev-code company-dabbrev company-files company-semantic company-template company-capf company flycheck json map find-func subr-x dash counsel xdg xref project dired-x dired dired-loaddefs compile text-property-search comint ansi-color swiper ivy-avy avy ivy flx ivy-faces ivy-overlay colir color pcase term/tmux term/xterm xterm jka-compr elec-pair init composable composable-mark xt-mouse simple-16-theme winner ring saveplace diminish edmacro kmacro which-key advice configmail cl-extra help-mode use-package use-package-ensure use-package-delight use-package-diminish use-package-bind-key bind-key use-package-core disp-table delsel savehist easy-mmode display-fill-column-indicator display-line-numbers info ede/auto eieio-base cl-seq seq eieio byte-opt bytecomp byte-compile cconv eieio-core cl-macs gv eieio-loaddefs cl-loaddefs cl-lib tex-site rx slime-autoloads early-init iso-transl tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type 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 elisp-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 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 255105 10285) (symbols 48 18525 1) (strings 32 58700 7082) (string-bytes 1 2146750) (vectors 16 29784) (vector-slots 8 590763 10019) (floats 8 189 1037) (intervals 56 1022 0) (buffers 992 11)) From unknown Sat Jun 21 12:15:58 2025 X-Loop: help-debbugs@gnu.org Subject: bug#48752: 28.0.50; Feature request: Hook hide-ifdef into font-lock Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 31 May 2021 12:02:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48752 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Ergus Cc: 48752@debbugs.gnu.org Received: via spool by 48752-submit@debbugs.gnu.org id=B48752.162246249724541 (code B ref 48752); Mon, 31 May 2021 12:02:01 +0000 Received: (at 48752) by debbugs.gnu.org; 31 May 2021 12:01:37 +0000 Received: from localhost ([127.0.0.1]:32903 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lngbw-0006Nh-Lz for submit@debbugs.gnu.org; Mon, 31 May 2021 08:01:37 -0400 Received: from eggs.gnu.org ([209.51.188.92]:41360) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lngbv-0006NM-14 for 48752@debbugs.gnu.org; Mon, 31 May 2021 08:01:35 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:41934) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lngbp-0003YL-ND; Mon, 31 May 2021 08:01:29 -0400 Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:4597 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 1lngbn-0006bc-Ed; Mon, 31 May 2021 08:01:28 -0400 Date: Mon, 31 May 2021 15:01:42 +0300 Message-Id: <83eedn2jtl.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: <20210530202606.qlopn6lmwzfa75z5@Ergus> (bug-gnu-emacs@gnu.org) References: <20210530202606.qlopn6lmwzfa75z5.ref@Ergus> <20210530202606.qlopn6lmwzfa75z5@Ergus> X-Spam-Score: -2.3 (--) 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: Sun, 30 May 2021 22:26:06 +0200 > From: Ergus via "Bug reports for GNU Emacs, > the Swiss army knife of text editors" > > The use of hide-ifdef is a bit outdated and it requires to manually > call: `M-x hide-ifdefs` to update the buffer > > #if 0 > > #endif > > M-x hide-ifdef-mode > M-x hide-ifdef-toggle-shadowing > > does not shadows/hides the region . > > It requires to explicitly call: M-x hide-ifdefs. Did you try customizing hide-ifdef-initially to a non-nil value? > Then if we change #if 0 -> #if 1; > > the shadow does not disappears/appears either until we call: M-x > hide-ifdefs again. > > This part may be automatized. Calling hide-ifdefs every time is annoying > and unneeded. Vim and most of other editors already do the > re-fontification automatically. So we can take that behavior as a good > starting point. As mentioned on emacs-devel, how exactly to automate this should be carefully thought-out, because blindly using the JIT font-lock mechanism will cause code blocks to appear and disappear several time as long as the user types the preprocessor directive. It sounds like a no-brainer for a simple "#if 0" (which btw is rarely if ever used in real-life production code), but think about typing something like this: #if (defined __has_attribute \ && (!defined __clang_minor__ \ || 3 < __clang_major__ + (5 <= __clang_minor__))) (This is a real-life example from our conf_post.h, and there are a lot like it all over our code.) Depending on how each of the symbols are defined, the block under this could appear and disappear several times until you end typing. I'm quite sure we want to avoid this annoying effect as much as possible. From unknown Sat Jun 21 12:15:58 2025 X-Loop: help-debbugs@gnu.org Subject: bug#48752: 28.0.50; Feature request: Hook hide-ifdef into font-lock Resent-From: Ergus Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 31 May 2021 14:31:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48752 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: 48752@debbugs.gnu.org Received: via spool by 48752-submit@debbugs.gnu.org id=B48752.162247143216290 (code B ref 48752); Mon, 31 May 2021 14:31:02 +0000 Received: (at 48752) by debbugs.gnu.org; 31 May 2021 14:30:32 +0000 Received: from localhost ([127.0.0.1]:34592 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lniw4-0004Eg-0t for submit@debbugs.gnu.org; Mon, 31 May 2021 10:30:32 -0400 Received: from sonic315-13.consmr.mail.bf2.yahoo.com ([74.6.134.123]:38324) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lniw1-0004ES-WD for 48752@debbugs.gnu.org; Mon, 31 May 2021 10:30:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048; t=1622471424; bh=7RlMWR1qi51vCPmJx2wqhNMKOz41PnvHbcn/gC84ZaQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From:Subject:Reply-To; b=EtPrtOmKpbCe/qGyVjEcKYWhMT3JiDCi+B20keD1mAuTAQk/I6NeIcCoxqdC2KYUdSHbYs76bny7Y0BwGdMetu67/GtnsV90QjoDibXaGSPAbh69TZUEGW/DugFHYoq908RFIxNW/VSWJlwuwRGChtf3JXkiP5YwCXCCDbkOjtdHODTJfENK+1muMFwqRRkC/WUNkrBWx1awCC6qLMQnyDRMkEyMuj5lCdhv4bQ/IH/hOcH9uLcwR5/LeGQa04jeLl949VHK9B1853NcZ+jwmy88Clgvwvc0rCgBID4kTw/byUs5QKCQOMyOvXLmnIQIFzS8Q+mE5bmNszQYSqwIGA== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1622471424; bh=/Wq50kd2qqm4tqXkx1oq/MZ4ytblmXpoQ8125yWEAX4=; h=X-Sonic-MF:Date:From:To:Subject:From:Subject; b=bD+SgL4jt+rNBw1JQ1/ZVTpXOPwqU1GhtSPu3dfofElbk8HmPU/w6m4DNrXyVMFIuFeZqHuk1wcBZXKGpQJvQ4XuaEuuTydV5Uf+PyGWkGu/j172gvBnOzqNw9IlpKB7RDO3dqWcwG7LUb+j4cFvgS0VqvFFRkDkjETR9D/wBYpA9n3RBJzLRtsprUImiVj1XVsULiiBeos0BnfgMNSWm1Qp953GZOWgdVNC/Yelk5wsH1gx2uk0Mqa/3xlUBTYR+KlbuDy49gwHAKYYxzuZrYNmXetAiYPaq05f9ojb0RROUjr3iFsumJNOx/USn5dYVDgMMRki1KQrd9eYi2sKWQ== X-YMail-OSG: FTyiXigVM1mVjyvTuS.Cvp3dvmfGtciVrUnMZ8D0_6Nfn3xvMj6Kn0Js6taDphn 9.tdBI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uqKM8vZoPS5mZMV8DosLq8ITVh43BUMqd5wbB18ifgd1 BCDV_3H8Cujlf.6EA5C9e9BHYBO1xgSB2rFt4SRtn4fgmBS7Pos2FgZNPy5k3GPN9mhZ3cjUgT.Y SCf0K1TrtLQR4OOU9mWUKnuir4RoVVFAYCL_l9q0OjRI9yUhEcMHTCKQ1huCncNygVkfT3KHXMo_ W7w4g9Z5ucWXja7cAl7.wgu6ixeyp0PkxdSGM_PqH1Q3930nPeq_w4gNCJtHSVaUByPZB20EDGZS 2pQkdoWJpOQQEQM0Y7t4_WxOJ2xpiVvgn.lRx_g-- X-Sonic-MF: Received: from sonic.gate.mail.ne1.yahoo.com by sonic315.consmr.mail.bf2.yahoo.com with HTTP; Mon, 31 May 2021 14:30:24 +0000 Received: by kubenode522.mail-prod1.omega.ir2.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID 6f0409fcb3a956a801195149f30a399e; Mon, 31 May 2021 14:30:19 +0000 (UTC) Date: Mon, 31 May 2021 16:29:59 +0200 From: Ergus Message-ID: <20210531142959.3sjh4g5ucu5xc4of@Ergus> References: <20210530202606.qlopn6lmwzfa75z5.ref@Ergus> <20210530202606.qlopn6lmwzfa75z5@Ergus> <83eedn2jtl.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <83eedn2jtl.fsf@gnu.org> X-Mailer: WebService/1.1.18368 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.aol Content-Length: 2726 X-Spam-Score: 0.0 (/) 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 (-) On Mon, May 31, 2021 at 03:01:42PM +0300, Eli Zaretskii wrote: >> Date: Sun, 30 May 2021 22:26:06 +0200 >> From: Ergus via "Bug reports for GNU Emacs, >> the Swiss army knife of text editors" >> >> The use of hide-ifdef is a bit outdated and it requires to manually >> call: `M-x hide-ifdefs` to update the buffer >> >> #if 0 >> >> #endif >> >> M-x hide-ifdef-mode >> M-x hide-ifdef-toggle-shadowing >> >> does not shadows/hides the region . >> >> It requires to explicitly call: M-x hide-ifdefs. > >Did you try customizing hide-ifdef-initially to a non-nil value? > >> Then if we change #if 0 -> #if 1; >> >> the shadow does not disappears/appears either until we call: M-x >> hide-ifdefs again. >> >> This part may be automatized. Calling hide-ifdefs every time is annoying >> and unneeded. Vim and most of other editors already do the >> re-fontification automatically. So we can take that behavior as a good >> starting point. > >As mentioned on emacs-devel, how exactly to automate this should be >carefully thought-out, because blindly using the JIT font-lock >mechanism will cause code blocks to appear and disappear several time >as long as the user types the preprocessor directive. It sounds like >a no-brainer for a simple "#if 0" (which btw is rarely if ever used in >real-life production code), but think about typing something like >this: > > #if (defined __has_attribute \ > && (!defined __clang_minor__ \ > || 3 < __clang_major__ + (5 <= __clang_minor__))) > >(This is a real-life example from our conf_post.h, and there are a lot >like it all over our code.) Depending on how each of the symbols are >defined, the block under this could appear and disappear several times >until you end typing. I'm quite sure we want to avoid this annoying >effect as much as possible. Hi Eli: I understand that emacs tries to do something smarter than what vim and the other editors do, but this is limiting the basic trivial use case. I don;t actually think many people are using the hide-ifdef package... specially not new users. In the general case I understand that the block under this could appear and disappear, but that will be also a feedback for the user to know if the region will be enabled or not. For example in the case we have #if #else #endif That may be also very useful to know which branch will be compiled. I don't intend to get something very complex here, but at least the most basic highlight with trivial symbols may work. We use emacs to develop code, so, our code is not really production most of the time. And the #if 0 is very common in many code I have seen around. While the /* // */ Approach I use is not common at all. From unknown Sat Jun 21 12:15:58 2025 X-Loop: help-debbugs@gnu.org Subject: bug#48752: 28.0.50; Feature request: Hook hide-ifdef into font-lock Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 31 May 2021 15:45:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48752 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: 48752@debbugs.gnu.org, Ergus Received: via spool by 48752-submit@debbugs.gnu.org id=B48752.162247585222994 (code B ref 48752); Mon, 31 May 2021 15:45:02 +0000 Received: (at 48752) by debbugs.gnu.org; 31 May 2021 15:44:12 +0000 Received: from localhost ([127.0.0.1]:34676 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lnk5M-0005yo-Cn for submit@debbugs.gnu.org; Mon, 31 May 2021 11:44:12 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:30051) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lnk5J-0005yZ-3v for 48752@debbugs.gnu.org; Mon, 31 May 2021 11:44:11 -0400 Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 7FD5D8074B; Mon, 31 May 2021 11:44:03 -0400 (EDT) Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 3B8EC8009E; Mon, 31 May 2021 11:44:02 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1622475842; bh=O0PiK80xHUmlv6BpwdOWp8d43YMpJHAqNP5MrcuaSn4=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=ah7+AaabmnnM3E7BxC8F7QYpUbwjTCFt9TRVpn/v5SmsGUqV0emRNRiZ5dBNqPMCg VVrMBOF0uDPs/RxAgPTUkKdk0U6I67AEiY38EEGRQkdxtSuGG3usFPD1dT6W3UZZu5 sl/hzi+M6CxRsGZN2ZNal0F4xv21mhWpASMVxJBSnxf8H0VPK+L+p0ruJajhGPv63s v6X+zmagS4RNd2kYeZtsGFD29mgRYxGErccxZzFfjTcDluSx7+6NhyJWG0Xm+JH9dz c/g43FiBqS4Hh625bbiF0uZTdSG0qbaHqC9VZYRBFNAkn0cd8MdUtHgEB7+JsbQwac ZHfCV7fXPAVBw== Received: from alfajor (69-196-163-239.dsl.teksavvy.com [69.196.163.239]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 0C70E12100F; Mon, 31 May 2021 11:44:02 -0400 (EDT) From: Stefan Monnier Message-ID: References: <20210530202606.qlopn6lmwzfa75z5.ref@Ergus> <20210530202606.qlopn6lmwzfa75z5@Ergus> <83eedn2jtl.fsf@gnu.org> Date: Mon, 31 May 2021 11:44:01 -0400 In-Reply-To: <83eedn2jtl.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 31 May 2021 15:01:42 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.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.087 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-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 (---) > As mentioned on emacs-devel, how exactly to automate this should be > carefully thought-out, because blindly using the JIT font-lock > mechanism will cause code blocks to appear and disappear several time > as long as the user types the preprocessor directive. When the code is actually made invisible the appear/disappear could be quite annoying, indeed, but I think Ergus is mostly concerned about the case where `hide-ifdef-shadow` is activated, where it would make sense to make it behave like comments and strings, I think. Stefan