Path: utzoo!yunexus!ists!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!swrinde!gem.mps.ohio-state.edu!brutus.cs.uiuc.edu!rpi!tale From: tale@pawl.rpi.edu (David C Lawrence) Newsgroups: comp.emacs Subject: Re: possible s-expr management error (? naw, but ...) Message-ID: <1989Nov17.210003.16822@rpi.edu> Date: 17 Nov 89 21:00:03 GMT Article-I.D.: rpi.1989Nov17.210003.16822 References: <8911160201.AA04995@NMSU.Edu> <31688@news.Think.COM> <1989Nov16.061626.22143@rpi.edu> Organization: Rensselaer Polytechnic Institute, Troy NY Lines: 31 In <31688@news.Think.COM> barmar@leander.think.com (Barry Margolin) writes: Barry> SORT is a destructive operation; it actually reorders the Barry> original list by rearranging the cdr chain. [...] Barry> The above code should then be changed to Barry> (setq gnus-unsub-assoc (sort (copy-list gnus-unsub-assoc) 'gnus-assoc-lessp)) In <1989Nov16.061626.22143@rpi.edu> tale@pawl.rpi.edu (Me): Me> It should not. That screws the function up. I used sort because Me> sort was what I wanted. I am well aware of the lisp functions which Me> directly alter list structure and the usage of both sort and setcdr in Me> the function was for exactly that behaviour. Boy, do I love the taste of shoe leather. The nifty little sorting hack which worked for me because I had a mostly sorted list anyway ended up being a krufty mismanagement of pointers which is unnecessary because the function cleans up after itself later anyway. Blargh. As Barry suggests, but using an Emacs builtin: (setq gnus-unsub-assoc (sort (copy-sequence gnus-unsub-assoc) 'gnus-assoc-lessp)) is the appropriate thing to do. Sheepishly, Dave -- (setq mail '("tale@pawl.rpi.edu" "tale@ai.mit.edu" "tale@rpitsmts.bitnet"))