Function: preview-reinstate-preview

preview-reinstate-preview is a byte-compiled function defined in preview.el.

Signature

(preview-reinstate-preview TEMPDIRLIST TIMESTAMP START END IMAGE FILENAME &optional COUNTERS)

Documentation

Reinstate a single preview.

This gets passed TEMPDIRLIST, a list consisting of the kind of entries used in TeX-active-tempdir, and TIMESTAMP, the time stamp under which the file got read in. It returns an augmented list. START and END give the buffer location where the preview is to be situated, IMAGE the image to place there, and FILENAME the file to use: a triple consisting of filename, its temp directory and the corresponding topdir. COUNTERS is saved counter information, if any.

Source Code

;; Defined in ~/.emacs.d/elpa/auctex-14.1.2/preview.el
(defun preview-reinstate-preview (tempdirlist timestamp start end
  image filename &optional counters)
  "Reinstate a single preview.
This gets passed TEMPDIRLIST, a list consisting of the kind
of entries used in `TeX-active-tempdir', and TIMESTAMP, the
time stamp under which the file got read in.  It returns an augmented
list.  START and END give the buffer location where the preview
is to be situated, IMAGE the image to place there, and FILENAME
the file to use: a triple consisting of filename, its temp directory
and the corresponding topdir.  COUNTERS is saved counter information,
if any."
  (when
      (or (null filename) (file-readable-p (car filename)))
    (when filename
      (unless (equal (nth 1 filename) (car TeX-active-tempdir))
        (setq TeX-active-tempdir
              (or (assoc (nth 1 filename) tempdirlist)
                  (car (push (append (cdr filename) (list 0))
                             tempdirlist))))
        (setcar (cdr TeX-active-tempdir)
                (car (or (member (nth 1 TeX-active-tempdir)
                                 preview-temp-dirs)
                         (progn
                           (add-hook 'kill-emacs-hook
                                     #'preview-cleanout-tempfiles t)
                           (push (nth 1 TeX-active-tempdir)
                                 preview-temp-dirs))))))
      (setcar (nthcdr 2 TeX-active-tempdir)
              (1+ (nth 2 TeX-active-tempdir)))
      (setcdr filename TeX-active-tempdir)
      (setq filename (list filename)))
    (let ((ov (make-overlay start end nil nil nil)))
      (overlay-put ov 'priority (TeX-overlay-prioritize start end))
      (overlay-put ov 'preview-map
                   (preview-make-clickable
                    nil nil nil
                    (lambda (event) (interactive "e")
                      (preview-toggle ov 'toggle event))
                    (lambda (event) (interactive "e")
                      (preview-context-menu ov event))))
      (when counters
        (overlay-put
         ov 'preview-counters
         (cons
            (mapcar #'cdr
                    (if (string= (car counters) "")
                        preview-parsed-counters
                      (setq preview-parsed-counters
                            (preview-parse-counters (car counters)))))
            (mapcar #'cdr
                    (if (string= (cdr counters) "")
                        preview-parsed-counters
                      (setq preview-parsed-counters
                            (preview-parse-counters (cdr counters)))))))
        (setq preview-buffer-has-counters t))
      (overlay-put ov 'filenames filename)
      (overlay-put ov 'preview-image (cons (preview-import-image image)
                                           image))
      (overlay-put ov 'strings
                   (list (preview-active-string ov)))
      (overlay-put ov 'timestamp timestamp)
      (preview-toggle ov t)))
  tempdirlist)