dajva / rg.el

Emacs search tool based on ripgrep
https://rgel.readthedocs.io
GNU General Public License v3.0
471 stars 38 forks source link

Instructions on lazy loading incomplete, missing autoloads #107

Closed zenspider closed 3 years ago

zenspider commented 3 years ago

Given documentation for lazy loading https://rgel.readthedocs.io/en/2.0.1/usage.html#installation :

(global-set-key (kbd "C-c s") #'rg-menu)
(with-eval-after-load 'rg
   ;; Your settings goes here.
)

but if you actually do this you get:

Debugger entered--Lisp error: (wrong-type-argument commandp rg-menu)
  call-interactively(rg-menu nil nil)
  command-execute(rg-menu)

If you add your own autoload for rg-menu:

(autoload 'rg-menu "rg-menu" "doco" t)

then you get:

Debugger entered--Lisp error: (void-variable rg-command-line-flags-function)
  rg--transient()
  funcall-interactively(rg--transient)
  call-interactively(rg--transient nil nil)
  command-execute(rg--transient)

So it seems that a lot of autoloads are missing or there needs to be more requires... or something?

zenspider commented 3 years ago

workaround:

(autoload 'rg-menu "rg-menu" "doco" t)
(global-set-key (kbd "C-c s") #'rg-menu)

(with-eval-after-load 'rg-menu
  (require 'rg)
  ...)
dajva commented 3 years ago

Clearly a bug. I've added the autoload cookie that should solve the rg-menu problem. On my side everything works if I generate autoloads for all files in the package so I think this should be enough. Did you do that?

zenspider commented 3 years ago

I saw the quick commit (thank you!) but the package hasn't updated through melpa yet.

If I keep my own autoload, but get rid of my with-eval-after-load, no... The autoload ensures that rg-menu.el is loaded, but nothing loads rg.el and it fails on the first thing defined in there, as described above. If, however, I require 'rg when rg-menu.el is loaded, then things work fine.

zenspider commented 3 years ago

I will add, it LOOKED like it was fixed for a hot second... but if I keep cleaning up my .elc files or recompiling them, then it consistently shows the problem.

dajva commented 3 years ago

Ah, right. I just tested to get the menu up which worked but not invoking the actual command, which fails for me too.

dajva commented 3 years ago

I think this last commit should do it.

zenspider commented 3 years ago

Confirmed fixed! Thank you!