Comments (8)
I use multiple cursors and iedit along with tree-sitter and I don't experience this issue
from elisp-tree-sitter.
Can you provide more details for to reproduce/debug the issue? For example:
- A minimal file with the issue.
- Steps to trigger the issue, using that file.
- What is the expected behavior? What did you observe instead?
from elisp-tree-sitter.
Thank you for the reply.
I think the issue might lay within evil-multiedit
, I brought up the issue in their repo: hlissner/evil-multiedit#40 with snippets to reproduce in a Doom emacs setup.
from elisp-tree-sitter.
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)
from elisp-tree-sitter.
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?
from elisp-tree-sitter.
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.
from elisp-tree-sitter.
closing this since it is a issue with iedit
from elisp-tree-sitter.
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.
from elisp-tree-sitter.
Related Issues (20)
- Tree sitter highlighting breaks buffer content during search/replace (reproducible example within)
- Nested template strings arenβt (can't be?) highlighted properly
- Building melpa packages from the master branch HOT 2
- `tsc-traverse-mapc` doesn't forward DEPTH to FUNC when PROPS is fed nil
- Doesn't highlight Rust documentation code examples
- Swift support, revisited. HOT 1
- wrong ELF class: ELFCLASS64 on RPI4 HOT 1
- `Unsupported Operating System: OpenBSD` HOT 7
- bin/build not work on linux because builtin cd will output the folder name. HOT 1
- tree-sitter languages download of windows binaries failed with error
- tsc-lang-abi-too-new when installing new language HOT 11
- Crash when large file contains an ERROR node
- Invalid version syntax: β[email protected] HOT 2
- Colors look wrong in haskell mode. HOT 3
- `tree-sitter-debug-mode` is broken
- Crash when loading one particular Markdown file HOT 7
- Reporting Vulnerability
- (ts-fold-indicators-mode) not working when running emacs from terminal
- How do I add a new grammer to this mode? HOT 2
- why the submodule langs pointed to an old commit?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from elisp-tree-sitter.