Use forward-line rather than goto-line.

This commit is contained in:
Glenn Morris 2009-08-22 19:29:18 +00:00
parent a569b48010
commit e6ce8c4239
24 changed files with 207 additions and 112 deletions

View file

@ -1,3 +1,50 @@
2009-08-22 Glenn Morris <rgm@gnu.org>
* bs.el (bs--redisplay):
* cus-edit.el (custom-redraw):
* ibuffer.el (ibuffer-bury-buffer):
* server.el (server-goto-line-column):
* startup.el (command-line-1):
* strokes.el (strokes-xpm-for-stroke):
* term.el (term-display-buffer-line):
* view.el (View-goto-line):
* calc/calc.el (calc-do, calc-trail-buffer):
* play/gamegrid.el (gamegrid-add-score-insecure):
* progmodes/ada-mode.el (ada-compile-goto-error):
* progmodes/ada-xref.el (ada-xref-find-in-modified-ali):
(ebrowse-select-1st-to-9nth):
* progmodes/ebrowse.el (ebrowse-toggle-file-name-display)
* progmodes/gud.el (gud-display-line):
(idlwave-shell-display-line):
* progmodes/idlw-shell.el (idlwave-shell-goto-frame)
* progmodes/make-mode.el (makefile-browser-toggle):
(vhdl-speedbar-port-copy, vhdl-compose-components-package):
* progmodes/vhdl-mode.el (vhdl-speedbar-find-file)
* textmodes/picture.el (picture-draw-rectangle):
* textmodes/reftex-index.el (reftex-index-goto-letter):
(reftex-select-jump-to-previous):
* textmodes/reftex-sel.el (reftex-find-start-point)
* textmodes/reftex-toc.el (reftex-toc, reftex-toc-restore-region):
(rst-straighten-deco-spacing, rst-section-tree, rst-toc):
* textmodes/rst.el (rst-promote-region, rst-straighten-decorations)
* textmodes/tex-mode.el (tex-compilation-parse-errors):
* textmodes/two-column.el (2C-associated-buffer):
Use forward-line rather than goto-line.
* emulation/vi.el (vi-goto-line): Don't warn about non-interactive
goto-line.
* international/ucs-normalize.el (nfd)
(decomposition-translation-alist, decomposition-char-recursively)
(alist-list-to-vector, quick-check-list, quick-check-list-to-regexp):
Declare.
* progmodes/make-mode.el (makefile-browser-insert-selection): Use
goto-char rather than goto-line.
* progmodes/prolog.el (compilation-error-regexp-alist)
(compilation-forget-errors): Declare.
2009-08-22 Juri Linkov <juri@jurta.org>
* progmodes/grep.el (lgrep, rgrep): At the beginning

View file

@ -1,7 +1,7 @@
;;; bs.el --- menu for selecting and displaying buffers
;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004,
;; 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
;; 2007, 2008, 2009 Free Software Foundation, Inc.
;; Author: Olaf Sylvester <Olaf.Sylvester@netsurf.de>
;; Maintainer: Olaf Sylvester <Olaf.Sylvester@netsurf.de>
;; Keywords: convenience
@ -575,10 +575,11 @@ a special function. SORT-DESCRIPTION is an element of `bs-sort-functions'."
"Redisplay whole Buffer Selection Menu.
If KEEP-LINE-P is non-nil the point will stay on current line.
SORT-DESCRIPTION is an element of `bs-sort-functions'."
(let ((line (1+ (count-lines 1 (point)))))
(let ((line (count-lines 1 (point))))
(bs-show-in-buffer (bs-buffer-list nil sort-description))
(when keep-line-p
(goto-line line))
(goto-char (point-min))
(forward-line line))
(beginning-of-line)))
(defun bs--goto-current-buffer ()

View file

@ -1,7 +1,7 @@
;;; calc.el --- the GNU Emacs calculator
;; Copyright (C) 1990, 1991, 1992, 1993, 2001, 2002, 2003, 2004,
;; 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
;; Copyright (C) 1990, 1991, 1992, 1993, 2001, 2002, 2003, 2004, 2005,
;; 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
;; Author: David Gillespie <daveg@synaptics.com>
;; Maintainer: Jay Belanger <jay.p.belanger@gmail.com>
@ -1615,11 +1615,13 @@ See calc-keypad for details."
(and (memq 'position-point calc-command-flags)
(if (eq major-mode 'calc-mode)
(progn
(goto-line calc-final-point-line)
(goto-char (point-min))
(forward-line (1- calc-final-point-line))
(move-to-column calc-final-point-column))
(save-current-buffer
(calc-select-buffer)
(goto-line calc-final-point-line)
(goto-char (point-min))
(forward-line (1- calc-final-point-line))
(move-to-column calc-final-point-column))))
(unless (memq 'keep-flags calc-command-flags)
(save-excursion
@ -2019,7 +2021,8 @@ See calc-keypad for details."
(eq (marker-buffer calc-trail-pointer) calc-trail-buffer))
(save-excursion
(set-buffer calc-trail-buffer)
(goto-line 2)
(goto-char (point-min))
(forward-line 1)
(setq calc-trail-pointer (point-marker))))
calc-trail-buffer)

View file

@ -2192,9 +2192,10 @@ and `face'."
(when (and (>= pos from) (<= pos to))
(condition-case nil
(progn
(if (> column 0)
(goto-line line)
(goto-line (1+ line)))
(goto-char (point-min))
(forward-line (if (> column 0)
(1- line)
line))
(move-to-column column))
(error nil)))))

View file

@ -1,7 +1,7 @@
;;; ibuffer.el --- operate on buffers like dired
;; Copyright (C) 2000, 2001, 2002, 2003, 2004,
;; 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
;; Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
;; 2009 Free Software Foundation, Inc.
;; Author: Colin Walters <walters@verbum.org>
;; Maintainer: John Paul Wallington <jpw@gnu.org>
@ -1093,7 +1093,8 @@ one window."
(line (+ 1 (count-lines 1 (point)))))
(bury-buffer buf)
(ibuffer-update nil t)
(goto-line line)))
(goto-char (point-min))
(forward-line (1- line))))
(defun ibuffer-visit-tags-table ()
"Visit the tags table in the buffer on this line. See `visit-tags-table'."

View file

@ -586,7 +586,8 @@ FILE is created there."
(t ""))))
(sort-fields 1 (point-min) (point-max))
(reverse-region (point-min) (point-max))
(goto-line (1+ gamegrid-score-file-length))
(goto-char (point-min))
(forward-line gamegrid-score-file-length)
(delete-region (point) (point-max))
(setq buffer-read-only t)
(save-buffer)))

View file

@ -229,6 +229,8 @@ It may be `downcase-word', `upcase-word', `ada-loose-case-word' or
(const ada-no-auto-case))
:group 'ada)
;; FIXME If this is not something required by the ada language, this
;; should be removed.
(defcustom ada-clean-buffer-before-saving t
"*Non-nil means remove trailing spaces and untabify the buffer before saving."
:type 'boolean :group 'ada)
@ -793,8 +795,9 @@ the 4 file locations can be clicked on and jumped to."
(compilation-find-file (point-marker) (match-string 1) "./")
(set-buffer file)
(if (stringp line)
(goto-line (string-to-number line)))
(when (stringp line)
(goto-char (point-min))
(forward-line (1- (string-to-number line))))
(setq source (point-marker)))

View file

@ -1901,7 +1901,8 @@ This function is disabled for operators, and only works for identifiers."
(ada-name-of identlist)))
;; one => should be the right one
((= len 1)
(goto-line (caar declist)))
(goto-char (point-min))
(forward-line (1- (caar declist))))
;; more than one => display choice list
(t
@ -1937,7 +1938,8 @@ This function is disabled for operators, and only works for identifiers."
(read-from-minibuffer "Enter No. of your choice: "))))
)
(set-buffer ali-buffer)
(goto-line (car (nth (1- choice) declist)))
(goto-char (point-min))
(forward-line (1- (car (nth (1- choice) declist))))
))))))
@ -2166,7 +2168,8 @@ If OTHER-FRAME is non-nil, creates a new frame to show the file."
;; move the cursor to the correct position
(push-mark)
(goto-line line)
(goto-char (point-min))
(forward-line (1- line))
(move-to-column column)
;; If we are not on the identifier, the ali file was not up-to-date.

View file

@ -1337,7 +1337,8 @@ With PREFIX, insert that many filenames."
(setf ebrowse--show-file-names-flag (not ebrowse--show-file-names-flag))
(let ((old-line (count-lines (point-min) (point))))
(ebrowse-redraw-tree)
(goto-line old-line)))
(goto-char (point-min))
(forward-line (1- old-line))))
@ -4316,7 +4317,8 @@ NUMBER-OF-STATIC-VARIABLES:"
(interactive)
(let* ((maxlin (count-lines (point-min) (point-max)))
(n (min maxlin (+ 2 (string-to-number (this-command-keys))))))
(goto-line n)
(goto-char (point-min))
(forward-line (1- n))
(throw 'electric-buffer-menu-select (point))))

View file

@ -1,12 +1,12 @@
;;; gud.el --- Grand Unified Debugger mode for running GDB and other debuggers
;; Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 2000, 2001, 2002, 2003,
;; 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
;; Author: Eric S. Raymond <esr@snark.thyrsus.com>
;; Maintainer: FSF
;; Keywords: unix, tools
;; Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 2000, 2001, 2002, 2003,
;; 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
;; This file is part of GNU Emacs.
;; GNU Emacs is free software: you can redistribute it and/or modify
@ -2715,7 +2715,8 @@ Obeying it means displaying in another window the specified file and line."
(setq gud-keep-buffer t)))
(save-restriction
(widen)
(goto-line line)
(goto-char (point-min))
(forward-line (1- line))
(setq pos (point))
(or gud-overlay-arrow-position
(setq gud-overlay-arrow-position (make-marker)))

View file

@ -1,7 +1,7 @@
;; idlw-shell.el --- run IDL as an inferior process of Emacs.
;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
;; Free Software Foundation, Inc.
;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
;; 2009 Free Software Foundation, Inc.
;; Authors: J.D. Smith <jdsmith@as.arizona.edu>
;; Carsten Dominik <dominik@astro.uva.nl>
@ -2317,7 +2317,8 @@ used. Does nothing if the resulting frame is nil."
(frame
(set-buffer (idlwave-find-file-noselect (car frame) 'shell))
(widen)
(goto-line (nth 1 frame)))))
(goto-char (point-min))
(forward-line (1- (nth 1 frame))))))
(defun idlwave-shell-pc-frame ()
"Returns the frame for IDL execution."
@ -2388,8 +2389,8 @@ matter what the settings of that variable."
(set-buffer buffer)
(save-restriction
(widen)
(goto-line (nth 1 frame))
(forward-line 0)
(goto-char (point-min))
(forward-line (1- (nth 1 frame)))
(setq pos (point))
(setq idlwave-shell-is-stopped t)

View file

@ -15152,7 +15152,8 @@ is already shown in a buffer."
(let ((buffer (get-file-buffer (car token))))
(speedbar-find-file-in-frame (car token))
(when (or vhdl-speedbar-jump-to-unit buffer)
(goto-line (cdr token))
(goto-char (point-min))
(forward-line (1- (cdr token)))
(recenter))
(vhdl-speedbar-update-current-unit t t)
(speedbar-set-timer dframe-update-speed)
@ -15170,7 +15171,8 @@ is already shown in a buffer."
(let ((token (get-text-property
(match-beginning 3) 'speedbar-token)))
(vhdl-visit-file (car token) t
(progn (goto-line (cdr token))
(progn (goto-char (point-min))
(forward-line (1- (cdr token)))
(end-of-line)
(if is-entity
(vhdl-port-copy)
@ -15919,7 +15921,8 @@ current project/directory."
;; insert component declarations
(while ent-alist
(vhdl-visit-file (nth 2 (car ent-alist)) nil
(progn (goto-line (nth 3 (car ent-alist)))
(progn (goto-char (point-min))
(forward-line (1- (nth 3 (car ent-alist))))
(end-of-line)
(vhdl-port-copy)))
(goto-char component-pos)

View file

@ -1,7 +1,8 @@
;;; server.el --- Lisp code for GNU Emacs running as server process
;; Copyright (C) 1986, 1987, 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
;; 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
;; 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
;; Free Software Foundation, Inc.
;; Author: William Sommerfeld <wesommer@athena.mit.edu>
;; Maintainer: FSF
@ -1098,7 +1099,8 @@ The following commands are accepted by the client:
"Move point to the position indicated in LINE-COL.
LINE-COL should be a pair (LINE . COL)."
(when line-col
(goto-line (car line-col))
(goto-char (point-min))
(forward-line (1- (car line-col)))
(let ((column-number (cdr line-col)))
(when (> column-number 0)
(move-to-column (1- column-number))))))

View file

@ -2258,8 +2258,9 @@ A fancy display is used on graphic displays, normal otherwise."
(if (= file-count 1)
(setq first-file-buffer (find-file file))
(find-file-other-window file)))
(or (zerop line)
(goto-line line))
(unless (zerop line)
(goto-char (point-min))
(forward-line (1- line)))
(setq line 0)
(unless (< column 1)
(move-to-column (1- column)))
@ -2292,8 +2293,9 @@ A fancy display is used on graphic displays, normal otherwise."
(inhibit-startup-screen
(find-file-other-window file))
(t (find-file file))))
(or (zerop line)
(goto-line line))
(unless (zerop line)
(goto-char (point-min))
(forward-line (1- line)))
(setq line 0)
(unless (< column 1)
(move-to-column (1- column)))

View file

@ -1187,14 +1187,16 @@ the stroke as a character in some language."
(let ((char (or (car rainbow-chars) ?\.)))
(loop for i from 0 to 2 do
(loop for j from 0 to 2 do
(goto-line (+ 16 i y))
(goto-char (point-min))
(forward-line (+ 15 i y))
(forward-char (+ 1 j x))
(delete-char 1)
(insert char)))
(setq rainbow-chars (cdr rainbow-chars)
lift-flag nil))
;; Otherwise, just plot the point...
(goto-line (+ 17 y))
(goto-char (point-min))
(forward-line (+ 16 y))
(forward-char (+ 2 x))
(subst-char-in-region (point) (1+ (point)) ?\s ?\*)))
((strokes-lift-p point)

View file

@ -3465,7 +3465,8 @@ The top-most line is line 0."
(set-buffer buffer)
(save-restriction
(widen)
(goto-line line)
(goto-char (point-min))
(forward-line (1- line))
(setq pos (point))
(setq overlay-arrow-string "=>")
(or overlay-arrow-position

View file

@ -1,7 +1,7 @@
;;; picture.el --- "Picture mode" -- editing using quarter-plane screen model
;; Copyright (C) 1985, 1994, 2001, 2002, 2003, 2004,
;; 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
;; Copyright (C) 1985, 1994, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
;; 2008, 2009 Free Software Foundation, Inc.
;; Author: K. Shane Hartman
;; Maintainer: FSF
@ -559,7 +559,8 @@ Leaves the region surrounding the rectangle."
(left (min c1 c2))
(top (min r1 r2))
(bottom (max r1 r2)))
(goto-line top)
(goto-char (point-min))
(forward-line (1- top))
(move-to-column left t)
(picture-update-desired-column t)
@ -580,7 +581,8 @@ Leaves the region surrounding the rectangle."
(picture-insert picture-rectangle-v (- (picture-current-line) top))
(picture-set-motion pvs phs)
(goto-line sl)
(goto-char (point-min))
(forward-line (1- sl))
(move-to-column sc t)))

View file

@ -1088,7 +1088,8 @@ When index is restricted, select the previous section as restriction criterion."
"Go to the CHAR section in the index."
(let ((pos (point))
(case-fold-search nil))
(goto-line 3)
(goto-char (point-min))
(forward-line 2)
(if (re-search-forward (concat "^" (char-to-string char)) nil t)
(progn
(beginning-of-line)

View file

@ -362,7 +362,8 @@ During a selection process, these are the local bindings.
(throw 'exit t)))
((integerp loc)
(when (<= loc (count-lines (point-min) (point-max)))
(goto-line loc)
(goto-char (point-min))
(forward-line (1- loc))
(throw 'exit t)))))
(goto-char fallback))))
@ -525,7 +526,8 @@ Useful for large TOC's."
(goto-char pos))
((and (local-variable-p 'reftex-last-line (current-buffer))
(integerp reftex-last-line))
(goto-line reftex-last-line))
(goto-char (point-min))
(forward-line (1- reftex-last-line)))
(t (ding)))))
(defun reftex-select-toggle-follow ()
"Toggle follow mode: Other window follows with full context."

View file

@ -1,6 +1,7 @@
;;; reftex-toc.el --- RefTeX's table of contents mode
;; Copyright (C) 1997, 1998, 1999, 2000, 2003, 2004, 2005,
;; 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
;; Copyright (C) 1997, 1998, 1999, 2000, 2003, 2004, 2005, 2006, 2007,
;; 2008, 2009 Free Software Foundation, Inc.
;; Author: Carsten Dominik <dominik@science.uva.nl>
;; Maintainer: auctex-devel@gnu.org
@ -230,8 +231,8 @@ SPC=view TAB=goto RET=goto+hide [q]uit [r]escan [l]abels [f]ollow [x]r [?]Help
'toc here-I-am
(symbol-value reftex-docstruct-symbol))))
(put 'reftex-toc :reftex-line 3)
(goto-line 3)
(beginning-of-line)))
(goto-char (point-min))
(forward-line 2)))
;; Find the correct starting point
(reftex-find-start-point (point) offset (get 'reftex-toc :reftex-line))
@ -628,10 +629,13 @@ point."
(defun reftex-toc-restore-region (point-line &optional mark-line)
(if mark-line
(progn (goto-line mark-line)
(setq mpos (point))))
(if point-line (goto-line point-line))
(when mark-line
(goto-char (point-min))
(forward-line (1- mark-line))
(setq mpos (point)))
(when point-line
(goto-char (point-min))
(forward-line (1- point-line)))
(if mark-line
(progn
(set-mark mpos)

View file

@ -1398,7 +1398,8 @@ hierarchy is similar to that used by `rst-adjust-decoration'."
(let (m line)
(while (and cur (< (setq line (caar cur)) region-end-line))
(setq m (make-marker))
(goto-line line)
(goto-char (point-min))
(forward-line (1- line))
(push (list (set-marker m (point)) (cdar cur)) marker-list)
(setq cur (cdr cur)) ))
@ -1463,7 +1464,8 @@ in order to adapt it to our preferred style."
(lambda (deco)
(cons (rst-position (cdr deco) hier)
(let ((m (make-marker)))
(goto-line (car deco))
(goto-char (point-min))
(forward-line (1- (car deco)))
(set-marker m (point))
m)))
alldecos))
@ -1497,7 +1499,8 @@ section levels."
;; adjust for the changes in the document.
(dolist (deco (nreverse alldecos))
;; Go to the appropriate position.
(goto-line (car deco))
(goto-char (point-min))
(forward-line (1- (car deco)))
(insert "@\n")
;; FIXME: todo, we
)
@ -1628,7 +1631,8 @@ child. This has advantages later in processing the graph."
(save-excursion
(setq lines
(mapcar (lambda (deco)
(goto-line (car deco))
(goto-char (point-min))
(forward-line (1- (car deco)))
(list (gethash (cons (cadr deco) (caddr deco)) levels)
(rst-get-stripped-line)
(let ((m (make-marker)))
@ -2019,7 +2023,8 @@ brings the cursor in that section."
(set (make-local-variable 'rst-toc-return-buffer) curbuf)
;; Move the cursor near the right section in the TOC.
(goto-line line)
(goto-char (point-min))
(forward-line (1- line))
))
@ -2134,7 +2139,9 @@ backwards in the file (default is to use 1)."
;; If the index is positive, goto the line, otherwise go to the buffer
;; boundaries.
(if (and cur (>= idx 0))
(goto-line (car cur))
(progn
(goto-char (point-min))
(forward-line (1- (car cur))))
(if (> offset 0) (goto-char (point-max)) (goto-char (point-min))))
))

View file

@ -2229,7 +2229,10 @@ for the error messages."
(find-file-noselect filename))
(save-excursion
(if new-file
(progn (goto-line linenum) (setq last-position nil))
(progn
(goto-char (point-min))
(forward-line (1- linenum))
(setq last-position nil))
(goto-char last-position)
(forward-line (- linenum last-linenum)))
;; first try a forward search for the error text,

View file

@ -537,7 +537,8 @@ off trailing spaces with \\[delete-trailing-whitespace]."
(if (get-buffer-window (2C-other t))
(select-window (get-buffer-window (2C-other)))
(switch-to-buffer (2C-other)))
(newline (goto-line line))
(goto-char (point-min))
(newline (forward-line (1- line)))
(if col
(move-to-column col)
(end-of-line 1))))

View file

@ -817,7 +817,8 @@ Display is centered at LINE.
Also set the mark at the position where point was."
(interactive "p")
(push-mark)
(goto-line line)
(goto-char (point-min))
(forward-line (1- line))
(view-recenter))
(defun View-back-to-mark (&optional ignore)