How about making goto-line suggest the number at point as its default argument?
(defun goto-line (arg &optional buffer) "Goto line ARG, counting from line 1 at beginning of buffer. With just C-u as argument, move point in the most recently displayed other buffer, and display it." (interactive (if (and current-prefix-arg (not (consp current-prefix-arg))) (list (prefix-numeric-value current-prefix-arg)) ;; Look for a default, a number in the buffer at point. (let ((default (save-excursion (skip-chars-backward "0-9") (if (looking-at "[0-9]") (buffer-substring-no-properties (point) (progn (skip-chars-forward "0-9") (point))))))) ;; Read the argument, offering that number (if any) default. (list (read-from-minibuffer (format "Goto line (%s): " default) nil nil t 'minibuffer-history default) (if (consp current-prefix-arg) (other-buffer (current-buffer) t)))))) (with-current-buffer (or buffer (current-buffer)) (save-restriction (widen) (goto-char 1) (if (eq selective-display t) (re-search-forward "[\n\C-m]" nil 'end (1- arg)) (forward-line (1- arg))) (if buffer (let ((window (get-buffer-window buffer))) (if window (set-window-point window (point)) (display-buffer buffer))))))) _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-devel