casouri / vundo

Visualize the undo tree.
413 stars 20 forks source link

Debugger entered--Lisp error: (void-function vundo-diff--quit) #104

Closed Animeshz closed 4 months ago

Animeshz commented 4 months ago

I'm not sure how to properly install vundo,

I have this set up in elpaca:

;; Emulates vim keybinds & modal editing
(use-package evil
  :init
  ;; ...
  :config
  (evil-mode 1))

;; keep undo history
(use-package undo-fu
  :config
  (setq evil-undo-system 'undo-fu))

;; keep file's undo history between emacs sessions
(use-package undo-fu-session
  :config
  (undo-fu-session-global-mode))

;; make undo history a tree on-the-fly
(use-package vundo)

Every time I enter vundo using M-x, pressing <RET> returns this error,

Debugger entered--Lisp error: (void-function vundo-diff--quit)
  vundo-diff--quit()
  vundo-confirm()
  funcall-interactively(vundo-confirm)
  command-execute(vundo-confirm)

And it seems like the vundo-diff.el isn't getting loaded how hard I try, I couldn't see those functions in help page, but I do see those files cloned and compiled in the elpaca cache.

I tried different ways elpaca support

(use-package vundo
  :ensure (vundo :files (:defaults "*.el")))

;; or
(use-package vundo
  :ensure (vundo :files ("vundo.el" "vundo-diff.el")))

;; or
(use-package vundo
  :ensure (vundo :host github :repo "casouri/vundo" :files (:defaults "*.el")))

but none seem to work.

Thanks.

Also, can installation instructions be added in the README? :eyes:

Animeshz commented 4 months ago

It seems after an hour of debugging I seem to find the issue,

The elpaca actually loads the file, with autoload definitions it can generate, which consist of 3 functions from vundo-diff.el: vundo-diff vundo-diff-mark vundo-diff-unmark.

If I read any of those functions help page, rest of all the functions are loaded and vundo works flawlessly, but without reading help page of any 3 of them, doesn't load the defintion of function vundo-diff--quit which is not marked as #autoloadsand is called fromvundo.el`.

So it seems like a fix would be to add #autoloads to those internal functions as well which are referenced from vundo.el. Correct me if I'm wrong.

casouri commented 4 months ago

Thank you very much! You're right, vundo isn't requiring vundo-diff as it should. I pushed a fix for it.

Animeshz commented 4 months ago

@casouri emacs complaints it as recursive require, basically both files requiring each other, have you tested the change?

casouri commented 4 months ago

I have not. Ok, this fix should really fix it (https://github.com/casouri/vundo/commit/cf440667b4ece07a74e68dc84f029779f1ddfc24). It seems using the hook is the right approach after all :-) @jdtsmith

Animeshz commented 4 months ago

Yeah, this fixes it.

Thanks a ton!!!

jdtsmith commented 4 months ago

Oops, that was an oversight. The other option would be to introduce an autoload for vundo--diff-quit.

But I preferred the exit hook anyway, since it seems cleaner and couples vundo and vundo-diff less closely.