reddit / emacs

Bug? `file-notify--handle-event` seems to be passing its final argument (`FILE1-OR-COOKIE1) as the value of `:callback`to `file-notify--call-handler`

graduale · 2022-11-02 02:23
This is sort of a follow up on [this post](https://www.reddit.com/r/emacs/comments/y49r4q/help_figure_out_the_source_of_a/). I've been trying to find the source of a `file-notify--call-handler` error: file-notify--call-handler: Symbol’s function definition is void: nil I can finally reproduce the error in vanilla emacs using just a few lines of code. First, I evaluate the following in a buffer in vanilla emacs (`emacs -Q`): (require 'filenotify) (require 'autorevert) (require 'subr-x) (global-auto-revert-mode) (save-window-excursion (find-file "~/tmp/test.el")) And then, making use of the updated value of `file-notify-descriptors` (which I gather changes once you visit a new file if `global-auto-revert-mode` is enabled), I do the following: (file-notify--handle-event (car (hash-table-keys file-notify-descriptors)) '(renamed attribute-changed deleted) "/Users/apc/tmp/test.el" nil) Looking at the docstring of `file-notify--handle-event` makes me think this shouldn't give me the error it does: "Handle an event returned from file notification. DESC is the back-end descriptor. ACTIONS is a list of: `created' `changed' `attribute-changed' `deleted' `renamed' -- FILE is old name, FILE1-OR-COOKIE is new name or nil `renamed-from' -- FILE is old name, FILE1-OR-COOKIE is cookie or nil `renamed-to' -- FILE is new name, FILE1-OR-COOKIE is cookie or nil `stopped' -- no more events after this should be sent" Here's the backtrace: Debugger entered--Lisp error: (void-function nil) nil((18 attribute-changed "/Users/apc/tmp/test.el")) file-notify--call-handler(#s(file-notify--watch :directory "/Users/apc/tmp" :filename "test.el" :callback nil) 18 attribute-changed "/Users/apc/tmp/test.el" nil) file-notify--handle-event(18 (renamed attribute-changed deleted) "/Users/apc/tmp/test.el" nil) (progn (file-notify--handle-event (car (hash-table-keys file-notify-descriptors)) '(renamed attribute-changed deleted) "/Users/apc/tmp/test.el" nil)) eval((progn (file-notify--handle-event (car (hash-table-keys file-notify-descriptors)) '(renamed attribute-changed deleted) "/Users/apc/tmp/test.el" nil)) t) elisp--eval-last-sexp(nil) eval-last-sexp(nil) funcall-interactively(eval-last-sexp nil) call-interactively(eval-last-sexp nil nil) command-execute(eval-last-sexp) I tried instrumenting `file-notify--handle-event` to see if I could figure out what was going on. But I was quickly out of my depth. I'm hoping someone here may be able to help out in some way or other.
nv-elisp · 2022-11-02 04:08
Report it to the mailing list with your repro case.
graduale · 2022-11-02 12:42
👍