Doom-emacs: (wrong-number-of-arguments (&keys url files) 4) when calling +pretty-code/install-patched-font "Iosevka"

Created on 1 Apr 2020  ·  14Comments  ·  Source: hlissner/doom-emacs

What did you expect to happen?

The patched Iosveka to be installed.

What actually happened?

(wrong-number-of-arguments (&keys url files) 4) was thrown.

Additional details:


Debugger entered--Lisp error: (wrong-number-of-arguments (&keys url files) 4)
signal(wrong-number-of-arguments ((&keys url files) 4))
(if (= (length --cl-rest--) 3) (car-safe (prog1 --cl-rest-- (setq --cl-rest-- (cdr --cl-rest--)))) (signal 'wrong-number-of-arguments (list '(&keys url files) (length --cl-rest--))))
(let* ((--cl-rest-- font-files) (&keys (if (= (length --cl-rest--) 3) (car-safe (prog1 --cl-rest-- (setq --cl-rest-- (cdr --cl-rest--)))) (signal 'wrong-number-of-arguments (list '(&keys url files) (length --cl-rest--))))) (url (car-safe (prog1 --cl-rest-- (setq --cl-rest-- (cdr --cl-rest--))))) (files (car --cl-rest--))) (+pretty-code--install-font prefix font-name url font-files))
(if font-files (let* ((--cl-rest-- font-files) (&keys (if (= (length --cl-rest--) 3) (car-safe (prog1 --cl-rest-- (setq --cl-rest-- ...))) (signal 'wrong-number-of-arguments (list '... (length --cl-rest--))))) (url (car-safe (prog1 --cl-rest-- (setq --cl-rest-- (cdr --cl-rest--))))) (files (car --cl-rest--))) (+pretty-code--install-font prefix font-name url font-files)) (user-error "%S is not a valid font"))
(let* ((font-files (and t (cdr (assoc font-name +pretty-code-font-alist))))) (if font-files (let* ((--cl-rest-- font-files) (&keys (if (= (length --cl-rest--) 3) (car-safe (prog1 --cl-rest-- ...)) (signal 'wrong-number-of-arguments (list ... ...)))) (url (car-safe (prog1 --cl-rest-- (setq --cl-rest-- ...)))) (files (car --cl-rest--))) (+pretty-code--install-font prefix font-name url font-files)) (user-error "%S is not a valid font")))
+pretty-code/install-patched-font("Iosevka")
funcall-interactively(+pretty-code/install-patched-font "Iosevka")
call-interactively(+pretty-code/install-patched-font record nil)
command-execute(+pretty-code/install-patched-font record)
counsel-M-x-action("+pretty-code/install-patched-font")
#f(compiled-function (x) #)("+pretty-code/install-patched-font")
ivy-call()
#f(compiled-function (arg1 arg2 &rest rest) "Read a string in the minibuffer, with completion.\n\nPROMPT is a string, normally ending in a colon and a space.\nivy-count-format' is prepended to PROMPT during completion.\n\nCOLLECTION is either a list of strings, a function, an alist, or\na hash table, supplied forminibuffer-completion-table'.\n\nPREDICATE is applied to filter out the COLLECTION immediately.\nThis argument is for compatibility with completing-read'.\n\nWhen REQUIRE-MATCH is non-nil, only members of COLLECTION can be\nselected.\n\nIf INITIAL-INPUT is non-nil, then insert that input in the\nminibuffer initially.\n\nHISTORY is a name of a variable to hold the completion session\nhistory.\n\nKEYMAP is composed withivy-minibuffer-map'.\n\nPRESELECT, when non-nil, determines which one of the candidates\nmatching INITIAL-INPUT to select initially. An integer stands\nfor the position of the desired candidate in the collection,\ncounting from zero. Otherwise, use the first occurrence of\nPRESELECT in the collection. Comparison is first done with\nequal'. If that fails, and when applicable, match PRESELECT as\na regular expression.\n\nDEF is for compatibility withcompleting-read'.\n\nUPDATE-FN is called each time the candidate list is re-displayed.\n\nWhen SORT is non-nil, ivy-sort-functions-alist' determines how\nto sort candidates before displaying them.\n\nACTION is a function to call after selecting a candidate.\nIt takes one argument, the selected candidate. If COLLECTION is\nan alist, the argument is a cons cell, otherwise it's a string.\n\nMULTI-ACTION, when non-nil, is called instead of ACTION when\nthere are marked candidates. It takes the list of candidates as\nits only argument. When it's nil, ACTION is called on each marked\ncandidate.\n\nUNWIND is a function of no arguments to call before exiting.\n\nRE-BUILDER is a function transforming input text into a regex\npattern.\n\nMATCHER is a function which can override how candidates are\nfiltered based on user input. It takes a regex pattern and a\nlist of candidates, and returns the list of matching candidates.\n\nDYNAMIC-COLLECTION is a boolean specifying whether the list of\ncandidates is updated after each input by calling COLLECTION.\n\nEXTRA-PROPS can be used to store collection-specific\nsession-specific data.\n\nCALLER is a symbol to uniquely identify the caller toivy-read'.\nIt is used, along with COLLECTION, to determine which\ncustomizations apply to the current completion session." #)("M-x " ("+pretty-code/install-patched-font" "cd" "5x5" "amx" "arp" "dbx" "dig" "erc" "ert" "eww" "ftp" "gdb" "irc" "jdb" "lsp" "man" "mpc" "pdb" "pwd" "rsh" "sdb" "xdb" "calc" "diff" "dirs" "ffap" "gnus" "grep" "help" "ielm" "info" "life" "mail" "mpuz" "ping" "pong" "talk" "term" "undo" "yank" "zone" "align" "chmod" "debug" "diary" "dired" "ediff" "edirs" "hanoi" "hayoo" ...) :predicate #f(compiled-function (x) #) :require-match t :history counsel-M-x-history :action counsel-M-x-action :keymap (keymap (67108908 . counsel--info-lookup-symbol) (67108910 . counsel-find-symbol)) :initial-input nil :caller counsel-M-x :sort t)
apply(#f(compiled-function (arg1 arg2 &rest rest) "Read a string in the minibuffer, with completion.\n\nPROMPT is a string, normally ending in a colon and a space.\nivy-count-format' is prepended to PROMPT during completion.\n\nCOLLECTION is either a list of strings, a function, an alist, or\na hash table, supplied forminibuffer-completion-table'.\n\nPREDICATE is applied to filter out the COLLECTION immediately.\nThis argument is for compatibility with completing-read'.\n\nWhen REQUIRE-MATCH is non-nil, only members of COLLECTION can be\nselected.\n\nIf INITIAL-INPUT is non-nil, then insert that input in the\nminibuffer initially.\n\nHISTORY is a name of a variable to hold the completion session\nhistory.\n\nKEYMAP is composed withivy-minibuffer-map'.\n\nPRESELECT, when non-nil, determines which one of the candidates\nmatching INITIAL-INPUT to select initially. An integer stands\nfor the position of the desired candidate in the collection,\ncounting from zero. Otherwise, use the first occurrence of\nPRESELECT in the collection. Comparison is first done with\nequal'. If that fails, and when applicable, match PRESELECT as\na regular expression.\n\nDEF is for compatibility withcompleting-read'.\n\nUPDATE-FN is called each time the candidate list is re-displayed.\n\nWhen SORT is non-nil, ivy-sort-functions-alist' determines how\nto sort candidates before displaying them.\n\nACTION is a function to call after selecting a candidate.\nIt takes one argument, the selected candidate. If COLLECTION is\nan alist, the argument is a cons cell, otherwise it's a string.\n\nMULTI-ACTION, when non-nil, is called instead of ACTION when\nthere are marked candidates. It takes the list of candidates as\nits only argument. When it's nil, ACTION is called on each marked\ncandidate.\n\nUNWIND is a function of no arguments to call before exiting.\n\nRE-BUILDER is a function transforming input text into a regex\npattern.\n\nMATCHER is a function which can override how candidates are\nfiltered based on user input. It takes a regex pattern and a\nlist of candidates, and returns the list of matching candidates.\n\nDYNAMIC-COLLECTION is a boolean specifying whether the list of\ncandidates is updated after each input by calling COLLECTION.\n\nEXTRA-PROPS can be used to store collection-specific\nsession-specific data.\n\nCALLER is a symbol to uniquely identify the caller toivy-read'.\nIt is used, along with COLLECTION, to determine which\ncustomizations apply to the current completion session." #) ("M-x " ("+pretty-code/install-patched-font" "cd" "5x5" "amx" "arp" "dbx" "dig" "erc" "ert" "eww" "ftp" "gdb" "irc" "jdb" "lsp" "man" "mpc" "pdb" "pwd" "rsh" "sdb" "xdb" "calc" "diff" "dirs" "ffap" "gnus" "grep" "help" "ielm" "info" "life" "mail" "mpuz" "ping" "pong" "talk" "term" "undo" "yank" "zone" "align" "chmod" "debug" "diary" "dired" "ediff" "edirs" "hanoi" "hayoo" ...) :predicate #f(compiled-function (x) #) :require-match t :history counsel-M-x-history :action counsel-M-x-action :keymap (keymap (67108908 . counsel--info-lookup-symbol) (67108910 . counsel-find-symbol)) :initial-input nil :caller counsel-M-x :sort t))
ivy-read("M-x " ("+pretty-code/install-patched-font" "cd" "5x5" "amx" "arp" "dbx" "dig" "erc" "ert" "eww" "ftp" "gdb" "irc" "jdb" "lsp" "man" "mpc" "pdb" "pwd" "rsh" "sdb" "xdb" "calc" "diff" "dirs" "ffap" "gnus" "grep" "help" "ielm" "info" "life" "mail" "mpuz" "ping" "pong" "talk" "term" "undo" "yank" "zone" "align" "chmod" "debug" "diary" "dired" "ediff" "edirs" "hanoi" "hayoo" ...) :predicate #f(compiled-function (x) #) :require-match t :history counsel-M-x-history :action counsel-M-x-action :keymap (keymap (67108908 . counsel--info-lookup-symbol) (67108910 . counsel-find-symbol)) :initial-input nil :caller counsel-M-x)
counsel-M-x()
funcall-interactively(counsel-M-x)
call-interactively(counsel-M-x nil nil)
command-execute(counsel-M-x)

Steps to reproduce:

From a fresh start: SPC : +pretty-code/install-patched-font and choose Iosevka, though the bug happens with all of them

System information:

emacs   version    28.0.50
        features   XPM JPEG TIFF GIF PNG RSVG CAIRO SOUND DBUS GSETTINGS GLIB NOTIFY INOTIFY LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS LIBSYSTEMD JSON PDUMPER GMP
        build      Apr 01, 2020
        buildopts  (--prefix=/nix/store/fsrnjx5z8mj3bv3sndy358nylkf4a494-emacs-git-20200328.0 --disable-build-details --with-modules --with-x-toolkit=gtk3 --with-xft CFLAGS=-DMAC_OS_X_VERSION_MAX_ALLOWED=101200)
        windowsys  x
        daemonp    server-running
doom    version    2.0.9
        build      HEAD -> develop 84d2e6763 2020-03-31 15:20:58 -0400
        dir        ~/sync/dotfiles/doom-emacs/
system  type       gnu/linux
        config     x86_64-pc-linux-gnu
        shell      /run/current-system/sw/bin/fish
        uname      Linux 4.19.109 #1-NixOS SMP Wed Mar 11 13:15:13 UTC 2020 x86_64
        path       (/nix/store/kbycg3n20dk736fsq568wk00lxhxs05a-emacs-packages-deps/bin ~/bin /run/wrappers/bin ~/.nix-profile/bin /etc/profiles/per-user/ollie/bin /nix/var/nix/profiles/default/bin /run/current-system/sw/bin /nix/store/fsrnjx5z8mj3bv3sndy358nylkf4a494-emacs-git-20200328.0/libexec/emacs/28.0.50/x86_64-pc-linux-gnu)
config  envfile    nil
        elc-files  0
        modules    (:completion (company +childframe) (ivy +icons +prescient) :ui doom doom-dashboard doom-quit hl-todo modeline nav-flash ophints (popup +all +defaults) (pretty-code +iosevka) treemacs vc-gutter (window-select +switch-window) workspaces :editor (evil +everywhere) file-templates fold rotate-text :emacs dired electric ibuffer vc :term vterm :checkers (syntax +childframe) :tools direnv (lookup +docsets) (lsp +peek) magit :lang data (elm +lsp) emacs-lisp (haskell +lsp +ghcide) javascript markdown nix (org +attach +babel +capture +export +present +roam) rst sh :config (default +bindings +smartparens))
        packages   ((magit-todos :disable t))
        unpin      (n/a)
        elpa       (n/a)

:ui ligatures regression resolved

Most helpful comment

@huygn Let's hope a381f59 is the one

All 14 comments

As of 4ca30d5 this issue should be resolved. Let me know if that isn't the case and I'll reopen it. Thanks for bringing it to my attention!

Thanks, but I now get:

Debugger entered--Lisp error: (file-error "Creating directory" "Permission denied" "/fonts")
  signal(file-error ("Creating directory" "Permission denied" "/fonts"))
  files--ensure-directory("/fonts")
  mkdir("/fonts/" t)
  (if (file-directory-p font-dest) nil (mkdir font-dest t))
  (let* ((font-dest (cond ((eq window-system 'x) (expand-file-name "/fonts/" (or (getenv "XDG_DATA_HOME") (concat ... "/.local/share")))) ((memq window-system '(ns mac)) (expand-file-name "~/Library/Fonts/")) (t nil))) (known-dest\? (stringp font-dest)) (font-dest (or font-dest (read-directory-name "Font installation directory: " "~/")))) (if (file-directory-p font-dest) nil (mkdir font-dest t)) (let ((--dolist-tail-- fonts-alist)) (while --dolist-tail-- (let ((font (car --dolist-tail--))) (url-copy-file (format url-format font) (expand-file-name font font-dest) t) (setq --dolist-tail-- (cdr --dolist-tail--))))) (if known-dest\? (progn (message "Font downloaded, updating font cache... <fc-cache ...") (shell-command-to-string (format "fc-cache -f -v")))) (message "Successfully %s `%s' fonts to `%s'!%s" (if known-dest\? "installed" "downloaded") name font-dest))
  +pretty-code--install-font(nil "Iosevka" "https://github.com/jsravn/iosevka-emacs/raw/20fc2c..." (:url "https://github.com/jsravn/iosevka-emacs/raw/20fc2c..." :files ("iosevka-custom-lightoblique.ttf" "iosevka-custom-thinoblique.ttf" "iosevka-custom-mediumitalic.ttf" "iosevka-custom-light.ttf" "iosevka-custom-heavy.ttf" "iosevka-custom-bolditalic.ttf" "iosevka-custom-bold.ttf" "iosevka-custom-lightitalic.ttf" "iosevka-custom-thin.ttf" "iosevka-custom-extralight.ttf" "iosevka-custom-oblique.ttf" "iosevka-custom-italic.ttf" "iosevka-custom-heavyoblique.ttf" "iosevka-custom-heavyitalic.ttf" "iosevka-custom-extralightitalic.ttf" "iosevka-custom-thinitalic.ttf" "iosevka-custom-medium.ttf" "iosevka-custom-mediumoblique.ttf" "iosevka-custom-extralightoblique.ttf" "iosevka-custom-boldoblique.ttf" "iosevka-custom-regular.ttf")))

Do you want a new issue for this? It seems that I don't have XDG_DATA_HOME set in my environment (but I do have various other XDG_ variables).

@ocharles Shouldn't be necessary. a8f34f0 should fix that error.

I upgrade develop and got this error:

This will download and install the Iosevka fonts, are you sure you want to do this? (y or n) y
url-copy-file: Wrong type argument: stringp, :url

@huygn 07e8032 should fix the issue.

@hlissner thanks, upgraded got below output

...
Contacting host: github.com:443
Wrote /Users/huygn/Library/Fonts/iosevka-custom-regular.ttf
Font downloaded, updating font cache... <fc-cache -f -v> 
let*: Not enough arguments for format string

@huygn Let's hope a381f59 is the one

Got the success message now 👍🏼

Also working for me now. Thank you!

I'm getting this similar backtrace trying to install patched Fira Code using a recent Doom Emacs when trying (+ligatures/install-patched-font 'fira) (or interactively):

Debugger entered--Lisp error: (wrong-number-of-arguments (font-name &keys _range url files) 7)
  signal(wrong-number-of-arguments ((font-name &keys _range url files) 7))
  (if (= (length --cl-rest--) 5) (car-safe (prog1 --cl-rest-- (setq --cl-rest-- (cdr --cl-rest--)))) (signal 'wrong-number-of-arguments (list '(font-name &keys _range url files) (length --cl-rest--))))
  (let* ((--cl-rest-- (or (alist-get font-id +ligatures--font-alist) (user-error "%S is not a valid font" font-id))) (font-name (if (= (length --cl-rest--) 5) (car-safe (prog1 --cl-rest-- (setq --cl-rest-- (cdr --cl-rest--)))) (signal 'wrong-number-of-arguments (list '(font-name &keys _range url files) (length --cl-rest--))))) (&keys (car-safe (prog1 --cl-rest-- (setq --cl-rest-- (cdr --cl-rest--))))) (_range (car-safe (prog1 --cl-rest-- (setq --cl-rest-- (cdr --cl-rest--))))) (url (car-safe (prog1 --cl-rest-- (setq --cl-rest-- (cdr --cl-rest--))))) (files (car --cl-rest--))) (+ligatures--install-font prefix font-name url files))
  +ligatures/install-patched-font(fira)
[...]

System information:

❯ doom info
((emacs
  (version . "27.1")
  (features . "XPM JPEG TIFF GIF PNG RSVG SOUND GPM DBUS GSETTINGS GLIB NOTIFY INOTIFY ACL GNUTLS LIBXML2 FREETYPE HARFBUZZ M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS LIBSYSTEMD JSON PDUMPER LCMS2 GMP")
  (build . "Aug 13, 2020")
  (buildopts "--prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib --localstatedir=/var --with-x-toolkit=gtk3 --with-xft --with-wide-int --with-modules 'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fno-plt' CPPFLAGS=-D_FORTIFY_SOURCE=2 LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now")
  (windowsys . batch)
  (daemonp . server-running))
 (doom
  (version . "2.0.9")
  (build . "HEAD -> develop c497cdabc 2020-08-23 02:32:58 -0400")
  (dir . "~/.doom.d/"))
 (system
  (type . gnu/linux)
  (config . "x86_64-pc-linux-gnu")
  (shell . "/bin/bash")
  (uname . "Linux 5.8.1-arch1-1 #1 SMP PREEMPT Wed, 12 Aug 2020 18:50:43 +0000 x86_64")
  (path "~/.doom-emacs/bin" "~/bin" "~/.local/bin" "~/.cargo/bin" "~/.doom-emacs/bin" "~/bin" "~/.local/bin" "~/.cargo/bin" "/usr/local/sbin" "/usr/local/bin" "/usr/bin" "/usr/bin/site_perl" "/usr/bin/vendor_perl" "/usr/bin/core_perl" "/usr/bin/site_perl" "/usr/bin/vendor_perl" "/usr/bin/core_perl" "/usr/lib/emacs/27.1/x86_64-pc-linux-gnu"))
 (config
  (envfile . envvar-file)
  (elc-files . 0)
  (modules :completion company (ivy +icons) :ui doom doom-dashboard fill-column hl-todo (ligatures +fira) modeline nav-flash ophints (popup +defaults) vc-gutter vi-tilde-fringe window-select :editor file-templates fold (format (:if (not WORK) +onsave)) word-wrap :emacs (dired +icons) electric (undo +tree) vc :term vterm :checkers syntax (spell +everywhere) :tools (eval +overlay) lookup lsp magit rgb :os tty :lang cc data json yaml emacs-lisp markdown org (rust +lsp) sh :email notmuch :app irc :config (default +bindings +smartparens))
  (packages (solarized-theme) (buffer-move) (zoom-window) (string-inflection) (dired-hide-dotfiles) (pkgbuild-mode) (highlight-thing) (defrepeater) (keychain-environment) (ztree) (notmuch-unread :recipe (:host github :repo "rbutoi/notmuch-unread")) (visual-fill-column) (password-store) (outshine) (mac-pseudo-daemon :disable (not IS-MAC)) (ivy-xref) (eglot :built-in 'prefer) (project :built-in 'prefer))
  (unpin "n/a")
  (elpa "n/a")))

@rbutoi Should be fixed in b5227b3

Thanks @hlissner ! There were two more changes had to make to get them installed:

diff --git a/modules/ui/ligatures/autoload/install.el b/modules/ui/ligatures/autoload/install.el
index 8a0ce69d3..1d07e5a86 100644
--- a/modules/ui/ligatures/autoload/install.el
+++ b/modules/ui/ligatures/autoload/install.el
@@ -31,7 +31,7 @@ filename of each font. It is used as the source and destination filename."
     (when known-dest-p
       (message "Font downloaded, updating font cache... <fc-cache -f -v> ")
       (shell-command-to-string "fc-cache -f -v"))
-    (if IS-WINDOW
+    (if IS-WINDOWS
         (when (y-or-n-p "The %S font was downloaded, but Windows users must install them manually.\n\nShow files in windows explorer?")
           (call-process "explorer.exe" nil nil nil font-dest))
       (message "Successfully %s %S fonts to %S!"
@@ -55,4 +55,4 @@ If PREFIX is non-nil, don't ask for confirmation and install it."
   (cl-destructuring-bind (font-name &key _range url files)
       (or (alist-get font-id +ligatures--font-alist)
           (user-error "%S is not a valid font" font-id))
-    (+ligatures--install-font prefix font-name url files)))
+    (+ligatures--install-font current-prefix-arg font-name url files)))

Although, after installing the patched fonts, I didn't get any ligatures to show up using (ligatures +fira), and ended up using this snippet on the official Emacs instructions.

Applied that patch in 97471f1.

Although, after installing the patched fonts, I didn't get any ligatures to show up using (ligatures +fira), and ended up using this snippet on the official Emacs instructions.

That's very strange, because Doom is doing exactly what the fira-code-mode package does. In fact, its implementation is inspired by the same source that informed Doom's implementation. The one difference is this line. Try changing it:

                (or (alist-get ',id +ligatures--font-alist)
                    (error "No ligature font called %s" ',id))
              (when range
-               (set-fontset-font t range name nil 'prepend))
+               (set-fontset-font t range name))
              (setq-default prettify-symbols-alist
                            (append (default-value 'prettify-symbols-alist)

This change was made to address seagle0128/doom-modeline#69.

Also: I've tried it myself and it seems to work fine, so perhaps it's a font issue? Do you have Fira Code Symbol installed on your system?

Yeah there's something definitely something wrong on my end, since the fira-code-mode package doesn't work either, only the original code snippet linked from the FiraCode wiki. I certainly do have Fira Code Symbol installed:

❯ fc-list |grep 'Fira Code Symbol'
/home/radu/.local/share/fonts/FiraCode-Regular-Symbol.otf: Fira Code Symbol:style=Symbol-Regular

And the original snippet works with that font. At this point, though, it doesn't seem like a Doom problem, and I can try debugging this separately. (edit: i tried looking if there are different versions of the Symbol OTF font, but it seems all links point to one place. when I use the fira-code-mode package I seem to get some but the wrong ligatures, so there's a mismapping somewhere)

Was this page helpful?
0 / 5 - 0 ratings