comparison lisp/simple.el @ 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 b8e337c7df8f
children e4c0623f4a2e
comparison
equal deleted inserted replaced
12399:d205e49dd68c 12400:9e7727cdbb68
48 (let ((last-command-char ?\n) 48 (let ((last-command-char ?\n)
49 ;; Don't auto-fill if we have a numeric argument. 49 ;; Don't auto-fill if we have a numeric argument.
50 ;; Also not if flag is true (it would fill wrong line); 50 ;; Also not if flag is true (it would fill wrong line);
51 ;; there is no need to since we're at BOL. 51 ;; there is no need to since we're at BOL.
52 (auto-fill-function (if (or arg flag) nil auto-fill-function))) 52 (auto-fill-function (if (or arg flag) nil auto-fill-function)))
53 (self-insert-command (prefix-numeric-value arg))) 53 (unwind-protect
54 (self-insert-command (prefix-numeric-value arg))
55 ;; If we get an error in self-insert-command, put point at right place.
56 (if flag (forward-char 1))))
57 ;; If we did *not* get an error, cancel that forward-char.
58 (if flag (backward-char 1))
54 ;; Mark the newline(s) `hard'. 59 ;; Mark the newline(s) `hard'.
55 (if use-hard-newlines 60 (if use-hard-newlines
56 (let* ((from (- (point) (if arg (prefix-numeric-value arg) 1))) 61 (let* ((from (- (point) (if arg (prefix-numeric-value arg) 1)))
57 (sticky (get-text-property from 'rear-nonsticky))) 62 (sticky (get-text-property from 'rear-nonsticky)))
58 (put-text-property from (point) 'hard 't) 63 (put-text-property from (point) 'hard 't)