GithubHelp home page GithubHelp logo

Comments (8)

shackra avatar shackra commented on April 24, 2024

I use multiple cursors and iedit along with tree-sitter and I don't experience this issue

from elisp-tree-sitter.

ubolonton avatar ubolonton commented on April 24, 2024

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.

lccambiaghi avatar lccambiaghi commented on April 24, 2024

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.

lccambiaghi avatar lccambiaghi commented on April 24, 2024

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.

zbelial avatar zbelial commented on April 24, 2024

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.

lccambiaghi avatar lccambiaghi commented on April 24, 2024

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.

shackra avatar shackra commented on April 24, 2024

closing this since it is a issue with iedit

from elisp-tree-sitter.

ubolonton avatar ubolonton commented on April 24, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.