clojure-mode.el (clojure-mode): Force elec. indentation in a docstring#447
Merged
bbatsov merged 2 commits intoclojure-emacs:masterfrom Oct 7, 2017
bzg:master
Merged
clojure-mode.el (clojure-mode): Force elec. indentation in a docstring#447bbatsov merged 2 commits intoclojure-emacs:masterfrom bzg:master
bbatsov merged 2 commits intoclojure-emacs:masterfrom
bzg:master
Conversation
…ring By default, ‘electric-layout-post-self-insert-function’ prevents indentation in strings and comments. When ‘electric-indent-mode’ is on, we want ‘newline’ to reindent the line when the point is within a docstring, so this patch adds a hook to ‘electric-indent-functions’ to that effect.
|
It appears to work for me. Thanks! |
bbatsov
reviewed
Oct 7, 2017
| (clojure-font-lock-setup) | ||
| (add-hook 'paredit-mode-hook #'clojure-paredit-setup)) | ||
| (add-hook 'paredit-mode-hook #'clojure-paredit-setup) | ||
| (add-hook 'electric-indent-functions |
Member
There was a problem hiding this comment.
I'd really add some explanations here, as people are going to be confused by this bit of code for sure.
You might also consider adding some simple unit test verifying the correct behavior when electric indent is enabled.
Member
|
Apart from my small inline remark - this needs a changelog entry. |
Contributor
Author
|
Hi @bbatsov, thanks for the feedback! I've completely the previous commit with an inline comment and a changelog entry. Hopefully I've done it right. Thanks! |
slipset
pushed a commit
to slipset/clojure-mode
that referenced
this pull request
Nov 1, 2017
By default, ‘electric-layout-post-self-insert-function’ prevents indentation in strings and comments. When ‘electric-indent-mode’ is on, we want ‘newline’ to reindent the line when the point is within a docstring, so this patch adds a hook to ‘electric-indent-functions’ to that effect.
Contributor
|
This commit breaks variable docstrings indentation for me. Entering a char in the docstring forces an indent by two spaces: I had to disable |
5 tasks
bbatsov
pushed a commit
that referenced
this pull request
Jul 9, 2019
bbatsov
added a commit
that referenced
this pull request
Feb 18, 2026
- Fix issue number/URL mismatches (#520 -> #508, #447 -> #241) - Fix double parenthesis in #528 link - Add missing colon after #608 issue link - Add missing "Bugs fixed" subheading under 5.9.1 - Fix missing space after backtick-quoted text - Fix "airity" typo -> "arity" - Fix wrong function name clojure-toggle-defun -> clojure-toggle-ignore-defun
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
By default,
electric-layout-post-self-insert-functionprevents indentation in strings and comments. Whenelectric-indent-modeis on, we wantnewlineto reindent the line when the point is within a docstring, so this patch adds a hook toelectric-indent-functionsto that effect.See #241 (comment) for a discussion about this bug.