Subject: bug#37418: [PATCH] Add new function to clear tags in tabulated list

From: Lars Ingebrigtsen <[email-masked]>
Date: Fri, 20 Sep 2019 19:54:51 +0200

Stefan Kangas <[email-masked]> writes:

> I found myself wanting to clear all tags in *Packages* buffer, but it
> made more sense to implement this as general functionality in
> tabulated list mode.  How does it look?

[...]

> +(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,%s\\}[^ ]" (1- tabulated-list-padding)))
> +          (empty (make-string tabulated-list-padding ? )))
> +      (while (re-search-forward re nil 'noerror)
> +        (tabulated-list-put-tag empty)))))

I think it's a good command to add, but I'm not familiar enough with how
tabulated list mode works, so my the only nit-pick I have to add here is
that the %s should be a %d here.  :-)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no