Function: compilation--update-markers

compilation--update-markers is a byte-compiled function defined in compile.el.gz.

Signature

(compilation--update-markers LOC MARKER SCREEN-COLUMNS FIRST-COLUMN)

Documentation

Update markers in LOC, and set MARKER to location pointed by LOC.

SCREEN-COLUMNS and FIRST-COLUMN are the value of compilation-error-screen-columns and compilation-first-column to use if they are not set buffer-locally in the target buffer.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/compile.el.gz
(defun compilation--update-markers (loc marker screen-columns first-column)
  "Update markers in LOC, and set MARKER to location pointed by LOC.
SCREEN-COLUMNS and FIRST-COLUMN are the value of
`compilation-error-screen-columns' and `compilation-first-column' to use
if they are not set buffer-locally in the target buffer."
  (with-current-buffer
      (if (bufferp (caar (compilation--loc->file-struct loc)))
          (caar (compilation--loc->file-struct loc))
        (apply #'compilation-find-file
               marker
               (caar (compilation--loc->file-struct loc))
               (cadr (car (compilation--loc->file-struct loc)))
               (compilation--file-struct->formats
                (compilation--loc->file-struct loc))))
    (let ((screen-columns
           ;; Obey the compilation-error-screen-columns of the target
           ;; buffer if its major mode set it buffer-locally.
           (if (local-variable-p 'compilation-error-screen-columns)
               compilation-error-screen-columns screen-columns))
          (compilation-first-column
           (if (local-variable-p 'compilation-first-column)
               compilation-first-column first-column))
          (last 1))
      (save-restriction
        (widen)
        (goto-char (point-min))
        ;; Treat file's found lines in forward order, 1 by 1.
        (dolist (line (reverse (cddr (compilation--loc->file-struct loc))))
          (when (car line)     ; else this is a filename without a line#
            (compilation-beginning-of-line (- (car line) last -1))
            (setq last (car line)))
          ;; Treat line's found columns and store/update a marker for each.
          (dolist (col (cdr line))
            (if (compilation--loc->col col)
                (if (eq (compilation--loc->col col) -1)
                    ;; Special case for range end.
                    (end-of-line)
                  (compilation-move-to-column (compilation--loc->col col)
                                              screen-columns))
              (beginning-of-line)
              (skip-chars-forward " \t"))
            (if (compilation--loc->marker col)
                (set-marker (compilation--loc->marker col) (point))
              (setf (compilation--loc->marker col) (point-marker)))
            ;; (setf (compilation--loc->timestamp col) timestamp)
            ))))))