abo-abo / swiper

Ivy - a generic completion frontend for Emacs, Swiper - isearch with an overview, and more. Oh, man!
https://oremacs.com/swiper/
2.31k stars 338 forks source link

Wrong number of arguments error when using ivy-update-candidates #2783

Closed MonsieurPi closed 3 years ago

MonsieurPi commented 3 years ago

I installed counsel-spotify and got a wrong number of arguments error.

completion-metadata: Wrong number of arguments: (1 . 1), 3

I toggled error display and got the following output:

Debugger entered--Lisp error: (wrong-number-of-arguments (1 . 1) 3)
  #f(compiled-function (search-term) #<bytecode 0x155bb04d3295>)("" nil metadata)
  completion-metadata("" #f(compiled-function (search-term) #<bytecode 0x155bb04d3295>) nil)
  ivy-update-candidates(nil)
  counsel-spotify-update-ivy-candidates(nil)
  #f(compiled-function (status) #<bytecode 0x155bafd13ab5>)((:error (error http 400) :peer (:certificates ((:version 3 :serial-number "05:2f:06:e2:03:e1:42:d2:1e:3e:d1:2f:d8:ce:e9:9f" :issuer "C=US,O=DigiCert Inc,CN=DigiCert SHA2 Secure Server..." :valid-from "2020-06-23" :valid-to "2021-09-02" :subject "C=SE,L=Stockholm,O=Spotify AB,CN=*.spotify.com" :public-key-algorithm "RSA" :certificate-security-level "Medium" :signature-algorithm "RSA-SHA256" :public-key-id "sha1:4b:8e:2b:b6:41:ff:5f:01:48:9b:ac:d3:8f:bd:0a:..." :certificate-id "sha1:b9:79:6b:ce:fd:61:21:97:a7:02:90:ee:da:cd:f0:..." :pem "-----BEGIN CERTIFICATE-----\nMIIGEDCCBPigAwIBAgIQBS...") (:version 3 :serial-number "01:fd:a3:eb:6e:ca:75:c8:88:43:8b:72:4b:cf:bc:91" :issuer "C=US,O=DigiCert Inc,OU=www.digicert.com,CN=DigiCer..." :valid-from "2013-03-08" :valid-to "2023-03-08" :subject "C=US,O=DigiCert Inc,CN=DigiCert SHA2 Secure Server..." :public-key-algorithm "RSA" :certificate-security-level "Medium" :signature-algorithm "RSA-SHA256" :public-key-id "sha1:51:bc:4f:77:17:08:cf:e5:09:dd:e9:ea:a5:54:8e:..." :certificate-id "sha1:1f:b8:6b:11:68:ec:74:31:54:06:2e:8c:9c:c5:b1:..." :pem "-----BEGIN CERTIFICATE-----\nMIIElDCCA3ygAwIBAgIQAf...")) :certificate (:version 3 :serial-number "05:2f:06:e2:03:e1:42:d2:1e:3e:d1:2f:d8:ce:e9:9f" :issuer "C=US,O=DigiCert Inc,CN=DigiCert SHA2 Secure Server..." :valid-from "2020-06-23" :valid-to "2021-09-02" :subject "C=SE,L=Stockholm,O=Spotify AB,CN=*.spotify.com" :public-key-algorithm "RSA" :certificate-security-level "Medium" :signature-algorithm "RSA-SHA256" :public-key-id "sha1:4b:8e:2b:b6:41:ff:5f:01:48:9b:ac:d3:8f:bd:0a:..." :certificate-id "sha1:b9:79:6b:ce:fd:61:21:97:a7:02:90:ee:da:cd:f0:..." :pem "-----BEGIN CERTIFICATE-----\nMIIGEDCCBPigAwIBAgIQBS...") :key-exchange "ECDHE-RSA" :protocol "TLS1.3" :cipher "AES-256-GCM" :mac "AEAD" :encrypt-then-mac nil)))
  apply(#f(compiled-function (status) #<bytecode 0x155bafd13ab5>) (:error (error http 400) :peer (:certificates ((:version 3 :serial-number "05:2f:06:e2:03:e1:42:d2:1e:3e:d1:2f:d8:ce:e9:9f" :issuer "C=US,O=DigiCert Inc,CN=DigiCert SHA2 Secure Server..." :valid-from "2020-06-23" :valid-to "2021-09-02" :subject "C=SE,L=Stockholm,O=Spotify AB,CN=*.spotify.com" :public-key-algorithm "RSA" :certificate-security-level "Medium" :signature-algorithm "RSA-SHA256" :public-key-id "sha1:4b:8e:2b:b6:41:ff:5f:01:48:9b:ac:d3:8f:bd:0a:..." :certificate-id "sha1:b9:79:6b:ce:fd:61:21:97:a7:02:90:ee:da:cd:f0:..." :pem "-----BEGIN CERTIFICATE-----\nMIIGEDCCBPigAwIBAgIQBS...") (:version 3 :serial-number "01:fd:a3:eb:6e:ca:75:c8:88:43:8b:72:4b:cf:bc:91" :issuer "C=US,O=DigiCert Inc,OU=www.digicert.com,CN=DigiCer..." :valid-from "2013-03-08" :valid-to "2023-03-08" :subject "C=US,O=DigiCert Inc,CN=DigiCert SHA2 Secure Server..." :public-key-algorithm "RSA" :certificate-security-level "Medium" :signature-algorithm "RSA-SHA256" :public-key-id "sha1:51:bc:4f:77:17:08:cf:e5:09:dd:e9:ea:a5:54:8e:..." :certificate-id "sha1:1f:b8:6b:11:68:ec:74:31:54:06:2e:8c:9c:c5:b1:..." :pem "-----BEGIN CERTIFICATE-----\nMIIElDCCA3ygAwIBAgIQAf...")) :certificate (:version 3 :serial-number "05:2f:06:e2:03:e1:42:d2:1e:3e:d1:2f:d8:ce:e9:9f" :issuer "C=US,O=DigiCert Inc,CN=DigiCert SHA2 Secure Server..." :valid-from "2020-06-23" :valid-to "2021-09-02" :subject "C=SE,L=Stockholm,O=Spotify AB,CN=*.spotify.com" :public-key-algorithm "RSA" :certificate-security-level "Medium" :signature-algorithm "RSA-SHA256" :public-key-id "sha1:4b:8e:2b:b6:41:ff:5f:01:48:9b:ac:d3:8f:bd:0a:..." :certificate-id "sha1:b9:79:6b:ce:fd:61:21:97:a7:02:90:ee:da:cd:f0:..." :pem "-----BEGIN CERTIFICATE-----\nMIIGEDCCBPigAwIBAgIQBS...") :key-exchange "ECDHE-RSA" :protocol "TLS1.3" :cipher "AES-256-GCM" :mac "AEAD" :encrypt-then-mac nil)))
  url-http-activate-callback()
  url-http-chunked-encoding-after-change-function(878 883 5)
  url-http-generic-filter(#<process api.spotify.com> "0\15\n\15\n")
  read-from-minibuffer("Search album: " nil (keymap keymap (67108903 . ivy-avy) (36 . ivy-magic-read-file-env) (3 keymap (19 . ivy-rotate-sort) (1 . ivy-toggle-ignore) (15 . ivy-occur)) (33554464 . ivy-restrict-to-matches) (15 . hydra-ivy/body) (22 . ivy-scroll-up-command) (prior . ivy-scroll-down-command) (next . ivy-scroll-up-command) (7 . minibuffer-keyboard-quit) (right . ivy-forward-char) (32 . self-insert-command) (18 . ivy-reverse-i-search) (remap keymap (describe-mode . ivy-help) (kill-ring-save . ivy-kill-ring-save) (kill-whole-line . ivy-kill-whole-line) (kill-line . ivy-kill-line) (scroll-down-command . ivy-scroll-down-command) (scroll-up-command . ivy-scroll-up-command) (end-of-buffer . ivy-end-of-buffer) (beginning-of-buffer . ivy-beginning-of-buffer) (kill-word . ivy-kill-word) (forward-char . ivy-forward-char) (delete-char . ivy-delete-char) (backward-kill-word . ivy-backward-kill-word) (backward-delete-char-untabify . ivy-backward-delete-char) (delete-backward-char . ivy-backward-delete-char) (previous-line . ivy-previous-line) (next-line . ivy-next-line)) (9 . ivy-partial-or-done) (10 . ivy-alt-done) (27 keymap (1 . ivy-read-action) (15 . ivy-dispatching-call) (111 . ivy-dispatching-done) (25 . ivy-insert-current-full) (105 . ivy-insert-current) (106 . ivy-yank-word) (114 . ivy-toggle-regexp-quote) (97 . ivy-toggle-marks) (16 . ivy-previous-line-and-call) (14 . ivy-next-line-and-call) (118 . ivy-scroll-down-command) (112 . ivy-previous-history-element) (110 . ivy-next-history-element) (10 . ivy-immediate-done) (13 . ivy-call)) (mouse-3 . ivy-mouse-dispatching-done) (mouse-1 . ivy-mouse-done) (down-mouse-1 . ignore) (13 . ivy-done)) nil ivy-history)
  #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.\n`ivy-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 for `minibuffer-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 with `ivy-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\n`equal'.  If that fails, and when applicable, match PRESELECT as\na regular expression.\n\nDEF is for compatibility with `completing-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 is a plist that can be used to store\ncollection-specific session-specific data.\n\nCALLER is a symbol to uniquely identify the caller to `ivy-read'.\nIt is used, along with COLLECTION, to determine which\ncustomizations apply to the current completion session." #<bytecode 0x155bb040d0a5>)("Search album: " #f(compiled-function (search-term) #<bytecode 0x155bb04d3295>) :dynamic-collection t :action counsel-spotify-play-string)
  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.\n`ivy-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 for `minibuffer-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 with `ivy-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\n`equal'.  If that fails, and when applicable, match PRESELECT as\na regular expression.\n\nDEF is for compatibility with `completing-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 is a plist that can be used to store\ncollection-specific session-specific data.\n\nCALLER is a symbol to uniquely identify the caller to `ivy-read'.\nIt is used, along with COLLECTION, to determine which\ncustomizations apply to the current completion session." #<bytecode 0x155bb040d0a5>) ("Search album: " #f(compiled-function (search-term) #<bytecode 0x155bb04d3295>) :dynamic-collection t :action counsel-spotify-play-string))
  ivy-posframe--read(#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.\n`ivy-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 for `minibuffer-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 with `ivy-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\n`equal'.  If that fails, and when applicable, match PRESELECT as\na regular expression.\n\nDEF is for compatibility with `completing-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 is a plist that can be used to store\ncollection-specific session-specific data.\n\nCALLER is a symbol to uniquely identify the caller to `ivy-read'.\nIt is used, along with COLLECTION, to determine which\ncustomizations apply to the current completion session." #<bytecode 0x155bb040d0a5>) "Search album: " #f(compiled-function (search-term) #<bytecode 0x155bb04d3295>) :dynamic-collection t :action counsel-spotify-play-string)
  apply(ivy-posframe--read #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.\n`ivy-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 for `minibuffer-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 with `ivy-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\n`equal'.  If that fails, and when applicable, match PRESELECT as\na regular expression.\n\nDEF is for compatibility with `completing-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 is a plist that can be used to store\ncollection-specific session-specific data.\n\nCALLER is a symbol to uniquely identify the caller to `ivy-read'.\nIt is used, along with COLLECTION, to determine which\ncustomizations apply to the current completion session." #<bytecode 0x155bb040d0a5>) ("Search album: " #f(compiled-function (search-term) #<bytecode 0x155bb04d3295>) :dynamic-collection t :action counsel-spotify-play-string))
  ivy-read("Search album: " #f(compiled-function (search-term) #<bytecode 0x155bb04d3295>) :dynamic-collection t :action counsel-spotify-play-string)
  counsel-spotify-search-album()
  funcall-interactively(counsel-spotify-search-album)
  call-interactively(counsel-spotify-search-album record nil)
  command-execute(counsel-spotify-search-album record)
  counsel-M-x-action("counsel-spotify-search-album")
  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.\n`ivy-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 for `minibuffer-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 with `ivy-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\n`equal'.  If that fails, and when applicable, match PRESELECT as\na regular expression.\n\nDEF is for compatibility with `completing-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 is a plist that can be used to store\ncollection-specific session-specific data.\n\nCALLER is a symbol to uniquely identify the caller to `ivy-read'.\nIt is used, along with COLLECTION, to determine which\ncustomizations apply to the current completion session." #<bytecode 0x155bb040d0a5>)("M-x " ("toggle-debug-on-error" "counsel-spotify-search-artist" "counsel-spotify-search-album" "company-mode" "counsel-spotify-next" "org-gcal-fetch" "list-packages" "treemacs" "treemacs-projectile" "prettify-symbols-mode" "ligature-mode" "treemacs-mode" "counsel-projectile-rg" "org-plot/gnuplot" "package-install" "treemacs-edit-workspaces" "lsp" "helm-regexp" "tuareg-mode" "describe-face" "projectile-mode" "package-refresh-contents" "all-the-icons-install-fonts" "cd" "magit" "rgrep" "lsp-mode" "dune-mode" "eldoc-mode" "eval-defun" "re-builder" "tuareg-help" "tab-bar-mode" "eval-expression" "orgtbl-ascii-plot" "pdf-tools-install" "crux-kill-other-buffers" "projectile-remove-known-project" "package-install-selected-packages" "jb" "5x5" "amx" "arp" "dbx" "dig" "erc" "ert" "eww" "ftp" "gdb" ...) :predicate #f(compiled-function (x) #<bytecode 0x155bb057de19>) :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)
  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.\n`ivy-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 for `minibuffer-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 with `ivy-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\n`equal'.  If that fails, and when applicable, match PRESELECT as\na regular expression.\n\nDEF is for compatibility with `completing-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 is a plist that can be used to store\ncollection-specific session-specific data.\n\nCALLER is a symbol to uniquely identify the caller to `ivy-read'.\nIt is used, along with COLLECTION, to determine which\ncustomizations apply to the current completion session." #<bytecode 0x155bb040d0a5>) ("M-x " ("toggle-debug-on-error" "counsel-spotify-search-artist" "counsel-spotify-search-album" "company-mode" "counsel-spotify-next" "org-gcal-fetch" "list-packages" "treemacs" "treemacs-projectile" "prettify-symbols-mode" "ligature-mode" "treemacs-mode" "counsel-projectile-rg" "org-plot/gnuplot" "package-install" "treemacs-edit-workspaces" "lsp" "helm-regexp" "tuareg-mode" "describe-face" "projectile-mode" "package-refresh-contents" "all-the-icons-install-fonts" "cd" "magit" "rgrep" "lsp-mode" "dune-mode" "eldoc-mode" "eval-defun" "re-builder" "tuareg-help" "tab-bar-mode" "eval-expression" "orgtbl-ascii-plot" "pdf-tools-install" "crux-kill-other-buffers" "projectile-remove-known-project" "package-install-selected-packages" "jb" "5x5" "amx" "arp" "dbx" "dig" "erc" "ert" "eww" "ftp" "gdb" ...) :predicate #f(compiled-function (x) #<bytecode 0x155bb057de19>) :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))
  ivy-posframe--read(#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.\n`ivy-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 for `minibuffer-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 with `ivy-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\n`equal'.  If that fails, and when applicable, match PRESELECT as\na regular expression.\n\nDEF is for compatibility with `completing-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 is a plist that can be used to store\ncollection-specific session-specific data.\n\nCALLER is a symbol to uniquely identify the caller to `ivy-read'.\nIt is used, along with COLLECTION, to determine which\ncustomizations apply to the current completion session." #<bytecode 0x155bb040d0a5>) "M-x " ("toggle-debug-on-error" "counsel-spotify-search-artist" "counsel-spotify-search-album" "company-mode" "counsel-spotify-next" "org-gcal-fetch" "list-packages" "treemacs" "treemacs-projectile" "prettify-symbols-mode" "ligature-mode" "treemacs-mode" "counsel-projectile-rg" "org-plot/gnuplot" "package-install" "treemacs-edit-workspaces" "lsp" "helm-regexp" "tuareg-mode" "describe-face" "projectile-mode" "package-refresh-contents" "all-the-icons-install-fonts" "cd" "magit" "rgrep" "lsp-mode" "dune-mode" "eldoc-mode" "eval-defun" "re-builder" "tuareg-help" "tab-bar-mode" "eval-expression" "orgtbl-ascii-plot" "pdf-tools-install" "crux-kill-other-buffers" "projectile-remove-known-project" "package-install-selected-packages" "jb" "5x5" "amx" "arp" "dbx" "dig" "erc" "ert" "eww" "ftp" "gdb" ...) :predicate #f(compiled-function (x) #<bytecode 0x155bb057de19>) :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)
  apply(ivy-posframe--read #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.\n`ivy-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 for `minibuffer-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 with `ivy-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\n`equal'.  If that fails, and when applicable, match PRESELECT as\na regular expression.\n\nDEF is for compatibility with `completing-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 is a plist that can be used to store\ncollection-specific session-specific data.\n\nCALLER is a symbol to uniquely identify the caller to `ivy-read'.\nIt is used, along with COLLECTION, to determine which\ncustomizations apply to the current completion session." #<bytecode 0x155bb040d0a5>) ("M-x " ("toggle-debug-on-error" "counsel-spotify-search-artist" "counsel-spotify-search-album" "company-mode" "counsel-spotify-next" "org-gcal-fetch" "list-packages" "treemacs" "treemacs-projectile" "prettify-symbols-mode" "ligature-mode" "treemacs-mode" "counsel-projectile-rg" "org-plot/gnuplot" "package-install" "treemacs-edit-workspaces" "lsp" "helm-regexp" "tuareg-mode" "describe-face" "projectile-mode" "package-refresh-contents" "all-the-icons-install-fonts" "cd" "magit" "rgrep" "lsp-mode" "dune-mode" "eldoc-mode" "eval-defun" "re-builder" "tuareg-help" "tab-bar-mode" "eval-expression" "orgtbl-ascii-plot" "pdf-tools-install" "crux-kill-other-buffers" "projectile-remove-known-project" "package-install-selected-packages" "jb" "5x5" "amx" "arp" "dbx" "dig" "erc" "ert" "eww" "ftp" "gdb" ...) :predicate #f(compiled-function (x) #<bytecode 0x155bb057de19>) :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))
  ivy-read("M-x " ("toggle-debug-on-error" "counsel-spotify-search-artist" "counsel-spotify-search-album" "company-mode" "counsel-spotify-next" "org-gcal-fetch" "list-packages" "treemacs" "treemacs-projectile" "prettify-symbols-mode" "ligature-mode" "treemacs-mode" "counsel-projectile-rg" "org-plot/gnuplot" "package-install" "treemacs-edit-workspaces" "lsp" "helm-regexp" "tuareg-mode" "describe-face" "projectile-mode" "package-refresh-contents" "all-the-icons-install-fonts" "cd" "magit" "rgrep" "lsp-mode" "dune-mode" "eldoc-mode" "eval-defun" "re-builder" "tuareg-help" "tab-bar-mode" "eval-expression" "orgtbl-ascii-plot" "pdf-tools-install" "crux-kill-other-buffers" "projectile-remove-known-project" "package-install-selected-packages" "jb" "5x5" "amx" "arp" "dbx" "dig" "erc" "ert" "eww" "ftp" "gdb" ...) :predicate #f(compiled-function (x) #<bytecode 0x155bb057de19>) :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)

The following commit introduced a call to (completion-metadata "" minibuffer-completion-table minibuffer-completion-predicate))). If I redefine this function like it was before I don't have any error but my elisp-fu is not good enough to understand why a function expecting 3 arguments is sad about receiving 3 arguments

basil-conto commented 3 years ago

why a function expecting 3 arguments is sad about receiving 3 arguments

The error is about a function of 1 argument receiving 3 arguments, and the function in question is counsel-spotify-search-by, judging by the argument called search-term.

I don't know whether commit 71c59aecf669142ebe264fac8ff7b440c0c71712 is always TRT, but the above suggests that the problem may lie with counsel-spotify as well.

Perhaps there is a mixup between normal programmed completion functions which take three arguments (see try-completion), dynamic completion table transducers which take a single argument (see completion-table-dynamic), and Ivy :dynamic-collection completion functions, which also take a single argument (but I don't know whether they work the same as completion-table-dynamic).

nbfalcon commented 3 years ago

This is a regression caused by that commit, which caused an lsp-ivy issue: emacs-lsp/lsp-ivy#27. The collection of ivy-read, if it is a :dynamic-collection, is not a completion table (because it takes only one argument). The changes need to guard against :dynamic-collection and only do the completion-table thing if ivy was not called with that.

nbfalcon commented 3 years ago

Something like

;; `:dynamic-collection` COLLECTIONS are not completion tables
(unless (ivy-state-dynamic-collection ivy-last)
           (completion-metadata "" minibuffer-completion-table minibuffer-completion-predicate))

fixes this for me.

nbfalcon commented 3 years ago

Workaround:

(defun ivy-update-candidates-dynamic-collection-workaround-a (old-fun &rest args)
  (cl-letf (((symbol-function #'completion-metadata) #'ignore))
    (apply old-fun args)))
(advice-add #'ivy-update-candidates :around #'ivy-update-candidates-dynamic-collection-workaround-a)
basil-conto commented 3 years ago

Thanks for the info.

The collection of ivy-read, if it is a :dynamic-collection, is not a completion table (because it takes only one argument).

Then how do you explain that other :dynamic-collection commands like counsel-git-grep and counsel-locate still work?

And why are all these external packages using the undocumented function ivy-update-candidates?

What am I missing? Paging @abo-abo.

nbfalcon commented 3 years ago

@basil-conto Their collections aren't completion tables either. They work because apparently no other parts of ivy (besides ivy-update-candidates) wants to use a :dynamic-collection as a completion table.

As for the other packages, I can only speak for lsp-ivy: lsp-ivy-workspace-symbol, which uses ivy-update-candidates, searches all project symbols, of which there can be many. This is why the LSP protocol allows clients to filter symbols by regex, so we utilize that.

basil-conto commented 3 years ago

As for the other packages, I can only speak for lsp-ivy: lsp-ivy-workspace-symbol, which uses ivy-update-candidates, searches all project symbols, of which there can be many. This is why the LSP protocol allows clients to filter symbols by regex, so we utilize that.

How does that translate to a need to call ivy-update-candidates directly?

Anyway, I'll revert the offending commit for now until @abo-abo or someone else comes up with a better solution.

nbfalcon commented 3 years ago

@basil-conto Oh I forgot to mention that. We do the requests asynchrnously. So the user types something, the COLLECTION gets called with the new input, we make a JSONRpc request (not hanging Emacs), and, when the server eventually answers, we just call ivy-update-candidates to replace the existing ones.

basil-conto commented 3 years ago

Oh I forgot to mention that. We do the requests asynchrnously. So the user types something, the COLLECTION gets called with the new input, we make a JSONRpc request (not hanging Emacs), and, when the server eventually answers, we just call ivy-update-candidates to replace the existing ones.

Thanks, I'm starting to get déjà vu from all the other issues pertaining to external packages using the ad-hoc and undocumented ivy-update-candidates ;).

basil-conto commented 3 years ago

I've gone with @nbfalcon's suggestion to check for dynamic collections in ivy-update-candidates, so hopefully that should plug this hole for now. Thanks again.