Gnus development mailing list
 help / color / mirror / Atom feed
* Symbol's function definition is void: remove-if-not
@ 2010-10-03 15:13 Stephen Berman
  2010-10-03 15:23 ` Julien Danjou
  0 siblings, 1 reply; 11+ messages in thread
From: Stephen Berman @ 2010-10-03 15:13 UTC (permalink / raw)
  To: ding

I just updated from the Emacs trunk, built with make bootstrap, started
Emacs with my initializations, started Gnus, typed `1 j' to select a
group, typed TAB to get a completion list, and got the error in the
subject line (in gnus-group-completing-read).  After evalling (require
'cl) the error ceased.

Steve Berman 




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Symbol's function definition is void: remove-if-not
  2010-10-03 15:13 Symbol's function definition is void: remove-if-not Stephen Berman
@ 2010-10-03 15:23 ` Julien Danjou
  2010-10-04  3:49   ` Ted Zlatanov
  0 siblings, 1 reply; 11+ messages in thread
From: Julien Danjou @ 2010-10-03 15:23 UTC (permalink / raw)
  To: Stephen Berman; +Cc: ding

[-- Attachment #1: Type: text/plain, Size: 656 bytes --]

On Sun, Oct 03 2010, Stephen Berman wrote:

> I just updated from the Emacs trunk, built with make bootstrap, started
> Emacs with my initializations, started Gnus, typed `1 j' to select a
> group, typed TAB to get a completion list, and got the error in the
> subject line (in gnus-group-completing-read).  After evalling (require
> 'cl) the error ceased.

This is a known issue. I've introduced the use of remove-if-not in a
recent patch, and am not smart enough to write a gnus-remove-if(-not)
working on all types of sequence to replace it.

(Help welcome. :)

-- 
Julien Danjou
// ᐰ <julien@danjou.info>   http://julien.danjou.info

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Symbol's function definition is void: remove-if-not
  2010-10-03 15:23 ` Julien Danjou
@ 2010-10-04  3:49   ` Ted Zlatanov
  2010-10-04  7:15     ` Katsumi Yamaoka
  2010-10-04 16:30     ` Ted Zlatanov
  0 siblings, 2 replies; 11+ messages in thread
From: Ted Zlatanov @ 2010-10-04  3:49 UTC (permalink / raw)
  To: ding

On Sun, 03 Oct 2010 17:23:26 +0200 Julien Danjou <julien@danjou.info> wrote: 

JD> On Sun, Oct 03 2010, Stephen Berman wrote:
>> I just updated from the Emacs trunk, built with make bootstrap, started
>> Emacs with my initializations, started Gnus, typed `1 j' to select a
>> group, typed TAB to get a completion list, and got the error in the
>> subject line (in gnus-group-completing-read).  After evalling (require
>> 'cl) the error ceased.

JD> This is a known issue. I've introduced the use of remove-if-not in a
JD> recent patch, and am not smart enough to write a gnus-remove-if(-not)
JD> working on all types of sequence to replace it.

Can you use `gnus-remove-if' with the predicate inverted?

It looks like `remove-if-not' is used in several places actually:

gnus-art.el:         (remove-if-not pred (mailcap-mime-types))
gnus-group.el:                          (remove-if-not 'symbolp collection)))
gnus-score.el:                                            (remove-if-not
gnus-sum.el:             (remove-if-not 'gnus-valid-move-group-p gnus-active-hashtb)
gnus-sum.el:             prom (remove-if-not 'gnus-valid-move-group-p gnus-active-hashtb)

Speaking of gnus-util.el, IMO `gnus-pull' should be renamed.  The name
is really not intuitive.

Ted




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Symbol's function definition is void: remove-if-not
  2010-10-04  3:49   ` Ted Zlatanov
@ 2010-10-04  7:15     ` Katsumi Yamaoka
  2010-10-04 16:36       ` Ted Zlatanov
  2010-10-04 16:30     ` Ted Zlatanov
  1 sibling, 1 reply; 11+ messages in thread
From: Katsumi Yamaoka @ 2010-10-04  7:15 UTC (permalink / raw)
  To: ding

Ted Zlatanov wrote:
[...]
> Can you use `gnus-remove-if' with the predicate inverted?

It can be used, if the type of a sequence is `list'.  For a non-
list sequence, we can convert it to a list as the function `coerce'
does (see cl-extra.el).  Though the type of a modified sequence has
to be changed again into that of the original (if needed).  However,
it may be hard to make it work for a hash table.  So is the genuine
`remove-if-not'!

> It looks like `remove-if-not' is used in several places actually:

> gnus-art.el:         (remove-if-not pred (mailcap-mime-types))
> gnus-group.el:                          (remove-if-not 'symbolp collection)))
> gnus-score.el:                                            (remove-if-not
> gnus-sum.el:             (remove-if-not 'gnus-valid-move-group-p gnus-active-hashtb)
> gnus-sum.el:             prom (remove-if-not 'gnus-valid-move-group-p gnus-active-hashtb)

The use of `remove-if-not' in gnus-sum.el is a wrong approach since
it doesn't necessarily recognize all the group names in
`gnus-active-hashtb'.  That looks like a normal vector of which
the length is 4096, however it can hold more than 4096 group names
and `remove-if-not' cannot access all of them.  For instance:

;; Make a hash table of which the length is 1.
(let ((hashtable (make-vector 1 0)))
  (length hashtable))
 => 1

;; We can put more than 1 symbol to it,
;; but it still looks like a vector of which the size is 1.
(let ((hashtable (make-vector 1 0)))
  (intern "A" hashtable)
  (intern "B" hashtable)
  (intern "C" hashtable)
  (intern "D" hashtable)
  (list (length hashtable) hashtable))
 => (1 [D])

;; It actually holds four symbols.
(let ((hashtable (make-vector 1 0)))
  (intern "A" hashtable)
  (intern "B" hashtable)
  (intern "C" hashtable)
  (intern "D" hashtable)
  (let (rest)
    (mapatoms (lambda (symbol) (push symbol rest)) hashtable)
    rest))
 => (A B C D)

;; `remove-if-not' recognize the hash table in question as [D],
;; therefore:
(let ((hashtable (make-vector 1 0)))
  (intern "A" hashtable)
  (intern "B" hashtable)
  (intern "C" hashtable)
  (intern "D" hashtable)
  (remove-if-not (lambda (symbol) (string-lessp symbol 'C)) hashtable))
 => []

;; But the expected result of it is like the following, isn't it?
(let ((sequence [A B C D]))
  (remove-if-not (lambda (symbol) (string-lessp symbol 'C)) sequence))
 => [A B]



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Symbol's function definition is void: remove-if-not
  2010-10-04  3:49   ` Ted Zlatanov
  2010-10-04  7:15     ` Katsumi Yamaoka
@ 2010-10-04 16:30     ` Ted Zlatanov
  2010-10-04 16:42       ` Lars Magne Ingebrigtsen
  1 sibling, 1 reply; 11+ messages in thread
From: Ted Zlatanov @ 2010-10-04 16:30 UTC (permalink / raw)
  To: ding

On Sun, 03 Oct 2010 22:49:10 -0500 Ted Zlatanov <tzz@lifelogs.com> wrote: 

TZ> Speaking of gnus-util.el, IMO `gnus-pull' should be renamed.  The name
TZ> is really not intuitive.

Would it be OK if I renamed it to `gnus-alist-pull'?  Any objections?
It's definitely useful, it's in 10 or so places.

Ted




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Symbol's function definition is void: remove-if-not
  2010-10-04  7:15     ` Katsumi Yamaoka
@ 2010-10-04 16:36       ` Ted Zlatanov
  2010-10-04 16:42         ` Lars Magne Ingebrigtsen
  2010-10-05  7:32         ` Katsumi Yamaoka
  0 siblings, 2 replies; 11+ messages in thread
From: Ted Zlatanov @ 2010-10-04 16:36 UTC (permalink / raw)
  To: ding

On Mon, 04 Oct 2010 16:15:56 +0900 Katsumi Yamaoka <yamaoka@jpl.org> wrote: 

KY> Ted Zlatanov wrote:
KY> [...]
>> Can you use `gnus-remove-if' with the predicate inverted?

KY> It can be used, if the type of a sequence is `list'.

I know, I meant for Julien's case specifically, I think he's just using
lists.  In general our (Gnus) usage is pretty trivial, without using all
the bells and whistles of the CL function.

KY> For a non- list sequence, we can convert it to a list as the
KY> function `coerce' does (see cl-extra.el).  Though the type of a
KY> modified sequence has to be changed again into that of the original
KY> (if needed).  However, it may be hard to make it work for a hash
KY> table.  So is the genuine `remove-if-not'!

>> It looks like `remove-if-not' is used in several places actually:

>> gnus-art.el:         (remove-if-not pred (mailcap-mime-types))
>> gnus-group.el:                          (remove-if-not 'symbolp collection)))
>> gnus-score.el:                                            (remove-if-not

Those three should be able to use `gnus-remove-if' with the predicate
inverted, I think.

>> gnus-sum.el:             (remove-if-not 'gnus-valid-move-group-p gnus-active-hashtb)
>> gnus-sum.el:             prom (remove-if-not 'gnus-valid-move-group-p gnus-active-hashtb)

KY> The use of `remove-if-not' in gnus-sum.el is a wrong approach since
KY> it doesn't necessarily recognize all the group names in
KY> `gnus-active-hashtb'.  That looks like a normal vector of which
KY> the length is 4096, however it can hold more than 4096 group names
KY> and `remove-if-not' cannot access all of them.

So it's potentially a bug.  I am no expert on ELisp data types,
especially between Emacs and XEmacs.  Should we take this to emacs-devel
or does someone know a good solution?

I think it's acceptable to simply provide `gnus-remove-hashtb-keys-if'
rather than try to reimplement CL.  So maybe that's the right way.

Ted




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Symbol's function definition is void: remove-if-not
  2010-10-04 16:36       ` Ted Zlatanov
@ 2010-10-04 16:42         ` Lars Magne Ingebrigtsen
  2010-10-05  7:32         ` Katsumi Yamaoka
  1 sibling, 0 replies; 11+ messages in thread
From: Lars Magne Ingebrigtsen @ 2010-10-04 16:42 UTC (permalink / raw)
  To: ding

Ted Zlatanov <tzz@lifelogs.com> writes:

> I think it's acceptable to simply provide `gnus-remove-hashtb-keys-if'
> rather than try to reimplement CL.  So maybe that's the right way.

Yup.

-- 
(domestic pets only, the antidote for overdose, milk.)
  larsi@gnus.org * Lars Magne Ingebrigtsen




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Symbol's function definition is void: remove-if-not
  2010-10-04 16:30     ` Ted Zlatanov
@ 2010-10-04 16:42       ` Lars Magne Ingebrigtsen
  2010-10-08 16:36         ` Ted Zlatanov
  0 siblings, 1 reply; 11+ messages in thread
From: Lars Magne Ingebrigtsen @ 2010-10-04 16:42 UTC (permalink / raw)
  To: ding

Ted Zlatanov <tzz@lifelogs.com> writes:

> Would it be OK if I renamed it to `gnus-alist-pull'?  Any objections?
> It's definitely useful, it's in 10 or so places.

Sure; go ahead.

-- 
(domestic pets only, the antidote for overdose, milk.)
  larsi@gnus.org * Lars Magne Ingebrigtsen




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Symbol's function definition is void: remove-if-not
  2010-10-04 16:36       ` Ted Zlatanov
  2010-10-04 16:42         ` Lars Magne Ingebrigtsen
@ 2010-10-05  7:32         ` Katsumi Yamaoka
  2010-10-08 16:35           ` Ted Zlatanov
  1 sibling, 1 reply; 11+ messages in thread
From: Katsumi Yamaoka @ 2010-10-05  7:32 UTC (permalink / raw)
  To: ding

Ted Zlatanov wrote:
[...]
>>> It looks like `remove-if-not' is used in several places actually:

>>> gnus-art.el:   (remove-if-not pred (mailcap-mime-types))
>>> gnus-group.el:                    (remove-if-not 'symbolp collection)))
>>> gnus-score.el:                                      (remove-if-not

> Those three should be able to use `gnus-remove-if' with the predicate
> inverted, I think.

No, gnus-group.el is not.  `gnus-group-completing-read' takes a hash
table as an argument, in addition to `gnus-read-move-group-name' in
gnus-sum.el.

>>> gnus-sum.el: (remove-if-not 'gnus-valid-move-group-p gnus-active-hashtb)
>>> gnus-sum.el: prom (remove-if-not 'gnus-valid-move-group-p gnus-active-hashtb)

KY> The use of `remove-if-not' in gnus-sum.el is a wrong approach since
[...]

> So it's potentially a bug.  I am no expert on ELisp data types,
> especially between Emacs and XEmacs.  Should we take this to emacs-devel
> or does someone know a good solution?

> I think it's acceptable to simply provide `gnus-remove-hashtb-keys-if'
> rather than try to reimplement CL.  So maybe that's the right way.

I'd like to try it (maybe tomorrow).

BTW, as you know `mapatoms' is the only means to access elements
of a hash table:

,---- (info "(elisp)Creating Symbols") ----
| there is no way to find all the symbols in an obarray except
| using `mapatoms' (below).
`----

It doesn't care of non-interned symbols in a hash table, so the
code `(remove-if-not 'symbolp collection)' used in gnus-group.el
is useless:

(let ((hashtable (make-vector 4096 0)))
  hashtable)
 => [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

(let ((hashtable (make-vector 4096 0))
      rest)
  (intern "foo" hashtable)
  (intern "bar" hashtable)
  (mapatoms (lambda (symbol) (push symbol rest)) hashtable)
  rest)
 => (bar foo)



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Symbol's function definition is void: remove-if-not
  2010-10-05  7:32         ` Katsumi Yamaoka
@ 2010-10-08 16:35           ` Ted Zlatanov
  0 siblings, 0 replies; 11+ messages in thread
From: Ted Zlatanov @ 2010-10-08 16:35 UTC (permalink / raw)
  To: ding

On Tue, 05 Oct 2010 16:32:41 +0900 Katsumi Yamaoka <yamaoka@jpl.org> wrote: 

KY> BTW, as you know `mapatoms' is the only means to access elements
KY> of a hash table:

With me it's safer to assume I don't know :)

Ted




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Symbol's function definition is void: remove-if-not
  2010-10-04 16:42       ` Lars Magne Ingebrigtsen
@ 2010-10-08 16:36         ` Ted Zlatanov
  0 siblings, 0 replies; 11+ messages in thread
From: Ted Zlatanov @ 2010-10-08 16:36 UTC (permalink / raw)
  To: ding

On Mon, 04 Oct 2010 18:42:48 +0200 Lars Magne Ingebrigtsen <larsi@gnus.org> wrote: 

LMI> Ted Zlatanov <tzz@lifelogs.com> writes:
>> Would it be OK if I renamed it to `gnus-alist-pull'?  Any objections?
>> It's definitely useful, it's in 10 or so places.

LMI> Sure; go ahead.

Done.

Ted




^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2010-10-08 16:36 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-03 15:13 Symbol's function definition is void: remove-if-not Stephen Berman
2010-10-03 15:23 ` Julien Danjou
2010-10-04  3:49   ` Ted Zlatanov
2010-10-04  7:15     ` Katsumi Yamaoka
2010-10-04 16:36       ` Ted Zlatanov
2010-10-04 16:42         ` Lars Magne Ingebrigtsen
2010-10-05  7:32         ` Katsumi Yamaoka
2010-10-08 16:35           ` Ted Zlatanov
2010-10-04 16:30     ` Ted Zlatanov
2010-10-04 16:42       ` Lars Magne Ingebrigtsen
2010-10-08 16:36         ` Ted Zlatanov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).