249 |
(const :tag "Fringe arrow" 'fringe-arrow)) |
(const :tag "Fringe arrow" 'fringe-arrow)) |
250 |
:group 'next-error |
:group 'next-error |
251 |
:version "21.4") |
:version "21.4") |
252 |
|
|
253 |
|
;;; Internal variable for `next-error-follow-mode-post-command-hook'. |
254 |
|
(defvar next-error-follow-last-line nil) |
255 |
|
|
256 |
|
(define-minor-mode next-error-follow-minor-mode |
257 |
|
"Minor mode for compilation, occur and diff modes. |
258 |
|
When turned on, cursor motion in the compilation, grep, occur or diff |
259 |
|
buffer causes automatic display of the corresponding source code |
260 |
|
location." |
261 |
|
nil " Fol" nil |
262 |
|
(if (not next-error-follow-minor-mode) |
263 |
|
(remove-hook 'post-command-hook 'next-error-follow-mode-post-command-hook t) |
264 |
|
(add-hook 'post-command-hook 'next-error-follow-mode-post-command-hook nil t) |
265 |
|
(make-variable-buffer-local 'next-error-follow-last-line))) |
266 |
|
|
267 |
|
;;; Used as a `post-command-hook' by `next-error-follow-mode' |
268 |
|
;;; for the *Compilation* *grep* and *Occur* buffers. |
269 |
|
(defun next-error-follow-mode-post-command-hook () |
270 |
|
(unless (equal next-error-follow-last-line (line-number-at-pos)) |
271 |
|
(setq next-error-follow-last-line (line-number-at-pos)) |
272 |
|
(condition-case nil |
273 |
|
(let ((compilation-context-lines nil)) |
274 |
|
(setq compilation-current-error (point)) |
275 |
|
(next-error-no-select 0)) |
276 |
|
(error t)))) |
277 |
|
|
278 |
|
|
279 |
;;; |
;;; |
280 |
|
|