justinbarclay / parinfer-rust-mode

Simplifying how you write Lisp
https://shaunlebron.github.io/parinfer/
GNU General Public License v3.0
227 stars 16 forks source link

Weird behaviour in let statement #66

Closed fixgoats closed 5 months ago

fixgoats commented 1 year ago

I'm a Lisp newb so maybe this is intended behaviour and I should be doing something else, but I was trying to write a let statement as shown in the included screengrab, and when I hit enter the cursor freaked out and jumped into the "let" word.

https://user-images.githubusercontent.com/18019781/217111033-e4cb8cc3-fb05-4cb4-a1af-0bd0dbbb9bad.mp4

justinbarclay commented 1 year ago

Hmm I can't recreate that in Emacs-Lisp or Common-Lisp modes?

Are you using Evil perhaps? Or are you using any minor modes that manage your whitespace or parens?

randall-fulton commented 1 year ago

I have been dealing with this as well. In trying to recreate a simple init.el to reproduce, I found indent-tabs-mode to be the culprit.

Simple reproduction, if you are curious:

(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(package-refresh-contents)
(package-install 'use-package)
(eval-when-compile (require 'use-package))

(indent-tabs-mode 1)

(use-package parinfer-rust-mode
  :ensure t
  :hook emacs-lisp-mode)

;; try adding a new var to the let and cursor jumps to the "t" in "let"
(defun foo (bar)
  (let ((baz bar))))

In my case, solved with a simple hook:

(add-hook 'emacs-lisp-mode-hook #'(lambda () (indent-tabs-mode -1)))
justinbarclay commented 5 months ago

I've added indent-tabs-mode to one of the modes parinfer-rust-mode will try to disable if it detects it. Hopefully this helps fix the problem. If not we can reopen the issue