GNU bug report logs - #37418
[PATCH] Add new function to clear tags in tabulated list

Previous Next

Package: emacs;

Reported by: Stefan Kangas <stefan <at> marxist.se>

Date: Mon, 16 Sep 2019 01:56:04 UTC

Severity: normal

Tags: patch

Done: Stefan Kangas <stefan <at> marxist.se>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 37418 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: 37418 <at> debbugs.gnu.org
Subject: Re: bug#37418: [PATCH] Add new function to clear tags in tabulated
 list
Date: Fri, 20 Sep 2019 19:54:51 +0200
Stefan Kangas <stefan <at> 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




This bug report was last modified 5 years and 242 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.