From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philip Kaludercic Newsgroups: gmane.emacs.devel Subject: Re: [ELPA] New package: colorful-mode Date: Sat, 27 Apr 2024 10:12:31 +0000 Message-ID: <87jzkjqflc.fsf@posteo.net> References: <878r15vnr1.fsf@posteo.net> 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="15535"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Elijah G Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Apr 27 12:13:13 2024 Return-path: Envelope-to: ged-emacs-devel@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 1s0f3R-0003u5-Bj for ged-emacs-devel@m.gmane-mx.org; Sat, 27 Apr 2024 12:13:13 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s0f2t-0000QO-Mc; Sat, 27 Apr 2024 06:12:39 -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 1s0f2r-0000QE-RQ for emacs-devel@gnu.org; Sat, 27 Apr 2024 06:12:37 -0400 Original-Received: from mout02.posteo.de ([185.67.36.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s0f2p-0004oZ-So for emacs-devel@gnu.org; Sat, 27 Apr 2024 06:12:37 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 000DA240103 for ; Sat, 27 Apr 2024 12:12:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1714212753; bh=NYFwDhrZt/QrUtglxyQRSuyrutL/74PUH6i7yZGI8hU=; h=From:To:Cc:Subject:OpenPGP:Date:Message-ID:MIME-Version: Content-Type:Content-Transfer-Encoding:From; b=OkNizRfGt3TAuEeUcsOJPgTf1Gz92b9vr0yuSlN+1KYmwa9w7kd55UO3q/zchXq9Z XeYoN4aYr7Bqq5csvEYCjSkB7cNoRE6EmKiaYeoClL3k5+yFcfEsTP30Q6QDWyXGKJ cBdD4PCZeuyqeFVrOMcDHa3u0nYnprzzIxwxbaGDjHgIwKDV3/vfoitD4FHkDOxFps Xj2XjIXW9s9Dwt2jLNwToe7002y5BSt+xzJ4dylQJoyr3OBuI2Ki52metUHAQwCBsE J6+sSqbvPoBxkjUmvvCknimzYBJvyc2gHhcwjmEH9rC9GhvzJWxwwegYQU0IqEZQYc UVwKsJngNdvww== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4VRQPr4NGdz6tyK; Sat, 27 Apr 2024 12:12:32 +0200 (CEST) In-Reply-To: (Elijah G.'s message of "Mon, 22 Apr 2024 20:49:44 -0600") OpenPGP: id=7126E1DE2F0CE35C770BED01F2C3CC513DB89F66; url="https://keys.openpgp.org/vks/v1/by-fingerprint/7126E1DE2F0CE35C770BED01F2C3CC513DB89F66"; preference=signencrypt Received-SPF: pass client-ip=185.67.36.66; envelope-from=philipk@posteo.net; helo=mout02.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:318184 Archived-At: Elijah G writes: > Hi Philip, thank you for your suggestions, I've now added > some of them to my package, here are my answers to your questions. > > On Mon, Apr 22, 2024 at 1:51=E2=80=AFAM Philip Kaludercic wrote: >> >> (defun colorful--latex-gray-to-hex (gray) >> "Return LaTex GRAY as hexadecimal format. GRAY must be a string." >> @@ -350,6 +342,8 @@ HSL must be a string." >> (string-remove-prefix "hsl(" hsl) >> (string-remove-prefix "hsla(" hsl)) >> (rx (one-or-more (any "," " " "\t" "\n""\r" "\v" "\f"= ))))) >> + ;; what error is being ignored here? if (nth n hsl) is >> + ;; nil, we can check this manually > > I had to add ignore-errors because it nth was throwing an error when > nth is nil, it was bugging the other overlays in the next lines, using > ignore-errors allows returning nil in case it can't be done and break the > if-let conditional without affecting the other overlays. What I am trying to say, is that ignore-errors is a rather coarse tool. It will swallow and forget all errors that might arise, which can make debugging difficult if something else goes wrong. My advice is to use something like (and (nth 0 hsl) (/ (string-to-number (nth 0 hsl)) 360.0)) unless I am misunderstanding your response somehow. >> (h (ignore-errors (/ (string-to-number (nth 0 hsl)) 360.0))) >> (s (ignore-errors (/ (string-to-number (nth 1 hsl)) 100.0))) >> (l (ignore-errors (/ (string-to-number (nth 2 hsl)) 100.0))) > >> (defvar colorful-hex-font-lock-keywords >> `((,(rx (seq (not (any "&")) >> @@ -639,6 +631,7 @@ converted to a Hex color." >> "Function for add hex colors to `colorful-color-keywords'. >> This is intended to be used with `colorful-extra-color-keyword-function= s'." >> (dolist (colors colorful-hex-font-lock-keywords) >> + ;; why are you using `add-to-list' here? >> (add-to-list 'colorful-color-keywords colors t))) > > It was the way I found for adding the other color keywords, > i found that using add-to-list with a buffer-local variable doesn't > override the other buffer ones, If you know another way in how > I would gladly implement it in my package. I would have just used `push', as the `add-to-list' docstring advises. > Thanks. --=20 Philip Kaludercic on peregrine