summaryrefslogtreecommitdiff
path: root/lisp/electric.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2019-06-26 10:24:59 -0400
committerStefan Monnier <monnier@iro.umontreal.ca>2019-06-26 10:24:59 -0400
commit0b4e003766f15225dede9bdba4ead33e493856e2 (patch)
tree99de57fe8feeca540f398acb232b75e9c802418c /lisp/electric.el
parent699fce296b13d7db386b1cb5cecf2710e5196691 (diff)
downloademacs-0b4e003766f15225dede9bdba4ead33e493856e2.tar.gz
Revert "* lisp/calc/calc-ext.el (math-scalarp): Fix typo"
This reverts commit 698ff554ac2699ec48fefc85a1307cbc4a183b0d.
Diffstat (limited to 'lisp/electric.el')
-rw-r--r--lisp/electric.el38
1 files changed, 15 insertions, 23 deletions
diff --git a/lisp/electric.el b/lisp/electric.el
index c70e60b720a..53e53bd975c 100644
--- a/lisp/electric.el
+++ b/lisp/electric.el
@@ -220,14 +220,6 @@ If `indent-line-function' is one of those, then `electric-indent-mode' will
not try to reindent lines. It is normally better to make the major
mode set `electric-indent-inhibit', but this can be used as a workaround.")
-(defun electric-indent--inhibited-p ()
- (or electric-indent-inhibit
- (memq indent-line-function
- electric-indent-functions-without-reindent)))
-
-(defvar electric-indent--destination nil
- "If non-nil, position to which point will be later restored.")
-
(defun electric-indent-post-self-insert-function ()
"Function that `electric-indent-mode' adds to `post-self-insert-hook'.
This indents if the hook `electric-indent-functions' returns non-nil,
@@ -269,26 +261,26 @@ or comment."
(when at-newline
(let ((before (copy-marker (1- pos) t)))
(save-excursion
- (unless (electric-indent--inhibited-p)
+ (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)
(condition-case-unless-debug ()
(indent-according-to-mode)
- (error (throw 'indent-error nil))))
- ;; The goal here will be to remove the trailing
- ;; whitespace after reindentation of the previous line
- ;; because that may have (re)introduced it.
- (goto-char before)
- ;; We were at EOL in marker `before' before the call
- ;; to `indent-according-to-mode' but after we may
- ;; not be (Bug#15767).
- (when (and (eolp)
- ;; Don't delete "trailing space" before point!
- (not (and electric-indent--destination
- (= (point) electric-indent--destination))))
- (delete-horizontal-space t)))))
- (unless (and (electric-indent--inhibited-p)
+ (error (throw 'indent-error nil)))
+ ;; The goal here will be to remove the trailing
+ ;; whitespace after reindentation of the previous line
+ ;; because that may have (re)introduced it.
+ (goto-char before)
+ ;; We were at EOL in marker `before' before the call
+ ;; to `indent-according-to-mode' but after we may
+ ;; not be (Bug#15767).
+ (when (and (eolp))
+ (delete-horizontal-space t))))))
+ (unless (and electric-indent-inhibit
(not at-newline))
(condition-case-unless-debug ()
(indent-according-to-mode)