Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

autothemer-generate-templates returns wrong-type-argument symbolp (1 . -1) #20

Closed
kguidonimartins opened this issue Aug 1, 2021 · 5 comments

Comments

@kguidonimartins
Copy link

Hi @jasonm23, I'm tried your package but something goes wrong. Below, I provide a sample code to reproduce the error step by step. Can you help with this?

I write the sample code in the file minimal.el. Then, I loaded the file in emacs using emacs -q -l ~/minimal.el. I have changed the colors yellowish and reddish from the example code in your README.

;; minimal.el
;; run with `emacs -q -l /path/to/minimal.el'

(require 'package)
(setq package-archives '(("melpa" . "https://melpa.org/packages/")
                         ("elpa" . "https://elpa.gnu.org/packages/")))

(package-initialize)
(unless package-archive-contents
  (package-refresh-contents))

;; Initialize use-package on non-Linux platforms
(unless (package-installed-p 'use-package)
  (package-install 'use-package))

;; activate use-package
(require 'use-package)

(use-package autothemer)

(autothemer-deftheme example-name "Autothemer example..."

                     ;; Specify the color classes used by the theme
                     ((((class color) (min-colors #xFFFFFF))
                       ((class color) (min-colors #xFF)))

                      ;; Specify the color palette for each of the classes above.
                      (example-red    "#781210" "#FF0000")
                      (example-green  "#22881F" "#00D700")
                      (example-blue   "#212288" "#0000FF")
                      (example-purple "#812FFF" "#Af00FF")
                      (example-yellow "#EFFE00" "#FFFF00")
                      (example-orange "#E06500" "#FF6600")
                      (example-cyan   "#22DDFF" "#00FFFF"))

                     ;; specifications for Emacs faces.
                     ((button (:underline t :weight 'bold :foreground example-yellow))
                      (error  (:foreground example-red)))

                     ;; Forms after the face specifications are evaluated.
                     ;; (palette vars can be used, read below for details.)
                     (custom-theme-set-variables 'example-name
                                                 `(ansi-color-names-vector [,example-red
                                                                            ,example-green
                                                                            ,example-blue
                                                                            ,example-purple
                                                                            ,example-yellow
                                                                            ,example-orange
                                                                            ,example-cyan])))

I turned on toggle-debug-on-error, evaluated the (autothemer-deftheme ..., then I run M-x autothemer-generate-templates, and I received the following message:

Debugger entered--Lisp error: (wrong-type-argument symbolp (1 . -1))
  boundp((1 . -1))
  #f(compiled-function (it) #<bytecode -0x443ba3bfbd9c438>)((1 . -1))
  -tree-map(#f(compiled-function (it) #<bytecode -0x443ba3bfbd9c438>) (1 . -1))
  #f(compiled-function (x) #<bytecode 0x84d6d9bc17bf44a>)((1 . -1))
  mapcar(#f(compiled-function (x) #<bytecode 0x84d6d9bc17bf44a>) (:line-width (1 . -1) :color "grey35"))
  -tree-map(#f(compiled-function (it) #<bytecode -0x443ba3bfbd9c438>) (:line-width (1 . -1) :color "grey35"))
  #f(compiled-function (x) #<bytecode 0x84d6d9bc17bf44a>)((:line-width (1 . -1) :color "grey35"))
  mapcar(#f(compiled-function (x) #<bytecode 0x84d6d9bc17bf44a>) (:box (:line-width (1 . -1) :color "grey35") :foreground "LightBlue" :background "grey19"))
  -tree-map(#f(compiled-function (it) #<bytecode -0x443ba3bfbd9c438>) (:box (:line-width (1 . -1) :color "grey35") :foreground "LightBlue" :background "grey19"))
  #f(compiled-function (x) #<bytecode 0x84d6d9bc17bf44a>)((:box (:line-width (1 . -1) :color "grey35") :foreground "LightBlue" :background "grey19"))
  mapcar(#f(compiled-function (x) #<bytecode 0x84d6d9bc17bf44a>) ((:box (:line-width (1 . -1) :color "grey35") :foreground "LightBlue" :background "grey19")))
  -tree-map(#f(compiled-function (it) #<bytecode -0x443ba3bfbd9c438>) ((:box (:line-width (1 . -1) :color "grey35") :foreground "LightBlue" :background "grey19")))
  autothemer--approximate-spec((help-key-binding (:box (:line-width (1 . -1) :color "grey35") :foreground "LightBlue" :background "grey19")) #s(autothemer--theme :colors (#s(autothemer--color :name example-red :value "#781210") #s(autothemer--color :name example-green :value "#22881F") #s(autothemer--color :name example-blue :value "#212288") #s(autothemer--color :name example-purple :value "#812FFF") #s(autothemer--color :name example-yellow :value "#EFFE00") #s(autothemer--color :name example-orange :value "#E06500") #s(autothemer--color :name example-cyan :value "#22DDFF")) :defined-faces (button error)))
  #f(compiled-function (it) #<bytecode 0xa45ecd4abb6b7>)(help-key-binding)
  mapcar(#f(compiled-function (it) #<bytecode 0xa45ecd4abb6b7>) (diff-refine-added diff-refine-removed diff-refine-changed diff-error diff-nonexistent diff-context diff-function diff-indicator-changed diff-indicator-added diff-indicator-removed diff-changed diff-added diff-removed diff-hunk-header diff-index diff-file-header diff-header Info-quoted info-index-match info-header-node info-header-xref info-xref-visited info-xref info-menu-star info-menu-header info-title-4 info-title-3 info-title-2 info-title-1 info-node package-status-avail-obso package-status-incompat package-status-unsigned package-status-dependency package-status-installed package-status-disabled package-status-held package-status-new package-status-available package-status-external package-status-built-in package-description package-name package-help-section-name browse-url-button tooltip eldoc-highlight-function-argument vc-edited-state vc-missing-state vc-removed-state ...))
  autothemer-generate-templates()
  funcall-interactively(autothemer-generate-templates)
  call-interactively(autothemer-generate-templates record nil)
  command-execute(autothemer-generate-templates record)
  execute-extended-command(nil "autothemer-generate-templates" nil)
  funcall-interactively(execute-extended-command nil "autothemer-generate-templates" nil)
  call-interactively(execute-extended-command nil nil)
  command-execute(execute-extended-command)

I'm on Arch Linux using the Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.29, cairo version 1.17.4) of 2021-06-06.

Thanks in advance for any help.

@jonpalmisc
Copy link

I am also experiencing this issue, using Emacs 28.0.60 on macOS 12, ARM64.

The traceback for me looks like this:

Debugger entered--Lisp error: (wrong-type-argument symbolp (1 . -1))
  boundp((1 . -1))
  #f(compiled-function (it) #<bytecode -0x1e66d6e934344aec>)((1 . -1))
  -tree-map(#f(compiled-function (it) #<bytecode -0x1e66d6e934344aec>) (1 . -1))
  #f(compiled-function (x) #<bytecode 0x84d6db87393274a>)((1 . -1))
  -tree-map(#f(compiled-function (it) #<bytecode -0x1e66d6e934344aec>) (:line-width (1 . -1) :color "grey35"))
  #f(compiled-function (x) #<bytecode 0x84d6db87393274a>)((:line-width (1 . -1) :color "grey35"))
  -tree-map(#f(compiled-function (it) #<bytecode -0x1e66d6e934344aec>) (:box (:line-width (1 . -1) :color "grey35") :foreground "LightBlue" :background "grey19"))
  #f(compiled-function (x) #<bytecode 0x84d6db87393274a>)((:box (:line-width (1 . -1) :color "grey35") :foreground "LightBlue" :background "grey19"))
  -tree-map(#f(compiled-function (it) #<bytecode -0x1e66d6e934344aec>) ((:box (:line-width (1 . -1) :color "grey35") :foreground "LightBlue" :background "grey19")))
  autothemer--approximate-spec((help-key-binding (:box (:line-width (1 . -1) :color "grey35") :foreground "LightBlue" :background "grey19")) #s(autothemer--theme :colors (#s(autothemer--color :name nv/base1 :value "#1B1C1C") #s(autothemer--color :name nv/base2 :value "#2F3032") #s(autothemer--color :name nv/base3 :value "#454749") #s(autothemer--color :name nv/base4 :value "#A8ACAF") #s(autothemer--color :name nv/base5 :value "#D7DEE4") #s(autothemer--color :name nv/base6 :value "#FFFFFF") #s(autothemer--color :name nv/blue :value "#93BEDD") #s(autothemer--color :name nv/yellow :value "#E8D2A9") #s(autothemer--color :name nv/green :value "#BACDA5") #s(autothemer--color :name nv/red :value "#DFB4B6") #s(autothemer--color :name nv/hl :value "#39444B") #s(autothemer--color :name nv/hl-bright :value "#4F626F")) :defined-faces (region hl-line highlight lazy-highlight secondary-selection font-lock-keyword-face font-lock-builtin-face font-lock-constant-face font-lock-type-face font-lock-string-face font-lock-variable-name-face font-lock-function-name-face font-lock-comment-face font-lock-doc-face minibuffer-prompt orderless-match-face-0 orderless-match-face-1 orderless-match-face-2 orderless-match-face-3 isearch isearch-fail escape-glyph homoglyph trailing-whitespace compilation-info compilation-error compilation-mode-line-fail link link-visited success warning error tooltip default)))
  #<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_6>(help-key-binding)
  autothemer-generate-templates()
  funcall-interactively(autothemer-generate-templates)
  command-execute(autothemer-generate-templates record)
  execute-extended-command(nil "autothemer-generate-templates" "autothe")
  funcall-interactively(execute-extended-command nil "autothemer-generate-templates" "autothe")
  command-execute(execute-extended-command)

@jasonm23
Copy link
Owner

jasonm23 commented Aug 8, 2022

Hi @kguidonimartins @jonpalmisc

I'm investigating this error now. Will update at close of the day. (Timezone Bangkok.)

@jasonm23
Copy link
Owner

jasonm23 commented Aug 9, 2022

Late update. Error confirmed. Setting up ert tests for autothemer.

@jasonm23
Copy link
Owner

jasonm23 commented Aug 9, 2022

Fixed.

@jasonm23
Copy link
Owner

jasonm23 commented Aug 9, 2022

Postmortem.

In some rare cases a cons cell is used as face attribute value.

For all of our errors, I notice we are all getting tripped on:

(help-key-binding (:box (:line-width (1 . -1) :color "grey35")...

Side note, I initially quoted the cons when they are found. However, this seems unecessary and potentially harmful. cons are just passed through...

The problematic face now generates the following auto-spec.

 (help-key-binding
  (:box
   (:line-width
    (1 . -1)
    :color example-blue)
   :foreground example-cyan :background example-blue))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants