From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ergus via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#48752: 28.0.50; Feature request: Hook hide-ifdef into font-lock Date: Sun, 30 May 2021 22:26:06 +0200 Message-ID: <20210530202606.qlopn6lmwzfa75z5@Ergus> References: <20210530202606.qlopn6lmwzfa75z5.ref@Ergus> Reply-To: Ergus Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26111"; mail-complaints-to="usenet@ciao.gmane.io" To: 48752@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun May 30 22:27:11 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lnS1f-0006Zh-7s for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 30 May 2021 22:27:11 +0200 Original-Received: from localhost ([::1]:33968 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lnS1e-0007QV-AO for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 30 May 2021 16:27:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54122) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lnS1W-0007Q1-96 for bug-gnu-emacs@gnu.org; Sun, 30 May 2021 16:27:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:48888) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lnS1V-0004TK-VR for bug-gnu-emacs@gnu.org; Sun, 30 May 2021 16:27:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lnS1V-0004g6-RR for bug-gnu-emacs@gnu.org; Sun, 30 May 2021 16:27:01 -0400 X-Loop: help-debbugs@gnu.org 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-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.162240639817946 (code B ref -1); Sun, 30 May 2021 20:27:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 30 May 2021 20:26:38 +0000 Original-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 Original-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 Original-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 Original-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.m7B39MEHNUpPb23qIB3A 8sm3c4ofWnDM7fwzyAoC_ytrbbmhd2JPnOHiLXPffM4McrgPFoiBvhNhuVK0a9Fl2bLvVo.2h5SR V7SewouoW1nCFW91LKkxrrSbC1XTkotC1GOM4fz10x.ePVzSOHej9H5sHs_sCxJWqP6YqskplC7o 0O9lHFFf4QOiglDdwtch0VLOfMj1CDcvotMl3k6OzGqalVnu_4ufZIYYgYG7bM7p7clgzBcC9zZ9 QBm8YpvXAC8nwB_nFSTXP7eV.2Mvi_KtEDxjzGa5OKqlEFdKBmeRXLvScEWYZ_VJvlP5j1qSnY9e cW95ZMgCVuBomgCrQ1UWppBbErgR.cA7VWjjAzISNLJJ827wCDKUcXGHw6ZabqscvNyrCmkyCVtr lMi9kI_jqP7nekyw.OWvBrIqLy6E2KP0d3KbDZxcIob.8hAfqeZFNUoX_ZIoTWOSZyu1VFD9Ysud Wkf3iy7dC6zd8Izqv_aLzVmoJPvQf0AEnG4dKMy75LTMUh_4kh4ysn7q0kZfsELxyed7oqPZksU3 nfHFX1ZoICDBHxJ1dWrpQ0s438JDVmbpbJL0sWPxqJLTmQEqAm7IUPQifh9Q9E89iWb34TETkns3 UindYAQYrkmrqFPDrad5ZFChS8z5o8lNJHE5W4U79j X-Sonic-MF: Original-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 Original-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) Content-Disposition: inline X-Mailer: WebService/1.1.18368 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.aol 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-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:207641 Archived-At: 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))