Function: occur--highlight-occurrences

occur--highlight-occurrences is a byte-compiled function defined in replace.el.gz.

Signature

(occur--highlight-occurrences TARGETS)

Source Code

;; Defined in /usr/src/emacs/lisp/replace.el.gz
;; Highlight the current visited occurrence.
(defun occur--highlight-occurrences (targets)
  (let ((start-marker (occur--targets-start targets)))
    (occur-goto-locus-delete-o)
    (with-current-buffer (marker-buffer start-marker)
      (when (or (eq next-error-highlight t)
                (numberp next-error-highlight))
        (setq occur-highlight-overlays
              (mapcar (lambda (target)
                        (let ((o (make-overlay (car target) (cdr target))))
                          (overlay-put o 'face 'next-error)
                          o))
                      (if (listp targets)
                          targets
                        ;; `occur-target' compatibility: when we only
                        ;; have a single starting point, highlight the
                        ;; rest of the line.
                        (let ((end-pos (save-excursion
                                         (goto-char start-marker)
                                         (line-end-position))))
                          (list (cons start-marker end-pos))))))
        (add-hook 'pre-command-hook #'occur-goto-locus-delete-o)
        (when (numberp next-error-highlight)
          ;; We want highlighting for a limited time:
          ;; set up a timer to delete it.
	  (setq next-error-highlight-timer
                (run-at-time next-error-highlight nil
			     'occur-goto-locus-delete-o))))

      (when (eq next-error-highlight 'fringe-arrow)
        ;; We want a fringe arrow (instead of highlighting).
        (setq next-error-overlay-arrow-position
	      (copy-marker (line-beginning-position)))))))