]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-sort):
authorArtur Malabarba <bruce.connor.am@gmail.com>
Wed, 7 Oct 2015 13:09:09 +0000 (14:09 +0100)
committerArtur Malabarba <bruce.connor.am@gmail.com>
Wed, 7 Oct 2015 14:13:07 +0000 (15:13 +0100)
Check if column can be sorted before trying.  (Bug#21639)

lisp/emacs-lisp/tabulated-list.el

index 47ecd2b7922478e2e36c51ce4ae90a6081697099..4bd8a19937d4961efe9cbec400d06b0b2a2c8789 100644 (file)
@@ -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))