]> git.eshelyaron.com Git - emacs.git/commitdiff
Make `newline' check the argument earlier
authorLars Ingebrigtsen <larsi@gnus.org>
Thu, 30 Sep 2021 07:03:18 +0000 (09:03 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Thu, 30 Sep 2021 07:03:18 +0000 (09:03 +0200)
* lisp/simple.el (newline): Signal an error earlier to avoid
peculiar behaviour after getting a backtrace (bug#50900).

lisp/simple.el

index 7eba33116dec8fdeb7f70b16bb3f713e2f7f6ff4..11a6a4f1fd3bb5577bdc4c6e467f4f7cf23db019 100644 (file)
@@ -589,6 +589,8 @@ text-property `hard'.
 A non-nil INTERACTIVE argument means to run the `post-self-insert-hook'."
   (interactive "*P\np")
   (barf-if-buffer-read-only)
+  (when (< arg 0)
+    (error "Repetition argument has to be non-negative"))
   ;; Call self-insert so that auto-fill, abbrev expansion etc. happen.
   ;; Set last-command-event to tell self-insert what to insert.
   (let* ((was-page-start (and (bolp) (looking-at page-delimiter)))