From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: uzibalqa Newsgroups: gmane.emacs.help Subject: Colouring capital letters Date: Wed, 20 Sep 2023 12:08:26 +0000 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26948"; mail-complaints-to="usenet@ciao.gmane.io" To: uzibalqa via Users list for the GNU Emacs text editor Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Wed Sep 20 14:09:28 2023 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 1qiw1F-0006eR-HP for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 20 Sep 2023 14:09:25 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qiw0i-00059o-8n; Wed, 20 Sep 2023 08:08:52 -0400 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 1qiw0g-000574-K0 for help-gnu-emacs@gnu.org; Wed, 20 Sep 2023 08:08:50 -0400 Original-Received: from mail-40141.protonmail.ch ([185.70.40.141]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qiw0c-0003Ob-RA for help-gnu-emacs@gnu.org; Wed, 20 Sep 2023 08:08:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=proton.me; s=protonmail; t=1695211715; x=1695470915; bh=Ic/aizK6o+h1RcEYxzaivTLWCCLg7i5Or9vYtev7amM=; h=Date:To:From:Subject:Message-ID:Feedback-ID:From:To:Cc:Date: Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector; b=nm0TQ/8pY4A7z7TRSasPlqHZmpNKS6sF+GJN0k3FoVtO8aTL5qvhu2473xn0R/aB0 YZr7b2DX8qLcTw4SPE0Lcl6VDY3PxkFkfeQUPpUOh1yZvEhriqMbepZ3n9h7UsmhDr 0dJjvCgnlXhIp032BXcRyNyUYOnnRYPg7uRuyPVucPA/wfu57bqoHgoKV2HaF+XGUs J8Gy6GZcB7H+4wxmsGr75MUL92Txyj1admkRz2Uoa1miC6A3rCZCMOShAZU/uOXIUw inT/sdPjX9QBEJ/wYvSGSGGM0avi1/IlIi78N9Y4cykCdGnit8Dxcy8SVcjXHTlNEu 0Sj7QBI6t4N3Q== Feedback-ID: 52887082:user:proton Received-SPF: pass client-ip=185.70.40.141; envelope-from=uzibalqa@proton.me; helo=mail-40141.protonmail.ch 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, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-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:145146 Archived-At: I would to extract (from glasses.el) and complete the necessary code so tha= t variable and=20 function names written in CamelCase appearing in capitals are coloured diff= erently. After having identified glasses-face and glasses-make-overlay, I need addit= ional assistance to implement the functionality. (defun change-face-for-camel-case (face) "Change the face of capital letters in CamelCase words throughout the buf= fer. FACE is the face to apply to the capital letters." (interactive "MFace for CamelCase letters: ") (let ((case-fold-search nil)) (save-excursion (goto-char (point-min)) (while (re-search-forward "\\b\\([A-Z][a-z0-9]*\\)\\([A-Z][a-z0-9]*\\= )\\b" nil t) (add-text-properties (match-beginning 1) (match-end 1) `(face ,face= )) (add-text-properties (match-beginning 2) (match-end 2) `(face ,face= ))) (font-lock-fontify-buffer)))) ;; Bind the function to a key for easy use, e.g., F5 (global-set-key (kbd "")=20 (lambda ()=20 (interactive)=20 (change-face-for-camel-case 'font-lock-variable-name-face))) Sent with Proton Mail secure email.