From 456d96353c8e7eadfe3b62afd5ff45559057d39b Mon Sep 17 00:00:00 2001 From: Dave Love Date: Mon, 6 Nov 2000 22:46:03 +0000 Subject: [PATCH] Use (featurep 'xemacs). (uudecode-char-int): New alias, replacing char-int. (uudecode-decode-region): Don't call buffer-disable-undo. --- lisp/gnus/uudecode.el | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/lisp/gnus/uudecode.el b/lisp/gnus/uudecode.el index 4135372c525..3b99ea8a212 100644 --- a/lisp/gnus/uudecode.el +++ b/lisp/gnus/uudecode.el @@ -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 @@ If FILE-NAME is non-nil, save the result to FILE-NAME." (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 @@ If FILE-NAME is non-nil, save the result to FILE-NAME." 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 @@ If FILE-NAME is non-nil, save the result to FILE-NAME." ((> (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)) -- 2.39.5