emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ELPA] New package: colorful-mode


From: Elijah G
Subject: Re: [ELPA] New package: colorful-mode
Date: Mon, 22 Apr 2024 20:49:44 -0600

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.

>              (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.
Thanks.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]