diff options
| author | Lars Ingebrigtsen | 2021-11-29 16:39:02 +0100 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2021-11-29 16:39:02 +0100 |
| commit | 4de13ef147a4c88c33fe608ee7ca5bd4212476ee (patch) | |
| tree | d7372237d1327baa29c8cc77d6d953ef60be858d | |
| parent | e3351f61529b196a5ad8c772746646a82da2f3a5 (diff) | |
| download | emacs-4de13ef147a4c88c33fe608ee7ca5bd4212476ee.tar.gz emacs-4de13ef147a4c88c33fe608ee7ca5bd4212476ee.zip | |
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).
| -rw-r--r-- | lisp/emacs-lisp/tabulated-list.el | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lisp/emacs-lisp/tabulated-list.el b/lisp/emacs-lisp/tabulated-list.el index 8f6c655dbef..075fe836f6b 100644 --- a/lisp/emacs-lisp/tabulated-list.el +++ b/lisp/emacs-lisp/tabulated-list.el | |||
| @@ -684,6 +684,10 @@ With a numeric prefix argument N, sort the Nth column. | |||
| 684 | If the numeric prefix is -1, restore order the list was | 684 | If the numeric prefix is -1, restore order the list was |
| 685 | originally displayed in." | 685 | originally displayed in." |
| 686 | (interactive "P") | 686 | (interactive "P") |
| 687 | (when (and n | ||
| 688 | (or (>= n (length tabulated-list-format)) | ||
| 689 | (< n -1))) | ||
| 690 | (user-error "Invalid column number")) | ||
| 687 | (if (equal n -1) | 691 | (if (equal n -1) |
| 688 | ;; Restore original order. | 692 | ;; Restore original order. |
| 689 | (progn | 693 | (progn |