summaryrefslogtreecommitdiff
path: root/lisp/textmodes
diff options
context:
space:
mode:
authorGlenn Morris <rgm@gnu.org>2009-08-22 19:29:18 +0000
committerGlenn Morris <rgm@gnu.org>2009-08-22 19:29:18 +0000
commite6ce8c4239a0b7003430d94a5f591e1d4ad50213 (patch)
tree17852bba62da89f449af8c75f4fe50a3fb89852f /lisp/textmodes
parenta569b4801085fa14c3bd0d153e389636645908b9 (diff)
downloademacs-e6ce8c4239a0b7003430d94a5f591e1d4ad50213.tar.gz
Use forward-line rather than goto-line.
Diffstat (limited to 'lisp/textmodes')
-rw-r--r--lisp/textmodes/picture.el10
-rw-r--r--lisp/textmodes/reftex-index.el3
-rw-r--r--lisp/textmodes/reftex-sel.el40
-rw-r--r--lisp/textmodes/reftex-toc.el66
-rw-r--r--lisp/textmodes/rst.el19
-rw-r--r--lisp/textmodes/tex-mode.el7
-rw-r--r--lisp/textmodes/two-column.el3
7 files changed, 84 insertions, 64 deletions
diff --git a/lisp/textmodes/picture.el b/lisp/textmodes/picture.el
index 1f532b41974..92412eccd10 100644
--- a/lisp/textmodes/picture.el
+++ b/lisp/textmodes/picture.el
@@ -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)))
diff --git a/lisp/textmodes/reftex-index.el b/lisp/textmodes/reftex-index.el
index 21602d3f670..31627604b0b 100644
--- a/lisp/textmodes/reftex-index.el
+++ b/lisp/textmodes/reftex-index.el
@@ -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)
diff --git a/lisp/textmodes/reftex-sel.el b/lisp/textmodes/reftex-sel.el
index e35ac10a6c9..f6f384fcb7d 100644
--- a/lisp/textmodes/reftex-sel.el
+++ b/lisp/textmodes/reftex-sel.el
@@ -39,7 +39,7 @@ started with the command \\[reftex-reference].")
(defun reftex-select-label-mode ()
"Major mode for selecting a label in a LaTeX document.
This buffer was created with RefTeX.
-It only has a meaningful keymap when you are in the middle of a
+It only has a meaningful keymap when you are in the middle of a
selection process.
To select a label, move the cursor to it and press RET.
Press `?' for a summary of important key bindings.
@@ -70,7 +70,7 @@ started with the command \\[reftex-citation].")
(defun reftex-select-bib-mode ()
"Major mode for selecting a citation key in a LaTeX document.
This buffer was created with RefTeX.
-It only has a meaningful keymap when you are in the middle of a
+It only has a meaningful keymap when you are in the middle of a
selection process.
In order to select a citation, move the cursor to it and press RET.
Press `?' for a summary of important key bindings.
@@ -263,7 +263,7 @@ During a selection process, these are the local bindings.
note (nth 5 cell))
(when (and labels
- (or (eq labels t)
+ (or (eq labels t)
(string= typekey labels)
(string= labels " "))
(or show-commented (null comment)))
@@ -297,7 +297,7 @@ During a selection process, these are the local bindings.
(put-text-property from to :data cell)
(when mouse-face
(put-text-property from (1- to)
- 'mouse-face mouse-face))
+ 'mouse-face mouse-face))
(goto-char to)))
((eq (car cell) 'index)
@@ -315,7 +315,7 @@ During a selection process, these are the local bindings.
(when font
(setq to (point))
- (put-text-property
+ (put-text-property
(- (point) (length (nth 7 cell))) to
'face index-face)
(goto-char to))
@@ -328,10 +328,10 @@ During a selection process, these are the local bindings.
(put-text-property from to :data cell)
(when mouse-face
(put-text-property from (1- to)
- 'mouse-face mouse-face))
+ 'mouse-face mouse-face))
(goto-char to))))
- (if (eq cell here-I-am)
+ (if (eq cell here-I-am)
(setq offset 'attention))
(if (and prev-inserted (eq offset 'attention))
(setq offset prev-inserted))
@@ -358,11 +358,12 @@ During a selection process, these are the local bindings.
((listp loc)
(setq pos (text-property-any (point-min) (point-max) :data loc))
(when pos
- (goto-char pos)
+ (goto-char pos)
(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))))
@@ -395,7 +396,7 @@ During a selection process, these are the local bindings.
(setq truncate-lines t)
;; Find a good starting point
- (reftex-find-start-point
+ (reftex-find-start-point
(point-min) offset reftex-last-data reftex-last-line)
(beginning-of-line 1)
(set (make-local-variable 'reftex-last-follow-point) (point))
@@ -452,11 +453,11 @@ During a selection process, these are the local bindings.
(let (b e)
(setq data (get-text-property (point) :data))
(setq last-data (or data last-data))
-
+
(when (and data cb-flag
(not (equal reftex-last-follow-point (point))))
(setq reftex-last-follow-point (point))
- (funcall call-back data reftex-callback-fwd
+ (funcall call-back data reftex-callback-fwd
(not reftex-revisit-to-follow)))
(if data
(setq b (or (previous-single-property-change
@@ -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."
@@ -576,7 +578,7 @@ Useful for large TOC's."
(defun reftex-select-read-label ()
"Use minibuffer to read a label to reference, with completion."
(interactive)
- (let ((label (completing-read
+ (let ((label (completing-read
"Label: " (symbol-value reftex-docstruct-symbol)
nil nil reftex-prefix)))
(unless (or (equal label "") (equal label reftex-prefix))
@@ -676,7 +678,7 @@ Useful for large TOC's."
([(up)] . reftex-select-previous)
("f" . reftex-select-toggle-follow)
("\C-m" . reftex-select-accept)
- ([(return)] . reftex-select-accept)
+ ([(return)] . reftex-select-accept)
("q" . reftex-select-quit)
("." . reftex-select-show-insertion-point)
("?" . reftex-select-help))
@@ -687,7 +689,7 @@ Useful for large TOC's."
(define-key map [(button2)] 'reftex-select-mouse-accept)
(define-key map [(mouse-2)] 'reftex-select-mouse-accept)
(define-key map [follow-link] 'mouse-face))
-
+
;; Digit arguments
(loop for key across "0123456789" do
@@ -701,7 +703,7 @@ Useful for large TOC's."
;; Specific bindings in reftex-select-label-map
(loop for key across "aAcgFlrRstx#%" do
(define-key reftex-select-label-map (vector (list key))
- (list 'lambda '()
+ (list 'lambda '()
"Press `?' during selection to find out about this key."
'(interactive) (list 'throw '(quote myexit) key))))
@@ -725,7 +727,7 @@ Useful for large TOC's."
;; Specific bindings in reftex-select-bib-map
(loop for key across "grRaAeE" do
(define-key reftex-select-bib-map (vector (list key))
- (list 'lambda '()
+ (list 'lambda '()
"Press `?' during selection to find out about this key."
'(interactive) (list 'throw '(quote myexit) key))))
@@ -735,7 +737,7 @@ Useful for large TOC's."
("m" . reftex-select-mark)
("u" . reftex-select-unmark))
do (define-key reftex-select-bib-map (car x) (cdr x)))
-
+
;; arch-tag: 842078ff-0586-4e0b-957e-536e08218464
;;; reftex-sel.el ends here
diff --git a/lisp/textmodes/reftex-toc.el b/lisp/textmodes/reftex-toc.el
index c8fa5a7032e..0feda11a49f 100644
--- a/lisp/textmodes/reftex-toc.el
+++ b/lisp/textmodes/reftex-toc.el
@@ -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
@@ -149,7 +150,7 @@ When called with a raw C-u prefix, rescan the document first."
(frame-parameter (selected-frame) 'unsplittable)))
offset toc-window)
- (if (setq toc-window (get-buffer-window
+ (if (setq toc-window (get-buffer-window
"*toc*"
(if reuse 'visible)))
(select-window toc-window)
@@ -165,7 +166,7 @@ When called with a raw C-u prefix, rescan the document first."
(split-window-horizontally
(floor (* (window-width)
reftex-toc-split-windows-fraction)))
- (split-window-vertically
+ (split-window-vertically
(floor (* (window-height)
reftex-toc-split-windows-fraction)))))
@@ -210,11 +211,11 @@ SPC=view TAB=goto RET=goto+hide [q]uit [r]escan [l]abels [f]ollow [x]r [?]Help
reftex-toc-include-context
nil ; counter
nil ; commented
- here-I-am
+ here-I-am
"" ; xr-prefix
t ; a toc buffer
))
-
+
(run-hooks 'reftex-display-copied-context-hook)
(message "Building *toc* buffer...done.")
(setq buffer-read-only t))
@@ -226,12 +227,12 @@ SPC=view TAB=goto RET=goto+hide [q]uit [r]escan [l]abels [f]ollow [x]r [?]Help
t
reftex-toc-include-index-entries
reftex-toc-include-file-boundaries)
- (reftex-last-assoc-before-elt
+ (reftex-last-assoc-before-elt
'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))
@@ -251,7 +252,7 @@ SPC=view TAB=goto RET=goto+hide [q]uit [r]escan [l]abels [f]ollow [x]r [?]Help
(not (get-text-property (point) 'intangible))
(memq reftex-highlight-selection '(cursor both))
(reftex-highlight 2
- (or (previous-single-property-change
+ (or (previous-single-property-change
(min (point-max) (1+ (point))) :data)
(point-min))
(or (next-single-property-change (point) :data)
@@ -298,10 +299,10 @@ SPC=view TAB=goto RET=goto+hide [q]uit [r]escan [l]abels [f]ollow [x]r [?]Help
(window-height))))))
(defun reftex-toc-dframe-p (&optional frame error)
- ;; Check if FRAME is the dedicated TOC frame.
+ ;; Check if FRAME is the dedicated TOC frame.
;; If yes, and ERROR is non-nil, throw an error.
(setq frame (or frame (selected-frame)))
- (let ((res (equal
+ (let ((res (equal
(if (fboundp 'frame-property)
(frame-property frame 'name)
(frame-parameter frame 'name))
@@ -327,7 +328,7 @@ SPC=view TAB=goto RET=goto+hide [q]uit [r]escan [l]abels [f]ollow [x]r [?]Help
(when (featurep 'xemacs) (setq zmacs-region-stays t))
(setq reftex-callback-fwd t)
(or (eobp) (forward-char 1))
- (goto-char (or (next-single-property-change (point) :data)
+ (goto-char (or (next-single-property-change (point) :data)
(point))))
(defun reftex-toc-previous (&optional arg)
"Move to previous selectable item."
@@ -364,7 +365,7 @@ SPC=view TAB=goto RET=goto+hide [q]uit [r]escan [l]abels [f]ollow [x]r [?]Help
With prefix ARG, prompt for a label type and include only labels of
that specific type."
(interactive "P")
- (setq reftex-toc-include-labels
+ (setq reftex-toc-include-labels
(if arg (reftex-query-label-type)
(not reftex-toc-include-labels)))
(reftex-toc-revert))
@@ -468,7 +469,7 @@ With prefix arg 1, restrict index to the section at point."
(defun reftex-toc-rescan (&rest ignore)
"Regenerate the *toc* buffer by reparsing file of section at point."
(interactive)
- (if (and reftex-enable-partial-scans
+ (if (and reftex-enable-partial-scans
(null current-prefix-arg))
(let* ((data (get-text-property (point) :data))
(what (car data))
@@ -502,7 +503,7 @@ With prefix arg 1, restrict index to the section at point."
(defun reftex-toc-revert (&rest ignore)
"Regenerate the *toc* from the internal lists."
(interactive)
- (let ((unsplittable
+ (let ((unsplittable
(if (fboundp 'frame-property)
(frame-property (selected-frame) 'unsplittable)
(frame-parameter (selected-frame) 'unsplittable)))
@@ -596,7 +597,7 @@ point."
(goto-char start-pos)
(setq sections (reftex-toc-extract-section-number (car entries)))
(if (> (setq nsec (length entries)) 1)
- (setq sections
+ (setq sections
(concat sections "-"
(reftex-toc-extract-section-number
(nth (1- nsec) entries)))))
@@ -621,17 +622,20 @@ point."
(save-window-excursion
(reftex-toc-Rescan))
(reftex-toc-restore-region start-line mark-line)
- (message "%d section%s %smoted"
+ (message "%d section%s %smoted"
nsec (if (= 1 nsec) "" "s") pro-or-de)
nil))
(if msg (progn (ding) (message "%s" msg)))))
(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)
@@ -781,7 +785,7 @@ label prefix determines the wording of a reference."
(error "This is not a label entry."))
(setq newlabel (read-string (format "Rename label \"%s\" to:" label)))
(if (assoc newlabel (symbol-value reftex-docstruct-symbol))
- (if (not (y-or-n-p
+ (if (not (y-or-n-p
(format "Label '%s' exists. Use anyway? " label)))
(error "Abort")))
(save-excursion
@@ -791,7 +795,7 @@ label prefix determines the wording of a reference."
(reftex-query-replace-document
(concat "{" (regexp-quote label) "}")
(format "{%s}" newlabel))
- (error t))))
+ (error t))))
(reftex-toc-rescan)))
@@ -810,9 +814,9 @@ label prefix determines the wording of a reference."
show-window show-buffer match)
(unless toc (error "Don't know which toc line to visit"))
-
+
(cond
-
+
((eq (car toc) 'toc)
;; a toc entry
(setq match (reftex-toc-find-section toc no-revisit)))
@@ -828,7 +832,7 @@ label prefix determines the wording of a reference."
(file (nth 1 toc)))
(if (or (not no-revisit) (reftex-get-buffer-visiting file))
(progn
- (switch-to-buffer-other-window
+ (switch-to-buffer-other-window
(reftex-get-file-buffer-force file nil))
(goto-char (if (eq where 'bof) (point-min) (point-max))))
(message "%s" reftex-no-follow-message) nil))))
@@ -881,8 +885,8 @@ label prefix determines the wording of a reference."
(looking-at (reftex-make-desperate-section-regexp literal))
(looking-at (concat "\\\\"
(regexp-quote
- (car
- (rassq level
+ (car
+ (rassq level
reftex-section-levels-all)))
"[[{]?"))))
((or (not no-revisit)
@@ -1056,7 +1060,7 @@ always show the current section in connection with the option
(define-key reftex-toc-map (vector (list key)) 'digit-argument))
(define-key reftex-toc-map "-" 'negative-argument)
-(easy-menu-define
+(easy-menu-define
reftex-toc-menu reftex-toc-map
"Menu for Table of Contents buffer"
'("TOC"
@@ -1089,7 +1093,7 @@ always show the current section in connection with the option
["Context" reftex-toc-toggle-context :style toggle
:selected reftex-toc-include-context]
"--"
- ["Follow Mode" reftex-toc-toggle-follow :style toggle
+ ["Follow Mode" reftex-toc-toggle-follow :style toggle
:selected reftex-toc-follow-mode]
["Auto Recenter" reftex-toggle-auto-toc-recenter :style toggle
:selected reftex-toc-auto-recenter-timer]
diff --git a/lisp/textmodes/rst.el b/lisp/textmodes/rst.el
index de2a5350f3c..d24bcf7e2b4 100644
--- a/lisp/textmodes/rst.el
+++ b/lisp/textmodes/rst.el
@@ -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))))
))
diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el
index 8c8a9d5ac1a..ed975ab45c6 100644
--- a/lisp/textmodes/tex-mode.el
+++ b/lisp/textmodes/tex-mode.el
@@ -2210,7 +2210,7 @@ for the error messages."
(with-syntax-table tex-error-parse-syntax-table
(backward-up-list 1)
(skip-syntax-forward "(_")
- (while (not
+ (while (not
(and (setq try-filename (thing-at-point
'filename))
(not (string= "" try-filename))
@@ -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,
diff --git a/lisp/textmodes/two-column.el b/lisp/textmodes/two-column.el
index d8d298909c1..c393e1d9bcd 100644
--- a/lisp/textmodes/two-column.el
+++ b/lisp/textmodes/two-column.el
@@ -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))))