aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog18
-rw-r--r--lisp/simple.el34
-rw-r--r--lisp/vc.el29
3 files changed, 45 insertions, 36 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 0073e5143ab..c64f0d17698 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,21 @@
12004-01-23 Benjamin Rutt <brutt@bloomington.in.us>
2
3 * vc.el (vc-annotate): Fix improper use of `make-local-variable'
4 at the top level of vc.el.
5
62004-01-23 Andre Spiegel <spiegel@gnu.org>
7
8 * vc.el (vc-current-line): Function removed. This is now done by
9 the new function line-at-pos in simple.el.
10 (vc-annotate-warp-version): Use line-at-pos instead of
11 vc-current-line.
12
132004-01-22 Kim F. Storm <storm@cua.dk>
14
15 * simple.el (line-at-pos): New defun.
16 (what-line): Use it. Optimize by only counting lines in narrowed
17 region once.
18
12004-01-22 Kenichi Handa <handa@m17n.org> 192004-01-22 Kenichi Handa <handa@m17n.org>
2 20
3 * language/cyrillic.el (ccl-encode-windows-1251-font): Rearrange 21 * language/cyrillic.el (ccl-encode-windows-1251-font): Rearrange
diff --git a/lisp/simple.el b/lisp/simple.el
index d23ed11c6c3..3d2be573012 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -498,20 +498,15 @@ that uses or sets the mark."
498(defun what-line () 498(defun what-line ()
499 "Print the current buffer line number and narrowed line number of point." 499 "Print the current buffer line number and narrowed line number of point."
500 (interactive) 500 (interactive)
501 (let ((opoint (point)) start) 501 (let ((opoint (point)) (start (point-min))
502 (save-excursion 502 (n (line-at-pos)))
503 (save-restriction 503 (if (= start 1)
504 (goto-char (point-min)) 504 (message "Line %d" n)
505 (widen) 505 (save-excursion
506 (forward-line 0) 506 (save-restriction
507 (setq start (point)) 507 (widen)
508 (goto-char opoint) 508 (message "line %d (narrowed line %d)"
509 (forward-line 0) 509 (+ n (line-at-pos start) -1) n))))))
510 (if (/= start (point-min))
511 (message "line %d (narrowed line %d)"
512 (1+ (count-lines (point-min) (point)))
513 (1+ (count-lines start (point))))
514 (message "Line %d" (1+ (count-lines (point-min) (point)))))))))
515 510
516(defun count-lines (start end) 511(defun count-lines (start end)
517 "Return number of lines between START and END. 512 "Return number of lines between START and END.
@@ -536,6 +531,17 @@ and the greater of them is not at the start of a line."
536 done))) 531 done)))
537 (- (buffer-size) (forward-line (buffer-size))))))) 532 (- (buffer-size) (forward-line (buffer-size)))))))
538 533
534(defun line-at-pos (&optional pos)
535 "Return (narrowed) buffer line number at position POS.
536If POS is nil, use current buffer location."
537 (let ((opoint (or pos (point))) start)
538 (save-excursion
539 (goto-char (point-min))
540 (setq start (point))
541 (goto-char opoint)
542 (forward-line 0)
543 (1+ (count-lines start (point))))))
544
539(defun what-cursor-position (&optional detail) 545(defun what-cursor-position (&optional detail)
540 "Print info on cursor position (on screen and within buffer). 546 "Print info on cursor position (on screen and within buffer).
541Also describe the character after point, and give its character code 547Also describe the character after point, and give its character code
diff --git a/lisp/vc.el b/lisp/vc.el
index 383ffa6fae8..33bb04e4aa1 100644
--- a/lisp/vc.el
+++ b/lisp/vc.el
@@ -7,7 +7,7 @@
7;; Maintainer: Andre Spiegel <spiegel@gnu.org> 7;; Maintainer: Andre Spiegel <spiegel@gnu.org>
8;; Keywords: tools 8;; Keywords: tools
9 9
10;; $Id: vc.el,v 1.363 2004/01/21 11:05:51 uid65624 Exp $ 10;; $Id: vc.el,v 1.365 2004/01/23 11:20:55 uid65624 Exp $
11 11
12;; This file is part of GNU Emacs. 12;; This file is part of GNU Emacs.
13 13
@@ -2816,9 +2816,6 @@ Uses `rcs2log' which only works for RCS and CVS."
2816(defvar vc-annotate-parent-file nil) 2816(defvar vc-annotate-parent-file nil)
2817(defvar vc-annotate-parent-rev nil) 2817(defvar vc-annotate-parent-rev nil)
2818(defvar vc-annotate-parent-display-mode nil) 2818(defvar vc-annotate-parent-display-mode nil)
2819(make-local-variable 'vc-annotate-parent-file)
2820(make-local-variable 'vc-annotate-parent-rev)
2821(make-local-variable 'vc-annotate-parent-display-mode)
2822 2819
2823(defconst vc-annotate-font-lock-keywords 2820(defconst vc-annotate-font-lock-keywords
2824 ;; The fontification is done by vc-annotate-lines instead of font-lock. 2821 ;; The fontification is done by vc-annotate-lines instead of font-lock.
@@ -3038,9 +3035,10 @@ colors. `vc-annotate-background' specifies the background color."
3038 vc-annotate-version)) 3035 vc-annotate-version))
3039 (save-excursion 3036 (save-excursion
3040 (set-buffer temp-buffer-name) 3037 (set-buffer temp-buffer-name)
3041 (setq vc-annotate-parent-file bfn) 3038 (set (make-local-variable 'vc-annotate-parent-file) bfn)
3042 (setq vc-annotate-parent-rev vc-annotate-version) 3039 (set (make-local-variable 'vc-annotate-parent-rev) vc-annotate-version)
3043 (setq vc-annotate-parent-display-mode vc-annotate-display-mode)) 3040 (set (make-local-variable 'vc-annotate-parent-display-mode)
3041 vc-annotate-display-mode))
3044 3042
3045 ;; Don't use the temp-buffer-name until the buffer is created 3043 ;; Don't use the temp-buffer-name until the buffer is created
3046 ;; (only after `with-output-to-temp-buffer'.) 3044 ;; (only after `with-output-to-temp-buffer'.)
@@ -3135,19 +3133,6 @@ versions after."
3135 (vc-version-diff vc-annotate-parent-file prev-rev rev-at-line)) 3133 (vc-version-diff vc-annotate-parent-file prev-rev rev-at-line))
3136 (switch-to-buffer "*vc-diff*")))))) 3134 (switch-to-buffer "*vc-diff*"))))))
3137 3135
3138(defun vc-current-line ()
3139 "Return the current buffer's line number."
3140 (let ((oldpoint (point)) start)
3141 (save-excursion
3142 (save-restriction
3143 (goto-char (point-min))
3144 (widen)
3145 (forward-line 0)
3146 (setq start (point))
3147 (goto-char oldpoint)
3148 (forward-line 0)
3149 (1+ (count-lines (point-min) (point)))))))
3150
3151(defun vc-annotate-warp-version (revspec) 3136(defun vc-annotate-warp-version (revspec)
3152 "Annotate the version described by REVSPEC. 3137 "Annotate the version described by REVSPEC.
3153 3138
@@ -3159,7 +3144,7 @@ string, then it describes a revision number, so warp to that
3159revision." 3144revision."
3160 (if (not (equal major-mode 'vc-annotate-mode)) 3145 (if (not (equal major-mode 'vc-annotate-mode))
3161 (message "Cannot be invoked outside of a vc annotate buffer") 3146 (message "Cannot be invoked outside of a vc annotate buffer")
3162 (let* ((oldline (vc-current-line)) 3147 (let* ((oldline (line-at-pos))
3163 (revspeccopy revspec) 3148 (revspeccopy revspec)
3164 (newrev nil)) 3149 (newrev nil))
3165 (cond 3150 (cond
@@ -3191,7 +3176,7 @@ revision."
3191 (switch-to-buffer (car (car (last vc-annotate-buffers)))) 3176 (switch-to-buffer (car (car (last vc-annotate-buffers))))
3192 (goto-line (min oldline (progn (goto-char (point-max)) 3177 (goto-line (min oldline (progn (goto-char (point-max))
3193 (previous-line) 3178 (previous-line)
3194 (vc-current-line)))))))) 3179 (line-at-pos))))))))
3195 3180
3196(defun vc-annotate-car-last-cons (a-list) 3181(defun vc-annotate-car-last-cons (a-list)
3197 "Return car of last cons in association list A-LIST." 3182 "Return car of last cons in association list A-LIST."