From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Christopher Dimech Newsgroups: gmane.emacs.help Subject: Re: Introducing face in comments for various modes Date: Tue, 13 Dec 2022 11:24:50 +0100 Message-ID: References: <9ZK1Solghrmps4AarUsz2E6-mAdkrTZoXPs4RTRTd9sZ0Cd8DGhK955im1kuug-EZXU3tc5rgDDd16vQexxpFnMvMFjFqnNnh0noashyLdE=@protonmail.com> <0RJB0bPRTMAqXlUbL2kGUvJtnCNPYwPhqTNi_l9nIpQAciTZYcYCikFVqi2Nr_UZLbT1_DRtX8G0dSkgI4jln5DTYBDxLz4i7L2d9wx-kA8=@protonmail.com> <0icp58GJsK8dY-4h0rYl1g47IKcUW6zTIdHTpT6gRBXa24dgtBv86Vw2KlQPzBMBtEsHJBM6T1S-JX_xg8xrmQ8vXI1k7_OsdXnTX-_iNZE=@protonmail.com> <0413ccbf-68dd-a9f2-7541-1df84853cfd0@gmail.com> <3d77f749-9a47-3a87-40d0-7c7de73b64e7@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31387"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Heime , Jean Louis , help-gnu-emacs@gnu.org To: Thibaut Verron Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Tue Dec 13 11:26:08 2022 Return-path: Envelope-to: geh-help-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 1p52UB-0007r3-FN for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 13 Dec 2022 11:26:07 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p52Tg-0000e8-7c; Tue, 13 Dec 2022 05:25:36 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p52Te-0000dI-N8 for help-gnu-emacs@gnu.org; Tue, 13 Dec 2022 05:25:34 -0500 Original-Received: from mout.gmx.net ([212.227.15.19]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p52Tc-00023V-Ij for help-gnu-emacs@gnu.org; Tue, 13 Dec 2022 05:25:34 -0500 Original-Received: from [92.251.127.164] ([92.251.127.164]) by web-mail.gmx.net (3c-app-mailcom-bs16.server.lan [172.19.170.184]) (via HTTP); Tue, 13 Dec 2022 11:24:50 +0100 Importance: normal Sensitivity: Normal In-Reply-To: <3d77f749-9a47-3a87-40d0-7c7de73b64e7@gmail.com> X-UI-Message-Type: mail X-Priority: 3 X-Provags-ID: V03:K1:sIxvOnsKIVx9W+oeoDubt9cdPxWMY8TRuWZXIo4QV3QRAzlAEHBnip8n1i4kZv5GGeI4r Qslxcnr0zdAsXL/Jd12hCCu2qH4VRwe3k/Sxhi3bHMFCv4HIcXi2ysFzXD3cxWnm1vI0d3X6WGJ0 EYL0p2Xu5SkjXOvpg8GSj0K1AbjzeBNbj6gq3e3LEPUtyNDZ/gAd5+siOUR2+husRdEOTI7VXqBK l8QdY5FGPjKab5f7ehVuCumGXnPpsfq8eyfmm4x+jmJYFwMtHOuwW5o7TkyhTqlhGQi3JKgJStNJ lw= UI-OutboundReport: notjunk:1;M01:P0:vgsA7tPwYPo=;fw1XyzG+/q6HsAqb62+knEruvhD Hs2xR50VwDVBfsnwJyhas/o9SHIA5g4VuNlcBlddF15+OJBhyr1gQgbjaI6fBX1o+rKZOWQAK GcYJDySSP5T4/RYK/IHnS9D/KzBH1VuD9Eso4KPjj8La13wIqxyMmrsif719T+QH7rLPzsAOd umiAW4q/DXhlS8cu2AlRuOgHIq5yYIUUWisrj+2+6+SjJoZFxCRGyyxb9ZnKTHueRJVwDaPvV Fp8BpzwWkTKI06g7VtT6oDRgg/QMK3BcEjNXwQuF3zWMsGE0Xotz9yEPr4xCwWZ9vCBHtQRO9 0D5VRH+mqH8tswTprcb4vPDyz/jE2Bc0UxMavQ6FT08zukY4WoSxXXDAanswC5Y330IYFdqtl 9Ew/pwlqLv1sX+VajOgmXeRyXeLPSKDELzTN7zZmVM2qaAO6pICnRUreYH9Vc5cxI7re9DfFC +KS+TDKgusA+pGAFwJgBWTssiVE8Xmp1yQGpMshu9+mSjBL/N8p5kh4bU6Gygw8ogJR3WVXZh VgFT6i8Q04FzMMX7mAEQzWDafGfV5mr0EKv4IYSyXLkcHKOKc9XiB+tP/KovdjI6j0ZYUG9+o BLH5X+kkOQ04hxdvMRLE41HQSBeQF2XWMjwfug4wbNR0xpusUtWAC0nW4Jkv776NxATaKr0tF g/dQFkSYuephA9P6wTR2RtIQ7Cj2BwK9EwVcav+dcrcXFVOrJnJeXtUNwNjv1wVW41vWU2e4p cKpAzxZkZTfjc7YFHg42UYA3G/CW8TRDlfx01sMwWfDxDbS2r9K0UwKuL2jBemwcMsReUKTk Received-SPF: pass client-ip=212.227.15.19; envelope-from=dimech@gmx.com; helo=mout.gmx.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:141704 Archived-At: > Sent: Tuesday, December 13, 2022 at 10:05 PM > From: "Thibaut Verron" > To: "Heime" > Cc: "Jean Louis" , help-gnu-emacs@gnu.org > Subject: Re: Introducing face in comments for various modes > > On 13/12/2022 10:46, Heime wrote: > > ------- Original Message ------- > > On Tuesday, December 13th, 2022 at 9:35 AM, Thibaut Verron wrote: > > > > > >> On 13/12/2022 09:30, Heime wrote: > >> > >>> ------- Original Message ------- > >>> On Tuesday, December 13th, 2022 at 8:04 AM, Heime heimeborgia@protonmail.com wrote: > >>> > >>>> ------- Original Message ------- > >>>> On Tuesday, December 13th, 2022 at 7:52 AM, Jean Louis bugs@gnu.support wrote: > >>>> > >>>>> Heime, I like the idea of highlighting comments, though I do it this > >>>>> way to specify (syntax comment-start) as that works for multiple > >>>>> modes. > >>>>> > >>>>> ; one > >>>>> ;; two > >>>>> ;;; three > >>>>> ;;;; and more > >>>>> > >>>>> ;;; Highlighting comments > >>>>> > >>>>> (setq rcd-regexp-comment (rx line-start > >>>>> (one-or-more (syntax comment-start)) > >>>>> (one-or-more space) > >>>>> (group (one-or-more not-newline)) > >>>>> line-end)) > >>>>> > >>>>> ;; (highlight-regexp regexp nil 1) > >>>>> ;; (unhighlight-regexp regexp) > >>>>> > >>>>> Jean > >>>>> I would like to introduce (syntax comment-start) in place > >>>>> of ";;" in "^;;\s+\\[.+\\].*$". > >> > >> It's not something you can "introduce" in your regexp, it only makes > >> sense within the context of a regexp built with rx: > >> https://www.gnu.org/software/emacs/manual/html_node/elisp/Rx-Notation.html > >> > >> Rewriting your regexp as an rx regexp would not be too difficult if you > >> want to go that route, Jean's example is a good template. > >> > >> Otherwise, as an approximation of that feature, you could built your > >> regex string using the value of the variable comment-start ( ";" in > >> emacs-lisp-mode) instead of hardcoding ;; . > > How can one specify two comment characters next to each other? > > Using the variable, the same way you would normally do for a regexp, by > putting \{2\} after the matched regexp. > > E.g. > > ELISP> (format "\\(%s\\)\\{2\\}" comment-start) > "\\(;\\)\\{2\\}" > > (don't trust me for the number of escape characters) > > But I don't think it's really what you want: for example, in a mode > where comment-start is "# " (e.g. org or python), this will match "# # " > but not "##". It is unfortunate that org and python demand a space after # > Using the syntax table is better here, as the character # alone has the > syntax of a comment-start. > > I had forgotten about the simplest option, that is the regexp equivalent > of the rx syntax: \s< in a regexp will match exactly a character with > the syntax of a comment-start. > > So: "\s<\{2\}" should be exactly what you want (at least in languages > where comments start with a single character).