Function: occur-mode-goto-occurrence

occur-mode-goto-occurrence is an interactive and byte-compiled function defined in replace.el.gz.

Signature

(occur-mode-goto-occurrence &optional EVENT)

Documentation

Go to the occurrence specified by EVENT, a mouse click.

If not invoked by a mouse click, go to occurrence on the current line.

Key Bindings

Aliases

occur-mode-mouse-goto

Source Code

;; Defined in /usr/src/emacs/lisp/replace.el.gz
(defun occur-mode-goto-occurrence (&optional event)
  "Go to the occurrence specified by EVENT, a mouse click.
If not invoked by a mouse click, go to occurrence on the current line."
  (interactive (list last-nonmenu-event))
  (let* ((buffer (when event (current-buffer)))
         (targets
          (if (null event)
              ;; Actually `event-end' works correctly with a nil argument as
              ;; well, so we could dispense with this test, but let's not
              ;; rely on this undocumented behavior.
              (occur-mode--find-occurrences)
            (with-current-buffer (window-buffer (posn-window (event-end event)))
              (save-excursion
                (goto-char (posn-point (event-end event)))
                (occur-mode--find-occurrences)))))
         (pos (occur--targets-start targets)))
    (occur--set-arrow)
    (pop-to-buffer (marker-buffer pos))
    (goto-char pos)
    (occur--highlight-occurrences targets)
    (when buffer (next-error-found buffer (current-buffer)))
    (run-hooks 'occur-mode-find-occurrence-hook)))