aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Love2000-11-06 22:46:03 +0000
committerDave Love2000-11-06 22:46:03 +0000
commit456d96353c8e7eadfe3b62afd5ff45559057d39b (patch)
treeb1863f8a56cb98471c2fcf6be2ae040350dd9360
parente0c12c681385d90936890598874046b5df326627 (diff)
downloademacs-456d96353c8e7eadfe3b62afd5ff45559057d39b.tar.gz
emacs-456d96353c8e7eadfe3b62afd5ff45559057d39b.zip
Use (featurep 'xemacs).
(uudecode-char-int): New alias, replacing char-int. (uudecode-decode-region): Don't call buffer-disable-undo.
-rw-r--r--lisp/gnus/uudecode.el20
1 files 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 @@
27;; Lots of codes are stolen from mm-decode.el, gnus-uu.el and 27;; Lots of codes are stolen from mm-decode.el, gnus-uu.el and
28;; base64.el 28;; base64.el
29 29
30;; This looks as though it could be made rather more efficient.
31;; Encoding could use a lookup table and decoding should presumably
32;; use a vector or list buffer for partial results rather than
33;; with-current-buffer. -- fx
34
30;;; Code: 35;;; Code:
31 36
32(if (not (fboundp 'char-int)) 37(defalias 'uudecode-char-int
33 (defalias 'char-int 'identity)) 38 (if (fboundp 'char-int)
39 'char-int
40 'identity))
34 41
35(defcustom uudecode-decoder-program "uudecode" 42(defcustom uudecode-decoder-program "uudecode"
36 "*Non-nil value should be a string that names a uu decoder. 43 "*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."
112 (and work-buffer (kill-buffer work-buffer)) 119 (and work-buffer (kill-buffer work-buffer))
113 (ignore-errors (or file-name (delete-file tempfile)))))) 120 (ignore-errors (or file-name (delete-file tempfile))))))
114 121
115(if (string-match "XEmacs" emacs-version) 122(if (featurep 'xemacs)
116 (defalias 'uudecode-insert-char 'insert-char) 123 (defalias 'uudecode-insert-char 'insert-char)
117 (defun uudecode-insert-char (char &optional count ignored buffer) 124 (defun uudecode-insert-char (char &optional count ignored buffer)
118 (if (or (null buffer) (eq buffer (current-buffer))) 125 (if (or (null buffer) (eq buffer (current-buffer)))
@@ -145,7 +152,6 @@ If FILE-NAME is non-nil, save the result to FILE-NAME."
145 nil nil nil 152 nil nil nil
146 (match-string 1)))))) 153 (match-string 1))))))
147 (setq work-buffer (generate-new-buffer " *uudecode-work*")) 154 (setq work-buffer (generate-new-buffer " *uudecode-work*"))
148 (buffer-disable-undo work-buffer)
149 (forward-line 1) 155 (forward-line 1)
150 (skip-chars-forward non-data-chars end) 156 (skip-chars-forward non-data-chars end)
151 (while (not done) 157 (while (not done)
@@ -155,14 +161,16 @@ If FILE-NAME is non-nil, save the result to FILE-NAME."
155 ((> (skip-chars-forward uudecode-alphabet end) 0) 161 ((> (skip-chars-forward uudecode-alphabet end) 0)
156 (setq lim (point)) 162 (setq lim (point))
157 (setq remain 163 (setq remain
158 (logand (- (char-int (char-after inputpos)) 32) 63)) 164 (logand (- (uudecode-char-int (char-after inputpos)) 32)
165 63))
159 (setq inputpos (1+ inputpos)) 166 (setq inputpos (1+ inputpos))
160 (if (= remain 0) (setq done t)) 167 (if (= remain 0) (setq done t))
161 (while (and (< inputpos lim) (> remain 0)) 168 (while (and (< inputpos lim) (> remain 0))
162 (setq bits (+ bits 169 (setq bits (+ bits
163 (logand 170 (logand
164 (- 171 (-
165 (char-int (char-after inputpos)) 32) 63))) 172 (uudecode-char-int (char-after inputpos)) 32)
173 63)))
166 (if (/= counter 0) (setq remain (1- remain))) 174 (if (/= counter 0) (setq remain (1- remain)))
167 (setq counter (1+ counter) 175 (setq counter (1+ counter)
168 inputpos (1+ inputpos)) 176 inputpos (1+ inputpos))