From e60a1e2717ded78f062719b2cd8c41f358cf0198 Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Wed, 7 Oct 2015 14:09:09 +0100 Subject: [PATCH] * lisp/emacs-lisp/tabulated-list.el (tabulated-list-sort): Check if column can be sorted before trying. (Bug#21639) --- lisp/emacs-lisp/tabulated-list.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lisp/emacs-lisp/tabulated-list.el b/lisp/emacs-lisp/tabulated-list.el index 47ecd2b7922..4bd8a19937d 100644 --- a/lisp/emacs-lisp/tabulated-list.el +++ b/lisp/emacs-lisp/tabulated-list.el @@ -520,7 +520,9 @@ With a numeric prefix argument N, sort the Nth column." (car (aref tabulated-list-format n)) (get-text-property (point) 'tabulated-list-column-name)))) - (tabulated-list--sort-by-column-name name))) + (if (nth 2 (assoc name (append tabulated-list-format nil))) + (tabulated-list--sort-by-column-name name) + (user-error "Cannot sort by %s" name)))) (defun tabulated-list--sort-by-column-name (name) (when (and name (derived-mode-p 'tabulated-list-mode)) -- 2.39.2