Function: reftex-index-phrases-info
reftex-index-phrases-info is an interactive and byte-compiled function
defined in reftex-index.el.gz.
Signature
(reftex-index-phrases-info)
Documentation
Display information about the phrase at point.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/textmodes/reftex-index.el.gz
(defun reftex-index-phrases-info ()
"Display information about the phrase at point."
(interactive)
(save-excursion
(beginning-of-line)
(unless (looking-at reftex-index-phrases-phrase-regexp12)
(error "Not a phrase line"))
(save-match-data (reftex-index-phrases-parse-header t))
(let* ((char (if (not (equal (match-string 1) ""))
(string-to-char (match-string 1))))
(phrase (match-string 3))
(index-key (match-string 6))
(index-keys (split-string
(or index-key phrase)
reftex-index-phrases-logical-or-regexp))
(macro-data (cdr (if (null char)
(car reftex-index-phrases-macro-data)
(assoc char reftex-index-phrases-macro-data))))
(macro-fmt (car macro-data))
(repeat (nth 1 macro-data))
(as-words reftex-index-phrases-search-whole-words)
(example (reftex-index-make-replace-string
macro-fmt (downcase phrase) (car index-keys) repeat))
(re (reftex-index-make-phrase-regexp phrase as-words t))
(re1 (reftex-index-phrases-find-dup-re phrase))
(re2 (reftex-index-phrases-find-dup-re phrase 'sub))
superphrases
(nmatches 0)
(ntimes1 0)
(ntimes2 0)
(case-fold-search reftex-index-phrases-case-fold-search)
file files buf)
(setq files reftex-index-phrases-files)
(save-excursion
(save-restriction
(widen)
(goto-char (point-min))
(while (re-search-forward re1 nil t)
(cl-incf ntimes1))
(goto-char (point-min))
(while (re-search-forward re2 nil t)
(push (cons (count-lines 1 (point)) (match-string 1)) superphrases)
(cl-incf ntimes2))))
(save-current-buffer
(while (setq file (pop files))
(setq buf (reftex-get-file-buffer-force file))
(when buf
(set-buffer buf)
(save-excursion
(save-restriction
(widen)
(goto-char (point-min))
(let ((case-fold-search reftex-index-phrases-case-fold-search))
(while (re-search-forward re nil t)
(or (reftex-in-comment)
(cl-incf nmatches)))))))))
(with-output-to-temp-buffer "*Help*"
(princ (format " Phrase: %s\n" phrase))
(princ (format " Macro key: %s\n" char))
(princ (format " Macro format: %s\n" macro-fmt))
(princ (format " Repeat: %s\n" repeat))
(cond
(index-key
(let ((iks index-keys) (cnt 0) ik)
(while (setq ik (pop iks))
(princ (format "Index entry %d: %s\n" (cl-incf cnt) ik)))))
(repeat
(princ (format " Index entry: %s\n" phrase)))
(t
(princ " Index key: <<Given by the match>>\n")))
(princ (format " Example: %s\n" example))
(terpri)
(princ (format "Total matches: %s in %s\n"
(reftex-number nmatches "match" "es")
(reftex-number (length reftex-index-phrases-files)
"LaTeX file")))
(princ (format " Uniqueness: Phrase occurs %s in phrase buffer\n"
(reftex-number ntimes1 "time")))
(if (> ntimes2 1)
(progn
(princ (format " Superphrases: Phrase matches the following %s in the phrase buffer:\n"
(reftex-number ntimes2 "line")))
(mapcar (lambda(x)
(princ (format " Line %4d: %s\n" (car x) (cdr x))))
(nreverse superphrases))))))))