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

electric-indent-mode #318

Open
TobiasZawada opened this issue May 24, 2022 · 0 comments
Open

electric-indent-mode #318

TobiasZawada opened this issue May 24, 2022 · 0 comments

Comments

@TobiasZawada
Copy link

TobiasZawada commented May 24, 2022

Don't have much time. Have to work.

But, the following advice lets electric-indent-mode work more like intended:

(defun adocTZA-polymode-electric-indent-line (fun)
  "Give `electric-indent-post-self-insert-function' the right indentation.
This is an advice for `electric-indent-post-self-insert-function' as FUN."
  (let ((electric-indent-functions-without-reindent
	 (and
	  (memq pm--indent-line-function-original electric-indent-functions-without-reindent)
	  '(pm-indent-line-dispatcher))))
    (funcall fun)))

(advice-add 'electric-indent-post-self-insert-function :around #'adocTZA-polymode-electric-indent-line)

(Really sorry, that I cannot be of more help at the moment...)

Without the advice electric-indent-mode also indents the current line at newline in modes where it shouldn't. (It should only indent the newly created line.)
For examples of affected modes, see the current setting of electric-indent-functions-without-reindent.

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

No branches or pull requests

1 participant