From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Elijah G Newsgroups: gmane.emacs.devel Subject: Re: [ELPA] New package: colorful-mode Date: Sat, 27 Apr 2024 10:44:49 -0600 Message-ID: References: <878r15vnr1.fsf@posteo.net> <87jzkjqflc.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="27275"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Philip Kaludercic Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Apr 27 18:45:45 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 1s0lBJ-0006r4-1a for ged-emacs-devel@m.gmane-mx.org; Sat, 27 Apr 2024 18:45:45 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s0lAc-0005Za-WE; Sat, 27 Apr 2024 12:45:03 -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 1s0lAb-0005Yn-9s for emacs-devel@gnu.org; Sat, 27 Apr 2024 12:45:01 -0400 Original-Received: from mail-yw1-x1143.google.com ([2607:f8b0:4864:20::1143]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s0lAZ-0004cV-O7 for emacs-devel@gnu.org; Sat, 27 Apr 2024 12:45:01 -0400 Original-Received: by mail-yw1-x1143.google.com with SMTP id 00721157ae682-61b92a83216so36176227b3.2 for ; Sat, 27 Apr 2024 09:44:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714236298; x=1714841098; darn=gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=XZcZ1nfxMBdPwC84PI/8FZKHtNteu+QGdHmr6ugBwhY=; b=DDcBYSQmFypzuAfU/yn7vvaaAXmKsPMFUEbvqcvim0OZiLxTugP3bsW+r6YYcojZ2i FeotbzpNAKN3jRWms3ErkMKkFqQJhuxwA5EYQAxUUGyp2iuWC1fUTYoso9ZM1REyzSpF q4T6ibjKoSjKmVefgLs7jsK88WI8e2RuWZBJO/duNap3M7G9SiwROKfAWNnSHTtOmFbV YuHyXMkFT90YfkKRkWWwsKt1UhQ79gaAr3If9rT1PtKcb3lFdA0RQ3/W+xLd6aJ4e0/D /kq1J1ZJnuli8NE6UGOaYVO4esbtrNlL1KvDy3Ul6NQ4AUI5qBk15oMfCzIOuLA6QES2 MZRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714236298; x=1714841098; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XZcZ1nfxMBdPwC84PI/8FZKHtNteu+QGdHmr6ugBwhY=; b=oq/imSIgdQmjimRBZ41cIJDLStAoh/4pjJmAfAANLLNqtVTwJ/mGePbyG2d9MW1PN1 cEhvMhYdkmT/Bytdz0pmPGXPNknK4jv8Q0xuuTkkrhVDHLXKE09zZ/z0XzJfg+v9Y9EP hK+586RWf+CBRoSRIp1LnyPXaoQ+kPtjzgWPGr9uteJZiLp7Tu6GnkO4MSd/KXZ+ZQN5 aeTskcTPO8tx1Sgcy2AGv/ZZ0j5MF2d2rBaauUsgNefiOxcJ8QiPOZ9mOtNgGjcCgAej 8gUn+b2kJAwujzA4/6JsAdG9jOua1MCktrzBN/hi6wufkMcWIKhKx1UJg2R6/l4WeG0K AVDA== X-Gm-Message-State: AOJu0YxuaAafqk5/fffcGxsTRUYniiBlp9hukYtkJr1pGe8VD3IHMpB4 5vL9+8JEvdQxpmPCXCSDEj0MyyVW8p79dwMQRtEK8uXN2dRbhv/Yho9ekiZvB4wBe/V40D9F9B8 SlnfouVpfbXT8FBWjNsjiH6XMfBcZNvnh X-Google-Smtp-Source: AGHT+IHlK1fszRevZbYJxEioG5CXDql1dBtm8Ea6k+bFzM7Gc+JmYljHIE5GKjHRbLbpKFmq/vJXxCxZX3F0+qojVT0= X-Received: by 2002:a05:690c:fcb:b0:618:1034:f4ef with SMTP id dg11-20020a05690c0fcb00b006181034f4efmr6552331ywb.16.1714236298517; Sat, 27 Apr 2024 09:44:58 -0700 (PDT) In-Reply-To: <87jzkjqflc.fsf@posteo.net> Received-SPF: pass client-ip=2607:f8b0:4864:20::1143; envelope-from=eg642616@gmail.com; helo=mail-yw1-x1143.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 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_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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:318218 Archived-At: On Sat, Apr 27, 2024 at 4:12=E2=80=AFAM Philip Kaludercic wrote: > > 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 t= he > > 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-functi= ons'." > >> (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. > > -- > Philip Kaludercic on peregrine Thank you, I've now updated the package to include the advices. Now I think it's ready to submit it to ELPA.