1678 |
"Jump to an error corresponding to MSG at MK. |
"Jump to an error corresponding to MSG at MK. |
1679 |
All arguments are markers. If END-MK is non-nil, mark is set there |
All arguments are markers. If END-MK is non-nil, mark is set there |
1680 |
and overlay is highlighted between MK and END-MK." |
and overlay is highlighted between MK and END-MK." |
|
(if (eq (window-buffer (selected-window)) |
|
|
(marker-buffer msg)) |
|
|
;; If the compilation buffer window is selected, |
|
|
;; keep the compilation buffer in this window; |
|
|
;; display the source in another window. |
|
|
(let ((pop-up-windows t)) |
|
|
(pop-to-buffer (marker-buffer mk))) |
|
|
(if (window-dedicated-p (selected-window)) |
|
|
(pop-to-buffer (marker-buffer mk)) |
|
|
(switch-to-buffer (marker-buffer mk)))) |
|
|
;; If narrowing gets in the way of going to the right place, widen. |
|
|
(unless (eq (goto-char mk) (point)) |
|
|
(widen) |
|
|
(goto-char mk)) |
|
|
(if end-mk |
|
|
(push-mark end-mk t) |
|
|
(if mark-active (setq mark-active))) |
|
|
;; If hideshow got in the way of |
|
|
;; seeing the right place, open permanently. |
|
|
(dolist (ov (overlays-at (point))) |
|
|
(when (eq 'hs (overlay-get ov 'invisible)) |
|
|
(delete-overlay ov) |
|
|
(goto-char mk))) |
|
|
|
|
1681 |
;; Show compilation buffer in other window, scrolled to this error. |
;; Show compilation buffer in other window, scrolled to this error. |
1682 |
(let* ((pop-up-windows t) |
(let* ((from-compilation-buffer (eq (window-buffer (selected-window)) |
1683 |
;; Use an existing window if it is in a visible frame. |
(marker-buffer msg))) |
1684 |
|
;; Use an existing window if it is in a visible frame. |
1685 |
(pre-existing (get-buffer-window (marker-buffer msg) 0)) |
(pre-existing (get-buffer-window (marker-buffer msg) 0)) |
1686 |
(w (let ((display-buffer-reuse-frames t)) |
(w (if (and from-compilation-buffer pre-existing) |
1687 |
;; Pop up a window. |
;; Calling display-buffer here may end up (partly) hiding |
1688 |
(display-buffer (marker-buffer msg)))) |
;; the error location if the two buffers are in two |
1689 |
|
;; different frames. So don't do it if it's not necessary. |
1690 |
|
pre-existing |
1691 |
|
(let ((display-buffer-reuse-frames t) |
1692 |
|
(pop-up-windows t)) |
1693 |
|
;; Pop up a window. |
1694 |
|
(display-buffer (marker-buffer msg))))) |
1695 |
(highlight-regexp (with-current-buffer (marker-buffer msg) |
(highlight-regexp (with-current-buffer (marker-buffer msg) |
1696 |
;; also do this while we change buffer |
;; also do this while we change buffer |
1697 |
(compilation-set-window w msg) |
(compilation-set-window w msg) |
1701 |
;; creating a new window. |
;; creating a new window. |
1702 |
(unless pre-existing (compilation-set-window-height w)) |
(unless pre-existing (compilation-set-window-height w)) |
1703 |
|
|
1704 |
|
(if from-compilation-buffer |
1705 |
|
;; If the compilation buffer window was selected, |
1706 |
|
;; keep the compilation buffer in this window; |
1707 |
|
;; display the source in another window. |
1708 |
|
(let ((pop-up-windows t)) |
1709 |
|
(pop-to-buffer (marker-buffer mk) 'other-window)) |
1710 |
|
(if (window-dedicated-p (selected-window)) |
1711 |
|
(pop-to-buffer (marker-buffer mk)) |
1712 |
|
(switch-to-buffer (marker-buffer mk)))) |
1713 |
|
;; If narrowing gets in the way of going to the right place, widen. |
1714 |
|
(unless (eq (goto-char mk) (point)) |
1715 |
|
(widen) |
1716 |
|
(goto-char mk)) |
1717 |
|
(if end-mk |
1718 |
|
(push-mark end-mk t) |
1719 |
|
(if mark-active (setq mark-active))) |
1720 |
|
;; If hideshow got in the way of |
1721 |
|
;; seeing the right place, open permanently. |
1722 |
|
(dolist (ov (overlays-at (point))) |
1723 |
|
(when (eq 'hs (overlay-get ov 'invisible)) |
1724 |
|
(delete-overlay ov) |
1725 |
|
(goto-char mk))) |
1726 |
|
|
1727 |
(when highlight-regexp |
(when highlight-regexp |
1728 |
(if (timerp next-error-highlight-timer) |
(if (timerp next-error-highlight-timer) |
1729 |
(cancel-timer next-error-highlight-timer)) |
(cancel-timer next-error-highlight-timer)) |