diff options
author | Karoly Lorentey <lorentey@elte.hu> | 2004-01-23 21:51:08 +0000 |
---|---|---|
committer | Karoly Lorentey <lorentey@elte.hu> | 2004-01-23 21:51:08 +0000 |
commit | 9ae44db9cce6aefe5012afbfa8bbbb1757ee1b92 (patch) | |
tree | a5e5c3c44ffcb7c2184df9792edabbb199705b85 /lisp | |
parent | d448e98221f74c780d5163ed819b782ee32f7d74 (diff) | |
parent | 414f7d4eb2c6aead50f48fb84b8a425d7cf356f5 (diff) | |
download | emacs-9ae44db9cce6aefe5012afbfa8bbbb1757ee1b92.tar.gz emacs-9ae44db9cce6aefe5012afbfa8bbbb1757ee1b92.tar.bz2 emacs-9ae44db9cce6aefe5012afbfa8bbbb1757ee1b92.zip |
Merged in changes from CVS HEAD
Patches applied:
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-51
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-52
Update from CVS
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-62
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/ChangeLog | 18 | ||||
-rw-r--r-- | lisp/simple.el | 34 | ||||
-rw-r--r-- | lisp/vc.el | 29 |
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 @@ +2004-01-23 Benjamin Rutt <brutt@bloomington.in.us> + + * vc.el (vc-annotate): Fix improper use of `make-local-variable' + at the top level of vc.el. + +2004-01-23 Andre Spiegel <spiegel@gnu.org> + + * vc.el (vc-current-line): Function removed. This is now done by + the new function line-at-pos in simple.el. + (vc-annotate-warp-version): Use line-at-pos instead of + vc-current-line. + +2004-01-22 Kim F. Storm <storm@cua.dk> + + * simple.el (line-at-pos): New defun. + (what-line): Use it. Optimize by only counting lines in narrowed + region once. + 2004-01-22 Kenichi Handa <handa@m17n.org> * 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." (defun what-line () "Print the current buffer line number and narrowed line number of point." (interactive) - (let ((opoint (point)) start) - (save-excursion - (save-restriction - (goto-char (point-min)) - (widen) - (forward-line 0) - (setq start (point)) - (goto-char opoint) - (forward-line 0) - (if (/= start (point-min)) - (message "line %d (narrowed line %d)" - (1+ (count-lines (point-min) (point))) - (1+ (count-lines start (point)))) - (message "Line %d" (1+ (count-lines (point-min) (point))))))))) + (let ((opoint (point)) (start (point-min)) + (n (line-at-pos))) + (if (= start 1) + (message "Line %d" n) + (save-excursion + (save-restriction + (widen) + (message "line %d (narrowed line %d)" + (+ n (line-at-pos start) -1) n)))))) (defun count-lines (start end) "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." done))) (- (buffer-size) (forward-line (buffer-size))))))) +(defun line-at-pos (&optional pos) + "Return (narrowed) buffer line number at position POS. +If POS is nil, use current buffer location." + (let ((opoint (or pos (point))) start) + (save-excursion + (goto-char (point-min)) + (setq start (point)) + (goto-char opoint) + (forward-line 0) + (1+ (count-lines start (point)))))) + (defun what-cursor-position (&optional detail) "Print info on cursor position (on screen and within buffer). Also 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 @@ ;; Maintainer: Andre Spiegel <spiegel@gnu.org> ;; Keywords: tools -;; $Id: vc.el,v 1.363 2004/01/21 11:05:51 uid65624 Exp $ +;; $Id: vc.el,v 1.365 2004/01/23 11:20:55 uid65624 Exp $ ;; This file is part of GNU Emacs. @@ -2816,9 +2816,6 @@ Uses `rcs2log' which only works for RCS and CVS." (defvar vc-annotate-parent-file nil) (defvar vc-annotate-parent-rev nil) (defvar vc-annotate-parent-display-mode nil) -(make-local-variable 'vc-annotate-parent-file) -(make-local-variable 'vc-annotate-parent-rev) -(make-local-variable 'vc-annotate-parent-display-mode) (defconst vc-annotate-font-lock-keywords ;; The fontification is done by vc-annotate-lines instead of font-lock. @@ -3038,9 +3035,10 @@ colors. `vc-annotate-background' specifies the background color." vc-annotate-version)) (save-excursion (set-buffer temp-buffer-name) - (setq vc-annotate-parent-file bfn) - (setq vc-annotate-parent-rev vc-annotate-version) - (setq vc-annotate-parent-display-mode vc-annotate-display-mode)) + (set (make-local-variable 'vc-annotate-parent-file) bfn) + (set (make-local-variable 'vc-annotate-parent-rev) vc-annotate-version) + (set (make-local-variable 'vc-annotate-parent-display-mode) + vc-annotate-display-mode)) ;; Don't use the temp-buffer-name until the buffer is created ;; (only after `with-output-to-temp-buffer'.) @@ -3135,19 +3133,6 @@ versions after." (vc-version-diff vc-annotate-parent-file prev-rev rev-at-line)) (switch-to-buffer "*vc-diff*")))))) -(defun vc-current-line () - "Return the current buffer's line number." - (let ((oldpoint (point)) start) - (save-excursion - (save-restriction - (goto-char (point-min)) - (widen) - (forward-line 0) - (setq start (point)) - (goto-char oldpoint) - (forward-line 0) - (1+ (count-lines (point-min) (point))))))) - (defun vc-annotate-warp-version (revspec) "Annotate the version described by REVSPEC. @@ -3159,7 +3144,7 @@ string, then it describes a revision number, so warp to that revision." (if (not (equal major-mode 'vc-annotate-mode)) (message "Cannot be invoked outside of a vc annotate buffer") - (let* ((oldline (vc-current-line)) + (let* ((oldline (line-at-pos)) (revspeccopy revspec) (newrev nil)) (cond @@ -3191,7 +3176,7 @@ revision." (switch-to-buffer (car (car (last vc-annotate-buffers)))) (goto-line (min oldline (progn (goto-char (point-max)) (previous-line) - (vc-current-line)))))))) + (line-at-pos)))))))) (defun vc-annotate-car-last-cons (a-list) "Return car of last cons in association list A-LIST." |