[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#29489: Obsolete gnus-remove-if and gnus-remove-if-not
From: |
Eric Abrahamsen |
Subject: |
bug#29489: Obsolete gnus-remove-if and gnus-remove-if-not |
Date: |
Tue, 28 Nov 2017 16:07:03 -0800 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
Noam Postavsky <npostavs@users.sourceforge.net> writes:
> Eric Abrahamsen <eric@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