Make down-list signal an error if called inside a string

* lisp/emacs-lisp/lisp.el (down-list): Signal an error inside a
string (bug#5588).
This commit is contained in:
Lars Ingebrigtsen 2022-05-06 21:13:32 +02:00
parent cbd59395bd
commit 0b3b295776

View file

@ -171,6 +171,8 @@ This command assumes point is not in a string or comment.
If INTERACTIVE is non-nil, as it is interactively,
report errors as appropriate for this kind of usage."
(interactive "^p\nd")
(when (ppss-comment-or-string-start (syntax-ppss))
(user-error "This command doesn't work in strings or comments"))
(if interactive
(condition-case _
(down-list arg nil)