summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/tabulated-list.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/emacs-lisp/tabulated-list.el')
-rw-r--r--lisp/emacs-lisp/tabulated-list.el15
1 files changed, 14 insertions, 1 deletions
diff --git a/lisp/emacs-lisp/tabulated-list.el b/lisp/emacs-lisp/tabulated-list.el
index 63ae1f8c072..ade60285883 100644
--- a/lisp/emacs-lisp/tabulated-list.el
+++ b/lisp/emacs-lisp/tabulated-list.el
@@ -192,6 +192,19 @@ If ADVANCE is non-nil, move forward by one line afterwards."
(if advance
(forward-line)))
+(defun tabulated-list-clear-all-tags ()
+ "Clear all tags from the padding area in the current buffer."
+ (unless (> tabulated-list-padding 0)
+ (error "There can be no tags in current buffer"))
+ (save-excursion
+ (goto-char (point-min))
+ (let ((inhibit-read-only t)
+ ;; Match non-space in the first n characters.
+ (re (format "^ \\{0,%d\\}[^ ]" (1- tabulated-list-padding)))
+ (empty (make-string tabulated-list-padding ? )))
+ (while (re-search-forward re nil 'noerror)
+ (tabulated-list-put-tag empty)))))
+
(defvar tabulated-list-mode-map
(let ((map (make-sparse-keymap)))
(set-keymap-parent map (make-composed-keymap
@@ -373,7 +386,7 @@ column. Negate the predicate that would be returned if
(if (stringp b) b (car b)))))))
;; Reversed order.
(if (cdr tabulated-list-sort-key)
- (lambda (a b) (not (funcall sorter a b)))
+ (lambda (a b) (funcall sorter b a))
sorter))))
(defsubst tabulated-list--col-local-max-widths (col)