alphapapa / org-sidebar

A helpful sidebar for Org mode
GNU General Public License v3.0
527 stars 16 forks source link

org-sidebar-backlinks "Symbol's function definition is void: closure" #54

Closed GovtIssueJoe closed 2 years ago

GovtIssueJoe commented 2 years ago

When I attempt to run org-sidebar-backlinks, it errors out with the message "funcall: Symbol’s function definition is void: closure"

It does this on several different computers, and I was able to replicate it with a minimal config, loading emacs28 with -Q, then enabling only the minimum required packages for org-sidebar.

Debug trace of the call: Debugger entered--Lisp error: (void-function closure) closure(#) funcall(closure #) (cons (funcall fn source-buffer) --cl-var--) (setq --cl-var-- (cons (funcall fn source-buffer) --cl-var--)) (while (consp --cl-var--) (setq fn (car --cl-var--)) (setq --cl-var-- (cons (funcall fn source-buffer) --cl-var--)) (setq --cl-var-- (cdr --cl-var--))) (let ((--cl-var-- fns) (fn nil) (--cl-var-- nil)) (while (consp --cl-var--) (setq fn (car --cl-var--)) (setq --cl-var-- (cons (funcall fn source-buffer) --cl-var--)) (setq --cl-var-- (cdr --cl-var--))) (nreverse --cl-var--)) (let ((source-buffer (current-buffer)) (fns (cond ((listp fns) fns) ((atom fns) (list fns)) ((error "cl-etypecase failed: %s, %s" fns '(list atom)) nil))) (display-buffers (let ((--cl-var-- fns) (fn nil) (--cl-var-- nil)) (while (consp --cl-var--) (setq fn (car --cl-var--)) (setq --cl-var-- (cons (funcall fn source-buffer) --cl-var--)) (setq --cl-var-- (cdr --cl-var--))) (nreverse --cl-var--)))) (if display-buffers (progn (setq org-sidebar-sidebar-buffers display-buffers) (let ((list display-buffers) (i 0) it it-index) (ignore it it-index) (while list (setq it (car-safe (prog1 list ...)) it-index i i (1+ i)) (save-current-buffer (set-buffer it) (org-sidebar--prepare-buffer) (setq org-sidebar-source-buffer source-buffer)))) (org-sidebar--display-buffers display-buffers :window-parameters (list (cons 'org-sidebar-window t) (cons 'org-sidebar-source-buffer-point-min (point-min))))))) org-sidebar((closure ((title . #("Links to: test" 10 14 (face org-level-1 org-category "test" wrap-prefix #(" " 0 2 (face org-indent)) line-prefix "" fontified t))) (sort) (super-groups) (narrow) (--cl-rest-- :title #("Links to: test" 10 14 (face org-level-1 org-category "test" wrap-prefix #(" " 0 2 (face org-indent)) line-prefix "" fontified t))) (query link :target "id:aae5db10-c35d-45ce-89a0-b044f4a0a0eb") (buffers-files "/home/user/org/inbox.org" "/home/user/org/user.org" "/home/user/org/todo.org") t) (&rest _ignore) (let ((display-buffer (generate-new-buffer "org-ql-sidebar"))) (let ((wconfig (current-window-configuration))) (unwind-protect (progn (org-ql-search buffers-files query :narrow narrow :sort sort :super-groups super-groups :buffer display-buffer :title title)) (set-window-configuration wconfig))) display-buffer))) (progn (let ((--cl-keys-- --cl-rest--)) (while --cl-keys-- (cond ((memq (car --cl-keys--) '(:narrow :super-groups :sort :title :allow-other-keys)) (setq --cl-keys-- (cdr (cdr --cl-keys--)))) ((car (cdr (memq ... --cl-rest--))) (setq --cl-keys-- nil)) (t (error "Keyword argument %s not one of (:narrow :super-gro..." (car --cl-keys--)))))) (org-sidebar #'(lambda (&rest _ignore) (let ((display-buffer (generate-new-buffer "org-ql-sidebar"))) (let ((wconfig ...)) (unwind-protect (progn ...) (set-window-configuration wconfig))) display-buffer)))) (let ((narrow (car (cdr (plist-member --cl-rest-- ':narrow)))) (super-groups (car (cdr (plist-member --cl-rest-- ':super-groups)))) (sort (car (cdr (plist-member --cl-rest-- ':sort)))) (title (car (cdr (plist-member --cl-rest-- ':title))))) (progn (let ((--cl-keys-- --cl-rest--)) (while --cl-keys-- (cond ((memq (car --cl-keys--) '...) (setq --cl-keys-- (cdr ...))) ((car (cdr ...)) (setq --cl-keys-- nil)) (t (error "Keyword argument %s not one of (:narrow :super-gro..." (car --cl-keys--)))))) (org-sidebar #'(lambda (&rest _ignore) (let ((display-buffer ...)) (let (...) (unwind-protect ... ...)) display-buffer))))) org-sidebar-ql(("/home/user/org/inbox.org" "/home/user/org/user.org" "/home/user/org/todo.org") (link :target "id:aae5db10-c35d-45ce-89a0-b044f4a0a0eb") :title #("Links to: test" 10 14 (face org-level-1 org-category "test" wrap-prefix #(" " 0 2 (face org-indent)) line-prefix "" fontified t))) (let ((id (org-entry-get (point) "ID")) (custom-id (org-entry-get (point) "CUSTOM_ID")) (query (cond ((and id custom-id) (warn "Entry has both ID and CUSTOM_ID set; query will be...") (list 'or (list 'link ':target (concat "id:" id)) (list 'link ':target (concat "id:" custom-id)))) ((or id custom-id) (list 'link ':target (concat "id:" (or id custom-id)))) (t (error "Entry has no ID nor CUSTOM_ID property"))))) (org-sidebar-ql (org-ql-search-directories-files) query :title (concat "Links to: " (org-get-heading t t)))) org-sidebar-backlinks() funcall-interactively(org-sidebar-backlinks) command-execute(org-sidebar-backlinks)

alphapapa commented 2 years ago

That error is bizarre, as it would suggest something fundamentally wrong in Emacs if it's unable to use closures.

Anyway, I just tested in a clean configuration using https://github.com/alphapapa/emacs-sandbox.sh, and it works.

I'd suggest trying to use Emacs 27.2, or at least making sure you have the latest commit of Emacs 28.0.50.

GovtIssueJoe commented 2 years ago

Interesting. I gave that a try, and it installed and worked with no issues under emacs-28. I'll do some more debugging -- I generally use a doom config, so perhaps one of the supporting packages is pinned to a commit that doesn't work well for org-sidebar.

Thanks for looking into it.

alphapapa commented 2 years ago

Doom does...special things with packages. It's a frequent source of problems like this, it seems, as I get many users reporting this kind of thing with my packages. Please be sure to mention that you're a Doom user when you report any issues like this.