From: Elijah G <eg642616@gmail.com>
To: Philip Kaludercic <philipk@posteo.net>
Cc: emacs-devel@gnu.org
Subject: Re: [ELPA] New package: colorful-mode
Date: Sat, 27 Apr 2024 10:44:49 -0600 [thread overview]
Message-ID: <CACnP4NKYC-14GJi-f-zXZCNPYmu1fOGoYdbMnpHRJFiasPnDGw@mail.gmail.com> (raw)
In-Reply-To: <87jzkjqflc.fsf@posteo.net>
On Sat, Apr 27, 2024 at 4:12 AM Philip Kaludercic <philipk@posteo.net> wrote:
>
> Elijah G <eg642616@gmail.com> 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 AM Philip Kaludercic <philipk@posteo.net> 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-functions'."
> >> (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.
next prev parent reply other threads:[~2024-04-27 16:44 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-20 1:07 [ELPA] New package: colorful-mode Elijah G
2024-04-22 7:51 ` Philip Kaludercic
2024-04-23 2:49 ` Elijah G
2024-04-27 10:12 ` Philip Kaludercic
2024-04-27 16:44 ` Elijah G [this message]
2024-04-27 21:12 ` Philip Kaludercic
2024-04-28 23:39 ` Elijah G
2024-04-29 5:47 ` Philip Kaludercic
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CACnP4NKYC-14GJi-f-zXZCNPYmu1fOGoYdbMnpHRJFiasPnDGw@mail.gmail.com \
--to=eg642616@gmail.com \
--cc=emacs-devel@gnu.org \
--cc=philipk@posteo.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).