syl20bnr / spacemacs

A community-driven Emacs distribution - The best editor is neither Emacs nor Vim, it's Emacs *and* Vim!
http://spacemacs.org
GNU General Public License v3.0
23.64k stars 4.89k forks source link

superword-mode and clojure-mode interact poorly. #13193

Open johanatan opened 4 years ago

johanatan commented 4 years ago

When superword-mode is enabled simultaneous to clojure-mode, the cursor will get stuck at the end of specific lines when advancing one word at a time.

johanatan commented 4 years ago

Repro steps are as follows: 1) enable clojure mode. 2) enable superword mode. 3) advance one word at a time until you get stuck at the end of a line (does not happen on every line).

@dpsutton

johanatan commented 4 years ago

@duianto please let me know if you require more detail. thank you.

dpsutton commented 4 years ago

I was unable to reproduce this on my non-spacemacs distro with clojure-mode and superword-mode enabled. What makes you think its these two packages interacting?

johanatan commented 4 years ago

I reproduced this on a fresh machine w/ a fresh install of spacemacs (default config, no customization). I have no knowledge of whether it reproduces on vanilla emacs or not. The combination of things here is: a) spacemacs b) superword-mode c) clojure-mode.

duianto commented 4 years ago

Confirmed

In this example file: https://github.com/clojurebook/ClojureProgramming/blob/master/ch03-game-of-life/src/com/clojurebook/collections/life.clj

With the url added on the first line as a comment:

;; https://github.com/clojurebook/ClojureProgramming/blob/master/ch03-game-of-life/src/com/clojurebook/collections/life.clj

pressing w, stops at the end of the url and after function names with a dash: (defn empty-board (defn count-neighbours etc.

There's an open issue about it upstream in the emacs-evil/evil repository: evil-forward-word-begin doesn't work with superword-mode https://github.com/emacs-evil/evil/issues/721

There's a comment with a possible workaround: https://github.com/emacs-evil/evil/issues/721#issuecomment-517855583

I am experiencing this issue as well.

If it helps, I found that disabling superword-mode and using this workaround helps: https://emacs.stackexchange.com/a/27350/2676

;; For python
(add-hook 'python-mode-hook #'(lambda () (modify-syntax-entry ?_ "w")))
;; For ruby
(add-hook 'ruby-mode-hook #'(lambda () (modify-syntax-entry ?_ "w")))
;; For Javascript
(add-hook 'js2-mode-hook #'(lambda () (modify-syntax-entry ?_ "w")))

which allows evil-mode to consider _ as part of the word. It's not a great solution, but it somewhat mimics superword-mode

jleonard-r7 commented 3 years ago

This issue is actually fairly important to me. It would be nice if it could get some attention at some point. My editing experience would improve tremendously with its resolution.

duianto commented 3 years ago

It's been reported upstream: evil-forward-word-begin doesn't work with superword-mode https://github.com/emacs-evil/evil/issues/721

Could you ping them in that thread. It would also help non-Spacemacs users if it was fixed upstream.

jleonard-r7 commented 2 years ago

This is still an issue.

github-actions[bot] commented 4 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid!

johanatan commented 4 months ago

Still valid.