Function: reftex-last-assoc-before-elt

reftex-last-assoc-before-elt is a byte-compiled function defined in reftex.el.gz.

Signature

(reftex-last-assoc-before-elt KEY ELT LIST &optional EXCLUSIVE)

Documentation

Find the last association of KEY in LIST before or at ELT.

ELT is found in LIST with equal, not eq. Returns nil when either KEY or elt are not found in LIST. When EXCLUSIVE is non-nil, ELT cannot be the return value. On success, returns the association.

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/reftex.el.gz
(defun reftex-last-assoc-before-elt (key elt list &optional exclusive)
  "Find the last association of KEY in LIST before or at ELT.
ELT is found in LIST with equal, not eq.
Returns nil when either KEY or elt are not found in LIST.
When EXCLUSIVE is non-nil, ELT cannot be the return value.
On success, returns the association."
  (let* ((elt (car (member elt list))) (ex (not exclusive)) ass last-ass)
    (while (and (setq ass (assoc key list))
                (setq list (memq ass list))
                (or ex (not (eq elt (car list))))
                (memq elt list))
      (setq last-ass ass
            list (cdr list)))
    last-ass))