changeset 33263:71a0b3b3c21c

Use (featurep 'xemacs). (uudecode-char-int): New alias, replacing char-int. (uudecode-decode-region): Don't call buffer-disable-undo.
author Dave Love <fx@gnu.org>
date Mon, 06 Nov 2000 22:46:03 +0000
parents 89a45bb5ac64
children 88e6276ee7b6
files lisp/gnus/uudecode.el
diffstat 1 files changed, 14 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/gnus/uudecode.el	Mon Nov 06 16:52:41 2000 +0000
+++ b/lisp/gnus/uudecode.el	Mon Nov 06 22:46:03 2000 +0000
@@ -27,10 +27,17 @@
 ;;     Lots of codes are stolen from mm-decode.el, gnus-uu.el and
 ;;     base64.el
 
+;; This looks as though it could be made rather more efficient.
+;; Encoding could use a lookup table and decoding should presumably
+;; use a vector or list buffer for partial results rather than
+;; with-current-buffer.  -- fx
+
 ;;; Code:
 
-(if (not (fboundp 'char-int))
-    (defalias 'char-int 'identity))
+(defalias 'uudecode-char-int
+  (if (fboundp 'char-int)
+      'char-int
+    'identity))
 
 (defcustom uudecode-decoder-program "uudecode"
   "*Non-nil value should be a string that names a uu decoder.
@@ -112,7 +119,7 @@
       (and work-buffer (kill-buffer work-buffer))
       (ignore-errors (or file-name (delete-file tempfile))))))
 
-(if (string-match "XEmacs" emacs-version)
+(if (featurep 'xemacs)
     (defalias 'uudecode-insert-char 'insert-char)
   (defun uudecode-insert-char (char &optional count ignored buffer)
     (if (or (null buffer) (eq buffer (current-buffer)))
@@ -145,7 +152,6 @@
 						    nil nil nil
 						    (match-string 1))))))
 	    (setq work-buffer (generate-new-buffer " *uudecode-work*"))
-	    (buffer-disable-undo work-buffer)
 	    (forward-line 1)
 	    (skip-chars-forward non-data-chars end)
 	    (while (not done)
@@ -155,14 +161,16 @@
 	       ((> (skip-chars-forward uudecode-alphabet end) 0)
 		(setq lim (point))
 		(setq remain
-		      (logand (- (char-int (char-after inputpos)) 32) 63))
+		      (logand (- (uudecode-char-int (char-after inputpos)) 32)
+			      63))
 		(setq inputpos (1+ inputpos))
 		(if (= remain 0) (setq done t))
 		(while (and (< inputpos lim) (> remain 0))
 		  (setq bits (+ bits
 				(logand
 				 (-
-				  (char-int (char-after inputpos)) 32) 63)))
+				  (uudecode-char-int (char-after inputpos)) 32)
+				 63)))
 		  (if (/= counter 0) (setq remain (1- remain)))
 		  (setq counter (1+ counter)
 			inputpos (1+ inputpos))