aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2002-06-25 00:11:28 +0000
committerStefan Monnier2002-06-25 00:11:28 +0000
commit498ecddeeefea9c65e7fba35a0d8515bde1655dc (patch)
tree65115494f12c769ae280c73338c521b08b63ad84
parenteb4504e0b52c2cf1ccf78dba3d2fd2df0775ae0e (diff)
downloademacs-498ecddeeefea9c65e7fba35a0d8515bde1655dc.tar.gz
emacs-498ecddeeefea9c65e7fba35a0d8515bde1655dc.zip
(cvs-parse-process): Don't save/restore point.
Fix last change not to introduce spurious dir FIs. (cvs-move-to-goal-column): New function extracted from cvs-mode-previous-line. (cvs-mode-previous-line, cvs-mode-next-line): Use it. (cvs-addto-collection): Use it to preserve point. (cvs-vc-command-advice): Ad-hoc workaround for `cvs -q add'.
-rw-r--r--lisp/pcvs.el106
1 files changed, 53 insertions, 53 deletions
diff --git a/lisp/pcvs.el b/lisp/pcvs.el
index ffec60e673b..b8ec3e009ad 100644
--- a/lisp/pcvs.el
+++ b/lisp/pcvs.el
@@ -14,7 +14,7 @@
14;; (Jari Aalto+mail.emacs) jari.aalto@poboxes.com 14;; (Jari Aalto+mail.emacs) jari.aalto@poboxes.com
15;; Maintainer: (Stefan Monnier) monnier+lists/cvs/pcl@flint.cs.yale.edu 15;; Maintainer: (Stefan Monnier) monnier+lists/cvs/pcl@flint.cs.yale.edu
16;; Keywords: CVS, version control, release management 16;; Keywords: CVS, version control, release management
17;; Revision: $Id: pcvs.el,v 1.36 2002/06/18 21:50:30 monnier Exp $ 17;; Revision: $Id: pcvs.el,v 1.37 2002/06/24 22:49:38 monnier Exp $
18 18
19;; This file is part of GNU Emacs. 19;; This file is part of GNU Emacs.
20 20
@@ -62,7 +62,6 @@
62;; ******** FIX THE DOCUMENTATION ********* 62;; ******** FIX THE DOCUMENTATION *********
63;; 63;;
64;; - rework the displaying of error messages. 64;; - rework the displaying of error messages.
65;; - use UP-TO-DATE rather than DEAD when cleaning before `examine'.
66;; - allow to flush messages only 65;; - allow to flush messages only
67;; - allow to protect files like ChangeLog from flushing 66;; - allow to protect files like ChangeLog from flushing
68;; - automatically cvs-mode-insert files from find-file-hook 67;; - automatically cvs-mode-insert files from find-file-hook
@@ -640,45 +639,41 @@ DCD is the `dont-change-disc' flag to use when parsing that output.
640SUBDIR is the subdirectory (if any) where this command was run. 639SUBDIR is the subdirectory (if any) where this command was run.
641OLD-FIS is the list of fileinfos on which the cvs command was applied and 640OLD-FIS is the list of fileinfos on which the cvs command was applied and
642 which should be considered up-to-date if they are missing from the output." 641 which should be considered up-to-date if they are missing from the output."
643 (let* ((from-buf (current-buffer)) 642 (let* ((fileinfos (cvs-parse-buffer 'cvs-parse-table dcd subdir))
644 (fileinfos (cvs-parse-buffer 'cvs-parse-table dcd subdir)) 643 last)
645 (_ (set-buffer cvs-buffer)) 644 (with-current-buffer cvs-buffer
646 last 645 ;; Expand OLD-FIS to actual files.
647 (from-pt (point))) 646 (let ((fis nil))
648 ;; Expand OLD-FIS to actual files. 647 (dolist (fi old-fis)
649 (dolist (fi old-fis) 648 (setq fis (if (eq (cvs-fileinfo->type fi) 'DIRCHANGE)
650 (when (eq (cvs-fileinfo->type fi) 'DIRCHANGE) 649 (nconc (ewoc-collect cvs-cookies 'cvs-dir-member-p
651 (setq old-fis (nconc (ewoc-collect cvs-cookies 'cvs-dir-member-p 650 (cvs-fileinfo->dir fi))
652 (cvs-fileinfo->dir fi)) 651 fis)
653 old-fis)))) 652 (cons fi fis))))
654 ;; Drop OLD-FIS which were already up-to-date. 653 (setq old-fis fis))
655 (let ((fis nil)) 654 ;; Drop OLD-FIS which were already up-to-date.
655 (let ((fis nil))
656 (dolist (fi old-fis)
657 (unless (eq (cvs-fileinfo->type fi) 'UP-TO-DATE) (push fi fis)))
658 (setq old-fis fis))
659 ;; Add the new fileinfos to the ewoc.
660 (dolist (fi fileinfos)
661 (setq last (cvs-addto-collection cvs-cookies fi last))
662 ;; This FI was in the output, so remove it from OLD-FIS.
663 (setq old-fis (delq (ewoc-data last) old-fis)))
664 ;; Process the "silent output" (i.e. absence means up-to-date).
656 (dolist (fi old-fis) 665 (dolist (fi old-fis)
657 (unless (eq (cvs-fileinfo->type fi) 'UP-TO-DATE) (push fi fis))) 666 (setf (cvs-fileinfo->type fi) 'UP-TO-DATE)
658 (setq old-fis fis)) 667 (setq last (cvs-addto-collection cvs-cookies fi last)))
659 ;; Add the new fileinfos to the ewoc. 668 (setq fileinfos (nconc old-fis fileinfos))
660 (dolist (fi fileinfos) 669 ;; Clean up the ewoc as requested by the user.
661 (setq last (cvs-addto-collection cvs-cookies fi last)) 670 (cvs-cleanup-collection cvs-cookies
662 ;; This FI was in the output, so remove it from OLD-FIS. 671 (eq cvs-auto-remove-handled t)
663 (setq old-fis (delq (ewoc-data last) old-fis))) 672 cvs-auto-remove-directories
664 ;; Process the "silent output" (i.e. absence means up-to-date). 673 nil)
665 (dolist (fi old-fis) 674 ;; Revert buffers if necessary.
666 (setf (cvs-fileinfo->type fi) 'UP-TO-DATE) 675 (when (and cvs-auto-revert (not dcd) (not cvs-from-vc))
667 (setq last (cvs-addto-collection cvs-cookies fi last))) 676 (cvs-revert-if-needed fileinfos)))))
668 (setq fileinfos (nconc old-fis fileinfos))
669 ;; Clean up the ewoc as requested by the user.
670 (cvs-cleanup-collection cvs-cookies
671 (eq cvs-auto-remove-handled t)
672 cvs-auto-remove-directories
673 nil)
674 ;; Revert buffers if necessary.
675 (when (and cvs-auto-revert (not dcd) (not cvs-from-vc))
676 (cvs-revert-if-needed fileinfos))
677 ;; get back to where we were. `save-excursion' doesn't seem to
678 ;; work in this case, probably because the buffer is reconstructed
679 ;; by the cookie code.
680 (goto-char from-pt)
681 (set-buffer from-buf)))
682 677
683(defmacro defun-cvs-mode (fun args docstring interact &rest body) 678(defmacro defun-cvs-mode (fun args docstring interact &rest body)
684 "Define a function to be used in a *cvs* buffer. 679 "Define a function to be used in a *cvs* buffer.
@@ -766,6 +761,8 @@ TIN specifies an optional starting point."
766 ;; fi == tin 761 ;; fi == tin
767 (cvs-fileinfo-update (ewoc-data tin) fi) 762 (cvs-fileinfo-update (ewoc-data tin) fi)
768 (ewoc-invalidate c tin) 763 (ewoc-invalidate c tin)
764 ;; Move cursor back to where it belongs.
765 (when (bolp) (cvs-move-to-goal-column))
769 tin)))) 766 tin))))
770 767
771(defcustom cvs-cleanup-functions nil 768(defcustom cvs-cleanup-functions nil
@@ -1108,29 +1105,25 @@ Full documentation is in the Texinfo file."
1108 1105
1109;; Move around in the buffer 1106;; Move around in the buffer
1110 1107
1108(defun cvs-move-to-goal-column ()
1109 (let* ((eol (line-end-position))
1110 (fpos (next-single-property-change (point) 'cvs-goal-column nil eol)))
1111 (when (< fpos eol)
1112 (goto-char fpos))))
1113
1111(defun-cvs-mode cvs-mode-previous-line (arg) 1114(defun-cvs-mode cvs-mode-previous-line (arg)
1112 "Go to the previous line. 1115 "Go to the previous line.
1113If a prefix argument is given, move by that many lines." 1116If a prefix argument is given, move by that many lines."
1114 (interactive "p") 1117 (interactive "p")
1115 (ewoc-goto-prev cvs-cookies arg) 1118 (ewoc-goto-prev cvs-cookies arg)
1116 (let ((fpos (next-single-property-change 1119 (cvs-move-to-goal-column))
1117 (point) 'cvs-goal-column
1118 (current-buffer) (line-end-position)))
1119 (eol (line-end-position)))
1120 (when (< fpos eol)
1121 (goto-char fpos))))
1122 1120
1123(defun-cvs-mode cvs-mode-next-line (arg) 1121(defun-cvs-mode cvs-mode-next-line (arg)
1124 "Go to the next line. 1122 "Go to the next line.
1125If a prefix argument is given, move by that many lines." 1123If a prefix argument is given, move by that many lines."
1126 (interactive "p") 1124 (interactive "p")
1127 (ewoc-goto-next cvs-cookies arg) 1125 (ewoc-goto-next cvs-cookies arg)
1128 (let ((fpos (next-single-property-change 1126 (cvs-move-to-goal-column))
1129 (point) 'cvs-goal-column
1130 (current-buffer) (line-end-position)))
1131 (eol (line-end-position)))
1132 (when (< fpos eol)
1133 (goto-char fpos))))
1134 1127
1135;;;; 1128;;;;
1136;;;; Mark handling 1129;;;; Mark handling
@@ -2144,7 +2137,7 @@ The exact behavior is determined also by `cvs-dired-use-hook'."
2144 (pop flags)) 2137 (pop flags))
2145 ;; don't parse output we don't understand. 2138 ;; don't parse output we don't understand.
2146 (member (car flags) cvs-parse-known-commands))) 2139 (member (car flags) cvs-parse-known-commands)))
2147 (save-excursion 2140 (save-current-buffer
2148 (let ((buffer (current-buffer)) 2141 (let ((buffer (current-buffer))
2149 (dir default-directory) 2142 (dir default-directory)
2150 (cvs-from-vc t)) 2143 (cvs-from-vc t))
@@ -2156,6 +2149,13 @@ The exact behavior is determined also by `cvs-dired-use-hook'."
2156 (let ((subdir (substring dir (length default-directory)))) 2149 (let ((subdir (substring dir (length default-directory))))
2157 (set-buffer buffer) 2150 (set-buffer buffer)
2158 (set (make-local-variable 'cvs-buffer) cvs-buf) 2151 (set (make-local-variable 'cvs-buffer) cvs-buf)
2152 ;; `cvs -q add file' produces no useful output :-(
2153 (when (and (equal (car flags) "add")
2154 (goto-char (point-min))
2155 (looking-at ".*to add this file permanently\n\\'"))
2156 (insert "cvs add: scheduling file `"
2157 (file-name-nondirectory file)
2158 "' for addition\n"))
2159 ;; VC never (?) does `cvs -n update' so dcd=nil 2159 ;; VC never (?) does `cvs -n update' so dcd=nil
2160 ;; should probably always be the right choice. 2160 ;; should probably always be the right choice.
2161 (cvs-parse-process nil subdir)))))))) 2161 (cvs-parse-process nil subdir))))))))