help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

detection of coding-system in cvs-retrieve-revision (was: pcl-cvs: suppr


From: Stefan Monnier
Subject: detection of coding-system in cvs-retrieve-revision (was: pcl-cvs: suppress empty dirs?)
Date: Tue, 16 May 2006 02:41:16 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

> I am in the same testing situation.
> I face again the problem discussed in

> http://groups.google.fr/group/gnu.emacs.help/index/browse_frm/thread/7e593f35d0d991eb

> Is there any better solution than patching - again -
> cvs-retrieve-revision

Contacting the author would be a good way to maximize the chances that the
problem gets fixed, so that you won't have to re-patch again and again.

Does the patch below do the right thing?


        Stefan


Index: lisp/pcvs.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/pcvs.el,v
retrieving revision 1.90
diff -u -r1.90 pcvs.el
--- lisp/pcvs.el        6 Feb 2006 14:33:34 -0000       1.90
+++ lisp/pcvs.el        16 May 2006 06:40:12 -0000
@@ -1722,16 +1722,22 @@
          (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))


reply via email to

[Prev in Thread] Current Thread [Next in Thread]