From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Marcin Borkowski Newsgroups: gmane.emacs.help Subject: Re: Colour Capital Letters Date: Wed, 25 Oct 2023 20:30:09 +0200 Message-ID: <875y2uimha.fsf@mbork.pl> References: <877cnjsqoe.fsf@mbork.pl> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3840"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.1.0; emacs 30.0.50 Cc: Heime via Users list for the GNU Emacs text editor To: Heime Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Wed Oct 25 20:31:14 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 1qviev-0000mg-Dv for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 25 Oct 2023 20:31:13 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qvieO-0004rS-EQ; Wed, 25 Oct 2023 14:30:40 -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 1qvieI-0004qd-SZ for help-gnu-emacs@gnu.org; Wed, 25 Oct 2023 14:30:35 -0400 Original-Received: from mail.mojserwer.eu ([195.110.48.8]) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qvie2-0006BO-UM for help-gnu-emacs@gnu.org; Wed, 25 Oct 2023 14:30:34 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by mail.mojserwer.eu (Postfix) with ESMTP id 8BEFC18CB405; Wed, 25 Oct 2023 20:30:12 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mail.mojserwer.eu Original-Received: from mail.mojserwer.eu ([127.0.0.1]) by localhost (mail.mojserwer.eu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 8vDLgiVR_swx; Wed, 25 Oct 2023 20:30:09 +0200 (CEST) Original-Received: from localhost (178235147172.dynamic-3-poz-k-0-1-0.vectranet.pl [178.235.147.172]) by mail.mojserwer.eu (Postfix) with ESMTPSA id 6F15818CB400; Wed, 25 Oct 2023 20:30:09 +0200 (CEST) In-reply-to: Received-SPF: pass client-ip=195.110.48.8; envelope-from=mbork@mbork.pl; helo=mail.mojserwer.eu X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, 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:145389 Archived-At: On 2023-10-18, at 21:40, Heime wrote: > Sent with Proton Mail secure email. > > ------- Original Message ------- > On Thursday, October 19th, 2023 at 6:58 AM, Marcin Borkowski wrote: > > >> On 2023-10-02, at 03:58, Heime heimeborgia@protonmail.com wrote: >> >> > I want to make a stand alone function that uses a different colour for capital letters >> > in CamelCase names. Possibly taking code from glasses.el. >> > >> > (defun color-camelcase-capital-letters () >> > "Color capital letters in CamelCase variables." >> > (interactive) >> > (highlight-regexp "\\(?:^\\|\\b\\)[[:upper:]][[:lower:]]*" 'hi-yellow)) >> >> >> Just saw this while looking through my email backlog. This is a great >> idea, but I think it can be made even better. How about using two >> colors so that subsequent /words/ in CamelCase identifiers are colored >> differently? I suspect this could be great for readibility! >> >> > What can I do ? >> >> >> Do you have any working code? I might be tempted to try to write >> something like this... > > Do not have a working one yet. I wanted to start with something quite > simple first. But I was planning to get subsequent words colored differently. > > The purpose was about readability, particularly for Latex where one cannot use > underscore '_'. I looked at glasses.el, and it *already has* that feature! Set `glasses-separator' to an empty string and `glasses-face' to e.g. 'bold (the symbol - name of te face). Note: use customize-option. If you really want to highlight every other subword, not just the initial letters, check out this proof-of-concept implementation: https://gitlab.com/-/snippets/3614958 . I plan to blog about it on Nov 11. Hth, -- Marcin Borkowski http://mbork.pl