[mcclim-devel] patch for possbility sorting

rpgoldman at real-time.com rpgoldman at real-time.com
Fri Apr 7 19:05:56 UTC 2006


In BEIRC, one can end up with an enormously long list of candidate
possibilities for completing a command, because IRC has so many
commands.  The possibilities are not ordered at all, so the list is
pretty much useless.

The following patch to input-editing would fix this problem by sorting
the set of possibilities alphabetically.

I realize that this may not be optimal, because it's a "one size fits
all" solution.  OTOH, it's clearly better than just getting an
arbitrarily permuted list, so I suggest that it be adopted.

I have commit privs, but have mostly used them for documentation and
Allegro-specific compatibility fixes, so I'd love some validation (or
reasoned rejection) before committing.

Thanks all,
R

P.S. It occurs to me that we could avoid pointlessly sorting length 1
lists by dumping the call to sort inside the VALUES call in the ELSE
branch of the final if of complete-from-generator-possibilies.  But
that shouldn't change the question of whether this is a good idea or
not...



--- input-editing.lisp  10 Mar 2006 21:58:13 -0000      1.49
+++ input-editing.lisp  7 Apr 2006 19:00:18 -0000
@@ -781,6 +781,9 @@ (defun complete-from-generator-possibili
               (incf nmatches)
               (push (cons str obj) possibilities))))
       (funcall generator initial-string #'suggester)
+      ;; attempting to get the list of candidates sorted [2006/04/07:rpg]
+      (setf possibilities
+           (sort possibilities #'string-lessp :key #'car))
       (if (and (eql nmatches 1)
               (string-equal initial-string (caar possibilities)))
          (values (caar possibilities)



More information about the mcclim-devel mailing list