Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

treemacs--async-update-part-complete fails with (wrong-type-argument number-or-marker-p nil) #1106

Open
drskalman opened this issue May 13, 2024 · 2 comments

Comments

@drskalman
Copy link

Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil) =(0 nil) (if (= 0 count) (progn (let ((it (buffer-live-p buffer))) (if it (progn (save-current-buffer (set-buffer buffer) (let (buffer-read-only) (treemacs-update-node top-path) (let* ... ...)))))))) (let* ((count (let* ((v treemacs--async-update-count) (v top-path)) (ht-set! v v (- (ht-get v v) 1))))) (if (= 0 count) (progn (let ((it (buffer-live-p buffer))) (if it (progn (save-current-buffer (set-buffer buffer) (let ... ... ...)))))))) treemacs--async-update-part-complete((lsp-treemacs-generic-root "foo") (lsp-treemacs-generic-root "foo") nil #<buffer *dap-ui-locals*>) (closure ((item-path lsp-treemacs-generic-root "foo") (buffer . #<buffer *dap-ui-locals*>) (path lsp-treemacs-generic-root "foo")) (items) (treemacs--async-update-part-complete path item-path items buffer))(nil) funcall((closure ((item-path lsp-treemacs-generic-root "foo") (buffer . #<buffer *dap-ui-locals*>) (path lsp-treemacs-generic-root "foo")) (items) (treemacs--async-update-part-complete path item-path items buffer)) nil) (cond ((functionp children) (funcall callback (lsp-treemacs-filter-if-needed (funcall children item)))) (children-async (let* ((buffer (current-buffer))) (funcall children-async item #'(lambda (result) (if (buffer-live-p ...) (progn ...)))))) (t (funcall callback (lsp-treemacs-filter-if-needed children)))) (let* ((item input0) (children (plist-get item :children)) (children-async (plist-get item :children-async))) (cond ((functionp children) (funcall callback (lsp-treemacs-filter-if-needed (funcall children item)))) (children-async (let* ((buffer (current-buffer))) (funcall children-async item #'(lambda (result) (if ... ...))))) (t (funcall callback (lsp-treemacs-filter-if-needed children))))) (let ((input0 item)) (let* ((item input0) (children (plist-get item :children)) (children-async (plist-get item :children-async))) (cond ((functionp children) (funcall callback (lsp-treemacs-filter-if-needed (funcall children item)))) (children-async (let* ((buffer (current-buffer))) (funcall children-async item #'(lambda ... ...)))) (t (funcall callback (lsp-treemacs-filter-if-needed children)))))) (closure (t) (&optional btn item callback) (ignore btn item callback) (let ((input0 item)) (let* ((item input0) (children (plist-get item :children)) (children-async (plist-get item :children-async))) (cond ((functionp children) (funcall callback (lsp-treemacs-filter-if-needed ...))) (children-async (let* (...) (funcall children-async item ...))) (t (funcall callback (lsp-treemacs-filter-if-needed children)))))))(#<marker (moves after insertion) at 15 in *dap-ui-locals*> (:label "Nothing to display..." :key "foo" :icon :empty) (closure ((item-path lsp-treemacs-generic-root "foo") (buffer . #<buffer *dap-ui-locals*>) (path lsp-treemacs-generic-root "foo")) (items) (treemacs--async-update-part-complete path item-path items buffer))) funcall((closure (t) (&optional btn item callback) (ignore btn item callback) (let ((input0 item)) (let* ((item input0) (children (plist-get item :children)) (children-async (plist-get item :children-async))) (cond ((functionp children) (funcall callback (lsp-treemacs-filter-if-needed ...))) (children-async (let* (...) (funcall children-async item ...))) (t (funcall callback (lsp-treemacs-filter-if-needed children))))))) #<marker (moves after insertion) at 15 in *dap-ui-locals*> (:label "Nothing to display..." :key "foo" :icon :empty) (closure ((item-path lsp-treemacs-generic-root "foo") (buffer . #<buffer *dap-ui-locals*>) (path lsp-treemacs-generic-root "foo")) (items) (treemacs--async-update-part-complete path item-path items buffer))) (let* ((item-path (car item)) (ext (cdr item)) (btn (treemacs-find-node item-path)) (item (get-text-property btn :item)) (children-fn (progn (or (progn (and (memq ... cl-struct-treemacs-extension-tags) t)) (signal 'wrong-type-argument (list 'treemacs-extension ext))) (aref ext 6)))) (funcall children-fn btn item #'(lambda (items) (treemacs--async-update-part-complete path item-path items buffer)))) (let ((item (car tail))) (let* ((item-path (car item)) (ext (cdr item)) (btn (treemacs-find-node item-path)) (item (get-text-property btn :item)) (children-fn (progn (or (progn (and ... t)) (signal 'wrong-type-argument (list ... ext))) (aref ext 6)))) (funcall children-fn btn item #'(lambda (items) (treemacs--async-update-part-complete path item-path items buffer)))) (setq tail (cdr tail))) (while tail (let ((item (car tail))) (let* ((item-path (car item)) (ext (cdr item)) (btn (treemacs-find-node item-path)) (item (get-text-property btn :item)) (children-fn (progn (or (progn ...) (signal ... ...)) (aref ext 6)))) (funcall children-fn btn item #'(lambda (items) (treemacs--async-update-part-complete path item-path items buffer)))) (setq tail (cdr tail)))) (let ((tail items-to-update)) (while tail (let ((item (car tail))) (let* ((item-path (car item)) (ext (cdr item)) (btn (treemacs-find-node item-path)) (item (get-text-property btn :item)) (children-fn (progn (or ... ...) (aref ext 6)))) (funcall children-fn btn item #'(lambda (items) (treemacs--async-update-part-complete path item-path items buffer)))) (setq tail (cdr tail))))) (let* ((items-to-update (treemacs--get-async-update-items path))) (ht-set! treemacs--async-update-count path (length items-to-update)) (let ((tail items-to-update)) (while tail (let ((item (car tail))) (let* ((item-path (car item)) (ext (cdr item)) (btn (treemacs-find-node item-path)) (item (get-text-property btn :item)) (children-fn (progn ... ...))) (funcall children-fn btn item #'(lambda ... ...))) (setq tail (cdr tail)))))) treemacs-update-async-node((lsp-treemacs-generic-root "foo") #<buffer *dap-ui-locals*>)

I fixed it with this:

-   (when (= 0 count)
+   (when (or (not count) (= 0 count))
@Alexander-Miller
Copy link
Owner

The fix would work, but really it's a thing that should not have happened in the first place, though it's been a while since I wrote that code. Is it possible to reproduce this problem?

Copy link

stale bot commented Jul 12, 2024

This issue has been automatically marked as stale because it has not had recent activity (this bot only works as a reminder, it will not close issues).

@stale stale bot added the stale label Jul 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants