Open alexispurslane opened 1 year ago
I'm not seeing this behaviour. Do you have smartparens
enabled? I see that buggy behaviour then. Might be a conflict with that and electric-tads-brace
.
Ohhhh, I'll check on that. I'd removed that behavior entirely to make it more usable in the meantime but I can put it back.
Yup, it was a conflict with smartparens. I'm going to see if I can figure out how to modify the function so that it is compatible with smartparens being on.
Alright, I managed to get a (possibly simpleminded) prototype implementation of electric braces going that works with and without smartparens enabled. Here it is:
(defun electric-tads3-brace (arg)
"Insert character and correct line's indentation."
(interactive "P")
(let (insertpos)
(if (and tads3-auto-newline
(not (save-excursion
(skip-chars-backward " \t")
(bolp))))
(progn
(tads3-indent-line)
(newline)))
(self-insert-command (prefix-numeric-value arg))
(tads3-indent-line)
(newline)
(save-excursion
(newline)
(tads3-indent-line))
(tads3-indent-line)))
I kept insertpos around bc if I need to expand this later to add some of the logic back, it might be needed.
When entering an open curly brace, it puts the cursor outside of the braces instead of inside when auto-newline is enabled.