]> code.delx.au - gnu-emacs/blobdiff - lisp/pcvs.el
(save-abbrevs, save-some-buffers): Don't ask the user
[gnu-emacs] / lisp / pcvs.el
index 65b39bc8bd58d2c43bd5e7a7cfd4b09e5fd0316c..82cd661bd02744e628e0c2ceb1d8400ba9432e24 100644 (file)
@@ -13,7 +13,7 @@
 ;;     (Jari Aalto+mail.emacs) jari.aalto@poboxes.com
 ;; Maintainer: (Stefan Monnier) monnier+lists/cvs/pcl@flint.cs.yale.edu
 ;; Keywords: CVS, version control, release management
-;; Revision: $Id: pcvs.el,v 1.27 2001/04/13 15:18:11 monnier Exp $
+;; Revision: $Id: pcvs.el,v 1.30 2001/10/30 04:41:28 monnier Exp $
 
 ;; This file is part of GNU Emacs.
 
@@ -53,8 +53,8 @@
 
 ;;; Bugs:
 
-;; - can somehow ignore important messages like `co aborted' or
-;;   or `co: output error: No space left on device'.
+;; - Extracting an old version seems not to recognize encoding correctly.
+;;   That's probably because it's done via a process rather than a file.
 
 ;;; Todo:
 
 (defun cvs-reread-cvsrc ()
   "Reset the default arguments to those in the `cvs-cvsrc-file'."
   (interactive)
-  (let ((cvsrc (cvs-file-to-string cvs-cvsrc-file)))
-    (when (stringp cvsrc)
-      ;; fetch the values
-      (dolist (cmd '("cvs" "checkout" "status" "log" "diff" "tag"
-                    "add" "commit" "remove" "update"))
-       (let* ((sym (intern (concat "cvs-" cmd "-flags")))
-              (val (when (string-match (concat "^" cmd "\\s-\\(.*\\)$") cvsrc)
-                     (cvs-string->strings (match-string 1 cvsrc)))))
-         (cvs-flags-set sym 0 val)))
-      ;; ensure that cvs doesn't have -q or -Q
-      (cvs-flags-set 'cvs-cvs-flags 0
-                    (cons "-f"
-                          (cdr (cvs-partition
-                                (lambda (x) (member x '("-q" "-Q")))
-                                (cvs-flags-query 'cvs-cvs-flags
-                                                 nil 'noquery))))))))
+  (condition-case nil
+      (with-temp-buffer
+       (insert-file-contents cvs-cvsrc-file)
+       ;; fetch the values
+       (dolist (cmd '("cvs" "checkout" "status" "log" "diff" "tag"
+                      "add" "commit" "remove" "update"))
+         (goto-char (point-min))
+         (let* ((sym (intern (concat "cvs-" cmd "-flags")))
+                (val (when (re-search-forward
+                            (concat "^" cmd "\\s-+\\(.*\\)$") nil t)
+                       (cvs-string->strings (match-string 1)))))
+           (cvs-flags-set sym 0 val)))
+       ;; ensure that cvs doesn't have -q or -Q
+       (cvs-flags-set 'cvs-cvs-flags 0
+                      (cons "-f"
+                            (cdr (cvs-partition
+                                  (lambda (x) (member x '("-q" "-Q")))
+                                  (cvs-flags-query 'cvs-cvs-flags
+                                                   nil 'noquery))))))
+      (file-error nil)))
 
 ;; initialize to cvsrc's default values
 (cvs-reread-cvsrc)
@@ -1313,6 +1317,11 @@ If FILE is non-nil, directory entries won't be selected."
   (interactive)
   (cvs-mode-commit 'force))
 
+(defcustom cvs-mode-commit-hook nil
+  "Hook run after setting up the commit buffer."
+  :type 'hook
+  :options '(cvs-mode-diff))
+
 (defun cvs-mode-commit (setup)
   "Check in all marked files, or the current file.
 The user will be asked for a log message in a buffer.
@@ -1332,7 +1341,8 @@ The POSTPROC specified there (typically `log-edit') is then called,
                      'log-edit)))
     (funcall setupfun 'cvs-do-commit setup 'cvs-commit-filelist buf)
     (set (make-local-variable 'cvs-minor-wrap-function) 'cvs-commit-minor-wrap)
-    (set (make-local-variable 'list-buffers-directory) lbd)))
+    (set (make-local-variable 'list-buffers-directory) lbd)
+    (run-hooks 'cvs-mode-commit-hook)))
 
 (defun cvs-commit-minor-wrap (buf f)
   (let ((cvs-ignore-marks-modif (cvs-mode-mark-get-modif "commit")))