diff options
| author | Dave Love | 2000-11-17 12:59:35 +0000 |
|---|---|---|
| committer | Dave Love | 2000-11-17 12:59:35 +0000 |
| commit | 96403ac1398236e5cde80de8135e480ff0cbe5fa (patch) | |
| tree | a4f046eb192b89aa275c3e46bfdfec6ef47115ba | |
| parent | 66321b2fe29789f23ba907eadb4f3220d222630a (diff) | |
| download | emacs-96403ac1398236e5cde80de8135e480ff0cbe5fa.tar.gz emacs-96403ac1398236e5cde80de8135e480ff0cbe5fa.zip | |
(uudecode-insert-char): Fix bogus feature test.
(uudecode-decode-region-external): Doc fix. Use with-temp-buffer
and make-temp-file.
(uudecode-decode-region): Doc fix.
| -rw-r--r-- | lisp/gnus/ChangeLog | 9 | ||||
| -rw-r--r-- | lisp/gnus/uudecode.el | 37 |
2 files changed, 24 insertions, 22 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 695d013264b..fbac3dc8f75 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog | |||
| @@ -1,8 +1,15 @@ | |||
| 1 | 2000-11-17 Dave Love <fx@gnu.org> | ||
| 2 | |||
| 3 | * uudecode.el (uudecode-insert-char): Fix bogus feature test. | ||
| 4 | (uudecode-decode-region-external): Doc fix. Use with-temp-buffer | ||
| 5 | and make-temp-file. | ||
| 6 | (uudecode-decode-region): Doc fix. | ||
| 7 | |||
| 1 | 2000-11-14 Dave Love <fx@gnu.org> | 8 | 2000-11-14 Dave Love <fx@gnu.org> |
| 2 | 9 | ||
| 3 | * cu-exit.pbm, exit-summ.pbm, followup.pbm, fuwo.pbm: | 10 | * cu-exit.pbm, exit-summ.pbm, followup.pbm, fuwo.pbm: |
| 4 | * mail-reply.pbm, next-ur.pbm, post.pbm, prev-ur.pbm: | 11 | * mail-reply.pbm, next-ur.pbm, post.pbm, prev-ur.pbm: |
| 5 | * reply-wo.pbm, reply.pbm rot13.pbm, save-aif.pbm, save-art.pbm: | 12 | * reply-wo.pbm, reply.pbm, rot13.pbm, save-aif.pbm, save-art.pbm: |
| 6 | New files, derived from the XPMs. | 13 | New files, derived from the XPMs. |
| 7 | 14 | ||
| 8 | 2000-11-12 Dave Love <fx@gnu.org> | 15 | 2000-11-12 Dave Love <fx@gnu.org> |
diff --git a/lisp/gnus/uudecode.el b/lisp/gnus/uudecode.el index 36640d5d13c..860cb9358ef 100644 --- a/lisp/gnus/uudecode.el +++ b/lisp/gnus/uudecode.el | |||
| @@ -27,10 +27,10 @@ | |||
| 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. | 30 | ;; This looks as though it could be made rather more efficient for |
| 31 | ;; Encoding could use a lookup table and decoding should presumably | 31 | ;; internal working. Encoding could use a lookup table and decoding |
| 32 | ;; use a vector or list buffer for partial results rather than | 32 | ;; should presumably use a vector or list buffer for partial results |
| 33 | ;; with-current-buffer. -- fx | 33 | ;; rather than with-current-buffer. -- fx |
| 34 | 34 | ||
| 35 | ;;; Code: | 35 | ;;; Code: |
| 36 | 36 | ||
| @@ -42,7 +42,7 @@ | |||
| 42 | 'char-int | 42 | 'char-int |
| 43 | 'identity)) | 43 | 'identity)) |
| 44 | 44 | ||
| 45 | (if (fboundp 'insert-char) | 45 | (if (featurep 'xemacs) |
| 46 | (defalias 'uudecode-insert-char 'insert-char) | 46 | (defalias 'uudecode-insert-char 'insert-char) |
| 47 | (defun uudecode-insert-char (char &optional count ignored buffer) | 47 | (defun uudecode-insert-char (char &optional count ignored buffer) |
| 48 | (if (or (null buffer) (eq buffer (current-buffer))) | 48 | (if (or (null buffer) (eq buffer (current-buffer))) |
| @@ -80,11 +80,11 @@ input and write the converted data to its standard output." | |||
| 80 | 80 | ||
| 81 | ;;;###autoload | 81 | ;;;###autoload |
| 82 | (defun uudecode-decode-region-external (start end &optional file-name) | 82 | (defun uudecode-decode-region-external (start end &optional file-name) |
| 83 | "Uudecode region between START and END with external decoder. | 83 | "Uudecode region between START and END using external program. |
| 84 | 84 | If FILE-NAME is non-nil, save the result to FILE-NAME. The program | |
| 85 | If FILE-NAME is non-nil, save the result to FILE-NAME." | 85 | used is specified by `uudecode-decoder-program'." |
| 86 | (interactive "r\nP") | 86 | (interactive "r\nP") |
| 87 | (let ((cbuf (current-buffer)) tempfile firstline work-buffer status) | 87 | (let ((cbuf (current-buffer)) tempfile firstline status) |
| 88 | (save-excursion | 88 | (save-excursion |
| 89 | (goto-char start) | 89 | (goto-char start) |
| 90 | (when (re-search-forward uudecode-begin-line nil t) | 90 | (when (re-search-forward uudecode-begin-line nil t) |
| @@ -98,16 +98,13 @@ If FILE-NAME is non-nil, save the result to FILE-NAME." | |||
| 98 | (match-string 1))))) | 98 | (match-string 1))))) |
| 99 | (setq tempfile (if file-name | 99 | (setq tempfile (if file-name |
| 100 | (expand-file-name file-name) | 100 | (expand-file-name file-name) |
| 101 | (make-temp-name | 101 | (let ((temporary-file-directory |
| 102 | ;; /tmp/uu... | 102 | uudecode-temporary-file-directory)) |
| 103 | (expand-file-name | 103 | (make-temp-file "uu")))) |
| 104 | "uu" uudecode-temporary-file-directory)))) | 104 | (let ((cdir default-directory) |
| 105 | (let ((cdir default-directory) default-process-coding-system) | 105 | default-process-coding-system) |
| 106 | (unwind-protect | 106 | (unwind-protect |
| 107 | (progn | 107 | (with-temp-buffer |
| 108 | (set-buffer (setq work-buffer | ||
| 109 | (generate-new-buffer " *uudecode-work*"))) | ||
| 110 | (buffer-disable-undo work-buffer) | ||
| 111 | (insert "begin 600 " (file-name-nondirectory tempfile) "\n") | 108 | (insert "begin 600 " (file-name-nondirectory tempfile) "\n") |
| 112 | (insert-buffer-substring cbuf firstline end) | 109 | (insert-buffer-substring cbuf firstline end) |
| 113 | (cd (file-name-directory tempfile)) | 110 | (cd (file-name-directory tempfile)) |
| @@ -127,13 +124,11 @@ If FILE-NAME is non-nil, save the result to FILE-NAME." | |||
| 127 | (let (format-alist) | 124 | (let (format-alist) |
| 128 | (insert-file-contents-literally tempfile))) | 125 | (insert-file-contents-literally tempfile))) |
| 129 | (message "Can not uudecode"))) | 126 | (message "Can not uudecode"))) |
| 130 | (and work-buffer (kill-buffer work-buffer)) | ||
| 131 | (ignore-errors (or file-name (delete-file tempfile)))))) | 127 | (ignore-errors (or file-name (delete-file tempfile)))))) |
| 132 | 128 | ||
| 133 | ;;;###autoload | 129 | ;;;###autoload |
| 134 | |||
| 135 | (defun uudecode-decode-region (start end &optional file-name) | 130 | (defun uudecode-decode-region (start end &optional file-name) |
| 136 | "Uudecode region between START and END. | 131 | "Uudecode region between START and END without using an external program. |
| 137 | If FILE-NAME is non-nil, save the result to FILE-NAME." | 132 | If FILE-NAME is non-nil, save the result to FILE-NAME." |
| 138 | (interactive "r\nP") | 133 | (interactive "r\nP") |
| 139 | (let ((work-buffer nil) | 134 | (let ((work-buffer nil) |