Function: TeX-region-update-point

TeX-region-update-point is a byte-compiled function defined in tex.el.

Signature

(TeX-region-update-point)

Documentation

Syncs the location of point in the region file with the current file.

Thereafter, point in the region file is on the same text as in the current buffer.

Do nothing in case the last command hasn't operated on the region or TeX-source-correlate-mode(var)/TeX-source-correlate-mode(fun) is disabled.

Source Code

;; Defined in ~/.emacs.d/elpa/auctex-14.1.2/tex.el
(defun TeX-region-update-point ()
  "Syncs the location of point in the region file with the current file.

Thereafter, point in the region file is on the same text as in
the current buffer.

Do nothing in case the last command hasn't operated on the region
or `TeX-source-correlate-mode' is disabled."
  (when (and TeX-current-process-region-p TeX-source-correlate-mode)
    (let ((region-buf (get-file-buffer (TeX-region-file t)))
          (orig-line (TeX-current-offset))
          (pos-in-line (- (point) (max (line-beginning-position)
                                       (or TeX-command-region-begin
                                           (region-beginning))))))
      (when region-buf
        (with-current-buffer region-buf
          (goto-char (point-min))
          (when (re-search-forward "!offset(\\(-?[0-9]+\\)" nil t)
            (let ((offset (string-to-number (match-string 1))))
              (goto-char (point-min))
              (forward-line (- orig-line offset))
              (forward-char pos-in-line))))))))