Closed lccambiaghi closed 3 years ago
I use multiple cursors and iedit along with tree-sitter and I don't experience this issue
Can you provide more details for to reproduce/debug the issue? For example:
Thank you for the reply.
I think the issue might lay within evil-multiedit
, I brought up the issue in their repo: https://github.com/hlissner/evil-multiedit/issues/40 with snippets to reproduce in a Doom emacs setup.
I reproduced the error.. I have highlighted all (3) occurrences with evil-multiedit-match-all
, tried to change them all at once with evil-multiedit--append-line
but only 2 out of 3 successfully changed. The debugger outputted this stacktrace:
Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil)
tree-sitter--after-change(3193 3193 1)
run-hook-with-args(tree-sitter--after-change 3193 3193 1)
iedit-update-occurrences-2(#<overlay from 704 to 723 in main_total_forecasts.py> t 723 723 1)
iedit-update-occurrences(#<overlay from 704 to 723 in main_total_forecasts.py> t 723 723 1)
delete-char(-1)
(cond ((and op cl (string= op cl) (and (string= (char-to-string (or (char-before) 0)) op) (setq open-len (length op))) (and (string= (char-to-string (or (char-after) 0)) cl) (setq close-len (length cl)))) (delete-char (- open-len)) (delete-char close-len)) ((and (not indent-tabs-mode) (> tab-width 1) (not (bolp)) (not (doom-point-in-string-p)) (save-excursion (>= (- (skip-chars-backward " \11")) tab-width))) (let ((movement (% (current-column) tab-width))) (if (= movement 0) (progn (setq movement tab-width))) (delete-char (- movement))) (if (memq (char-before) (list 10 32)) nil (insert " "))) ((delete-char -1)))
(let* ((context (condition-case nil (progn (sp-get-thing)) (error nil))) (op (plist-get context :op)) (cl (plist-get context :cl)) open-len close-len) (cond ((and op cl (string= op cl) (and (string= (char-to-string (or ... 0)) op) (setq open-len (length op))) (and (string= (char-to-string (or ... 0)) cl) (setq close-len (length cl)))) (delete-char (- open-len)) (delete-char close-len)) ((and (not indent-tabs-mode) (> tab-width 1) (not (bolp)) (not (doom-point-in-string-p)) (save-excursion (>= (- (skip-chars-backward " \11")) tab-width))) (let ((movement (% (current-column) tab-width))) (if (= movement 0) (progn (setq movement tab-width))) (delete-char (- movement))) (if (memq (char-before) (list 10 32)) nil (insert " "))) ((delete-char -1))))
doom/backward-delete-whitespace-to-column()
(cond ((and end beg (= end (+ beg (length op) (length cl)))) (delete-char (- (length op)))) ((doom-surrounded-p pair 'inline 'balanced) (delete-char -1 killflag) (delete-char 1) (if (= (point) (+ (length cl) beg)) (progn (sp-backward-delete-char 1) (sp-insert-pair op)))) ((and (bolp) (doom-surrounded-p pair nil 'balanced)) (delete-region beg end) (sp-insert-pair op) t) ((run-hook-with-args-until-success 'doom-delete-backward-functions)) ((doom/backward-delete-whitespace-to-column)))
(let* ((pair (condition-case nil (progn (sp-get-thing)) (error nil))) (op (plist-get pair :op)) (cl (plist-get pair :cl)) (beg (plist-get pair :beg)) (end (plist-get pair :end))) (cond ((and end beg (= end (+ beg (length op) (length cl)))) (delete-char (- (length op)))) ((doom-surrounded-p pair 'inline 'balanced) (delete-char -1 killflag) (delete-char 1) (if (= (point) (+ (length cl) beg)) (progn (sp-backward-delete-char 1) (sp-insert-pair op)))) ((and (bolp) (doom-surrounded-p pair nil 'balanced)) (delete-region beg end) (sp-insert-pair op) t) ((run-hook-with-args-until-success 'doom-delete-backward-functions)) ((doom/backward-delete-whitespace-to-column))))
(cond ((or (not t) (not (and (boundp 'smartparens-mode) smartparens-mode)) (and (memq (char-before) (list 32 9)) (save-excursion (and (/= (skip-chars-backward " \11" ...) 0) (bolp))))) (doom/backward-delete-whitespace-to-column)) ((let* ((pair (condition-case nil (progn (sp-get-thing)) (error nil))) (op (plist-get pair :op)) (cl (plist-get pair :cl)) (beg (plist-get pair :beg)) (end (plist-get pair :end))) (cond ((and end beg (= end (+ beg ... ...))) (delete-char (- (length op)))) ((doom-surrounded-p pair 'inline 'balanced) (delete-char -1 killflag) (delete-char 1) (if (= (point) (+ ... beg)) (progn (sp-backward-delete-char 1) (sp-insert-pair op)))) ((and (bolp) (doom-surrounded-p pair nil 'balanced)) (delete-region beg end) (sp-insert-pair op) t) ((run-hook-with-args-until-success 'doom-delete-backward-functions)) ((doom/backward-delete-whitespace-to-column))))))
(cond ((and (use-region-p) delete-active-region (= n 1)) (if (eq delete-active-region 'kill) (kill-region (region-beginning) (region-end) 'region) (funcall region-extract-function 'delete-only))) ((null (or (null overwrite-mode) (<= n 0) (memq (char-before) '(9 10)) (eobp) (eq (char-after) 10))) (let ((ocol (current-column))) (delete-char (- n) killflag) (save-excursion (insert-char 32 (- ocol (current-column)) nil)))) ((= n 1) (cond ((or (not t) (not (and (boundp ...) smartparens-mode)) (and (memq (char-before) (list 32 9)) (save-excursion (and ... ...)))) (doom/backward-delete-whitespace-to-column)) ((let* ((pair (condition-case nil ... ...)) (op (plist-get pair :op)) (cl (plist-get pair :cl)) (beg (plist-get pair :beg)) (end (plist-get pair :end))) (cond ((and end beg ...) (delete-char ...)) ((doom-surrounded-p pair ... ...) (delete-char -1 killflag) (delete-char 1) (if ... ...)) ((and ... ...) (delete-region beg end) (sp-insert-pair op) t) ((run-hook-with-args-until-success ...)) ((doom/backward-delete-whitespace-to-column))))))) ((delete-char (- n) killflag)))
+default--delete-backward-char-a(1 nil)
apply(+default--delete-backward-char-a (1 nil))
delete-backward-char(1 nil)
#<subr funcall-interactively>(delete-backward-char 1 nil)
apply(#<subr funcall-interactively> (delete-backward-char 1 nil))
funcall-interactively(delete-backward-char 1 nil)
#<subr call-interactively>(delete-backward-char nil nil)
apply(#<subr call-interactively> (delete-backward-char nil nil))
explain-pause--wrap-call-interactively(#<subr call-interactively> delete-backward-char nil nil)
apply(explain-pause--wrap-call-interactively #<subr call-interactively> (delete-backward-char nil nil))
call-interactively(delete-backward-char nil nil)
evil-delete-backward-char-and-join(1)
#<subr funcall-interactively>(evil-delete-backward-char-and-join 1)
apply(#<subr funcall-interactively> (evil-delete-backward-char-and-join 1))
funcall-interactively(evil-delete-backward-char-and-join 1)
#<subr call-interactively>(evil-delete-backward-char-and-join nil nil)
apply(#<subr call-interactively> (evil-delete-backward-char-and-join nil nil))
explain-pause--wrap-call-interactively(#<subr call-interactively> evil-delete-backward-char-and-join nil nil)
apply(explain-pause--wrap-call-interactively #<subr call-interactively> (evil-delete-backward-char-and-join nil nil))
call-interactively(evil-delete-backward-char-and-join nil nil)
command-execute(evil-delete-backward-char-and-join)
I use iedit
(which is depended on by evil-multiedit
) along with tree-sitter, and days ago(2020-11-17) I had the save/similar problem. So at that time I added some hook functions to iedit's hooks to disable tree-sitter-mode
when using iedit.
A moment ago I removed these hook functions and made a test again, iedit
worked without any errors, and I found that iedit was updated several times after 2020-11-17 and fixed some issues, so maybe the issue has been fixed at iedit side.
I'm using tree-sitter 0.12.1 and iedit 20201125.342, both were installed from melpa, and I'm using emacs's native-comp branch.
@lccambiaghi Maybe you can update iedit (if you're not using the latest version) and make another test?
Hi @zbelial thank you for your comment! Unfortunately DOOM Emacs has pinned iedit
to an old version. It is good to know that would fix the problem. I am going to investigate the side effects of unpinning it. I guess this issue is not really emacs-tree-sitter
specific then.
closing this since it is a issue with iedit
I took a brief look at iedit
. It uses inhibit-modification-hooks
and calls the change hooks on its own. Doing that right is tricky.
@lccambiaghi You can try changing the pinned version of iedit
in your local Doom installation to see whether the issue persists. If it does, please reopen this.
Hi, I am using your amazing package from Doom Emacs and I found a conflict between
tree-sitter-hl-mode
andevil-multiedit
.To reproduce:
evil-multiedit-match-symbol-and-next
, one occurrence in a string and one occurrence in a variable nameI work with python and both packages are essential to my workflow! Please let me know if I can do anything to help you debug!