Signal a better error in tabulated-list-sort

* lisp/emacs-lisp/tabulated-list.el (tabulated-list-sort): Signal
error earlier on invalid column numbers (bug#52154).
This commit is contained in:
Lars Ingebrigtsen 2021-11-29 16:39:02 +01:00
parent e3351f6152
commit 4de13ef147

View file

@ -684,6 +684,10 @@ With a numeric prefix argument N, sort the Nth column.
If the numeric prefix is -1, restore order the list was
originally displayed in."
(interactive "P")
(when (and n
(or (>= n (length tabulated-list-format))
(< n -1)))
(user-error "Invalid column number"))
(if (equal n -1)
;; Restore original order.
(progn