Mercurial > emacs
comparison lisp/gnus/mm-uu.el @ 92773:ca2ba2a312f0
(mm-uu-copy-to-buffer): Preserve (uni/multi)byteness.
(mm-uu-yenc-extract): Use with-current-buffer.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Wed, 12 Mar 2008 18:54:39 +0000 |
parents | 1af6d6eab2e9 |
children | f42ef85caf91 |
comparison
equal
deleted
inserted
replaced
92772:3637573105bd | 92773:ca2ba2a312f0 |
---|---|
278 | 278 |
279 If PROPERTIES is non-nil, PROPERTIES are applied to the buffer, | 279 If PROPERTIES is non-nil, PROPERTIES are applied to the buffer, |
280 see `set-text-properties'. If PROPERTIES equals t, this means to | 280 see `set-text-properties'. If PROPERTIES equals t, this means to |
281 apply the face `mm-uu-extract'." | 281 apply the face `mm-uu-extract'." |
282 (let ((obuf (current-buffer)) | 282 (let ((obuf (current-buffer)) |
283 (multi (and (boundp 'enable-multibyte-characters) | |
284 enable-multibyte-characters)) | |
283 (coding-system | 285 (coding-system |
284 ;; Might not exist in non-MULE XEmacs | 286 ;; Might not exist in non-MULE XEmacs |
285 (when (boundp 'buffer-file-coding-system) | 287 (when (boundp 'buffer-file-coding-system) |
286 buffer-file-coding-system))) | 288 buffer-file-coding-system))) |
287 (with-current-buffer (generate-new-buffer " *mm-uu*") | 289 (with-current-buffer (generate-new-buffer " *mm-uu*") |
290 (if multi (mm-enable-multibyte) (mm-disable-multibyte)) | |
288 (setq buffer-file-coding-system coding-system) | 291 (setq buffer-file-coding-system coding-system) |
289 (insert-buffer-substring obuf from to) | 292 (insert-buffer-substring obuf from to) |
290 (cond ((eq properties t) | 293 (cond ((eq properties t) |
291 (set-text-properties (point-min) (point-max) | 294 (set-text-properties (point-min) (point-max) |
292 '(face mm-uu-extract))) | 295 '(face mm-uu-extract))) |
439 | 442 |
440 (defun mm-uu-yenc-extract () | 443 (defun mm-uu-yenc-extract () |
441 ;; This might not be exactly correct, but we sure can't get the | 444 ;; This might not be exactly correct, but we sure can't get the |
442 ;; binary data from the article buffer, since that's already in a | 445 ;; binary data from the article buffer, since that's already in a |
443 ;; non-binary charset. So get it from the original article buffer. | 446 ;; non-binary charset. So get it from the original article buffer. |
444 (mm-make-handle (save-excursion | 447 (mm-make-handle (with-current-buffer gnus-original-article-buffer |
445 (set-buffer gnus-original-article-buffer) | |
446 (mm-uu-copy-to-buffer start-point end-point)) | 448 (mm-uu-copy-to-buffer start-point end-point)) |
447 (list (or (and file-name | 449 (list (or (and file-name |
448 (string-match "\\.[^\\.]+$" file-name) | 450 (string-match "\\.[^\\.]+$" file-name) |
449 (mailcap-extension-to-mime | 451 (mailcap-extension-to-mime |
450 (match-string 0 file-name))) | 452 (match-string 0 file-name))) |