Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
johanatan opened this issue Jan 18, 2020 · 13 comments
Open

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

johanatan opened this issue Jan 18, 2020 · 13 comments

Comments

@johanatan
Copy link

johanatan commented Jan 18, 2020

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
Copy link
Author

johanatan commented Feb 5, 2020

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
Copy link
Author

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

@dpsutton
Copy link

dpsutton commented Feb 6, 2020

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
Copy link
Author

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
Copy link
Collaborator

duianto commented Feb 9, 2020

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 emacs-evil/evil#721

There's a comment with a possible workaround: emacs-evil/evil#721 (comment)

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

@github-actions github-actions bot added the stale marked as a stale issue/pr (usually by a bot) label Feb 12, 2021
@jleonard-r7
Copy link

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 duianto removed the stale marked as a stale issue/pr (usually by a bot) label Feb 13, 2021
@duianto
Copy link
Collaborator

duianto commented Feb 13, 2021

It's been reported upstream:
evil-forward-word-begin doesn't work with superword-mode
emacs-evil/evil#721

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

@github-actions github-actions bot added the stale marked as a stale issue/pr (usually by a bot) label Feb 13, 2022
@jleonard-r7
Copy link

This is still an issue.

@github-actions github-actions bot removed the stale marked as a stale issue/pr (usually by a bot) label Feb 13, 2022
Repository owner deleted a comment from github-actions bot Feb 13, 2022
Repository owner deleted a comment from github-actions bot Feb 13, 2022
Copy link

github-actions bot commented May 1, 2024

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!

@github-actions github-actions bot added the stale marked as a stale issue/pr (usually by a bot) label May 1, 2024
@johanatan
Copy link
Author

Still valid.

@github-actions github-actions bot removed the stale marked as a stale issue/pr (usually by a bot) label May 1, 2024
@smile13241324 smile13241324 self-assigned this Sep 14, 2024
@smile13241324
Copy link
Collaborator

This seems to be caused by an upstream issue which has not been solved for quite a long time. I will try to find a workaround in spacemacs to remove the symptoms.

@johanatan
Copy link
Author

Awesome. It would be much appreciated.

@fnussbaum
Copy link
Contributor

The fix in emacs-evil/evil#1931 looks good to me (though I haven't tested it much). As long as that is not merged we could do the same:

(define-advice forward-evil-word (:around (orig-fun &optional count) spacemacs//respect-superword-mode)
  (if (bound-and-true-p superword-mode)
      (forward-evil-symbol count)
    (funcall orig-fun count)))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants