help-gnu-emacs
[Top][All Lists]
Advanced

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

version> and version>=


From: goncholden
Subject: version> and version>=
Date: Wed, 02 Feb 2022 10:21:15 +0000

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐

On Wednesday, February 2nd, 2022 at 3:47 AM, Stefan Monnier via Users list for 
the GNU Emacs text editor <help-gnu-emacs@gnu.org> wrote:

> What is the best way to check the version
>
> (if (version< emacs-version "28.0")
>
> or
>
> (< emacs-version 28.0)

(< emacs-major-version 28)

Stefan

Am working on colouring comments according to whether the background is light 
or dark.

But I am encountering

if: Wrong type argument: number-or-marker-p, "27.2"


Code:

(defvar annotation-chroma
  '( (dark .  ((low  . "#8300E0")  (mid  . "#AA33FF")  (high . "#C370FF")))
     (light . ((low  . "#C16BFF")  (mid  . "#AA33FF")  (high . "#8000DB"))) )
  "Colour contrast for comments, indigo on dark and light background.")


(defun annotation-typeface (chroma)
  "Set the foreground colour for comments."

  (let* ( (colors annotation-chroma)
          (levels
           (if (>= emacs-version 28.0)
               (alist-get (frame--current-backround-mode nil) colors)
             (message "GonCholden"))) )

    (face-remap-add-relative 'font-lock-comment-face
       `(:foreground ,(alist-get chroma levels)))

    (message "annotation: %s contrast" chroma)) )







reply via email to

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