In emacs-lisp mode whenever i insert a closing brace i prefer to have indented to the same column like the corresponding opening brace. How is that possible? If i have eg in my init.el
(defadvice isearch-forward-regexp (before kill-ring-save-before-search activate)
"Save region (if active) to kill-ring before starting isearch. So that region
can be inserted into isearch easily with C-y."
(when (region-active-p)
(kill-ring-save (region-beginning) (region-end))
) ;; this should be under (when
) ;; this should be under (defadvice
It seems that you want to align the close parens to be able to
visually match them to the opening ones. You can do that with
show-paren-mode
instead - it's much better at that job.
As pointed out by others, and I fully agree, the hanging parens are very annoying and painful to look at - don't make a habit out of using them. I've authored a minor mode for editing Elisp which might be interesting for you - lispy-mode:
Pressing i will auto-indent an s-expression, eliminating the hanging parens.
Pressing d will switch from one side of s-expression to the other: a quick way to see what the current list contains.
Pressing m will toggle the region selection on the current list: you can see what it contains even more clearly.