Function: reftex-get-restriction

reftex-get-restriction is a byte-compiled function defined in reftex-index.el.gz.

Signature

(reftex-get-restriction ARG DOCSTRUCT)

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/reftex-index.el.gz
(defun reftex-get-restriction (arg docstruct)
  ;; Interpret the prefix ARG and derive index restriction specs.
  (let* ((beg (min (point) (or (condition-case nil (mark) (error nil))
                               (point-max))))
         (end (max (point) (or (condition-case nil (mark) (error nil))
                               (point-min))))
         bor eor label here-I-am)
    (cond
     ((eq arg 2)
      (setq here-I-am (car (reftex-where-am-I))
            bor (if (eq (car here-I-am) 'toc)
                    here-I-am
                  (reftex-last-assoc-before-elt
                   'toc here-I-am docstruct))
            eor (car (memq (assq 'toc (cdr (memq bor docstruct))) docstruct))
            label (nth 6 bor)))
     ((eq arg 3)
      (save-excursion
        (setq label "region")
        (goto-char beg)
        (setq bor (car (reftex-where-am-I)))
        (setq bor (nth 1 (memq bor docstruct)))
        (goto-char end)
        (setq eor (nth 1 (memq (car (reftex-where-am-I)) docstruct)))))
     (t nil))
    (if (and label (or bor eor))
        (list label bor eor)
      nil)))