[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#37418: [PATCH] Add new function to clear tags in tabulated list
From: |
Lars Ingebrigtsen |
Subject: |
bug#37418: [PATCH] Add new function to clear tags in tabulated list |
Date: |
Fri, 20 Sep 2019 19:54:51 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
Stefan Kangas <stefan@marxist.se> 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