Function: reftex-context-substring
reftex-context-substring is a byte-compiled function defined in
reftex-parse.el.gz.
Signature
(reftex-context-substring &optional TO-END)
Documentation
Return up to 150 chars from point.
When point is just after a { or [, limit string to matching parenthesis.
Source Code
;; Defined in /usr/src/emacs/lisp/textmodes/reftex-parse.el.gz
(defun reftex-context-substring (&optional to-end)
"Return up to 150 chars from point.
When point is just after a { or [, limit string to matching parenthesis."
(cond
(to-end
;; Environment - find next \end
(buffer-substring-no-properties
(point)
(min (+ (point) 150)
(save-match-data
;; FIXME: This is not perfect
(if (re-search-forward "\\\\end{" nil t)
(match-beginning 0)
(point-max))))))
((memq (preceding-char) '(?\{ ?\[))
;; Inside a list - get only the list.
(buffer-substring-no-properties
(point)
(min (+ (point) 150)
(point-max)
(condition-case nil
(let ((forward-sexp-function nil)) ;Unneeded fanciness.
(up-list 1)
(1- (point)))
(error (point-max))))))
(t
;; no list - just grab 150 characters
(buffer-substring-no-properties (point)
(min (+ (point) 150) (point-max))))))