Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
3ebdceaf
Commit
3ebdceaf
authored
May 09, 2014
by
Philipp Rumpf
Committed by
Stefan Monnier
May 09, 2014
Browse files
* lisp/electric.el (electric-indent-post-self-insert-function): Don't use
`pos' after modifying the buffer. Fixes: debbugs:17449
parent
a3eda656
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
22 deletions
+28
-22
lisp/ChangeLog
lisp/ChangeLog
+5
-0
lisp/electric.el
lisp/electric.el
+23
-22
No files found.
lisp/ChangeLog
View file @
3ebdceaf
2014-05-09 Philipp Rumpf <prumpf@gmail.com> (tiny change)
* electric.el (electric-indent-post-self-insert-function): Don't use
`pos' after modifying the buffer (bug#17449).
2014-05-09 Stefan Monnier <monnier@iro.umontreal.ca>
* subr.el (function-put): Add function.
...
...
lisp/electric.el
View file @
3ebdceaf
...
...
@@ -259,29 +259,30 @@ or comment."
(
unless
(
eq
act
'do-indent
)
(
nth
8
(
syntax-ppss
))))))))
;; For newline, we want to reindent both lines and basically behave like
;; reindent-then-newline-and-indent (whose code we hence copied).
(
when
(
<=
pos
(
line-beginning-position
))
(
let
((
before
(
copy-marker
(
1-
pos
)
t
)))
(
save-excursion
(
unless
(
or
(
memq
indent-line-function
electric-indent-functions-without-reindent
)
electric-indent-inhibit
)
;; Don't reindent the previous line if the indentation function
;; is not a real one.
(
let
((
at-newline
(
<=
pos
(
line-beginning-position
))))
(
when
at-newline
(
let
((
before
(
copy-marker
(
1-
pos
)
t
)))
(
save-excursion
(
unless
(
or
(
memq
indent-line-function
electric-indent-functions-without-reindent
)
electric-indent-inhibit
)
;; Don't reindent the previous line if the indentation function
;; is not a real one.
(
goto-char
before
)
(
indent-according-to-mode
))
;; We are at EOL before the call to indent-according-to-mode, and
;; after it we usually are as well, but not always. We tried to
;; address it with `save-excursion' but that uses a normal marker
;; whereas we need `move after insertion', so we do the
;; save/restore by hand.
(
goto-char
before
)
(
indent-according-to-mode
))
;; We are at EOL before the call to indent-according-to-mode, and
;; after it we usually are as well, but not always. We tried to
;; address it with `save-excursion' but that uses a normal marker
;; whereas we need `move after insertion', so we do the
;; save/restore by hand.
(
goto-char
before
)
(
when
(
eolp
)
;; Remove the trailing whitespace after indentation because
;; indentation may (re)introduce the whitespace.
(
delete-horizontal-space
t
)))))
(
unless
(
and
electric-indent-inhibit
(
>
pos
(
line-beginning-position
)))
(
indent-according-to-mode
)))))
(
when
(
eolp
)
;; Remove the trailing whitespace after indentation because
;; indentation may (re)introduce the whitespace.
(
delete-horizontal-space
t
)))))
(
unless
(
and
electric-indent-inhibit
(
not
at-newline
))
(
indent-according-to-mode
))))))
(
put
'electric-indent-post-self-insert-function
'priority
60
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment