eyeinsky / org-anki

Sync org notes to Anki via AnkiConnect
BSD 3-Clause "New" or "Revised" License
180 stars 28 forks source link

Emacs 28 get error (wrong-number-of-arguments (3 . 4) 2) #54

Closed peng051410 closed 11 months ago

peng051410 commented 2 years ago

I have upgrade my emacs to 28, when i run "org-anki-*', it's broken. error message:

`Debugger entered--Lisp error: (wrong-number-of-arguments (3 . 4) 2)

f(compiled-function (obsolete-name current-name when &optional docstring) "Set OBSOLETE-NAME's function definition to CURRENT-NAME and mark it obsolete.\n\n(define-obsolete-function-alias \='old-fun \='new-fun \"28.1\" \"old-fun's doc.\")\n\nis equivalent to the following two lines of code:\n\n(defalias \='old-fun \='new-fun \"old-fun's doc.\")\n(make-obsolete \='old-fun \='new-fun \"28.1\")\n\nWHEN should be a string indicating when the function was first\nmade obsolete, for example a date or a release number.\n\nSee the docstrings of defalias' andmake-obsolete' for more details." #<bytecode 0x155f9ad256226c95>)('promise:make-process-with-buffer-string 'promise:make-process-send-buffer)

(define-obsolete-function-alias 'promise:make-process-with-buffer-string 'promise:make-process-send-buffer)

(#<buffer load-40468> nil "/Users/tomyli/.emacs.d/elpa/promise-1.1/promise.el" nil t)

apply(# (#<buffer load-40468> nil "/Users/tomyli/.emacs.d/elpa/promise-1.1/promise.el" nil t)) eval-buffer(#<buffer load-40468> nil "/Users/tomyli/.emacs.d/elpa/promise-1.1/promise.el" nil t) ; Reading at buffer position 9061 load-with-code-conversion("/Users/tomyli/.emacs.d/elpa/promise-1.1/promise.el" "/Users/tomyli/.emacs.d/elpa/promise-1.1/promise.el" nil t) require(promise)

(#<buffer load> nil "/Users/tomyli/.emacs.d/elpa/org-anki-1.0.5/org-ank..." nil t)

apply(# (#<buffer load> nil "/Users/tomyli/.emacs.d/elpa/org-anki-1.0.5/org-ank..." nil t)) eval-buffer(#<buffer load> nil "/Users/tomyli/.emacs.d/elpa/org-anki-1.0.5/org-ank..." nil t) ; Reading at buffer position 1287 load-with-code-conversion("/Users/tomyli/.emacs.d/elpa/org-anki-1.0.5/org-ank..." "/Users/tomyli/.emacs.d/elpa/org-anki-1.0.5/org-ank..." nil t)

((autoload "org-anki" "Syncronize all entries in optional BUFFER.\n\n(fn &o..." t nil) org-anki-sync-all nil)

apply(# ((autoload "org-anki" "Syncronize all entries in optional BUFFER.\n\n(fn &o..." t nil) org-anki-sync-all nil)) autoload-do-load((autoload "org-anki" "Syncronize all entries in optional BUFFER.\n\n(fn &o..." t nil) org-anki-sync-all nil) command-execute(org-anki-sync-all record) counsel-M-x-action("org-anki-sync-all") ivy-call()

("M-x " ("org-anki-sync-all" "org-anki-sync-entry" "toggle-debug-on-error" "org-id-get-create" "deadgrep" "org-mime-org-subtree-htmlize" "menu-set-font" "restart-emacs" "text-scale-adjust" "describe-font" "lsp-bridge-popup-complete" "lsp-bridge-mode" "org-roam-db-sync" "package-quickstart-refresh" "yt-set-time" "package-install" "text-scale-decrease" "lsp-bridge-ref-popup" "lsp-bridge-code-action" "blink-search" "org-babel-tangle" "yas-insert-snippet" "global-lsp-bridge-mode" "org-roam-buffer-toggle" "tomyli/new-daily-review" "lsp-bridge-popup-complete-menu" "ox-hugo" "flush-lines" "delete-frame" "erase-buffer" "org-add-note" "company-ctags" "company-gtags" "counsel-fonts" "org-clock-goto" "org-roam-buffer" "lsp-bridge-rename" "counsel-gtags-dwim" "link-hint-copy-link" "cfw:open-org-calendar" "color-rg-search-input" "lsp-bridge-code-format" "lsp-bridge-ref-open-file" "my/org-add-ids-to-headlines-in-file" "cd" "wc" "5x5" "amx" "arp" "dbx" ...) :predicate counsel--M-x-externs-predicate :require-match t :history counsel-M-x-history :action counsel-M-x-action :keymap (keymap (11 . kill-line) (27 keymap (121 . paste-from-x-clipboard)) (67108908 . counsel--info-lookup-symbol) (67108910 . counsel-find-symbol)) :initial-input nil :caller counsel-M-x)

ivy-posframe--read(# "M-x " ("org-anki-sync-all" "org-anki-sync-entry" "toggle-debug-on-error" "org-id-get-create" "deadgrep" "org-mime-org-subtree-htmlize" "menu-set-font" "restart-emacs" "text-scale-adjust" "describe-font" "lsp-bridge-popup-complete" "lsp-bridge-mode" "org-roam-db-sync" "package-quickstart-refresh" "yt-set-time" "package-install" "text-scale-decrease" "lsp-bridge-ref-popup" "lsp-bridge-code-action" "blink-search" "org-babel-tangle" "yas-insert-snippet" "global-lsp-bridge-mode" "org-roam-buffer-toggle" "tomyli/new-daily-review" "lsp-bridge-popup-complete-menu" "ox-hugo" "flush-lines" "delete-frame" "erase-buffer" "org-add-note" "company-ctags" "company-gtags" "counsel-fonts" "org-clock-goto" "org-roam-buffer" "lsp-bridge-rename" "counsel-gtags-dwim" "link-hint-copy-link" "cfw:open-org-calendar" "color-rg-search-input" "lsp-bridge-code-format" "lsp-bridge-ref-open-file" "my/org-add-ids-to-headlines-in-file" "cd" "wc" "5x5" "amx" "arp" "dbx" ...) :predicate counsel--M-x-externs-predicate :require-match t :history counsel-M-x-history :action counsel-M-x-action :keymap (keymap (11 . kill-line) (27 keymap (121 . paste-from-x-clipboard)) (67108908 . counsel--info-lookup-symbol) (67108910 . counsel-find-symbol)) :initial-input nil :caller counsel-M-x) apply(ivy-posframe--read # ("M-x " ("org-anki-sync-all" "org-anki-sync-entry" "toggle-debug-on-error" "org-id-get-create" "deadgrep" "org-mime-org-subtree-htmlize" "menu-set-font" "restart-emacs" "text-scale-adjust" "describe-font" "lsp-bridge-popup-complete" "lsp-bridge-mode" "org-roam-db-sync" "package-quickstart-refresh" "yt-set-time" "package-install" "text-scale-decrease" "lsp-bridge-ref-popup" "lsp-bridge-code-action" "blink-search" "org-babel-tangle" "yas-insert-snippet" "global-lsp-bridge-mode" "org-roam-buffer-toggle" "tomyli/new-daily-review" "lsp-bridge-popup-complete-menu" "ox-hugo" "flush-lines" "delete-frame" "erase-buffer" "org-add-note" "company-ctags" "company-gtags" "counsel-fonts" "org-clock-goto" "org-roam-buffer" "lsp-bridge-rename" "counsel-gtags-dwim" "link-hint-copy-link" "cfw:open-org-calendar" "color-rg-search-input" "lsp-bridge-code-format" "lsp-bridge-ref-open-file" "my/org-add-ids-to-headlines-in-file" "cd" "wc" "5x5" "amx" "arp" "dbx" ...) :predicate counsel--M-x-externs-predicate :require-match t :history counsel-M-x-history :action counsel-M-x-action :keymap (keymap (11 . kill-line) (27 keymap (121 . paste-from-x-clipboard)) (67108908 . counsel--info-lookup-symbol) (67108910 . counsel-find-symbol)) :initial-input nil :caller counsel-M-x)) ivy-read("M-x " ("org-anki-sync-all" "org-anki-sync-entry" "toggle-debug-on-error" "org-id-get-create" "deadgrep" "org-mime-org-subtree-htmlize" "menu-set-font" "restart-emacs" "text-scale-adjust" "describe-font" "lsp-bridge-popup-complete" "lsp-bridge-mode" "org-roam-db-sync" "package-quickstart-refresh" "yt-set-time" "package-install" "text-scale-decrease" "lsp-bridge-ref-popup" "lsp-bridge-code-action" "blink-search" "org-babel-tangle" "yas-insert-snippet" "global-lsp-bridge-mode" "org-roam-buffer-toggle" "tomyli/new-daily-review" "lsp-bridge-popup-complete-menu" "ox-hugo" "flush-lines" "delete-frame" "erase-buffer" "org-add-note" "company-ctags" "company-gtags" "counsel-fonts" "org-clock-goto" "org-roam-buffer" "lsp-bridge-rename" "counsel-gtags-dwim" "link-hint-copy-link" "cfw:open-org-calendar" "color-rg-search-input" "lsp-bridge-code-format" "lsp-bridge-ref-open-file" "my/org-add-ids-to-headlines-in-file" "cd" "wc" "5x5" "amx" "arp" "dbx" ...) :predicate counsel--M-x-externs-predicate :require-match t :history counsel-M-x-history :action counsel-M-x-action :keymap (keymap (11 . kill-line) (27 keymap (121 . paste-from-x-clipboard)) (67108908 . counsel--info-lookup-symbol) (67108910 . counsel-find-symbol)) :initial-input nil :caller counsel-M-x) counsel-M-x() funcall-interactively(counsel-M-x) command-execute(counsel-M-x) `

Looks like it's another package named promise issue. How to solve this?

eyeinsky commented 2 years ago

I can't really tell what the issue is? It seems there is a function that is given a wrong number of arguments, but which function is it?

I tried to find another package that does (provide 'promise) but couldn't find any.

Could you try to disable all other packages and see if org-anki evaluates without error?

peng051410 commented 2 years ago

I can't really tell what the issue is? It seems there is a function that is given a wrong number of arguments, but which function is it?

I tried to find another package that does (provide 'promise) but couldn't find any.

Could you try to disable all other packages and see if org-anki evaluates without error?

I found https://github.com/chuntaro/emacs-promise/issues/42

eyeinsky commented 1 year ago

Do you know how this error comes about? The promise package doesn't seem to make any function or variable obsolete.

I'm using emacs version 28.2 and the latest version of (emacs-)promise from melpa and can't reproduce the error.

9s-l-s9 commented 1 year ago

Any updates? @peng051410 did you find a solution? I have the same problem right now and it is at a really bad time :(

eyeinsky commented 1 year ago

@9s-l-s9 Sorry, no :(, I can't reproduce the error. But could you provide more context: did you also just upgrade to emacs 28, if not, then which other change triggered this?

9s-l-s9 commented 1 year ago

@eyeinsky I had org-anki working before on Fedora. Now I am using Guix and Emacs 28.2 with native-compilation.

9s-l-s9 commented 1 year ago

@eyeinsky Are you really using emacs 28.2 as well? And how did you install promise? It seems to be broken in general for emacs 28.2... if I add (require 'promise) in my config, I get: `Debugger entered--Lisp error: (wrong-number-of-arguments (3 . 4) 2)

f(compiled-function (obsolete-name current-name when &optional docstring) "Set OBSOLETE-NAME's function definition to CURRENT-NAME and mark it obsolete.\n\n(define-obsolete-function-alias \='old-fun \='new-fun \"28.1\" \"old-fun's doc.\")\n\nis equivalent to the following two lines of code:\n\n(defalias \='old-fun \='new-fun \"old-fun's doc.\")\n(make-obsolete \='old-fun \='new-fun \"28.1\")\n\nWHEN should be a string indicating when the function was first\nmade obsolete, for example a date or a release number.\n\nSee the docstrings of defalias' andmake-obsolete' for more details." #<bytecode 0x175cc58bdcd964a2>)('promise:make-process-with-buffer-string 'promise:make-process-send-buffer)

(define-obsolete-function-alias 'promise:make-process-with-buffer-string 'promise:make-process-send-buffer) load-with-code-conversion("/home/samuel/.crafted-emacs/elpa/promise-1.1/promi..." "/home/samuel/.crafted-emacs/elpa/promise-1.1/promi..." nil t) require(promise) load-with-code-conversion("/home/samuel/.crafted-emacs/config.el" "/home/samuel/.crafted-emacs/config.el" nil t) load("/home/samuel/.crafted-emacs/config.el" nil nomessage) (progn (load crafted-config-file nil 'nomessage)) (if (file-exists-p crafted-config-file) (progn (load crafted-config-file nil 'nomessage))) load-with-code-conversion("/home/samuel/.config/emacs/init.el" "/home/samuel/.config/emacs/init.el" t t) load("/home/samuel/.config/emacs/init" noerror nomessage) startup--load-user-init-file(#f(compiled-function () #<bytecode 0x1a225e15d1e41bee>) #f(compiled-function () #<bytecode 0x4d12c0e0e44348b>) t) command-line() normal-top-level()`

eyeinsky commented 1 year ago

Yes, version gives me GNU Emacs 28.2 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo version 1.16.0, Xaw3d scroll bars).

I'm on nixos, and have installed extensions through home-manager, which install promise as a dependency. This is what describe-package gives me:

    Status: External in ‘/nix/store/2kk67yfrnb954z3vc48g0hsih1n6mm1y-emacs-packages-deps/share/emacs/site-lisp/elpa/promise-20210307.727/’ (unsigned).
   Version: 20210307.727                                                                                                                              
    Commit: 3eaf5ac668008759677b9cc6f11406abd573012a                                                                                                  
   Summary: Promises/A+                                                                                                                               
  Requires: emacs-25.1                                                                                                                                
equired by: async-await-20220827.437                                                                                                                  
   Website: https://github.com/chuntaro/emacs-promise                                                                                                 
  Keywords: [async] [promise] [convenience]                                                                                                           
Maintainer: chuntaro <chuntaro@sakura-games.jp>                                                                                                       
    Author: chuntaro <chuntaro@sakura-games.jp>                                                                                                       
9s-l-s9 commented 1 year ago

So, I was able to fix it. I saw that the main difference between your output of 'describe-package' and mine was that you used another version. I also found this guide: https://github.com/SystemCrafters/crafted-emacs#a-package-suddenly-fails-to-work

So, to fix this you would need to: Install promise and then choose the Melpa Verison (see the link). Probably would be good, if there was a new release of promise to fix it completly.

eyeinsky commented 1 year ago

@9s-l-s9 Thanks! May I ask which version of promise package were you using and from which package repository was it installed from?

Looking at the one I have installed, the promise.el file is exactly the same as the latest version from github from 2021-03-07.

9s-l-s9 commented 1 year ago

@eyeinsky Before I used org-anki, I did not had promise installed. I installed it seperatly from github (package-install 'promise) to check, if that would solve the issue. Only than I changed to the Melpa Version.

eyeinsky commented 1 year ago

Right, so I finally may have an explanation on how this error comes about. In the promise package:

So if you have promise.el version from between those commits, then you'll get this error. It's the more likely because the promise.el hasn't been versioned correctly, the package's version has been constantly 1.1 since Feb 16 2017, so package managers wouldn't know they need to upgrade (unless they are git-aware and can detect a newer version from the latest commit).

I guess I'll leave this issue open for a while for people to find it.

eyeinsky commented 1 year ago

@9s-l-s9 Hi, has the issue resolved? A way to fix it would be to remove (uninstall/delete) emacs-promise package and then have the package manager download it again. The problem is that regardless of API changes in emacs-promise, it hasn't changed it's version number. So if you downloaded the package approximately in first half of 2020 it's likely to cause this issue. Deleting the package would force a re-download and you'd get the fixed package.

peng051410 commented 11 months ago

@eyeinsky Sorry for slow reply, I have got solution for this problem, cause my config package only download promise package from melpa stable repo. I only got promise 1.1 version with is not compatible with org-anki package, Now I download promise package from github manually, It works. And thanks @9s-l-s9 again for he conversation.

eyeinsky commented 11 months ago

@peng051410 Thanks!

In summary there are two ways to get and fix this error (anyone correct me if I'm wrong):