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: (wrong-type-argument number-or-marker-p nil) #1118

Open
eval-exec opened this issue Aug 7, 2024 · 3 comments
Open

Treemacs: (wrong-type-argument number-or-marker-p nil) #1118

eval-exec opened this issue Aug 7, 2024 · 3 comments
Labels

Comments

@eval-exec
Copy link

eval-exec commented Aug 7, 2024

Hello, I get an error, but I don't know how to reproduce.
This error occured when I:
a. create treemacs window
b. move focus to other window
c. switch focus to treemacs window
d. delete treemacs window.
e. create treemacs window, and repeat abcdabcdabcd very quickly. then this error will occur:

Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil)
  treemacs--apply-annotations-deferred(#<marker (moves after insertion) at 2309 in  *Treemacs-Scoped-Buffer-#<frame elisp/treemacs.el - GNU Emacs at Mufasa 0x19ddf60>*> "/home/exec/.config/emacs" #<buffer  *Treemacs-Scoped-Buffer-#<frame elisp/treemacs.el - GNU Emacs at Mufasa 0x19ddf60>*> #<process Process Future>)
  apply(treemacs--apply-annotations-deferred (#<marker (moves after insertion) at 2309 in  *Treemacs-Scoped-Buffer-#<frame elisp/treemacs.el - GNU Emacs at Mufasa 0x19ddf60>*> "/home/exec/.config/emacs" #<buffer  *Treemacs-Scoped-Buffer-#<frame elisp/treemacs.el - GNU Emacs at Mufasa 0x19ddf60>*> #<process Process Future>))
  timer-event-handler([t 26291 17083 672268 nil treemacs--apply-annotations-deferred (#<marker (moves after insertion) at 2309 in  *Treemacs-Scoped-Buffer-#<frame elisp/treemacs.el - GNU Emacs at Mufasa 0x19ddf60>*> "/home/exec/.config/emacs" #<buffer  *Treemacs-Scoped-Buffer-#<frame elisp/treemacs.el - GNU Emacs at Mufasa 0x19ddf60>*> #<process Process Future>) nil 824000 nil])

The treemacs repo I use is:

362bfa5 - (HEAD -> master, origin/master, origin/HEAD) [Misc] Checkdoc fixes. (3 weeks ago) <Alexander Miller>

What information should I provide to assist in investigating this?
Thank you.

@Alexander-Miller
Copy link
Owner

d. delete treemacs window.

Delete with Q or close with q?

create treemacs window, and repeat abcdabcdabcd

You mean just type random stuff in some buffer or in treemacs?

Anyway,for better debugging output eval this after loading treemacs:

(defun treemacs--apply-annotations-deferred (btn path buffer git-future)
  "Deferred application for annotations for BTN and PATH.

Runs on a timer after BTN was expanded and will apply annotations for all of
BTN's *immediate* children.

Change will happen in BUFFER, given that it is alive.

GIT-FUTURE is only awaited when `deferred' git-mode is used.

BTN: Button
PATH: Node Path
BUFFER: Buffer
GIT-FUTURE: Pfuture"
  (when (eq 'deferred treemacs--git-mode)
    (ht-set! treemacs--git-cache path
             (treemacs--get-or-parse-git-result git-future)))
  (when (buffer-live-p buffer)
    (with-current-buffer buffer
      (save-excursion
        (treemacs-with-writable-buffer
         (let* ((depth (1+ (treemacs-button-get btn :depth)))
                (git-info (or (ht-get treemacs--git-cache (treemacs-button-get btn :key))
                              treemacs--empty-table)))
           ;; the depth check ensures that we only iterate over the nodes that
           ;; are below parent-btn and stop when we've moved on to nodes that
           ;; are above or belong to the next project
           (while (and (setq btn (next-button btn))
                       (>= (treemacs-button-get btn :depth) depth))
             (when (= depth (treemacs-button-get btn :depth))
               (treemacs-log "Apply annotationat at [%s %s] git-info [%s] annotation [%s]"
                 btn
                 (when btn (treemacs-button-get btn :key))
                 (when btn (ht-get git-info (treemacs-button-get btn :path)))
                 (when btn (treemacs-get-annotation (treemacs-button-get btn :path))))
               (treemacs--do-apply-annotation
                btn
                (ht-get git-info (treemacs-button-get btn :key)))))))))))

This will add log output about what exactly treemacs is trying to do. You'll see a lot of lines like this:

[Treemacs] Apply annotationat at [#<marker (moves after insertion) at 2651 in Treemacs-Scoped-Buffer-#<frame SCRATCH.el - GNU Emacs at am-laptop 0x59c0c205a0e8>> /home/am/Documents/git/treemacs/src/elisp/treemacs.el] git-info [nil] annotation [#s(treemacs-annotation nil nil nil nil treemacs-git-unmodified-face)]

Hopefully that will give us the line where things break.

@eval-exec
Copy link
Author

Hello, I get this error today. And I don't know how to reproduce:

Debugger entered--Lisp error: (wrong-type-argument arrayp nil)
  treemacs--consolidate-projects()
  treemacs--show-single-project("/home/exec/.config/emacs" "emacs")
  treemacs--do-follow-project()
  #<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_7>()
  apply(#<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_7> nil)
  timer-event-handler([t 0 0 100000 nil #<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_7> nil idle 0 nil])
  redisplay(t)
  pos-tip-compute-pixel-position(nil #<window 3 on ediff.el> 874 39 nil nil 44)
  pos-tip-show-no-propertize(#("The footer should be: (provide 'ediff)\\n;;; ediff.el ends here" 0 62 (face (:font #<font-object "-JB-JetBrainsMono Nerd Font-regular-normal-normal-*-24-*-*-*-m-0-iso10646-1"> :foreground "white" :background "gray10"))) nil nil #<window 3 on ediff.el> 3 874 39 nil nil 44)
  pos-tip-show("The footer should be: (provide 'ediff)\\n;;; ediff.el ends here" nil nil nil 3 nil nil nil 44)
  flycheck-pos-tip-error-messages((#s(flycheck-error :buffer #<buffer ediff.el> :checker emacs-lisp-checkdoc :filename "/home/exec/.config/emacs/elisp/ediff.el" :line 24 :column nil :message "The footer should be: (provide 'ediff)\\n;;; ediff.el ends here" :level info :id nil :group nil :-end-line nil :-end-column nil)))
  flycheck-display-errors((#s(flycheck-error :buffer #<buffer ediff.el> :checker emacs-lisp-checkdoc :filename "/home/exec/.config/emacs/elisp/ediff.el" :line 24 :column nil :message "The footer should be: (provide 'ediff)\\n;;; ediff.el ends here" :level info :id nil :group nil :-end-line nil :-end-column nil)))
  flycheck-display-error-at-point()
  apply(flycheck-display-error-at-point nil)
  timer-event-handler([t 26328 15683 352569 nil flycheck-display-error-at-point nil nil 554000 nil])

Copy link

stale bot commented Nov 7, 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 Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants