I am getting [Treemacs] Error on highlight, this shouldn't happen: (wrong-type-argument overlayp nil) when I try to enable treemacs-mode.
Does the error go away if you disable treemacs-fringe-indicator-mode?
What is the value of treemacs--fringe-indicator-bitmap?
Also try again after evaluating the following code and enabling debug-on-error. I'll need a stack trace to debug this.
(defun treemacs--update-icon-selection ()
"Highlight current icon, unhighlight `treemacs--last-highlight'."
(when (eq major-mode 'treemacs-mode)
(progn
(when treemacs-fringe-indicator-mode
(treemacs--move-fringe-indicator-to-point))
(-when-let (btn (treemacs-current-button))
(let* ((pos (max (point-at-bol) (- (button-start btn) 2)))
(img-selected (get-text-property pos 'img-selected)))
(treemacs-with-writable-buffer
(when treemacs--last-highlight
(let* ((last-pos (- (button-start treemacs--last-highlight) 2))
(img-unselected (get-text-property last-pos 'img-unselected)))
(put-text-property last-pos (1+ last-pos) 'display img-unselected)))
(when img-selected
(put-text-property pos (1+ pos) 'display img-selected)
(setq treemacs--last-highlight btn))))))))
I don't know if this is the same issue, but the error message is similar.
When S-h (treemacs-collapse-parent-node) is pressed on a directory at a projects first level.
project
dir1
dir2
subdir1
subdir2
dir3
dir1:S-hThis message appears:
[Treemacs] Error on highlight, this shouldn't happen: (args-out-of-range 12 12)
The project folds closed.
When the project is unfolded TAB, then this error message is shown:
[Treemacs] Error on highlight, this shouldn't happen: (args-out-of-range 39 39)
The 39 39 error message repeats when navigating up k or down j, except when the cursor is moved to the empty line below dir3, then there's no error message.
Closing and reopening the Treemacs window stops the error messages, until S-h is pressed again on a first level directory.
Pressing S-h on a sub directory (subdir1 or subdir2) works as expected, it folds closed the parent directory (dir2).
The previous comment asked for the value of the following variable:
treemacs--fringe-indicator-bitmap is a variable defined in ‘treemacs-customization.el’.
Its value is ‘treemacs--fringe-indicator-bitmap’
treemacs--update-icon-selection and enabling debugSPC f t has been opened at least once.SPC t D has been enabled.dir1 has been selected.S-h has been pressedError in post-command-hook (hl-line-highlight): (args-out-of-range 12 12)The project can be unfolded TAB, but the fringe indicator is stuck (doesn't move with the cursor), and the project and the (sub)dirs all have the line highlight background color.
The cursors location can be detected by toggling the selection on and off with v.
Pressing S-h on dir1 when it's are closed, just closes the project without any error messages.
But if dir1 is opened TAB (the icon changes an open folder), and S-h is pressed, then the project closes, but when it's opened TAB, then a *Backtrace* buffer opens:
Debugger entered--Lisp error: (args-out-of-range 39 39)
previous-single-property-change(39 button)
button-start(#<marker (moves after insertion) at 38 in *Treemacs-Framebuffer-1*>)
(- (button-start treemacs--last-highlight) 2)
(let* ((last-pos (- (button-start treemacs--last-highlight) 2)) (img-unselected (get-text-property last-pos 'img-unselected))) (put-text-property last-pos (1+ last-pos) 'display img-unselected))
(progn (let* ((last-pos (- (button-start treemacs--last-highlight) 2)) (img-unselected (get-text-property last-pos 'img-unselected))) (put-text-property last-pos (1+ last-pos) 'display img-unselected)))
(if treemacs--last-highlight (progn (let* ((last-pos (- (button-start treemacs--last-highlight) 2)) (img-unselected (get-text-property last-pos 'img-unselected))) (put-text-property last-pos (1+ last-pos) 'display img-unselected))))
(let (buffer-read-only) (if treemacs--last-highlight (progn (let* ((last-pos (- (button-start treemacs--last-highlight) 2)) (img-unselected (get-text-property last-pos 'img-unselected))) (put-text-property last-pos (1+ last-pos) 'display img-unselected)))) (if img-selected (progn (put-text-property pos (1+ pos) 'display img-selected) (setq treemacs--last-highlight btn))))
(let* ((pos (max (point-at-bol) (- (button-start btn) 2))) (img-selected (get-text-property pos 'img-selected))) (let (buffer-read-only) (if treemacs--last-highlight (progn (let* ((last-pos (- (button-start treemacs--last-highlight) 2)) (img-unselected (get-text-property last-pos 'img-unselected))) (put-text-property last-pos (1+ last-pos) 'display img-unselected)))) (if img-selected (progn (put-text-property pos (1+ pos) 'display img-selected) (setq treemacs--last-highlight btn)))))
(progn (let* ((pos (max (point-at-bol) (- (button-start btn) 2))) (img-selected (get-text-property pos 'img-selected))) (let (buffer-read-only) (if treemacs--last-highlight (progn (let* ((last-pos (- (button-start treemacs--last-highlight) 2)) (img-unselected (get-text-property last-pos 'img-unselected))) (put-text-property last-pos (1+ last-pos) 'display img-unselected)))) (if img-selected (progn (put-text-property pos (1+ pos) 'display img-selected) (setq treemacs--last-highlight btn))))))
(if btn (progn (let* ((pos (max (point-at-bol) (- (button-start btn) 2))) (img-selected (get-text-property pos 'img-selected))) (let (buffer-read-only) (if treemacs--last-highlight (progn (let* ((last-pos (- (button-start treemacs--last-highlight) 2)) (img-unselected (get-text-property last-pos 'img-unselected))) (put-text-property last-pos (1+ last-pos) 'display img-unselected)))) (if img-selected (progn (put-text-property pos (1+ pos) 'display img-selected) (setq treemacs--last-highlight btn)))))))
(let ((btn (let* ((point-at-bol (point-at-bol))) (if (get-text-property point-at-bol 'button) (copy-marker point-at-bol t) (let* ((p (next-single-property-change point-at-bol 'button nil (point-at-eol)))) (if (get-char-property p 'button) (progn (copy-marker p t)))))))) (if btn (progn (let* ((pos (max (point-at-bol) (- (button-start btn) 2))) (img-selected (get-text-property pos 'img-selected))) (let (buffer-read-only) (if treemacs--last-highlight (progn (let* ((last-pos (- (button-start treemacs--last-highlight) 2)) (img-unselected (get-text-property last-pos 'img-unselected))) (put-text-property last-pos (1+ last-pos) 'display img-unselected)))) (if img-selected (progn (put-text-property pos (1+ pos) 'display img-selected) (setq treemacs--last-highlight btn))))))))
(progn (if treemacs-fringe-indicator-mode (progn (let* ((pabol (point-at-bol))) (move-overlay treemacs--fringe-indicator-overlay pabol (1+ pabol))))) (let ((btn (let* ((point-at-bol (point-at-bol))) (if (get-text-property point-at-bol 'button) (copy-marker point-at-bol t) (let* ((p (next-single-property-change point-at-bol 'button nil (point-at-eol)))) (if (get-char-property p 'button) (progn (copy-marker p t)))))))) (if btn (progn (let* ((pos (max (point-at-bol) (- (button-start btn) 2))) (img-selected (get-text-property pos 'img-selected))) (let (buffer-read-only) (if treemacs--last-highlight (progn (let* ((last-pos (- (button-start treemacs--last-highlight) 2)) (img-unselected (get-text-property last-pos 'img-unselected))) (put-text-property last-pos (1+ last-pos) 'display img-unselected)))) (if img-selected (progn (put-text-property pos (1+ pos) 'display img-selected) (setq treemacs--last-highlight btn)))))))))
(progn (progn (if treemacs-fringe-indicator-mode (progn (let* ((pabol (point-at-bol))) (move-overlay treemacs--fringe-indicator-overlay pabol (1+ pabol))))) (let ((btn (let* ((point-at-bol (point-at-bol))) (if (get-text-property point-at-bol 'button) (copy-marker point-at-bol t) (let* ((p (next-single-property-change point-at-bol 'button nil (point-at-eol)))) (if (get-char-property p 'button) (progn (copy-marker p t)))))))) (if btn (progn (let* ((pos (max (point-at-bol) (- (button-start btn) 2))) (img-selected (get-text-property pos 'img-selected))) (let (buffer-read-only) (if treemacs--last-highlight (progn (let* ((last-pos (- (button-start treemacs--last-highlight) 2)) (img-unselected (get-text-property last-pos 'img-unselected))) (put-text-property last-pos (1+ last-pos) 'display img-unselected)))) (if img-selected (progn (put-text-property pos (1+ pos) 'display img-selected) (setq treemacs--last-highlight btn))))))))))
(if (eq major-mode 'treemacs-mode) (progn (progn (if treemacs-fringe-indicator-mode (progn (let* ((pabol (point-at-bol))) (move-overlay treemacs--fringe-indicator-overlay pabol (1+ pabol))))) (let ((btn (let* ((point-at-bol (point-at-bol))) (if (get-text-property point-at-bol 'button) (copy-marker point-at-bol t) (let* ((p (next-single-property-change point-at-bol 'button nil (point-at-eol)))) (if (get-char-property p 'button) (progn (copy-marker p t)))))))) (if btn (progn (let* ((pos (max (point-at-bol) (- (button-start btn) 2))) (img-selected (get-text-property pos 'img-selected))) (let (buffer-read-only) (if treemacs--last-highlight (progn (let* ((last-pos (- (button-start treemacs--last-highlight) 2)) (img-unselected (get-text-property last-pos 'img-unselected))) (put-text-property last-pos (1+ last-pos) 'display img-unselected)))) (if img-selected (progn (put-text-property pos (1+ pos) 'display img-selected) (setq treemacs--last-highlight btn)))))))))))
treemacs--update-icon-selection()
apply(treemacs--update-icon-selection nil)
hl-line-highlight()
treemacs-goto-file-node("c:/project/dir1" nil)
treemacs-goto-node("c:/project/dir1")
treemacs--reopen-at("c:/project" nil)
treemacs--expand-root-node(#<marker (moves after insertion) at 3 in *Treemacs-Framebuffer-1*>)
treemacs-toggle-node(nil)
treemacs-TAB-action(nil)
funcall-interactively(treemacs-TAB-action nil)
call-interactively(treemacs-TAB-action nil nil)
command-execute(treemacs-TAB-action)
It might have been fixed, I just updated the packages, and I'm not seeing the error message:
[Treemacs] Error on highlight, this shouldn't happen: (args-out-of-range 12 12)
I should have updated the packages before posting, sorry about that 😄
To be fair I think I only pushed that fix this morning.
I had started a draft on this issue yesterday and posted it today, but as the rule goes: pull before push
Did I forget to close this? I think I did.
Hi,
I face this error when trying treemacs mode, with latest treemacs package from melpa (20190211) and emacs 26 (on MS Windows).
@deb75: Do you mean that your calling the command treemacs-mode in a buffer for example the *scratch* buffer?
Because I'm getting this message when I do that:
[Treemacs] Error on highlight, this shouldn't happen: (wrong-type-argument overlayp nil)
But that's not how Treemacs is supposed to be used.
You just call M-x treemacs RET and the Treemacs side window opens.
Since a lot of packages are enabled with treemacs-mode, I can see that one could come to that conclusion about Treemacs as well, but Treemacs is a tree layout file explorer, it's not a mode that's enabled in any buffer.
@Alexander-Miller If treemacs-mode is called manually from a non-treemacs buffer, then maybe a message could be shown describing how to use Treemacs, or the Treemacs side window could open (although that might lead to the conclusion that treemacs-mode is the command to open Treemacs).
Hi,
Thanks for your anweer.
Indeed, it works following your piece of advice.
Regards
@Alexander-Miller This issue should probably be reopened, I see now that the original report is the same as reported by dab75.
About calling treemacs-mode directly.
My issue report about error messages when collapsing the parent node and expanding it, was unrelated (it's fixed).
when I try to enable treemacs-mode.
Boy do I suck at reading comprehension.
then maybe a message could be shown describing how to use Treemacs, or the Treemacs side window could open
It'd rather not bend around my major-mode in arcane ways to try and do the right thing the way javascript bends the meaning of {} + [] to prevent a type error. That'd only encourage the wrong behavior. An error message is definitely the way to go. In fact I've got just the right format for it as well:
--------------------------
< You're doing it wrong. >
--------------------------
\
\
__
/ \
| |
@ @
| |
|| |/
|| ||
|\_/|
\___/
Most helpful comment
Boy do I suck at reading comprehension.
It'd rather not bend around my major-mode in arcane ways to try and do the right thing the way javascript bends the meaning of
{} + []to prevent a type error. That'd only encourage the wrong behavior. An error message is definitely the way to go. In fact I've got just the right format for it as well: