summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2021-09-30 09:03:18 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2021-09-30 09:03:18 +0200
commitd1aacceae939318f419e0c265358e041c53f1eea (patch)
tree7da7e0b387c2ca85dafdd0833eb7c5e4bd37e27e /lisp
parentc42af5aee74f310bdcd63aac96b1c02ec07a1c50 (diff)
downloademacs-d1aacceae939318f419e0c265358e041c53f1eea.tar.gz
emacs-d1aacceae939318f419e0c265358e041c53f1eea.tar.bz2
emacs-d1aacceae939318f419e0c265358e041c53f1eea.zip
Make `newline' check the argument earlier
* lisp/simple.el (newline): Signal an error earlier to avoid peculiar behaviour after getting a backtrace (bug#50900).
Diffstat (limited to 'lisp')
-rw-r--r--lisp/simple.el2
1 files changed, 2 insertions, 0 deletions
diff --git a/lisp/simple.el b/lisp/simple.el
index 7eba33116de..11a6a4f1fd3 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -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)))