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

paredit-mode inserts extra space in clojure-mode #565

Closed
dgr opened this issue Apr 17, 2020 · 2 comments · Fixed by #566
Closed

paredit-mode inserts extra space in clojure-mode #565

dgr opened this issue Apr 17, 2020 · 2 comments · Fixed by #566

Comments

@dgr
Copy link

dgr commented Apr 17, 2020

I'm not sure whether the following is a clojure-mode or paredit-mode bug. Recent updates seem to have introduced this, however, and it doesn't happen when using paredit-mode in other modes (e.g., emacs-lisp-mode).

Expected behavior

If I want to quote a list, I would typically type '( and paredit-mode would insert the closing parenthesis and it would show '() in the buffer.

Actual behavior

In clojure-mode, when I type the opening parenthesis, paredit-mode inserts an extra space between the tick and the opening parenthesis, leaving '<space>() rather than '() in the buffer (where <space> represents the extra space). This does NOT happen when using paredit-mode with emacs-lisp-mode, lisp-mode, or scheme-mode. This suggests that the root cause of the bug is located in clojure-mode.

Steps to reproduce the problem

The following init.el shows a minimal configuration. With this init.el, start emacs and then in the *scratch* buffer, type '( in emacs-lisp mode. Notice that no extra space is entered between the tick and the opening parenthesis.

Next, switch to clojure-mode (e.g., just use M-x clojure-mode in the *scratch* buffer). Type '( again and notice the extra space.

Sample init.el:

(require 'package)
(add-to-list 'package-archives
             '("melpa" . "http://melpa.milkbox.net/packages/")
             t)
(package-initialize)

;;; Bootstrap use-package if it isn't already installed
(unless (package-installed-p 'use-package)
  (unless package-archive-contents
    (package-refresh-contents))
  (package-install 'use-package))

(require 'use-package)

(use-package paredit
  :ensure t
  :hook ((emacs-lisp-mode clojure-mode cider-repl-mode lisp-mode scheme-mode) . paredit-mode))

(use-package clojure-mode
  :ensure t
  :mode (("\\.clj\\'" . clojure-mode)
         ("\\.cljs\\'" . clojurescript-mode)
         ("\\.cljc\\'" . clojurec-mode)
         ("\\.cljx\\'" . clojurex-mode)))

Environment & Version information

clojure-mode version

clojure-mode (version 5.2.0-snapshot)

Emacs version

GNU Emacs 26.3 (build 1, x86_64-apple-darwin18.2.0, NS appkit-1671.20 Version 10.14.3 (Build 18D109))
 of 2019-09-02

installed via brew cask install emacs.

Operating system

MacOS 10.15.4 (Catalina)

@yuhan0
Copy link
Contributor

yuhan0 commented Apr 18, 2020

Looks like more fallout from the syntax table changes in #559 :/

I think the fix for this lies in clojure-space-for-delimiter-p, will look into it a bit more and submit a PR

@dgr
Copy link
Author

dgr commented Apr 19, 2020

Thanks, folks.

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

Successfully merging a pull request may close this issue.

2 participants