[1843] in Kerberos_V5_Development
handy gnats elisp
daemon@ATHENA.MIT.EDU (Barry Jaspan)
Wed Oct 2 18:47:26 1996
Date: Wed, 2 Oct 1996 18:47:11 -0400
From: "Barry Jaspan" <bjaspan@MIT.EDU>
To: krbdev@MIT.EDU
Add the following code to your .emacs and you can arrange to have the
output of M-x summ-pr sorted by any number of fields; the code below
sorts by category first and responsible second. I'm not convinced my
sort-alist function is an efficient way to do it, and it seems this
code must already exist in emacs somewhere...
(setq gnats::summary-sort-function
(function (lambda (prs) (sort-alist prs '(category responsible)))))
(defun sort-alist-pred (el1 el2)
(let* ((key (car sort-alist-keys))
(k1 (assoc key el1))
(k2 (assoc key el2)))
(cond ((and k1 (not k2)) t)
((and k2 (not k1)) nil)
((string-lessp (cdr k1) (cdr k2)) t)
(t nil)
)))
(defun sort-alist (lst sort-alist-keys)
(let ((sort-alist-keys (reverse sort-alist-keys)))
(while sort-alist-keys
(setq lst (sort lst 'sort-alist-pred))
(setq sort-alist-keys (cdr sort-alist-keys)))
lst))
Barry