Function: reftex-show-entry

reftex-show-entry is a byte-compiled function defined in reftex-ref.el.gz.

Signature

(reftex-show-entry BEG-HLT END-HLT)

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/reftex-ref.el.gz
(defun reftex-show-entry (beg-hlt end-hlt)
  ;; Show entry if point is hidden
  (let* ((n (/ (reftex-window-height) 2))
         (beg (save-excursion
               (re-search-backward "[\n\r]" nil 1 n) (point)))
         (end (save-excursion
                (re-search-forward  "[\n\r]" nil 1 n) (point))))
    (cond
     ((and (boundp 'buffer-invisibility-spec) buffer-invisibility-spec
           (get-char-property (1+ beg-hlt) 'invisible))
      ;; Invisible with text properties.  That is easy to change.
      (push (cons (current-buffer) buffer-invisibility-spec)
            reftex-buffers-with-changed-invisibility)
      (setq buffer-invisibility-spec nil))
     ((string-search "\r" (buffer-substring beg end))
      ;; Invisible with selective display.  We need to copy it.
      (let ((string (buffer-substring-no-properties beg end)))
        (switch-to-buffer "*RefTeX Context Copy*")
        (setq buffer-read-only nil)
        (erase-buffer)
        (insert string)
        (subst-char-in-region (point-min) (point-max) ?\r ?\n t)
        (goto-char (- beg-hlt beg))
        (reftex-highlight 0 (1+ (- beg-hlt beg)) (1+ (- end-hlt beg)))
        (if (reftex-refontify)
            (when (or (not (eq major-mode 'latex-mode))
                      (not font-lock-mode))
              (latex-mode)
              (run-hook-with-args
               'reftex-pre-refontification-functions
               reftex-call-back-to-this-buffer 'reftex-hidden)
              (turn-on-font-lock))
          (when (or (not (eq major-mode 'fundamental-mode))
                    font-lock-mode)
            (fundamental-mode)))
        (run-hooks 'reftex-display-copied-context-hook)
        (setq buffer-read-only t))))))