summaryrefslogtreecommitdiff
path: root/lisp/simple.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1995-06-27 18:58:26 +0000
committerRichard M. Stallman <rms@gnu.org>1995-06-27 18:58:26 +0000
commit4cc9d0dcf0632369488c176c4860dad3414752f5 (patch)
tree034181e974c93d28668ae9e52aa03a1079a088ae /lisp/simple.el
parent9cb2482e93ce66b2e0ff1a551dc208f76ea33429 (diff)
downloademacs-4cc9d0dcf0632369488c176c4860dad3414752f5.tar.gz
(newline): Put point at right place if insert gets error.
Diffstat (limited to 'lisp/simple.el')
-rw-r--r--lisp/simple.el7
1 files changed, 6 insertions, 1 deletions
diff --git a/lisp/simple.el b/lisp/simple.el
index abe742152b4..60244e59a4f 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -50,7 +50,12 @@ In Auto Fill mode, if no numeric arg, break the preceding line if it's long."
;; Also not if flag is true (it would fill wrong line);
;; there is no need to since we're at BOL.
(auto-fill-function (if (or arg flag) nil auto-fill-function)))
- (self-insert-command (prefix-numeric-value arg)))
+ (unwind-protect
+ (self-insert-command (prefix-numeric-value arg))
+ ;; If we get an error in self-insert-command, put point at right place.
+ (if flag (forward-char 1))))
+ ;; If we did *not* get an error, cancel that forward-char.
+ (if flag (backward-char 1))
;; Mark the newline(s) `hard'.
(if use-hard-newlines
(let* ((from (- (point) (if arg (prefix-numeric-value arg) 1)))