Skip to content

Commit a307190

Browse files
author
Bozhidar Batsov
committed
Extract paredit setup into a separate function
1 parent c73fb62 commit a307190

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

clojure-mode.el

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,16 @@ ENDP and DELIMITER."
263263
t)
264264
(= orig-point (match-end 0)))))))))
265265

266+
(defun clojure-paredit-setup ()
267+
"A bit code to make `paredit-mode' play nice with `clojure-mode'."
268+
(when (>= paredit-version 21)
269+
(define-key clojure-mode-map "{" 'paredit-open-curly)
270+
(define-key clojure-mode-map "}" 'paredit-close-curly)
271+
(add-to-list 'paredit-space-for-delimiter-predicates
272+
'clojure-space-for-delimiter-p)
273+
(add-to-list 'paredit-space-for-delimiter-predicates
274+
'clojure-no-space-after-tag)))
275+
266276
;;;###autoload
267277
(define-derived-mode clojure-mode clojure-parent-mode "Clojure"
268278
"Major mode for editing Clojure code.
@@ -287,15 +297,7 @@ ENDP and DELIMITER."
287297
(setq-local parse-sexp-ignore-comments t)
288298
(clojure-mode-font-lock-setup)
289299
(setq-local open-paren-in-column-0-is-defun-start nil)
290-
(add-hook 'paredit-mode-hook
291-
(lambda ()
292-
(when (>= paredit-version 21)
293-
(define-key clojure-mode-map "{" 'paredit-open-curly)
294-
(define-key clojure-mode-map "}" 'paredit-close-curly)
295-
(add-to-list 'paredit-space-for-delimiter-predicates
296-
'clojure-space-for-delimiter-p)
297-
(add-to-list 'paredit-space-for-delimiter-predicates
298-
'clojure-no-space-after-tag)))))
300+
(add-hook 'paredit-mode-hook 'clojure-paredit-setup))
299301

300302
(defsubst clojure-in-docstring-p ()
301303
"Check whether point is in a docstring."

0 commit comments

Comments
 (0)