-
-
Notifications
You must be signed in to change notification settings - Fork 248
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
After turning off paredit-mode, can't type unbalanced curly brace } #504
Comments
This function might have something to do with it: Lines 490 to 501 in a4ed7a4
|
Probably needs a another function to undo this when leaving paredit-mode. |
paredit's config should have no effect if paredit is disabled. |
@bbatsov I was able to reproduce the problem, and in fact there are side effects in the code above. The defined keys are not restored when the I wrote the following code to restore the desired behavior. If you think this is a proper solution, I can submit a PR with the changes. (defun clojure-paredit-restore-default-keys (&optional keymap)
"Disabling \"paredit-mode\" should restore the `paredit` defined keys on `clojure-mode-map'.
If an optional KEYMAP is passed the changes are applied to it,
instead of to `clojure-mode-map'."
(when (>= paredit-version 21)
(let ((keymap (or keymap clojure-mode-map)))
(define-key keymap "{" #'self-insert-command)
(define-key keymap "}" #'self-insert-command))))
(defadvice paredit-mode (after toggle-clojure-setup-mode activate)
"Advice to restore defined `paredit' keys on the `clojure-mode-map' when `paredit-mode' is disabled."
(when (not paredit-mode)
(clojure-paredit-restore-default-keys))) |
I was refactoring my proposed solution and just noticed that I'm not considering the case where a Something link: (defun clojure-paredit-setup (&optional keymap)
....
(let ((keymap (or keymap clojure-mode-map)))
(define-key keymap "{" #'paredit-open-curly)
(define-key keymap "}" #'paredit-close-curly)
;; added advice
(advice-add 'paredit-mode :after (lambda (keymap) (clojure-paredit-restore-default-keys keymap))))
.... |
Expected behavior
Turn on paredit-mode, then turn it off, and be able to type unbalanced characters
()[]{}
.Actual behavior
Can't type an unbalanced
}
Steps to reproduce the problem
Open a clojure file, run
M-x paredit-mode
, then run it again to turn it off. Try to type a}
. Something of paredit mode persists and prevents it.Environment & Version information
clojure-mode version information
Clojure Mode 5.10.0
I see this is package list, but oddly,
clojure-mode-display-version
is showingclojure-mode (version nil)
in the minibuffer.Emacs version
Emacs 25.3.1
Operating system
macOS 10.13.6
The text was updated successfully, but these errors were encountered: