Function: mpc-sort

mpc-sort is a byte-compiled function defined in mpc.el.gz.

Signature

(mpc-sort ACTIVE)

Source Code

;; Defined in /usr/src/emacs/lisp/mpc.el.gz
(defun mpc-sort (active)
  ;; Sort the active elements at the front.
  (let ((inhibit-read-only t))
    (goto-char (point-min))
    (if (mpc-tagbrowser-all-p) (forward-line 1))
    (condition-case nil
        (sort-subr nil 'forward-line 'end-of-line
                   nil nil
                   (lambda (s1 s2)
                     (setq s1 (buffer-substring-no-properties
                               (car s1) (cdr s1)))
                     (setq s2 (buffer-substring-no-properties
                               (car s2) (cdr s2)))
                     (cond
                      ((member s1 active)
                       (if (member s2 active)
                           (let ((cmp (mpc-compare-strings s1 s2 t)))
                             (and (numberp cmp) (< cmp 0)))
                         t))
                      ((member s2 active) nil)
                      (t (let ((cmp (mpc-compare-strings s1 s2 t)))
                           (and (numberp cmp) (< cmp 0)))))))
      ;; The comparison predicate arg is new in Emacs-22.
      (wrong-number-of-arguments
        (sort-subr nil 'forward-line 'end-of-line
                   (lambda ()
                     (let ((name (buffer-substring-no-properties
                                  (point) (line-end-position))))
                       (cond
                        ((member name active) (concat "1" name))
                        (t (concat "2" "name"))))))))))