-
João Távora authored
Entries in electric-layout-rules can specify multiple newline-related actions which are executed in order of appearance. Also, have it play nice with electric-pair-mode when inserting a newlines, particularly with electric-pair-open-newline-between-pairs. Entries in electric-layout-rules can also be functions. Among other things, the logic behind electric-pair-open-newline-between-pairs could now be moved to electric-layout-mode, but this commit doesn't do that yet. This change was motivated by bug#33794 and is an alternative solution to the problem reported in that bug. * lisp/electric.el (electric-layout-rules): Adjust docstring. (electric-layout-post-self-insert-function): Call electric-layout-post-self-insert-function-1. (electric-layout-post-self-insert-function-1): Rename from electric-layout-post-self-insert-function. Redesign. (electric-layout-local-mode): New minor mode. * test/lisp/electric-tests.el (electric-layout-int-main-kernel-style) (electric-layout-int-main-allman-style) (electric-modes-in-c-mode-with-self-insert-command) (electric-pair-mode-newline-between-parens) (electric-layout-mode-newline-between-parens-without-e-p-m) (electric-layout-mode-newline-between-parens-without-e-p-m-2): New tests. (plainer-c-mode): New helper.
949295ae