comparison lisp/simple.el @ 81551:a39eb4ca5597

(next-error-recenter): New defcustom. (next-error, next-error-internal): Recenter if specified, immediately prior to running `next-error-hook'.
author Thien-Thi Nguyen <ttn@gnuvola.org>
date Fri, 22 Jun 2007 07:55:15 +0000
parents ad5cb9373c74
children 7be7263c7d7f
comparison
equal deleted inserted replaced
81550:da58802bf02a 81551:a39eb4ca5597
153 (const :tag "Semipermanent highlighting" t) 153 (const :tag "Semipermanent highlighting" t)
154 (const :tag "No highlighting" nil) 154 (const :tag "No highlighting" nil)
155 (const :tag "Fringe arrow" fringe-arrow)) 155 (const :tag "Fringe arrow" fringe-arrow))
156 :group 'next-error 156 :group 'next-error
157 :version "22.1") 157 :version "22.1")
158
159 (defcustom next-error-recenter nil
160 "*Display the line in the visited source file recentered to this number.
161 If nil, don't do any recentering. See `recenter'."
162 :type '(choice (number :tag "Argument for `recenter'")
163 (const :tag "No recentering" nil))
164 :group 'next-error
165 :version "23.1")
158 166
159 (defcustom next-error-hook nil 167 (defcustom next-error-hook nil
160 "*List of hook functions run by `next-error' after visiting source file." 168 "*List of hook functions run by `next-error' after visiting source file."
161 :type 'hook 169 :type 'hook
162 :group 'next-error) 170 :group 'next-error)
303 (if (consp arg) (setq reset t arg nil)) 311 (if (consp arg) (setq reset t arg nil))
304 (when (setq next-error-last-buffer (next-error-find-buffer)) 312 (when (setq next-error-last-buffer (next-error-find-buffer))
305 ;; we know here that next-error-function is a valid symbol we can funcall 313 ;; we know here that next-error-function is a valid symbol we can funcall
306 (with-current-buffer next-error-last-buffer 314 (with-current-buffer next-error-last-buffer
307 (funcall next-error-function (prefix-numeric-value arg) reset) 315 (funcall next-error-function (prefix-numeric-value arg) reset)
316 (when next-error-recenter
317 (recenter next-error-recenter))
308 (run-hooks 'next-error-hook)))) 318 (run-hooks 'next-error-hook))))
309 319
310 (defun next-error-internal () 320 (defun next-error-internal ()
311 "Visit the source code corresponding to the `next-error' message at point." 321 "Visit the source code corresponding to the `next-error' message at point."
312 (setq next-error-last-buffer (current-buffer)) 322 (setq next-error-last-buffer (current-buffer))
313 ;; we know here that next-error-function is a valid symbol we can funcall 323 ;; we know here that next-error-function is a valid symbol we can funcall
314 (with-current-buffer next-error-last-buffer 324 (with-current-buffer next-error-last-buffer
315 (funcall next-error-function 0 nil) 325 (funcall next-error-function 0 nil)
326 (when next-error-recenter
327 (recenter next-error-recenter))
316 (run-hooks 'next-error-hook))) 328 (run-hooks 'next-error-hook)))
317 329
318 (defalias 'goto-next-locus 'next-error) 330 (defalias 'goto-next-locus 'next-error)
319 (defalias 'next-match 'next-error) 331 (defalias 'next-match 'next-error)
320 332