Mercurial > emacs
comparison lisp/gnus/nnmh.el @ 92771:a3d61f1532f1
Use with-current-buffer.
(nnmh-request-list-1): Use mm-string-to-multibyte rather than
mm-string-as-multibyte on the output of mm-encode-coding-string.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Wed, 12 Mar 2008 18:44:07 +0000 |
parents | 107ccd98fa12 |
children | a789a1138b08 |
comparison
equal
deleted
inserted
replaced
92770:b7f1378e2a2c | 92771:a3d61f1532f1 |
---|---|
75 ;;; Interface functions. | 75 ;;; Interface functions. |
76 | 76 |
77 (nnoo-define-basics nnmh) | 77 (nnoo-define-basics nnmh) |
78 | 78 |
79 (deffoo nnmh-retrieve-headers (articles &optional newsgroup server fetch-old) | 79 (deffoo nnmh-retrieve-headers (articles &optional newsgroup server fetch-old) |
80 (save-excursion | 80 (with-current-buffer nntp-server-buffer |
81 (set-buffer nntp-server-buffer) | |
82 (erase-buffer) | 81 (erase-buffer) |
83 (let* ((file nil) | 82 (let* ((file nil) |
84 (number (length articles)) | 83 (number (length articles)) |
85 (large (and (numberp nnmail-large-newsgroup) | 84 (large (and (numberp nnmail-large-newsgroup) |
86 (> number nnmail-large-newsgroup))) | 85 (> number nnmail-large-newsgroup))) |
223 ;; For each directory, generate an active file line. | 222 ;; For each directory, generate an active file line. |
224 (unless (string= (expand-file-name nnmh-toplev) dir) | 223 (unless (string= (expand-file-name nnmh-toplev) dir) |
225 (let ((files (mapcar 'string-to-number | 224 (let ((files (mapcar 'string-to-number |
226 (directory-files dir nil "^[0-9]+$" t)))) | 225 (directory-files dir nil "^[0-9]+$" t)))) |
227 (when files | 226 (when files |
228 (save-excursion | 227 (with-current-buffer nntp-server-buffer |
229 (set-buffer nntp-server-buffer) | |
230 (goto-char (point-max)) | 228 (goto-char (point-max)) |
231 (insert | 229 (insert |
232 (format | 230 (format |
233 "%s %.0f %.0f y\n" | 231 "%s %.0f %.0f y\n" |
234 (progn | 232 (progn |
235 (string-match | 233 (string-match |
236 (regexp-quote | 234 (regexp-quote |
237 (file-truename (file-name-as-directory | 235 (file-truename (file-name-as-directory |
238 (expand-file-name nnmh-toplev)))) | 236 (expand-file-name nnmh-toplev)))) |
239 dir) | 237 dir) |
240 (mm-string-as-multibyte | 238 (mm-string-to-multibyte ;Why? Isn't it multibyte already? |
241 (mm-encode-coding-string | 239 (mm-encode-coding-string |
242 (nnheader-replace-chars-in-string | 240 (nnheader-replace-chars-in-string |
243 (substring dir (match-end 0)) | 241 (substring dir (match-end 0)) |
244 ?/ ?.) | 242 ?/ ?.) |
245 nnmail-pathname-coding-system))) | 243 nnmail-pathname-coding-system))) |
293 (let ((buf (get-buffer-create " *nnmh move*")) | 291 (let ((buf (get-buffer-create " *nnmh move*")) |
294 result) | 292 result) |
295 (and | 293 (and |
296 (nnmh-deletable-article-p group article) | 294 (nnmh-deletable-article-p group article) |
297 (nnmh-request-article article group server) | 295 (nnmh-request-article article group server) |
298 (save-excursion | 296 (with-current-buffer buf |
299 (set-buffer buf) | |
300 (erase-buffer) | 297 (erase-buffer) |
301 (insert-buffer-substring nntp-server-buffer) | 298 (insert-buffer-substring nntp-server-buffer) |
302 (setq result (eval accept-form)) | 299 (setq result (eval accept-form)) |
303 (kill-buffer (current-buffer)) | 300 (kill-buffer (current-buffer)) |
304 result) | 301 result) |
334 (when (and last nnmail-cache-accepted-message-ids) | 331 (when (and last nnmail-cache-accepted-message-ids) |
335 (nnmail-cache-close)))) | 332 (nnmail-cache-close)))) |
336 | 333 |
337 (deffoo nnmh-request-replace-article (article group buffer) | 334 (deffoo nnmh-request-replace-article (article group buffer) |
338 (nnmh-possibly-change-directory group) | 335 (nnmh-possibly-change-directory group) |
339 (save-excursion | 336 (with-current-buffer buffer |
340 (set-buffer buffer) | |
341 (nnmh-possibly-create-directory group) | 337 (nnmh-possibly-create-directory group) |
342 (ignore-errors | 338 (ignore-errors |
343 (nnmail-write-region | 339 (nnmail-write-region |
344 (point-min) (point-max) | 340 (point-min) (point-max) |
345 (concat nnmh-current-directory (int-to-string article)) | 341 (concat nnmh-current-directory (int-to-string article)) |
575 ;; Well, we can. | 571 ;; Well, we can. |
576 nnmh-allow-delete-final)))) | 572 nnmh-allow-delete-final)))) |
577 | 573 |
578 (provide 'nnmh) | 574 (provide 'nnmh) |
579 | 575 |
580 ;;; arch-tag: 36c12a98-3bad-44b3-9953-628078ef0e04 | 576 ;; arch-tag: 36c12a98-3bad-44b3-9953-628078ef0e04 |
581 ;;; nnmh.el ends here | 577 ;;; nnmh.el ends here |