4

When I load a Dart file with GNU Emacs 27.1-1 for OS X I get the following little error novel.

Debugger entered--Lisp error: (void-function -compose)
(-compose #'lsp--client-path->uri-fn #'lsp--workspace-client)
(-keep (-compose #'lsp--client-path->uri-fn #'lsp--workspace-client) (lsp-workspaces))
(cl-first (-keep (-compose #'lsp--client-path->uri-fn #'lsp--workspace-client) (lsp-workspaces)))
(and t (cl-first (-keep (-compose #'lsp--client-path->uri-fn #'lsp--workspace-client) (lsp-workspaces))))
(let* ((uri-fn (and t (cl-first (-keep (-compose #'lsp--client-path->uri-fn #'lsp--workspace-client) (lsp-workspaces)))))) (if uri-fn (funcall uri-fn path) (lsp--path-to-uri-1 path)))
lsp--path-to-uri("/Users/sam/.emacs.d/index.sqlite")
(closure (t) nil (lsp--path-to-uri (f-join user-emacs-directory "index.sqlite")))()
funcall((closure (t) nil (lsp--path-to-uri (f-join user-emacs-directory "index.sqlite"))))
eval((funcall #'(closure (t) nil (lsp--path-to-uri (f-join user-emacs-directory "index.sqlite")))))
custom-initialize-reset(lsp-serenata-index-database-uri (funcall #'(closure (t) nil (lsp--path-to-uri (f-join user-emacs-directory "index.sqlite")))))
custom-declare-variable(lsp-serenata-index-database-uri (funcall #'(closure (t) nil (lsp--path-to-uri (f-join user-emacs-directory "index.sqlite")))) "The location to store the index database.\nNote tha..." :group lsp-serenata :type file)
eval-buffer(#<buffer  *load*> nil "/Users/sam/.emacs.d/elpa/lsp-mode-20210222.1457/lsp..." nil t)  ; Reading at buffer position 12399
load-with-code-conversion("/Users/sam/.emacs.d/elpa/lsp-mode-20210222.1457/lsp..." "/Users/sam/.emacs.d/elpa/lsp-mode-20210222.1457/lsp..." t t)
require(lsp-php nil t)
(if (featurep package) nil (require package nil t))
(closure (company-mode cl-struct-lsp--log-entry-tags cl-struct-lsp-session-tags cl-struct-lsp--workspace-tags cl-struct-lsp--registered-capability-tags lsp-mode-menu cl-struct-lsp--folding-range-tags cl-struct-lsp-watch-tags cl-struct-lsp--client-tags lsp--log-lines dap-ui-menu-items company-backends t) (package) (if (featurep package) nil (require package nil t)))(lsp-php)
mapc((closure (company-mode cl-struct-lsp--log-entry-tags cl-struct-lsp-session-tags cl-struct-lsp--workspace-tags cl-struct-lsp--registered-capability-tags lsp-mode-menu cl-struct-lsp--folding-range-tags cl-struct-lsp-watch-tags cl-struct-lsp--client-tags lsp--log-lines dap-ui-menu-items company-backends t) (package) (if (featurep package) nil (require package nil t))) (ccls lsp-actionscript lsp-ada lsp-angular lsp-bash lsp-clangd lsp-clojure lsp-cmake lsp-crystal lsp-csharp lsp-css lsp-dart lsp-dhall lsp-dockerfile lsp-elm lsp-elixir lsp-erlang lsp-eslint lsp-fortran lsp-fsharp lsp-gdscript lsp-go lsp-hack lsp-groovy lsp-haskell lsp-haxe lsp-java lsp-javascript lsp-json lsp-kotlin lsp-lua lsp-nim lsp-nix lsp-metals lsp-ocaml lsp-perl lsp-php lsp-pwsh lsp-pyls lsp-python-ms lsp-purescript lsp-r lsp-rf lsp-rust lsp-solargraph lsp-sorbet lsp-tex lsp-terraform lsp-vala lsp-verilog ...))
seq-do((closure (company-mode cl-struct-lsp--log-entry-tags cl-struct-lsp-session-tags cl-struct-lsp--workspace-tags cl-struct-lsp--registered-capability-tags lsp-mode-menu cl-struct-lsp--folding-range-tags cl-struct-lsp-watch-tags cl-struct-lsp--client-tags lsp--log-lines dap-ui-menu-items company-backends t) (package) (if (featurep package) nil (require package nil t))) (ccls lsp-actionscript lsp-ada lsp-angular lsp-bash lsp-clangd lsp-clojure lsp-cmake lsp-crystal lsp-csharp lsp-css lsp-dart lsp-dhall lsp-dockerfile lsp-elm lsp-elixir lsp-erlang lsp-eslint lsp-fortran lsp-fsharp lsp-gdscript lsp-go lsp-hack lsp-groovy lsp-haskell lsp-haxe lsp-java lsp-javascript lsp-json lsp-kotlin lsp-lua lsp-nim lsp-nix lsp-metals lsp-ocaml lsp-perl lsp-php lsp-pwsh lsp-pyls lsp-python-ms lsp-purescript lsp-r lsp-rf lsp-rust lsp-solargraph lsp-sorbet lsp-tex lsp-terraform lsp-vala lsp-verilog ...))
(progn (seq-do #'(lambda (package) (if (featurep package) nil (require package nil t))) lsp-client-packages) (setq lsp--client-packages-required t))
(if (and lsp-auto-configure (not lsp--client-packages-required)) (progn (seq-do #'(lambda (package) (if (featurep package) nil (require package nil t))) lsp-client-packages) (setq lsp--client-packages-required t)))
lsp--require-packages()
lsp()
run-hooks(change-major-mode-after-body-hook prog-mode-hook dart-mode-hook)
apply(run-hooks (change-major-mode-after-body-hook prog-mode-hook dart-mode-hook))
run-mode-hooks(dart-mode-hook)
dart-mode()
set-auto-mode-0(dart-mode nil)
set-auto-mode()
normal-mode(t)
after-find-file(nil t)
find-file-noselect-1(#<buffer main.dart> "~/sam/flutter/proj9/lib/main.dart" nil nil "~/sam/flutter/proj9/lib/main.dart" (15751399 16777223))
find-file-noselect("/Users/sam/flutter/proj9/lib/mai..." nil nil nil)
find-file("/Users/sam/flutter/proj9/lib/mai...")
dired-find-file()
funcall-interactively(dired-find-file)
call-interactively(dired-find-file nil nil)
command-execute(dired-find-file)

How do I solve Lisp error: (void-function -compose) when using lsp-dart?

10
  • The immediate cause of the error is that emacs does not know how to define -compose. Try (require 'dash-functional) to fix this? Feb 27 at 11:23
  • @FranBurstall Do you mean this one: github.com/magnars/dash.el/blob/master/dash-functional.el ? But it doesn't show a -compose option. In any case, after this additional require, the same error remains.
    – Sam
    Feb 27 at 14:13
  • 1
    Does (require 'dash) help? It looks like maybe your dash installation is broken, or maybe too old for your lsp-mode install? Try upgrading your dash package? Feb 27 at 15:39
  • 1
    @CroadLangshan You're right. That solves it. Yet a reliance on dash is not mentioned (emacs-lsp.github.io/lsp-dart).
    – Sam
    Feb 27 at 21:57
  • Now a different kind of problem ("Server dart_analysis_server:54475/starting exited with status exit(check corresponding stderr buffer for details). Do you want to restart it? (y or n)") is persistent, and stderr isn't visible, not even with debug-on-error set to t.
    – Sam
    Feb 27 at 22:01
4

By chance, after commenting on this, hours later I ran into exactly the same issue. The cause was that spacemacs had for a while pinned its version of dash at 2.17.0, and -compose was introduced in 2.18.0 (moved over from the now obsolete package dash-functional). The latest lsp-mode.el uses that function.

I fixed it by updating my spacemacs checkout to the latest on branch develop.

I suspect the issue was fixed for me by https://github.com/syl20bnr/spacemacs/commit/ae65f3cedd7328b7f346f01e4597979671d67f5a

7
  • Bingo. I was using the latest official release, Emacs-27.1-1-universal.dmg from https://emacsformacosx.com/builds. As suggested, I was able to make this work by manually downloading dash-20210210.1449. Note that adding (require 'dash) is not necessary. (Is that because Emacs internally requires dash and it somehow grabs the latest version??) After I downloaded and used the bleeding-edge release Emacs-2020-12-29_01-40-19-ee0e259…-universal.dmg (GNU Emacs 28.0.50) I no longer need to have dash-20210210.1449 in my elpa folder.
    – Sam
    Feb 28 at 19:07
  • To make a long story short: either download the bleeding-edge, not-yet-released Emacs when you upgrade lsp-dart, or upgrade dash manually.
    – Sam
    Feb 28 at 19:08
  • Getting "Server dart_analysis_server:54475/starting exited with status exit(check corresponding stderr buffer for details). Do you want to restart it? (y or n)" is a separate issue.
    – Sam
    Feb 28 at 19:09
  • 1
    @Croad Langshan For a long time, -compose was provided by the dash-functional package, which was separate from dash due to its dependence on lexical-binding. Now that dash requires lexical-binding too, the two packages were merged, and so dash 2.18.0 is the first version of dash to include all the functions previously provided by dash-functional. See github.com/magnars/dash.el/blob/master/NEWS.md#from-217-to-218
    – Basil
    Feb 28 at 21:29
  • @Sam Emacs has never and probably will never include or internally require dash, as it is an external package officially distributed via GNU ELPA and GNU-devel ELPA. As long as you have Emacs 24+, it shouldn't matter what Emacs version you're using; dash will work the same.
    – Basil
    Feb 28 at 21:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.