mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-11-22 07:09:54 +00:00
* lisp/electric.el: Do auto-indent inside strings and comments by default
This fixes bug#20846 where it transpired that there is no good reason to shy away from auto-indenting inside comments and strings. (electric-indent-post-self-insert-function): Don't check syntax-ppss.
This commit is contained in:
parent
4d4c73da5a
commit
246a41759c
7
etc/NEWS
7
etc/NEWS
@ -2451,6 +2451,13 @@ similar to prefix arguments, but are more flexible and discoverable.
|
||||
|
||||
* Incompatible Editing Changes in Emacs 28.1
|
||||
|
||||
** `electric-indent-mode` now also indents inside strings and comments,
|
||||
(unless the indentation function doesn't, of course).
|
||||
To recover the previous behavior you can use:
|
||||
|
||||
(add-hook 'electric-indent-functions
|
||||
(lambda (_) (if (nth 8 (syntax-ppss)) 'no-indent)))
|
||||
|
||||
** The 'M-o' ('facemenu-keymap') global binding has been removed.
|
||||
To restore the old binding, say something like:
|
||||
|
||||
|
@ -245,10 +245,7 @@ or comment."
|
||||
'electric-indent-functions
|
||||
last-command-event)
|
||||
(memq last-command-event electric-indent-chars))))
|
||||
(not
|
||||
(or (memq act '(nil no-indent))
|
||||
;; In a string or comment.
|
||||
(unless (eq act 'do-indent) (nth 8 (syntax-ppss))))))))
|
||||
(not (memq act '(nil no-indent))))))
|
||||
;; If we error during indent, silently give up since this is an
|
||||
;; automatic action that the user didn't explicitly request.
|
||||
;; But we don't want to suppress errors from elsewhere in *this*
|
||||
|
Loading…
Reference in New Issue
Block a user