reddit / emacs

helm-org-rifle

nonreligious · 2022-07-30 22:18
Apologies for posting so many requests for help lately, but a recent update of packages seems to have screwed up some features that were working quite well before. I now have an issue with alphapapa's `helm-org-rifle` package, which allows you to search through all currently open org files. Any time I call `helm-org-rifle`, I receive the error: helm--run-init-hooks: ‘after-init-hook’ hook in source ‘xxx.org’ not specified as symbol function where `xxx.org` is whatever the last viewed org file is. Below is the backtrace from `debug-on-error` after I call `helm-org-rifle`. Debugger entered--Lisp error: (error "‘after-init-hook’ hook in source ‘xxx.org’ not...") signal(error ("‘after-init-hook’ hook in source ‘xxx.org’ not...")) error("`%s' hook in source `%s' not specified as symbol f..." after-init-hook "xxx.org") helm--run-init-hooks(after-init-hook (... ... ... ... ... ... ... ... ... ...)) helm-initial-setup(nil (... ... ... ... ... ... ... ... ... ...)) helm-initialize(nil nil nil (... ... ... ... ... ... ... ... ... ...)) helm-internal((... ... ... ... ... ... ... ... ... ...) nil nil nil nil nil nil nil nil) apply(helm-internal (... nil nil nil nil nil nil nil nil)) helm((... ... ... ... ... ... ... ... ... ...) nil nil nil nil nil nil nil nil) apply(helm (... nil nil nil nil nil nil nil nil)) helm(:sources (... ... ... ... ... ... ... ... ... ...)) helm-org-rifle() funcall-interactively(helm-org-rifle) call-interactively(helm-org-rifle nil nil) command-execute(helm-org-rifle) Here are some additional points: - The related `helm-org-rifle-occur` function seems to work totally fine, without any errors. I would just switch to this but I find it slightly less convenient. - Closing all org file buffers in Emacs and calling `helm-org-rifle` doesn't give an error, but then the function is totally useless. - I do have a general template for most org files, with a `#+SETUPFILE:` and `#+TITLE` etc. But I created a totally blank `.org` file, opened it in emacs, and did `helm-org-rifle` again - the same error came up again. - The problem is most likely something to do with my config. But if I do `emacs -Q`, and load the bare minimum of stuff to get `helm-org-rifle` working (which as far as I can tell is doing `(require 'package)` and `(package-initialize)` and adding some load paths), I get the same error! Maybe the issue is that there's an update with `helm` itself that is causing this? I haven't found an issue on `github` about this yet. I'm on Emacs `27.2`, with org version `9.4.4`, `helm` version `20220726.1622`, and `helm-org-rifle` version `20200512.1943`. ----------------------------- **EDIT** OK, it appears that the error was caused by an update to `helm`, and was apparently fixed by a subsequent update. Trying to switch to this resulted in me breaking `helm` and getting a `minibuffer-follows-selected-frame` error. After a lot of mucking around, I managed to switch `helm` to the latest `melpa-stable` version, and now it seems to be working. As for `helm-org-rifle`, the original issue, I now seem to have reproduced the error found by u/Hooxen (see the comments), which is that `helm-M-x-execute-command: Invalid function: (helm-org-rifle-set-input-idle-delay)` occurs every time `helm-org-rifle` is called. I'll wait to see if that's resolved as this is all a little beyond my competency. However, u/github-alphapapa has recommended his (slightly newer?) package `helm-org-ql` to use instead, so I will be giving that a try. **EDIT2** OK, updating to `helm-core-20220802.1409` has fixed the `helm-org-rifle-set-input-delay` error, so everything appears hunky-dory with `helm-org-rifle` now. Hope it will stay that way, and thanks to u/helm05 for letting me know about this update, and to everyone in the comments for their input and assistance.
helm05 · 2022-07-31 05:25
Update helm, it have been fixed.
github-alphapapa · 2022-07-31 12:45
Thanks, Mr. I-Think-I-Know-Who-You-Are. ;)
github-alphapapa · 2022-07-31 12:47
Sounds like it was a temporary bug in Helm that's been fixed. By the way, while `helm-org-rifle` remains a good and useful tool, it's been mostly superseded by [org-ql](https://github.com/alphapapa/org-ql/), which provides commands that function similarly (`org-ql-find`, which doesn't require Helm, and `helm-org-ql`), along with more power and speed.
Hooxen · 2022-07-31 17:30
updating to `helm-20220731.856/` against that same version of `helm-org-rifle` on emacs `28.1` and then running `M-x helm-org-rifle` gives error `helm-M-x-execute-command: Invalid function: (helm-org-rifle-set-input-idle-delay)` it is a similar backtrace as the OP: `Debugger entered--Lisp error: (invalid-function (helm-org-rifle-set-input-idle-delay)) (helm-org-rifle-set-input-idle-delay)() helm--run-init-hooks(after-init-hook (((name . "todo.org") (buffer . #<buffer` [`todo.org`](https://todo.org)`>)` `...` u/nonreligious did your updating to latest fix in your case? Will try again / dig a bit more later
nonreligious · 2022-07-31 18:10
Sorry for the slow response - finally managed to update today to `helm-20220731.856`, but now I keep getting the error `Symbol's value as variable is void: minibuffer-follows-selected-frame` every time I invoke `helm` -- which is a pain, as I've "helmized" everything from `M-x` to `C-x b`...
nonreligious · 2022-07-31 18:12
Thanks alphapapa, I've found `helm-org-ql` too and was planning on exploring it after I fixed this issue. Unfortunately, attempting to upgrade `helm` has apparently broken everything for me, so it will be some time before I get back to that...
nonreligious · 2022-07-31 18:28
Thanks, updated and now I keep getting the error `Symbol's value as variable is void: minibuffer-follows-selected-frame` every time I invoke `helm`, which is totally annoying.
Hooxen · 2022-07-31 19:55
It is this [commit](https://github.com/emacs-helm/helm/commit/202a70168ff9afb03f6d540fce9aa9424b489d67) if i replace the implementation of `helm--run-init-hooks` with the previous one [here](https://github.com/emacs-helm/helm/blob/e39db6bbf26d6a4b4b4d14140d98b4a254c7e153/helm-core.el) then `helm-org-rifle` works again, here was the previous impl of the loop: (cl-loop with sname = (cl-ecase hook (before-init-hook "h-before-init-hook") (after-init-hook "h-after-init-hook")) with h = (cl-gensym sname) for s in sources for hv = (assoc-default hook s) if (and hv (not (symbolp hv))) do (set h hv) and do (helm-log-run-hook h) else do (helm-log-run-hook hv)) and the current one that errors: (cl-loop for s in sources for hv = (assoc-default hook s) if (and hv (not (symbolp hv))) ; A lambda. do (funcall hv) ; Should raise an error with a list of lambdas. else do (helm-log-run-hook hv)) If i put a `print` in `helm-log-run-hook` in the previous implementation he gets called with `h-after-init-hook66` (result of `cl-gensym`) while the new impl errors trying to `funcall` the `cons` `(helm-org-rifle-set-input-idle-delay)` which, as the comment indicates, raises an error. Wonder if the `gensym` with the `(set h hv)` was a way around a lambda in a list, but maybe a case for a lambda in a list is the needed fix
github-alphapapa · 2022-07-31 19:57
FYI, it's a good idea to keep your Emacs config, including the `elpa/` directory, in a git repo, so you can always restore a known-good configuration and set of packages. (Don't feel bad--most of us learn this the hard way.) In the meantime, `org-ql-find` should get the job done. Its matching logic is the same as org-rifle's, and it's even faster.
nonreligious · 2022-07-31 20:30
Thanks for the advice - I've been tracking my `config.org` file changes, and other config files with git, but I hadn't yet thought of doing the same for `.emacs.d/elpa`. Hopefully I can check out both `org-ql-find` and it's helmized version soon!
nonreligious · 2022-08-01 16:03
Thanks - finally fixed the other bug that was causing me trouble by going back to the `melpa-stable` version of `helm`. Now I am indeed getting the `helm-org-rifle-set-input-idle-delay` error that you described. I'm afraid I don't know enough to comment on what would be needed to fix this, but you seem to have spotted an error that is reproducible, perhaps opening an issue on github is the next course of action.
helm05 · 2022-08-02 14:21
Has been fixed as well, please update ;-)
nonreligious · 2022-08-02 20:27
Ah, thank you! Updating to `helm-core-20220802.1409` seems to do the trick.