Update.
[elisp/gnus.git-] / lisp / gnus-util.el
index 289f237..ba7cbc9 100644 (file)
   "Pop to BUFFER, evaluate FORMS, and then return to the original window."
   (let ((tempvar (make-symbol "GnusStartBufferWindow"))
         (w (make-symbol "w"))
-        (buf (make-symbol "buf")))
+        (buf (make-symbol "buf"))
+       (frame (make-symbol "frame")))
     `(let* ((,tempvar (selected-window))
             (,buf ,buffer)
-            (,w (get-buffer-window ,buf 'visible)))
+            (,w (get-buffer-window ,buf 'visible))
+           ,frame)
        (unwind-protect
            (progn
              (if ,w
@@ -64,7 +66,9 @@
                    (set-buffer (window-buffer ,w)))
                (pop-to-buffer ,buf))
              ,@forms)
-         (select-window ,tempvar)))))
+        (setq ,frame (selected-frame))
+         (select-window ,tempvar)
+        (select-frame ,frame)))))
 
 (put 'gnus-eval-in-buffer-window 'lisp-indent-function 1)
 (put 'gnus-eval-in-buffer-window 'edebug-form-spec '(form body))
@@ -729,7 +733,7 @@ with potentially long computations."
       ;; Decide whether to append to a file or to an Emacs buffer.
       (let ((outbuf (get-file-buffer filename)))
        (if (not outbuf)
-           (append-to-file (point-min) (point-max) filename)
+           (write-region-as-binary (point-min) (point-max) filename 'append)
          ;; File has been visited, in buffer OUTBUF.
          (set-buffer outbuf)
          (let ((buffer-read-only nil)
@@ -982,7 +986,8 @@ ARG is passed to the first function."
     t))
 
 (static-if (boundp 'MULE)
-    (defun gnus-write-active-file-as-coding-system (coding-system file hashtb)
+    (defun gnus-write-active-file-as-coding-system
+      (coding-system file hashtb &optional full-names)
       (let ((output-coding-system coding-system))
        (with-temp-file file
          (mapatoms
@@ -991,11 +996,14 @@ ARG is passed to the first function."
                        (boundp sym)
                        (symbol-value sym))
               (insert (format "%s %d %d y\n"
-                              (gnus-group-real-name (symbol-name sym))
+                              (if full-names
+                                  (symbol-name sym)
+                                (gnus-group-real-name (symbol-name sym)))
                               (cdr (symbol-value sym))
                               (car (symbol-value sym))))))
           hashtb))))
-  (defun gnus-write-active-file-as-coding-system (coding-system file hashtb)
+  (defun gnus-write-active-file-as-coding-system
+    (coding-system file hashtb &optional full-names)
     (let ((coding-system-for-write coding-system))
       (with-temp-file file
        (mapatoms
@@ -1004,7 +1012,9 @@ ARG is passed to the first function."
                      (boundp sym)
                      (symbol-value sym))
             (insert (format "%s %d %d y\n"
-                            (gnus-group-real-name (symbol-name sym))
+                            (if full-names
+                                (symbol-name sym)
+                              (gnus-group-real-name (symbol-name sym)))
                             (cdr (symbol-value sym))
                             (car (symbol-value sym))))))
         hashtb))))