Mercurial > emacs
comparison lisp/simple.el @ 99799:3a08b596c63b
(goto-line): Rename argument.
author | Lute Kamstra <lute@gnu.org> |
---|---|
date | Sat, 22 Nov 2008 17:33:06 +0000 |
parents | ade78ac09095 |
children | a3ef480379ae |
comparison
equal
deleted
inserted
replaced
99798:0a0d1d91c5f8 | 99799:3a08b596c63b |
---|---|
835 (goto-char (point-min))) | 835 (goto-char (point-min))) |
836 | 836 |
837 | 837 |
838 ;; Counting lines, one way or another. | 838 ;; Counting lines, one way or another. |
839 | 839 |
840 (defun goto-line (arg &optional buffer) | 840 (defun goto-line (line &optional buffer) |
841 "Goto line ARG, counting from line 1 at beginning of buffer. | 841 "Goto LINE, counting from line 1 at beginning of buffer. |
842 Normally, move point in the current buffer, and leave mark at previous | 842 Normally, move point in the current buffer, and leave mark at the |
843 position. With just \\[universal-argument] as argument, move point | 843 previous position. With just \\[universal-argument] as argument, |
844 in the most recently displayed other buffer, and switch to it. | 844 move point in the most recently selected other buffer, and switch |
845 When called from Lisp code, the optional argument BUFFER specifies | 845 to it. When called from Lisp code, the optional argument BUFFER |
846 a buffer to switch to. | 846 specifies a buffer to switch to. |
847 | 847 |
848 If there's a number in the buffer at point, it is the default for ARG." | 848 If there's a number in the buffer at point, it is the default for |
849 LINE." | |
849 (interactive | 850 (interactive |
850 (if (and current-prefix-arg (not (consp current-prefix-arg))) | 851 (if (and current-prefix-arg (not (consp current-prefix-arg))) |
851 (list (prefix-numeric-value current-prefix-arg)) | 852 (list (prefix-numeric-value current-prefix-arg)) |
852 ;; Look for a default, a number in the buffer at point. | 853 ;; Look for a default, a number in the buffer at point. |
853 (let* ((default | 854 (let* ((default |
885 ;; Move to the specified line number in that buffer. | 886 ;; Move to the specified line number in that buffer. |
886 (save-restriction | 887 (save-restriction |
887 (widen) | 888 (widen) |
888 (goto-char 1) | 889 (goto-char 1) |
889 (if (eq selective-display t) | 890 (if (eq selective-display t) |
890 (re-search-forward "[\n\C-m]" nil 'end (1- arg)) | 891 (re-search-forward "[\n\C-m]" nil 'end (1- line)) |
891 (forward-line (1- arg))))) | 892 (forward-line (1- line))))) |
892 | 893 |
893 (defun count-lines-region (start end) | 894 (defun count-lines-region (start end) |
894 "Print number of lines and characters in the region." | 895 "Print number of lines and characters in the region." |
895 (interactive "r") | 896 (interactive "r") |
896 (message "Region has %d lines, %d characters" | 897 (message "Region has %d lines, %d characters" |