(defgroup reftex): Update home page url-link.
[bpt/emacs.git] / lisp / pcvs.el
index 7209c13..1f2bad1 100644 (file)
@@ -467,7 +467,7 @@ If non-nil, NEW means to create a new buffer no matter what."
         (cvs-mode)
         (set (make-local-variable 'list-buffers-directory) buffer-name)
         ;;(set (make-local-variable 'cvs-temp-buffer) (cvs-temp-buffer))
-        (let ((cookies (ewoc-create 'cvs-fileinfo-pp "\n\n" "\n")))
+        (let ((cookies (ewoc-create 'cvs-fileinfo-pp "\n\n" "\n" t)))
           (set (make-local-variable 'cvs-cookies) cookies)
           (add-hook 'kill-buffer-hook
                     (lambda ()
@@ -618,7 +618,6 @@ If non-nil, NEW means to create a new buffer no matter what."
         (str (car hf))
         (done "")
         (tin (ewoc-nth cvs-cookies 0)))
-    (if (eq (length str) 2) (setq str ""))
     ;; look for the first *real* fileinfo (to determine emptyness)
     (while
        (and tin
@@ -626,14 +625,17 @@ If non-nil, NEW means to create a new buffer no matter what."
                   '(MESSAGE DIRCHANGE)))
       (setq tin (ewoc-next cvs-cookies tin)))
     (if add
-       (setq str (concat "-- Running " cmd " ...\n" str))
+        (progn
+          ;; Remove the default empty line, if applicable.
+          (if (not (string-match "." str)) (setq str "\n"))
+          (setq str (concat "-- Running " cmd " ...\n" str)))
       (if (not (string-match
                (concat "^-- Running " (regexp-quote cmd) " \\.\\.\\.\n") str))
          (error "Internal PCL-CVS error while removing message")
        (setq str (replace-match "" t t str))
-       (if (zerop (length str)) (setq str "\n"))
-       (setq done (concat "-- last cmd: " cmd " --"))))
-    (setq str (concat str "\n") done (concat done "\n"))
+        ;; Re-add the default empty line, if applicable.
+        (if (not (string-match "." str)) (setq str "\n\n"))
+       (setq done (concat "-- last cmd: " cmd " --\n"))))
     ;; set the new header and footer
     (ewoc-set-hf cvs-cookies
                 str (concat "\n--------------------- "
@@ -1723,16 +1725,22 @@ Signal an error if there is no backup file."
          (message "Retrieving revision %s..." rev)
          ;; Discard stderr output to work around the CVS+SSH+libc
          ;; problem when stdout and stderr are the same.
-         (let ((res (apply 'call-process cvs-program nil '(t nil) nil
-                           "-q" "update" "-p"
-                           ;; If `rev' is HEAD, don't pass it at all:
-                           ;; the default behavior is to get the head
-                           ;; of the current branch whereas "-r HEAD"
-                           ;; stupidly gives you the head of the trunk.
-                           (append (unless (equal rev "HEAD") (list "-r" rev))
-                                   (list file)))))
+         (let ((res
+                 (let ((coding-system-for-read 'binary))
+                   (apply 'call-process cvs-program nil '(t nil) nil
+                          "-q" "update" "-p"
+                          ;; If `rev' is HEAD, don't pass it at all:
+                          ;; the default behavior is to get the head
+                          ;; of the current branch whereas "-r HEAD"
+                          ;; stupidly gives you the head of the trunk.
+                          (append (unless (equal rev "HEAD") (list "-r" rev))
+                                  (list file))))))
            (when (and res (not (and (equal 0 res))))
              (error "Something went wrong retrieving revision %s: %s" rev res))
+            ;; Figure out the encoding used and decode the byte-sequence
+            ;; into a sequence of chars.
+            (decode-coding-inserted-region
+             (point-min) (point-max) file t nil nil t)
            (set-buffer-modified-p nil)
            (let ((buffer-file-name (expand-file-name file)))
              (after-find-file))
@@ -2281,7 +2289,7 @@ this file, or a list of arguments to send to the program."
   (interactive "DNew repository: ")
   (if (or (file-directory-p (expand-file-name "CVSROOT" newroot))
          (y-or-n-p (concat "Warning: no CVSROOT found inside repository."
-                           " Change cvs-cvsroot anyhow?")))
+                           " Change cvs-cvsroot anyhow? ")))
       (setq cvs-cvsroot newroot)))
 
 ;;;;