Gnus development mailing list
 help / color / mirror / Atom feed
* message-remove-duplicates and gnus-remove-duplicates (was: Changes committed gnus/lisp (ChangeLog gnus-art.el message.el))
       [not found] <E1EKH9h-0000UQ-00@quimby.gnus.org>
@ 2005-09-28 14:25 ` Reiner Steib
  2005-09-29 13:39   ` message-remove-duplicates and gnus-remove-duplicates Simon Josefsson
  0 siblings, 1 reply; 9+ messages in thread
From: Reiner Steib @ 2005-09-28 14:25 UTC (permalink / raw)


On Tue, Sep 27 2005, Simon Josefsson committed:

> 2005-09-27  Arne Jørgensen  <arne@arnested.dk>
>
> 	* message.el (message-remove-duplicates): New function.
> 	Implementation borrowed from `gnus-remove-duplicates'.
[...]
> +(defun message-remove-duplicates (list)
> +  (let (new)
> +    (while list
> +      (or (member (car list) new)
> +	  (setq new (cons (car list) new)))
> +      (setq list (cdr list)))
> +    (nreverse new)))

Shouldn't we drop (or defalias) `gnus-remove-duplicates' in favor of
`message-remove-duplicates'?  (We can safely require `message.el' in
Gnus code but not the other way round.)

,----
| grep -nH -e "[se]-remove-duplicates" *.el
| gnus-util.el:1033:(defun gnus-remove-duplicates (list)
| message.el:2093:(defun message-remove-duplicates (list)
| message.el:5041:	       (message-remove-duplicates
| nnmail.el:1144:	      (setq split (gnus-remove-duplicates split))
`----

nnmail.el (the only use of gnus-remove-duplicates) already requires
message.

Bye, Reiner.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/




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

* Re: message-remove-duplicates and gnus-remove-duplicates
  2005-09-28 14:25 ` message-remove-duplicates and gnus-remove-duplicates (was: Changes committed gnus/lisp (ChangeLog gnus-art.el message.el)) Reiner Steib
@ 2005-09-29 13:39   ` Simon Josefsson
  2005-10-02 20:24     ` Reiner Steib
  0 siblings, 1 reply; 9+ messages in thread
From: Simon Josefsson @ 2005-09-29 13:39 UTC (permalink / raw)


Reiner Steib <reinersteib+gmane@imap.cc> writes:

> On Tue, Sep 27 2005, Simon Josefsson committed:
>
>> 2005-09-27  Arne Jørgensen  <arne@arnested.dk>
>>
>> 	* message.el (message-remove-duplicates): New function.
>> 	Implementation borrowed from `gnus-remove-duplicates'.
> [...]
>> +(defun message-remove-duplicates (list)
>> +  (let (new)
>> +    (while list
>> +      (or (member (car list) new)
>> +	  (setq new (cons (car list) new)))
>> +      (setq list (cdr list)))
>> +    (nreverse new)))
>
> Shouldn't we drop (or defalias) `gnus-remove-duplicates' in favor of
> `message-remove-duplicates'?  (We can safely require `message.el' in
> Gnus code but not the other way round.)

Sounds good.  Let's defalias it, in case external packages use g-r-d.

There is also mm-delete-duplicates, I'm not sure how it relates.



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

* Re: message-remove-duplicates and gnus-remove-duplicates
  2005-09-29 13:39   ` message-remove-duplicates and gnus-remove-duplicates Simon Josefsson
@ 2005-10-02 20:24     ` Reiner Steib
  2005-10-03  8:38       ` Simon Josefsson
  0 siblings, 1 reply; 9+ messages in thread
From: Reiner Steib @ 2005-10-02 20:24 UTC (permalink / raw)


On Thu, Sep 29 2005, Simon Josefsson wrote:

> Reiner Steib <reinersteib+gmane@imap.cc> writes:
>> Shouldn't we drop (or defalias) `gnus-remove-duplicates' in favor of
>> `message-remove-duplicates'?  (We can safely require `message.el' in
>> Gnus code but not the other way round.)
[...]
> There is also mm-delete-duplicates, I'm not sure how it relates.

Unless someone can see a reason that we actually need the different
implementations, I'd suggest to replace the defun in `mm-util.el' with
this code:

--8<---------------cut here---------------start------------->8---
(if (fboundp 'delete-dups)
    (defalias 'mm-delete-duplicates 'delete-dups)
  (defun mm-delete-duplicates (list)
    "Destructively remove `equal' duplicates from LIST.
Store the result in LIST and return it.  LIST must be a proper list.
Of several `equal' occurrences of an element in LIST, the first
one is kept.

This is a compatibility function for Emacsen without `delete-dups'."
    ;; Code from `subr.el' in Emacs 22:
    (let ((tail list))
      (while tail
	(setcdr tail (delete (car tail) (cdr tail)))
	(setq tail (cdr tail))))
    list))
--8<---------------cut here---------------end--------------->8---

As `message.el' and `nnmail.el' already require `mm-util.el' we can
use `mm-delete-duplicates' there.

> Let's defalias it, in case external packages use g-r-d.

I doubt that there's any external use.  At least no package in XEmacs
Sumo uses it.  And in Gnus, it's only used once.  But I won't mind
something like this in `gnus-util.el':

--8<---------------cut here---------------start------------->8---
;; In case external packages use `gnus-remove-duplicates', we provide an
;; alias.  In new code, `mm-delete-duplicates' or `delete-dups' should be
;; used.
(defalias 'gnus-remove-duplicates 'mm-delete-duplicates)
--8<---------------cut here---------------end--------------->8---

Bye, Reiner.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/




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

* Re: message-remove-duplicates and gnus-remove-duplicates
  2005-10-02 20:24     ` Reiner Steib
@ 2005-10-03  8:38       ` Simon Josefsson
  2005-10-03 10:51         ` Reiner Steib
  0 siblings, 1 reply; 9+ messages in thread
From: Simon Josefsson @ 2005-10-03  8:38 UTC (permalink / raw)


Reiner Steib <reinersteib+gmane@imap.cc> writes:

> On Thu, Sep 29 2005, Simon Josefsson wrote:
>
>> Reiner Steib <reinersteib+gmane@imap.cc> writes:
>>> Shouldn't we drop (or defalias) `gnus-remove-duplicates' in favor of
>>> `message-remove-duplicates'?  (We can safely require `message.el' in
>>> Gnus code but not the other way round.)
> [...]
>> There is also mm-delete-duplicates, I'm not sure how it relates.
>
> Unless someone can see a reason that we actually need the different
> implementations, I'd suggest to replace the defun in `mm-util.el' with
> this code:
>
> --8<---------------cut here---------------start------------->8---
> (if (fboundp 'delete-dups)
>     (defalias 'mm-delete-duplicates 'delete-dups)
>   (defun mm-delete-duplicates (list)
>     "Destructively remove `equal' duplicates from LIST.
> Store the result in LIST and return it.  LIST must be a proper list.
> Of several `equal' occurrences of an element in LIST, the first
> one is kept.
>
> This is a compatibility function for Emacsen without `delete-dups'."
>     ;; Code from `subr.el' in Emacs 22:
>     (let ((tail list))
>       (while tail
> 	(setcdr tail (delete (car tail) (cdr tail)))
> 	(setq tail (cdr tail))))
>     list))
> --8<---------------cut here---------------end--------------->8---
>
> As `message.el' and `nnmail.el' already require `mm-util.el' we can
> use `mm-delete-duplicates' there.

Yes, this sounds good.

>> Let's defalias it, in case external packages use g-r-d.
>
> I doubt that there's any external use.  At least no package in XEmacs
> Sumo uses it.  And in Gnus, it's only used once.  But I won't mind
> something like this in `gnus-util.el':
>
> --8<---------------cut here---------------start------------->8---
> ;; In case external packages use `gnus-remove-duplicates', we provide an
> ;; alias.  In new code, `mm-delete-duplicates' or `delete-dups' should be
> ;; used.
> (defalias 'gnus-remove-duplicates 'mm-delete-duplicates)
> --8<---------------cut here---------------end--------------->8---

Yes, I think that is good.  Perhaps instead use:

(define-obsolete-function-alias 'gnus-remove-duplicates 'mm-delete-duplicates)

Thanks,
Simon



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

* Re: message-remove-duplicates and gnus-remove-duplicates
  2005-10-03  8:38       ` Simon Josefsson
@ 2005-10-03 10:51         ` Reiner Steib
  2005-10-03 13:58           ` Simon Josefsson
  0 siblings, 1 reply; 9+ messages in thread
From: Reiner Steib @ 2005-10-03 10:51 UTC (permalink / raw)


On Mon, Oct 03 2005, Simon Josefsson wrote:

> Reiner Steib <reinersteib+gmane@imap.cc> writes:
[...]
>> --8<---------------cut here---------------start------------->8---
>> ;; In case external packages use `gnus-remove-duplicates', we provide an
>> ;; alias.  In new code, `mm-delete-duplicates' or `delete-dups' should be
>> ;; used.
>> (defalias 'gnus-remove-duplicates 'mm-delete-duplicates)
>> --8<---------------cut here---------------end--------------->8---
>
> Yes, I think that is good.  Perhaps instead use:
>
> (define-obsolete-function-alias 'gnus-remove-duplicates 'mm-delete-duplicates)

For compatibility with Emacs 20.7 (v5-10), Emacs 21 and maybe older
XEmacs versions we probably need:

(if (fboundp 'define-obsolete-function-alias)
    (define-obsolete-function-alias
      'gnus-remove-duplicates 'mm-delete-duplicates
      "22.1");; Gnus 5.10.7 / Gnus 5.11 / No Gnus
  (defalias 'gnus-remove-duplicates 'mm-delete-duplicates)
  (make-obsolete 'gnus-remove-duplicates 'mm-delete-duplicates "22.1"))

Bye, Reiner.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/




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

* Re: message-remove-duplicates and gnus-remove-duplicates
  2005-10-03 10:51         ` Reiner Steib
@ 2005-10-03 13:58           ` Simon Josefsson
  2005-10-03 17:55             ` Reiner Steib
  0 siblings, 1 reply; 9+ messages in thread
From: Simon Josefsson @ 2005-10-03 13:58 UTC (permalink / raw)


Reiner Steib <reinersteib+gmane@imap.cc> writes:

> On Mon, Oct 03 2005, Simon Josefsson wrote:
>
>> Reiner Steib <reinersteib+gmane@imap.cc> writes:
> [...]
>>> --8<---------------cut here---------------start------------->8---
>>> ;; In case external packages use `gnus-remove-duplicates', we provide an
>>> ;; alias.  In new code, `mm-delete-duplicates' or `delete-dups' should be
>>> ;; used.
>>> (defalias 'gnus-remove-duplicates 'mm-delete-duplicates)
>>> --8<---------------cut here---------------end--------------->8---
>>
>> Yes, I think that is good.  Perhaps instead use:
>>
>> (define-obsolete-function-alias 'gnus-remove-duplicates 'mm-delete-duplicates)
>
> For compatibility with Emacs 20.7 (v5-10), Emacs 21 and maybe older
> XEmacs versions we probably need:
>
> (if (fboundp 'define-obsolete-function-alias)
>     (define-obsolete-function-alias
>       'gnus-remove-duplicates 'mm-delete-duplicates
>       "22.1");; Gnus 5.10.7 / Gnus 5.11 / No Gnus
>   (defalias 'gnus-remove-duplicates 'mm-delete-duplicates)
>   (make-obsolete 'gnus-remove-duplicates 'mm-delete-duplicates "22.1"))

Do we need to make this change in 5-10?  It doesn't look like a bug
fix to me.  No Gnus assume at least Emacs 21.1 or XEmacs 21.4, which
has d-o-f-a, so no need to fall back to old code.



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

* Re: message-remove-duplicates and gnus-remove-duplicates
  2005-10-03 13:58           ` Simon Josefsson
@ 2005-10-03 17:55             ` Reiner Steib
  2005-10-04 10:01               ` Simon Josefsson
  0 siblings, 1 reply; 9+ messages in thread
From: Reiner Steib @ 2005-10-03 17:55 UTC (permalink / raw)


On Mon, Oct 03 2005, Simon Josefsson wrote:

> Reiner Steib <reinersteib+gmane@imap.cc> writes:
[...]
>> For compatibility with Emacs 20.7 (v5-10), Emacs 21 and maybe older
>> XEmacs versions we probably need:
>>
>> (if (fboundp 'define-obsolete-function-alias)
>>     (define-obsolete-function-alias
>>       'gnus-remove-duplicates 'mm-delete-duplicates
>>       "22.1");; Gnus 5.10.7 / Gnus 5.11 / No Gnus
>>   (defalias 'gnus-remove-duplicates 'mm-delete-duplicates)
>>   (make-obsolete 'gnus-remove-duplicates 'mm-delete-duplicates "22.1"))
>
> Do we need to make this change in 5-10?  It doesn't look like a bug
> fix to me.

IMHO it's not a good idea to have three functions for the same purpose
in v5-10.  Probably it was an oversight that we had two functions in
the first place (because of "delete" vs. "remove"?).  But now we have
three.

> No Gnus assume at least Emacs 21.1 or XEmacs 21.4, which has
> d-o-f-a, so no need to fall back to old code.

Emacs 21 doesn't have it, so we need the fall back code even in No
Gnus.  Given that, I think it's best to have the same code in trunk
and v5-10.

Bye, Reiner.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/




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

* Re: message-remove-duplicates and gnus-remove-duplicates
  2005-10-03 17:55             ` Reiner Steib
@ 2005-10-04 10:01               ` Simon Josefsson
  2005-10-04 15:50                 ` Reiner Steib
  0 siblings, 1 reply; 9+ messages in thread
From: Simon Josefsson @ 2005-10-04 10:01 UTC (permalink / raw)


Reiner Steib <reinersteib+gmane@imap.cc> writes:

> On Mon, Oct 03 2005, Simon Josefsson wrote:
>
>> Reiner Steib <reinersteib+gmane@imap.cc> writes:
> [...]
>>> For compatibility with Emacs 20.7 (v5-10), Emacs 21 and maybe older
>>> XEmacs versions we probably need:
>>>
>>> (if (fboundp 'define-obsolete-function-alias)
>>>     (define-obsolete-function-alias
>>>       'gnus-remove-duplicates 'mm-delete-duplicates
>>>       "22.1");; Gnus 5.10.7 / Gnus 5.11 / No Gnus
>>>   (defalias 'gnus-remove-duplicates 'mm-delete-duplicates)
>>>   (make-obsolete 'gnus-remove-duplicates 'mm-delete-duplicates "22.1"))
>>
>> Do we need to make this change in 5-10?  It doesn't look like a bug
>> fix to me.
>
> IMHO it's not a good idea to have three functions for the same purpose
> in v5-10.  Probably it was an oversight that we had two functions in
> the first place (because of "delete" vs. "remove"?).  But now we have
> three.
>
>> No Gnus assume at least Emacs 21.1 or XEmacs 21.4, which has
>> d-o-f-a, so no need to fall back to old code.
>
> Emacs 21 doesn't have it, so we need the fall back code even in No
> Gnus.  Given that, I think it's best to have the same code in trunk
> and v5-10.

Ok, you convinced me.



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

* Re: message-remove-duplicates and gnus-remove-duplicates
  2005-10-04 10:01               ` Simon Josefsson
@ 2005-10-04 15:50                 ` Reiner Steib
  0 siblings, 0 replies; 9+ messages in thread
From: Reiner Steib @ 2005-10-04 15:50 UTC (permalink / raw)


On Tue, Oct 04 2005, Simon Josefsson wrote:

> Reiner Steib <reinersteib+gmane@imap.cc> writes:
>>>> (if (fboundp 'define-obsolete-function-alias)
>>>>     (define-obsolete-function-alias
>>>>       'gnus-remove-duplicates 'mm-delete-duplicates
>>>>       "22.1");; Gnus 5.10.7 / Gnus 5.11 / No Gnus
>>>>   (defalias 'gnus-remove-duplicates 'mm-delete-duplicates)
>>>>   (make-obsolete 'gnus-remove-duplicates 'mm-delete-duplicates "22.1"))
[...]
>> Emacs 21 doesn't have it, so we need the fall back code even in No
>> Gnus.  Given that, I think it's best to have the same code in trunk
>> and v5-10.
>
> Ok, you convinced me.

I installed the changes[1] in v5-10 and in the trunk.  I didn't add an
alias, because (1) I don't think `gnus-remove-duplicates' has ever
been used outside of Gnus (no XEmacs Sumo package uses it; a Google
search didn't reveal anything) and (2) the above code didn't work form
me: When byte-compiling Gnus with Emacs 21 running the byte-compiled
program in Emacs 22 doesn't work[2].  Normally Emacs 21 byte-code
should run in Emacs 22 (CMIIW) so maybe I'm doing something wrong.  If
anyone wants to add an alias without introducing this problem, feel
free add it.  We could simply add the defalias/make-obsolete, but I
don't think it's useful, see (1).

Bye, Reiner.

[1] 	* gnus-util.el (gnus-remove-duplicates): Remove.

	* nnmail.el (nnmail-article-group): Use mm-delete-duplicates
	instead of gnus-remove-duplicates.

	* message.el (message-remove-duplicates): Remove.
	(message-idna-to-ascii-rhs-1): Use mm-delete-duplicates instead of
	message-remove-duplicates.

	* mm-util.el (mm-delete-duplicates): Use `delete-dups' if
	available, else use implementation from `delete-dups'.

[2] $ emacs-cvs -Q -f toggle-debug-on-error -l ./lisp/gnus-util.elc

Debugger entered--Lisp error: (invalid-function (macro .
  #[(obsolete-name current-name &optional when docstring) "[...]"
  [obsolete-name current-name docstring when progn defalias
  make-obsolete] 6 617511]))
  define-obsolete-function-alias(gnus-remove-duplicates
  mm-delete-duplicates "22.1")
  byte-code("[...]" [fboundp set-process-query-on-exit-flag defalias
  gnus-set-process-query-on-exit-flag process-kill-without-query
  define-obsolete-function-alias gnus-remove-duplicates
  mm-delete-duplicates "22.1" make-obsolete provide gnus-util] 4)
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/




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

end of thread, other threads:[~2005-10-04 15:50 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <E1EKH9h-0000UQ-00@quimby.gnus.org>
2005-09-28 14:25 ` message-remove-duplicates and gnus-remove-duplicates (was: Changes committed gnus/lisp (ChangeLog gnus-art.el message.el)) Reiner Steib
2005-09-29 13:39   ` message-remove-duplicates and gnus-remove-duplicates Simon Josefsson
2005-10-02 20:24     ` Reiner Steib
2005-10-03  8:38       ` Simon Josefsson
2005-10-03 10:51         ` Reiner Steib
2005-10-03 13:58           ` Simon Josefsson
2005-10-03 17:55             ` Reiner Steib
2005-10-04 10:01               ` Simon Josefsson
2005-10-04 15:50                 ` Reiner Steib

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).