Skip to content

Commit d224648

Browse files
bzgbbatsov
authored andcommitted
Prevent electric indentation within inlined docstrings
Fix #447 (comment)
1 parent 62e13ca commit d224648

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

clojure-mode.el

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -554,9 +554,14 @@ replacement for `cljr-expand-let`."
554554
(clojure-font-lock-setup)
555555
(add-hook 'paredit-mode-hook #'clojure-paredit-setup)
556556
;; `electric-layout-post-self-insert-function' prevents indentation in strings
557-
;; and comments, force indentation in docstrings:
557+
;; and comments, force indentation of non-inlined docstrings:
558558
(add-hook 'electric-indent-functions
559-
(lambda (_char) (if (clojure-in-docstring-p) 'do-indent)))
559+
(lambda (_char) (if (and (clojure-in-docstring-p)
560+
(save-excursion
561+
(beginning-of-line-text)
562+
(eq (get-text-property (point) 'face)
563+
'font-lock-doc-face)))
564+
'do-indent)))
560565
;; integration with project.el
561566
(add-hook 'project-find-functions #'clojure-current-project))
562567

0 commit comments

Comments
 (0)