changeset 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 da58802bf02a
children 34841f02adea
files lisp/simple.el
diffstat 1 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/simple.el	Fri Jun 22 06:22:31 2007 +0000
+++ b/lisp/simple.el	Fri Jun 22 07:55:15 2007 +0000
@@ -156,6 +156,14 @@
   :group 'next-error
   :version "22.1")
 
+(defcustom next-error-recenter nil
+  "*Display the line in the visited source file recentered to this number.
+If nil, don't do any recentering.  See `recenter'."
+  :type '(choice (number :tag "Argument for `recenter'")
+                 (const :tag "No recentering" nil))
+  :group 'next-error
+  :version "23.1")
+
 (defcustom next-error-hook nil
   "*List of hook functions run by `next-error' after visiting source file."
   :type 'hook
@@ -305,6 +313,8 @@
     ;; we know here that next-error-function is a valid symbol we can funcall
     (with-current-buffer next-error-last-buffer
       (funcall next-error-function (prefix-numeric-value arg) reset)
+      (when next-error-recenter
+        (recenter next-error-recenter))
       (run-hooks 'next-error-hook))))
 
 (defun next-error-internal ()
@@ -313,6 +323,8 @@
   ;; we know here that next-error-function is a valid symbol we can funcall
   (with-current-buffer next-error-last-buffer
     (funcall next-error-function 0 nil)
+    (when next-error-recenter
+      (recenter next-error-recenter))
     (run-hooks 'next-error-hook)))
 
 (defalias 'goto-next-locus 'next-error)