GNU bug report logs - #29489
Obsolete gnus-remove-if and gnus-remove-if-not

Previous Next

Packages: emacs, gnus;

Reported by: Eric Abrahamsen <eric <at> ericabrahamsen.net>

Date: Tue, 28 Nov 2017 17:03:05 UTC

Severity: normal

Tags: patch

Found in version 5.13

Done: Eric Abrahamsen <eric <at> ericabrahamsen.net>

Bug is archived. No further changes may be made.

Full log


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

From: Eric Abrahamsen <eric <at> ericabrahamsen.net>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#29489: Obsolete gnus-remove-if and gnus-remove-if-not
Date: Tue, 28 Nov 2017 16:07:03 -0800
Noam Postavsky <npostavs <at> users.sourceforge.net> writes:

> Eric Abrahamsen <eric <at> ericabrahamsen.net> writes:
>
>> Here's another one of these.
>>
>> I've replaced these with `seq-remove' and `seq-filter', and I suppose
>> someone might object to that -- the other option would be `cl-remove-if'
>> and `cl-remove-if-not'. I don't believe there's much practical difference.
>
> Neither the seq nor cl functions handle hash tables right?
>
>> -             (gnus-remove-if-not 'gnus-valid-move-group-p gnus-active-hashtb t)
>> +             (seq-filter 'gnus-valid-move-group-p gnus-active-hashtb)
>>               nil prefix nil default))
>>             ((= 1 (length split-name))
>>              (gnus-group-completing-read
>>               prom
>> -	     (gnus-remove-if-not 'gnus-valid-move-group-p gnus-active-hashtb t)
>> +	     (seq-filter 'gnus-valid-move-group-p gnus-active-hashtb)
>>               nil prefix 'gnus-group-history (car split-name)))
>
>> -(defun gnus-remove-if (predicate sequence &optional hash-table-p)
>> -  "Return a copy of SEQUENCE with all items satisfying PREDICATE removed.
>> -SEQUENCE should be a list, a vector, or a string.  Returns always a list.
>> -If HASH-TABLE-P is non-nil, regards SEQUENCE as a hash table."
>
> Although the docstring claims "hash table", while the code says...
>
>> -    (if hash-table-p
>> -	(mapatoms (lambda (symbol)
>> -		    (unless (funcall predicate symbol)
>> -		      (push symbol out)))
>> -		  sequence)
>
> obarray?

Shhh, that's my next patch to Gnus! Turning its "hash tables" into
actual hash tables. The obarrays are an impressive and horrible hack.

For this version of the patch, `seq-filter' works on vectors. In the
next patch, it's replaced by seq-filter->map-keys.

Eric





This bug report was last modified 7 years and 168 days ago.

Previous Next


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