Mercurial > emacs
comparison lisp/gnus/nnmail.el @ 19593:6d421627bb8b
(nnmail-active-file-coding-system): New variable.
(nnmail-insert-xref): Encode pathname for Emacs 20.
(nnmail-write-region, nnmh-retrieve-headers, nnmh-request-article,
nnmh-request-group, nnmh-possibly-change-directory): Protect from
conversion by `pathname-coding-system' for XEmacs/mule.
(nnmail-pathname-coding-system): New variable.
(nnmail-group-pathname): Encode pathname for Emacs 20.
nnmail-file-coding-system): New variable.
(nnmail-find-file): Bind `coding-system-for-read' with
`nnmail-file-coding-system' for Emacs/mule and XEmacs/mule.
(nnmail-write-region): Bind `coding-system-for-write' with
`nnmail-file-coding-system' for Emacs/mule and XEmacs/mule.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Thu, 28 Aug 1997 04:51:02 +0000 |
parents | 681265352f07 |
children | 5f1ab3dd344d |
comparison
equal
deleted
inserted
replaced
19592:86dc1337c489 | 19593:6d421627bb8b |
---|---|
468 | 468 |
469 | 469 |
470 (defun nnmail-request-post (&optional server) | 470 (defun nnmail-request-post (&optional server) |
471 (mail-send-and-exit nil)) | 471 (mail-send-and-exit nil)) |
472 | 472 |
473 ;; 1997/5/4 by MORIOKA Tomohiko <morioka@jaist.ac.jp> | |
474 (defvar nnmail-file-coding-system nil | |
475 "Coding system used in nnmail.") | |
476 | |
473 (defun nnmail-find-file (file) | 477 (defun nnmail-find-file (file) |
474 "Insert FILE in server buffer safely." | 478 "Insert FILE in server buffer safely." |
475 (set-buffer nntp-server-buffer) | 479 (set-buffer nntp-server-buffer) |
476 (erase-buffer) | 480 (erase-buffer) |
477 (let ((format-alist nil) | 481 (let ((format-alist nil) |
478 (after-insert-file-functions nil)) | 482 (after-insert-file-functions nil)) |
479 (condition-case () | 483 (condition-case () |
480 (progn (insert-file-contents file) t) | 484 ;; 1997/5/4 by MORIOKA Tomohiko <morioka@jaist.ac.jp> |
485 (let ((coding-system-for-read nnmail-file-coding-system) | |
486 ;; 1997/8/12 by MORIOKA Tomohiko | |
487 ;; for XEmacs/mule. | |
488 (pathname-coding-system 'binary)) | |
489 (insert-file-contents file) | |
490 t) | |
481 (file-error nil)))) | 491 (file-error nil)))) |
492 | |
493 ;; 1997/8/10 by MORIOKA Tomohiko | |
494 (defvar nnmail-pathname-coding-system | |
495 'iso-8859-1 | |
496 "*Coding system for pathname.") | |
482 | 497 |
483 (defun nnmail-group-pathname (group dir &optional file) | 498 (defun nnmail-group-pathname (group dir &optional file) |
484 "Make pathname for GROUP." | 499 "Make pathname for GROUP." |
485 (concat | 500 (concat |
486 (let ((dir (file-name-as-directory (expand-file-name dir)))) | 501 (let ((dir (file-name-as-directory (expand-file-name dir)))) |
487 ;; If this directory exists, we use it directly. | 502 ;; If this directory exists, we use it directly. |
488 (if (or nnmail-use-long-file-names | 503 (if (or nnmail-use-long-file-names |
489 (file-directory-p (concat dir group))) | 504 (file-directory-p (concat dir group))) |
490 (concat dir group "/") | 505 (concat dir group "/") |
491 ;; If not, we translate dots into slashes. | 506 ;; If not, we translate dots into slashes. |
492 (concat dir (nnheader-replace-chars-in-string group ?. ?/) "/"))) | 507 (concat dir |
508 ;; 1997/8/10 by MORIOKA Tomohiko | |
509 ;; encode file name for Emacs 20. | |
510 (encode-coding-string | |
511 (nnheader-replace-chars-in-string group ?. ?/) | |
512 nnmail-pathname-coding-system) | |
513 "/"))) | |
493 (or file ""))) | 514 (or file ""))) |
494 | 515 |
495 (defun nnmail-date-to-time (date) | 516 (defun nnmail-date-to-time (date) |
496 "Convert DATE into time." | 517 "Convert DATE into time." |
497 (condition-case () | 518 (condition-case () |
666 (cons (string-to-int (match-string 3)) | 687 (cons (string-to-int (match-string 3)) |
667 (string-to-int (match-string 2)))) | 688 (string-to-int (match-string 2)))) |
668 group-assoc))) | 689 group-assoc))) |
669 group-assoc)) | 690 group-assoc)) |
670 | 691 |
692 ;; 1997/8/12 by MORIOKA Tomohiko | |
693 (defvar nnmail-active-file-coding-system | |
694 'iso-8859-1 | |
695 "*Coding system for active file.") | |
696 | |
671 (defun nnmail-save-active (group-assoc file-name) | 697 (defun nnmail-save-active (group-assoc file-name) |
672 "Save GROUP-ASSOC in ACTIVE-FILE." | 698 "Save GROUP-ASSOC in ACTIVE-FILE." |
673 (when file-name | 699 (let ((coding-system-for-write nnmail-active-file-coding-system)) |
674 (nnheader-temp-write file-name | 700 (when file-name |
675 (nnmail-generate-active group-assoc)))) | 701 (nnheader-temp-write file-name |
702 (nnmail-generate-active group-assoc))))) | |
676 | 703 |
677 (defun nnmail-generate-active (alist) | 704 (defun nnmail-generate-active (alist) |
678 "Generate an active file from group-alist ALIST." | 705 "Generate an active file from group-alist ALIST." |
679 (erase-buffer) | 706 (erase-buffer) |
680 (let (group) | 707 (let (group) |
1110 (when (re-search-backward "^Xref: " nil t) | 1137 (when (re-search-backward "^Xref: " nil t) |
1111 (delete-region (match-beginning 0) | 1138 (delete-region (match-beginning 0) |
1112 (progn (forward-line 1) (point)))) | 1139 (progn (forward-line 1) (point)))) |
1113 (insert (format "Xref: %s" (system-name))) | 1140 (insert (format "Xref: %s" (system-name))) |
1114 (while group-alist | 1141 (while group-alist |
1115 (insert (format " %s:%d" (caar group-alist) (cdar group-alist))) | 1142 ;; 1997/8/10 by MORIOKA Tomohiko |
1143 ;; encode file name for Emacs 20. | |
1144 (insert (format " %s:%d" | |
1145 (encode-coding-string (caar group-alist) | |
1146 nnmail-pathname-coding-system) | |
1147 (cdar group-alist))) | |
1116 (setq group-alist (cdr group-alist))) | 1148 (setq group-alist (cdr group-alist))) |
1117 (insert "\n")))) | 1149 (insert "\n")))) |
1118 | 1150 |
1119 ;;; Message washing functions | 1151 ;;; Message washing functions |
1120 | 1152 |
1601 (unless (re-search-forward "^Message-ID[ \t]*:" nil t) | 1633 (unless (re-search-forward "^Message-ID[ \t]*:" nil t) |
1602 (insert "Message-ID: " (nnmail-message-id) "\n"))))) | 1634 (insert "Message-ID: " (nnmail-message-id) "\n"))))) |
1603 | 1635 |
1604 (defun nnmail-write-region (start end filename &optional append visit lockname) | 1636 (defun nnmail-write-region (start end filename &optional append visit lockname) |
1605 "Do a `write-region', and then set the file modes." | 1637 "Do a `write-region', and then set the file modes." |
1606 (write-region start end filename append visit lockname) | 1638 ;; 1997/5/4 by MORIOKA Tomohiko <morioka@jaist.ac.jp> |
1607 (set-file-modes filename nnmail-default-file-modes)) | 1639 (let ((coding-system-for-write nnmail-file-coding-system) |
1640 ;; 1997/8/12 by MORIOKA Tomohiko | |
1641 ;; for XEmacs/mule. | |
1642 (pathname-coding-system 'binary)) | |
1643 (write-region start end filename append visit lockname) | |
1644 (set-file-modes filename nnmail-default-file-modes))) | |
1608 | 1645 |
1609 ;;; | 1646 ;;; |
1610 ;;; Status functions | 1647 ;;; Status functions |
1611 ;;; | 1648 ;;; |
1612 | 1649 |