Skip to content

Fix auto-insertion of spaces in paredit #566

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

Merged
merged 9 commits into from
Apr 19, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 4 additions & 13 deletions clojure-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -457,20 +457,11 @@ The command will prompt you to select one of the available sections."
See `paredit-space-for-delimiter-predicates' for the meaning of
ENDP and DELIM."
(or endp
(not (memq delim '(?\" ?{ ?\( )))
(not (or (derived-mode-p 'clojure-mode)
(not (memq delim '(?\" ?\{ ?\())) ;; always insert for [
(not (or (derived-mode-p 'clojure-mode) ;; FIXME why does this check exist
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because without it this code would be applied to any mode where paredit is enabled.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I thought it was a mode local variable - will add it back in.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, wouldn't it make more sense to do (make-local-variable 'paredit-space-for-delimiter-predicates) inside clojure-paredit-setup rather than add global predicates?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess that's an option as well.

(derived-mode-p 'cider-repl-mode)))
(save-excursion
(backward-char)
(cond ((eq (char-after) ?#)
(and (not (bobp))
(or (char-equal ?w (char-syntax (char-before)))
(char-equal ?_ (char-syntax (char-before))))))
((and (eq delim ?\()
(eq (char-after) ??)
(eq (char-before) ?#))
nil)
(t)))))
(not (looking-back "\\_<#\\??")))) ;; auto-gensym syntax foo#


(defconst clojure--collection-tag-regexp "#\\(::[a-zA-Z0-9._-]*\\|:?\\([a-zA-Z0-9._-]+/\\)?[a-zA-Z0-9._-]+\\)"
"Collection reader macro tag regexp.
Expand Down