Sync up with Pteroductyl Gnus v0.69
[elisp/gnus.git-] / lisp / uudecode.el
index 0aab25c..b44e3c9 100644 (file)
@@ -2,7 +2,7 @@
 ;; Copyright (c) 1998 by Shenghuo Zhu <zsh@cs.rochester.edu>
 
 ;; Author: Shenghuo Zhu <zsh@cs.rochester.edu>
-;; $Revision: 1.3 $
+;; $Revision: 5.3 $
 ;; Keywords: uudecode
 
 ;; This file is not part of GNU Emacs, but the same permissions
@@ -52,7 +52,10 @@ input and write the converted data to its standard output.")
       (setq str (concat str "[^a-z]")))
     (concat str ".?$")))
 
-(defvar uudecode-temporary-file-directory "/tmp/")
+(defvar uudecode-temporary-file-directory
+  (cond ((fboundp 'temp-directory) (temp-directory))
+       ((boundp 'temporary-file-directory) temporary-file-directory)
+       ("/tmp/")))
 
 ;;;###autoload
 (defun uudecode-decode-region-external (start end &optional file-name)
@@ -106,21 +109,13 @@ If FILE-NAME is non-nil, save the result to FILE-NAME."
        (error))
       )))
 
-(defun uudecode-insert-char (char &optional count ignored buffer)
-  (condition-case nil
-      (progn
-       (insert-char char count ignored buffer)
-       (fset 'uudecode-insert-char 'insert-char))
-    (wrong-number-of-arguments
-     (fset 'uudecode-insert-char 'uudecode-xemacs-insert-char)
-     (uudecode-insert-char char count ignored buffer))))
-
-(defun uudecode-xemacs-insert-char (char &optional count ignored buffer)
-  (if (or (null buffer) (eq buffer (current-buffer)))
-      (insert-char char count)
-    (save-excursion
-      (set-buffer buffer)
-      (insert-char char count))))
+(if (string-match "XEmacs" emacs-version)
+    (defalias 'uudecode-insert-char 'insert-char)
+  (defun uudecode-insert-char (char &optional count ignored buffer)
+    (if (or (null buffer) (eq buffer (current-buffer)))
+       (insert-char char count)
+      (with-current-buffer buffer
+       (insert-char char count)))))
 
 ;;;###autoload