changeset 12400:9e7727cdbb68

(newline): Put point at right place if insert gets error.
author Richard M. Stallman <rms@gnu.org>
date Tue, 27 Jun 1995 18:58:26 +0000
parents d205e49dd68c
children 5c1a20283286
files lisp/simple.el
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/simple.el	Tue Jun 27 17:05:29 1995 +0000
+++ b/lisp/simple.el	Tue Jun 27 18:58:26 1995 +0000
@@ -50,7 +50,12 @@
 	  ;; 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)))