Function: reftex-compare-phrase-lines
reftex-compare-phrase-lines is a byte-compiled function defined in
reftex-index.el.gz.
Signature
(reftex-compare-phrase-lines A B)
Documentation
The comparison function used for sorting.
Source Code
;; Defined in /usr/src/emacs/lisp/textmodes/reftex-index.el.gz
(defun reftex-compare-phrase-lines (a b)
"The comparison function used for sorting."
(let (ca cb pa pb c-p p-p)
(if (string-match reftex-index-phrases-phrase-regexp12 a)
(progn
;; Extract macro char and phrase-or-key for a
(setq ca (match-string 1 a)
pa (downcase
(or (and reftex-index-phrases-sort-prefers-entry
(match-string 6 a))
(match-string 3 a))))
(if (string-match reftex-index-phrases-phrase-regexp12 b)
(progn
;; Extract macro char and phrase-or-key for b
(setq cb (match-string 1 b)
pb (downcase
(or (and reftex-index-phrases-sort-prefers-entry
(match-string 6 b))
(match-string 3 b))))
(setq c-p (string< ca cb)
p-p (string< pa pb))
;; Do the right comparison, based on the value of `chars-first'
;; `chars-first' is bound locally in the calling function
(if reftex--chars-first
(if (string= ca cb) p-p c-p)
(if (string= pa pb) c-p p-p)))))
;; If line a does not match, the answer we return determines
;; if non-matching lines are collected at the beginning.
;; When we return t here, non-matching lines form
;; block separators for searches.
(not reftex-index-phrases-sort-in-blocks))))