diff options
| author | Miles Bader | 2007-12-06 09:51:45 +0000 |
|---|---|---|
| committer | Miles Bader | 2007-12-06 09:51:45 +0000 |
| commit | 0bd508417142ff377f34aec8dcec9438d9175c2c (patch) | |
| tree | 4d60fe09e5cebf7d79766b11e9cda8cc1c9dbb9b /lisp/mail | |
| parent | 98fe991da804a42f53f6a5e84cd5eab18a82e181 (diff) | |
| parent | 9fb1ba8090da3528de56158a79bd3527d31c7f2f (diff) | |
| download | emacs-0bd508417142ff377f34aec8dcec9438d9175c2c.tar.gz emacs-0bd508417142ff377f34aec8dcec9438d9175c2c.zip | |
Merge from emacs--devo--0
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-294
Diffstat (limited to 'lisp/mail')
| -rw-r--r-- | lisp/mail/binhex.el | 333 | ||||
| -rw-r--r-- | lisp/mail/emacsbug.el | 3 | ||||
| -rw-r--r-- | lisp/mail/hashcash.el | 375 | ||||
| -rw-r--r-- | lisp/mail/mail-extr.el | 19 | ||||
| -rw-r--r-- | lisp/mail/mspools.el | 5 | ||||
| -rw-r--r-- | lisp/mail/reporter.el | 3 | ||||
| -rw-r--r-- | lisp/mail/rmail.el | 17 | ||||
| -rw-r--r-- | lisp/mail/rmailedit.el | 3 | ||||
| -rw-r--r-- | lisp/mail/rmailkwd.el | 9 | ||||
| -rw-r--r-- | lisp/mail/rmailmsc.el | 3 | ||||
| -rw-r--r-- | lisp/mail/rmailout.el | 2 | ||||
| -rw-r--r-- | lisp/mail/rmailsort.el | 1 | ||||
| -rw-r--r-- | lisp/mail/rmailsum.el | 7 | ||||
| -rw-r--r-- | lisp/mail/sendmail.el | 7 | ||||
| -rw-r--r-- | lisp/mail/supercite.el | 53 | ||||
| -rw-r--r-- | lisp/mail/uce.el | 8 | ||||
| -rw-r--r-- | lisp/mail/undigest.el | 2 | ||||
| -rw-r--r-- | lisp/mail/unrmail.el | 2 | ||||
| -rw-r--r-- | lisp/mail/uudecode.el | 242 | ||||
| -rw-r--r-- | lisp/mail/vms-pmail.el | 1 |
20 files changed, 1042 insertions, 53 deletions
diff --git a/lisp/mail/binhex.el b/lisp/mail/binhex.el new file mode 100644 index 00000000000..c1d1316c82e --- /dev/null +++ b/lisp/mail/binhex.el | |||
| @@ -0,0 +1,333 @@ | |||
| 1 | ;;; binhex.el --- elisp native binhex decode | ||
| 2 | |||
| 3 | ;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, | ||
| 4 | ;; 2005, 2006, 2007 Free Software Foundation, Inc. | ||
| 5 | |||
| 6 | ;; Author: Shenghuo Zhu <zsh@cs.rochester.edu> | ||
| 7 | ;; Keywords: binhex news | ||
| 8 | |||
| 9 | ;; This file is part of GNU Emacs. | ||
| 10 | |||
| 11 | ;; GNU Emacs is free software; you can redistribute it and/or modify | ||
| 12 | ;; it under the terms of the GNU General Public License as published by | ||
| 13 | ;; the Free Software Foundation; either version 3, or (at your option) | ||
| 14 | ;; any later version. | ||
| 15 | |||
| 16 | ;; GNU Emacs is distributed in the hope that it will be useful, | ||
| 17 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 18 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 19 | ;; GNU General Public License for more details. | ||
| 20 | |||
| 21 | ;; You should have received a copy of the GNU General Public License | ||
| 22 | ;; along with GNU Emacs; see the file COPYING. If not, write to the | ||
| 23 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
| 24 | ;; Boston, MA 02110-1301, USA. | ||
| 25 | |||
| 26 | ;;; Commentary: | ||
| 27 | |||
| 28 | ;;; Code: | ||
| 29 | |||
| 30 | (eval-when-compile (require 'cl)) | ||
| 31 | |||
| 32 | (eval-and-compile | ||
| 33 | (defalias 'binhex-char-int | ||
| 34 | (if (fboundp 'char-int) | ||
| 35 | 'char-int | ||
| 36 | 'identity))) | ||
| 37 | |||
| 38 | (defgroup binhex nil | ||
| 39 | "Decoding of BinHex (binary-to-hexadecimal) data." | ||
| 40 | :group 'mail | ||
| 41 | :group 'news) | ||
| 42 | |||
| 43 | (defcustom binhex-decoder-program "hexbin" | ||
| 44 | "*Non-nil value should be a string that names a binhex decoder. | ||
| 45 | The program should expect to read binhex data on its standard | ||
| 46 | input and write the converted data to its standard output." | ||
| 47 | :type 'string | ||
| 48 | :group 'binhex) | ||
| 49 | |||
| 50 | (defcustom binhex-decoder-switches '("-d") | ||
| 51 | "*List of command line flags passed to the command `binhex-decoder-program'." | ||
| 52 | :group 'binhex | ||
| 53 | :type '(repeat string)) | ||
| 54 | |||
| 55 | (defcustom binhex-use-external | ||
| 56 | (executable-find binhex-decoder-program) | ||
| 57 | "*Use external binhex program." | ||
| 58 | :version "22.1" | ||
| 59 | :group 'binhex | ||
| 60 | :type 'boolean) | ||
| 61 | |||
| 62 | (defconst binhex-alphabet-decoding-alist | ||
| 63 | '(( ?\! . 0) ( ?\" . 1) ( ?\# . 2) ( ?\$ . 3) ( ?\% . 4) ( ?\& . 5) | ||
| 64 | ( ?\' . 6) ( ?\( . 7) ( ?\) . 8) ( ?\* . 9) ( ?\+ . 10) ( ?\, . 11) | ||
| 65 | ( ?\- . 12) ( ?0 . 13) ( ?1 . 14) ( ?2 . 15) ( ?3 . 16) ( ?4 . 17) | ||
| 66 | ( ?5 . 18) ( ?6 . 19) ( ?8 . 20) ( ?9 . 21) ( ?@ . 22) ( ?A . 23) | ||
| 67 | ( ?B . 24) ( ?C . 25) ( ?D . 26) ( ?E . 27) ( ?F . 28) ( ?G . 29) | ||
| 68 | ( ?H . 30) ( ?I . 31) ( ?J . 32) ( ?K . 33) ( ?L . 34) ( ?M . 35) | ||
| 69 | ( ?N . 36) ( ?P . 37) ( ?Q . 38) ( ?R . 39) ( ?S . 40) ( ?T . 41) | ||
| 70 | ( ?U . 42) ( ?V . 43) ( ?X . 44) ( ?Y . 45) ( ?Z . 46) ( ?\[ . 47) | ||
| 71 | ( ?\` . 48) ( ?a . 49) ( ?b . 50) ( ?c . 51) ( ?d . 52) ( ?e . 53) | ||
| 72 | ( ?f . 54) ( ?h . 55) ( ?i . 56) ( ?j . 57) ( ?k . 58) ( ?l . 59) | ||
| 73 | ( ?m . 60) ( ?p . 61) ( ?q . 62) ( ?r . 63))) | ||
| 74 | |||
| 75 | (defun binhex-char-map (char) | ||
| 76 | (cdr (assq char binhex-alphabet-decoding-alist))) | ||
| 77 | |||
| 78 | ;;;###autoload | ||
| 79 | (defconst binhex-begin-line | ||
| 80 | "^:...............................................................$") | ||
| 81 | (defconst binhex-body-line | ||
| 82 | "^[^:]...............................................................$") | ||
| 83 | (defconst binhex-end-line ":$") | ||
| 84 | |||
| 85 | (defvar binhex-temporary-file-directory | ||
| 86 | (cond ((fboundp 'temp-directory) (temp-directory)) | ||
| 87 | ((boundp 'temporary-file-directory) temporary-file-directory) | ||
| 88 | ("/tmp/"))) | ||
| 89 | |||
| 90 | (eval-and-compile | ||
| 91 | (defalias 'binhex-insert-char | ||
| 92 | (if (featurep 'xemacs) | ||
| 93 | 'insert-char | ||
| 94 | (lambda (char &optional count ignored buffer) | ||
| 95 | "Insert COUNT copies of CHARACTER into BUFFER." | ||
| 96 | (if (or (null buffer) (eq buffer (current-buffer))) | ||
| 97 | (insert-char char count) | ||
| 98 | (with-current-buffer buffer | ||
| 99 | (insert-char char count))))))) | ||
| 100 | |||
| 101 | (defvar binhex-crc-table | ||
| 102 | [0 4129 8258 12387 16516 20645 24774 28903 | ||
| 103 | 33032 37161 41290 45419 49548 53677 57806 61935 | ||
| 104 | 4657 528 12915 8786 21173 17044 29431 25302 | ||
| 105 | 37689 33560 45947 41818 54205 50076 62463 58334 | ||
| 106 | 9314 13379 1056 5121 25830 29895 17572 21637 | ||
| 107 | 42346 46411 34088 38153 58862 62927 50604 54669 | ||
| 108 | 13907 9842 5649 1584 30423 26358 22165 18100 | ||
| 109 | 46939 42874 38681 34616 63455 59390 55197 51132 | ||
| 110 | 18628 22757 26758 30887 2112 6241 10242 14371 | ||
| 111 | 51660 55789 59790 63919 35144 39273 43274 47403 | ||
| 112 | 23285 19156 31415 27286 6769 2640 14899 10770 | ||
| 113 | 56317 52188 64447 60318 39801 35672 47931 43802 | ||
| 114 | 27814 31879 19684 23749 11298 15363 3168 7233 | ||
| 115 | 60846 64911 52716 56781 44330 48395 36200 40265 | ||
| 116 | 32407 28342 24277 20212 15891 11826 7761 3696 | ||
| 117 | 65439 61374 57309 53244 48923 44858 40793 36728 | ||
| 118 | 37256 33193 45514 41451 53516 49453 61774 57711 | ||
| 119 | 4224 161 12482 8419 20484 16421 28742 24679 | ||
| 120 | 33721 37784 41979 46042 49981 54044 58239 62302 | ||
| 121 | 689 4752 8947 13010 16949 21012 25207 29270 | ||
| 122 | 46570 42443 38312 34185 62830 58703 54572 50445 | ||
| 123 | 13538 9411 5280 1153 29798 25671 21540 17413 | ||
| 124 | 42971 47098 34713 38840 59231 63358 50973 55100 | ||
| 125 | 9939 14066 1681 5808 26199 30326 17941 22068 | ||
| 126 | 55628 51565 63758 59695 39368 35305 47498 43435 | ||
| 127 | 22596 18533 30726 26663 6336 2273 14466 10403 | ||
| 128 | 52093 56156 60223 64286 35833 39896 43963 48026 | ||
| 129 | 19061 23124 27191 31254 2801 6864 10931 14994 | ||
| 130 | 64814 60687 56684 52557 48554 44427 40424 36297 | ||
| 131 | 31782 27655 23652 19525 15522 11395 7392 3265 | ||
| 132 | 61215 65342 53085 57212 44955 49082 36825 40952 | ||
| 133 | 28183 32310 20053 24180 11923 16050 3793 7920]) | ||
| 134 | |||
| 135 | (defun binhex-update-crc (crc char &optional count) | ||
| 136 | (if (null count) (setq count 1)) | ||
| 137 | (while (> count 0) | ||
| 138 | (setq crc (logxor (logand (lsh crc 8) 65280) | ||
| 139 | (aref binhex-crc-table | ||
| 140 | (logxor (logand (lsh crc -8) 255) | ||
| 141 | char))) | ||
| 142 | count (1- count))) | ||
| 143 | crc) | ||
| 144 | |||
| 145 | (defun binhex-verify-crc (buffer start end) | ||
| 146 | (with-current-buffer buffer | ||
| 147 | (let ((pos start) (crc 0) (last (- end 2))) | ||
| 148 | (while (< pos last) | ||
| 149 | (setq crc (binhex-update-crc crc (char-after pos)) | ||
| 150 | pos (1+ pos))) | ||
| 151 | (if (= crc (binhex-string-big-endian (buffer-substring last end))) | ||
| 152 | nil | ||
| 153 | (error "CRC error"))))) | ||
| 154 | |||
| 155 | (defun binhex-string-big-endian (string) | ||
| 156 | (let ((ret 0) (i 0) (len (length string))) | ||
| 157 | (while (< i len) | ||
| 158 | (setq ret (+ (lsh ret 8) (binhex-char-int (aref string i))) | ||
| 159 | i (1+ i))) | ||
| 160 | ret)) | ||
| 161 | |||
| 162 | (defun binhex-string-little-endian (string) | ||
| 163 | (let ((ret 0) (i 0) (shift 0) (len (length string))) | ||
| 164 | (while (< i len) | ||
| 165 | (setq ret (+ ret (lsh (binhex-char-int (aref string i)) shift)) | ||
| 166 | i (1+ i) | ||
| 167 | shift (+ shift 8))) | ||
| 168 | ret)) | ||
| 169 | |||
| 170 | (defun binhex-header (buffer) | ||
| 171 | (with-current-buffer buffer | ||
| 172 | (let ((pos (point-min)) len) | ||
| 173 | (vector | ||
| 174 | (prog1 | ||
| 175 | (setq len (binhex-char-int (char-after pos))) | ||
| 176 | (setq pos (1+ pos))) | ||
| 177 | (buffer-substring pos (setq pos (+ pos len))) | ||
| 178 | (prog1 | ||
| 179 | (setq len (binhex-char-int (char-after pos))) | ||
| 180 | (setq pos (1+ pos))) | ||
| 181 | (buffer-substring pos (setq pos (+ pos 4))) | ||
| 182 | (buffer-substring pos (setq pos (+ pos 4))) | ||
| 183 | (binhex-string-big-endian | ||
| 184 | (buffer-substring pos (setq pos (+ pos 2)))) | ||
| 185 | (binhex-string-big-endian | ||
| 186 | (buffer-substring pos (setq pos (+ pos 4)))) | ||
| 187 | (binhex-string-big-endian | ||
| 188 | (buffer-substring pos (setq pos (+ pos 4)))))))) | ||
| 189 | |||
| 190 | (defvar binhex-last-char) | ||
| 191 | (defvar binhex-repeat) | ||
| 192 | |||
| 193 | (defun binhex-push-char (char &optional count ignored buffer) | ||
| 194 | (cond | ||
| 195 | (binhex-repeat | ||
| 196 | (if (eq char 0) | ||
| 197 | (binhex-insert-char (setq binhex-last-char 144) 1 | ||
| 198 | ignored buffer) | ||
| 199 | (binhex-insert-char binhex-last-char (- char 1) | ||
| 200 | ignored buffer) | ||
| 201 | (setq binhex-last-char nil)) | ||
| 202 | (setq binhex-repeat nil)) | ||
| 203 | ((= char 144) | ||
| 204 | (setq binhex-repeat t)) | ||
| 205 | (t | ||
| 206 | (binhex-insert-char (setq binhex-last-char char) 1 ignored buffer)))) | ||
| 207 | |||
| 208 | ;;;###autoload | ||
| 209 | (defun binhex-decode-region-internal (start end &optional header-only) | ||
| 210 | "Binhex decode region between START and END without using an external program. | ||
| 211 | If HEADER-ONLY is non-nil only decode header and return filename." | ||
| 212 | (interactive "r") | ||
| 213 | (let ((work-buffer nil) | ||
| 214 | (counter 0) | ||
| 215 | (bits 0) (tmp t) | ||
| 216 | (lim 0) inputpos | ||
| 217 | (non-data-chars " \t\n\r:") | ||
| 218 | file-name-length data-fork-start | ||
| 219 | header | ||
| 220 | binhex-last-char binhex-repeat) | ||
| 221 | (unwind-protect | ||
| 222 | (save-excursion | ||
| 223 | (goto-char start) | ||
| 224 | (when (re-search-forward binhex-begin-line end t) | ||
| 225 | (let (default-enable-multibyte-characters) | ||
| 226 | (setq work-buffer (generate-new-buffer " *binhex-work*"))) | ||
| 227 | (beginning-of-line) | ||
| 228 | (setq bits 0 counter 0) | ||
| 229 | (while tmp | ||
| 230 | (skip-chars-forward non-data-chars end) | ||
| 231 | (setq inputpos (point)) | ||
| 232 | (end-of-line) | ||
| 233 | (setq lim (point)) | ||
| 234 | (while (and (< inputpos lim) | ||
| 235 | (setq tmp (binhex-char-map (char-after inputpos)))) | ||
| 236 | (setq bits (+ bits tmp) | ||
| 237 | counter (1+ counter) | ||
| 238 | inputpos (1+ inputpos)) | ||
| 239 | (cond ((= counter 4) | ||
| 240 | (binhex-push-char (lsh bits -16) 1 nil work-buffer) | ||
| 241 | (binhex-push-char (logand (lsh bits -8) 255) 1 nil | ||
| 242 | work-buffer) | ||
| 243 | (binhex-push-char (logand bits 255) 1 nil | ||
| 244 | work-buffer) | ||
| 245 | (setq bits 0 counter 0)) | ||
| 246 | (t (setq bits (lsh bits 6))))) | ||
| 247 | (if (null file-name-length) | ||
| 248 | (with-current-buffer work-buffer | ||
| 249 | (setq file-name-length (char-after (point-min)) | ||
| 250 | data-fork-start (+ (point-min) | ||
| 251 | file-name-length 22)))) | ||
| 252 | (when (and (null header) | ||
| 253 | (with-current-buffer work-buffer | ||
| 254 | (>= (buffer-size) data-fork-start))) | ||
| 255 | (binhex-verify-crc work-buffer | ||
| 256 | (point-min) data-fork-start) | ||
| 257 | (setq header (binhex-header work-buffer)) | ||
| 258 | (when header-only (setq tmp nil counter 0))) | ||
| 259 | (setq tmp (and tmp (not (eq inputpos end))))) | ||
| 260 | (cond | ||
| 261 | ((= counter 3) | ||
| 262 | (binhex-push-char (logand (lsh bits -16) 255) 1 nil | ||
| 263 | work-buffer) | ||
| 264 | (binhex-push-char (logand (lsh bits -8) 255) 1 nil | ||
| 265 | work-buffer)) | ||
| 266 | ((= counter 2) | ||
| 267 | (binhex-push-char (logand (lsh bits -10) 255) 1 nil | ||
| 268 | work-buffer)))) | ||
| 269 | (if header-only nil | ||
| 270 | (binhex-verify-crc work-buffer | ||
| 271 | data-fork-start | ||
| 272 | (+ data-fork-start (aref header 6) 2)) | ||
| 273 | (or (markerp end) (setq end (set-marker (make-marker) end))) | ||
| 274 | (goto-char start) | ||
| 275 | (insert-buffer-substring work-buffer | ||
| 276 | data-fork-start (+ data-fork-start | ||
| 277 | (aref header 6))) | ||
| 278 | (delete-region (point) end))) | ||
| 279 | (and work-buffer (kill-buffer work-buffer))) | ||
| 280 | (if header (aref header 1)))) | ||
| 281 | |||
| 282 | ;;;###autoload | ||
| 283 | (defun binhex-decode-region-external (start end) | ||
| 284 | "Binhex decode region between START and END using external decoder." | ||
| 285 | (interactive "r") | ||
| 286 | (let ((cbuf (current-buffer)) firstline work-buffer status | ||
| 287 | (file-name (expand-file-name | ||
| 288 | (concat (binhex-decode-region-internal start end t) | ||
| 289 | ".data") | ||
| 290 | binhex-temporary-file-directory))) | ||
| 291 | (save-excursion | ||
| 292 | (goto-char start) | ||
| 293 | (when (re-search-forward binhex-begin-line nil t) | ||
| 294 | (let ((cdir default-directory) default-process-coding-system) | ||
| 295 | (unwind-protect | ||
| 296 | (progn | ||
| 297 | (set-buffer (setq work-buffer | ||
| 298 | (generate-new-buffer " *binhex-work*"))) | ||
| 299 | (buffer-disable-undo work-buffer) | ||
| 300 | (insert-buffer-substring cbuf firstline end) | ||
| 301 | (cd binhex-temporary-file-directory) | ||
| 302 | (apply 'call-process-region | ||
| 303 | (point-min) | ||
| 304 | (point-max) | ||
| 305 | binhex-decoder-program | ||
| 306 | nil | ||
| 307 | nil | ||
| 308 | nil | ||
| 309 | binhex-decoder-switches)) | ||
| 310 | (cd cdir) (set-buffer cbuf))) | ||
| 311 | (if (and file-name (file-exists-p file-name)) | ||
| 312 | (progn | ||
| 313 | (goto-char start) | ||
| 314 | (delete-region start end) | ||
| 315 | (let (format-alist) | ||
| 316 | (insert-file-contents-literally file-name))) | ||
| 317 | (error "Can not binhex"))) | ||
| 318 | (and work-buffer (kill-buffer work-buffer)) | ||
| 319 | (ignore-errors | ||
| 320 | (if file-name (delete-file file-name)))))) | ||
| 321 | |||
| 322 | ;;;###autoload | ||
| 323 | (defun binhex-decode-region (start end) | ||
| 324 | "Binhex decode region between START and END." | ||
| 325 | (interactive "r") | ||
| 326 | (if binhex-use-external | ||
| 327 | (binhex-decode-region-external start end) | ||
| 328 | (binhex-decode-region-internal start end))) | ||
| 329 | |||
| 330 | (provide 'binhex) | ||
| 331 | |||
| 332 | ;;; arch-tag: 8476badd-1e76-4f1d-a640-f9a38c72eed8 | ||
| 333 | ;;; binhex.el ends here | ||
diff --git a/lisp/mail/emacsbug.el b/lisp/mail/emacsbug.el index ce98a608665..14a0a8d4ef1 100644 --- a/lisp/mail/emacsbug.el +++ b/lisp/mail/emacsbug.el | |||
| @@ -229,6 +229,9 @@ Type SPC to scroll through this section and its subsections.")))) | |||
| 229 | (setq report-emacs-bug-orig-text (buffer-substring (point-min) (point)))) | 229 | (setq report-emacs-bug-orig-text (buffer-substring (point-min) (point)))) |
| 230 | (goto-char user-point))) | 230 | (goto-char user-point))) |
| 231 | 231 | ||
| 232 | (declare-function Info-menu "info" (menu-item &optional fork)) | ||
| 233 | (declare-function Info-goto-node "info" (nodename &optional fork)) | ||
| 234 | |||
| 232 | (defun report-emacs-bug-info () | 235 | (defun report-emacs-bug-info () |
| 233 | "Go to the Info node on reporting Emacs bugs." | 236 | "Go to the Info node on reporting Emacs bugs." |
| 234 | (interactive) | 237 | (interactive) |
diff --git a/lisp/mail/hashcash.el b/lisp/mail/hashcash.el new file mode 100644 index 00000000000..22005ce957e --- /dev/null +++ b/lisp/mail/hashcash.el | |||
| @@ -0,0 +1,375 @@ | |||
| 1 | ;;; hashcash.el --- Add hashcash payments to email | ||
| 2 | |||
| 3 | ;; Copyright (C) 2003, 2004, 2005, 2007 Free Software Foundation | ||
| 4 | |||
| 5 | ;; Written by: Paul Foley <mycroft@actrix.gen.nz> (1997-2002) | ||
| 6 | ;; Maintainer: Paul Foley <mycroft@actrix.gen.nz> | ||
| 7 | ;; Keywords: mail, hashcash | ||
| 8 | |||
| 9 | ;; This file is part of GNU Emacs. | ||
| 10 | |||
| 11 | ;; GNU Emacs is free software; you can redistribute it and/or modify | ||
| 12 | ;; it under the terms of the GNU General Public License as published by | ||
| 13 | ;; the Free Software Foundation; either version 3, or (at your option) | ||
| 14 | ;; any later version. | ||
| 15 | |||
| 16 | ;; GNU Emacs is distributed in the hope that it will be useful, | ||
| 17 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 18 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 19 | ;; GNU General Public License for more details. | ||
| 20 | |||
| 21 | ;; You should have received a copy of the GNU General Public License | ||
| 22 | ;; along with GNU Emacs; see the file COPYING. If not, write to the | ||
| 23 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
| 24 | ;; Boston, MA 02110-1301, USA. | ||
| 25 | |||
| 26 | ;;; Commentary: | ||
| 27 | |||
| 28 | ;; The hashcash binary is at http://www.hashcash.org/. | ||
| 29 | ;; | ||
| 30 | ;; Call mail-add-payment to add a hashcash payment to a mail message | ||
| 31 | ;; in the current buffer. | ||
| 32 | ;; | ||
| 33 | ;; Call mail-add-payment-async after writing the addresses but before | ||
| 34 | ;; writing the mail to start calculating the hashcash payment | ||
| 35 | ;; asynchronously. | ||
| 36 | ;; | ||
| 37 | ;; The easiest way to do this automatically for all outgoing mail | ||
| 38 | ;; is to set `message-generate-hashcash' to t. If you want more | ||
| 39 | ;; control, try the following hooks. | ||
| 40 | ;; | ||
| 41 | ;; To automatically add payments to all outgoing mail when sending: | ||
| 42 | ;; (add-hook 'message-send-hook 'mail-add-payment) | ||
| 43 | ;; | ||
| 44 | ;; To start calculations automatically when addresses are prefilled: | ||
| 45 | ;; (add-hook 'message-setup-hook 'mail-add-payment-async) | ||
| 46 | ;; | ||
| 47 | ;; To check whether calculations are done before sending: | ||
| 48 | ;; (add-hook 'message-send-hook 'hashcash-wait-or-cancel) | ||
| 49 | |||
| 50 | ;;; Code: | ||
| 51 | |||
| 52 | (defgroup hashcash nil | ||
| 53 | "Hashcash configuration." | ||
| 54 | :group 'mail) | ||
| 55 | |||
| 56 | (defcustom hashcash-default-payment 20 | ||
| 57 | "*The default number of bits to pay to unknown users. | ||
| 58 | If this is zero, no payment header will be generated. | ||
| 59 | See `hashcash-payment-alist'." | ||
| 60 | :type 'integer | ||
| 61 | :group 'hashcash) | ||
| 62 | |||
| 63 | (defcustom hashcash-payment-alist '() | ||
| 64 | "*An association list mapping email addresses to payment amounts. | ||
| 65 | Elements may consist of (ADDR AMOUNT) or (ADDR STRING AMOUNT), where | ||
| 66 | ADDR is the email address of the intended recipient and AMOUNT is | ||
| 67 | the value of hashcash payment to be made to that user. STRING, if | ||
| 68 | present, is the string to be hashed; if not present ADDR will be used." | ||
| 69 | :type '(repeat (choice (list :tag "Normal" | ||
| 70 | (string :name "Address") | ||
| 71 | (integer :name "Amount")) | ||
| 72 | (list :tag "Replace hash input" | ||
| 73 | (string :name "Address") | ||
| 74 | (string :name "Hash input") | ||
| 75 | (integer :name "Amount")))) | ||
| 76 | :group 'hashcash) | ||
| 77 | |||
| 78 | (defcustom hashcash-default-accept-payment 20 | ||
| 79 | "*The default minimum number of bits to accept on incoming payments." | ||
| 80 | :type 'integer | ||
| 81 | :group 'hashcash) | ||
| 82 | |||
| 83 | (defcustom hashcash-accept-resources `((,user-mail-address nil)) | ||
| 84 | "*An association list mapping hashcash resources to payment amounts. | ||
| 85 | Resources named here are to be accepted in incoming payments. If the | ||
| 86 | corresponding AMOUNT is NIL, the value of `hashcash-default-accept-payment' | ||
| 87 | is used instead." | ||
| 88 | :group 'hashcash) | ||
| 89 | |||
| 90 | (defcustom hashcash-path (executable-find "hashcash") | ||
| 91 | "*The path to the hashcash binary." | ||
| 92 | :group 'hashcash) | ||
| 93 | |||
| 94 | (defcustom hashcash-extra-generate-parameters nil | ||
| 95 | "*A list of parameter strings passed to `hashcash-path' when minting. | ||
| 96 | For example, you may want to set this to '(\"-Z2\") to reduce header length." | ||
| 97 | :type '(repeat string) | ||
| 98 | :group 'hashcash) | ||
| 99 | |||
| 100 | (defcustom hashcash-double-spend-database "hashcash.db" | ||
| 101 | "*The path to the double-spending database." | ||
| 102 | :group 'hashcash) | ||
| 103 | |||
| 104 | (defcustom hashcash-in-news nil | ||
| 105 | "*Specifies whether or not hashcash payments should be made to newsgroups." | ||
| 106 | :type 'boolean | ||
| 107 | :group 'hashcash) | ||
| 108 | |||
| 109 | (defvar hashcash-process-alist nil | ||
| 110 | "Alist of asynchronous hashcash processes and buffers.") | ||
| 111 | |||
| 112 | (require 'mail-utils) | ||
| 113 | |||
| 114 | (eval-and-compile | ||
| 115 | (if (fboundp 'point-at-bol) | ||
| 116 | (defalias 'hashcash-point-at-bol 'point-at-bol) | ||
| 117 | (defalias 'hashcash-point-at-bol 'line-beginning-position)) | ||
| 118 | |||
| 119 | (if (fboundp 'point-at-eol) | ||
| 120 | (defalias 'hashcash-point-at-eol 'point-at-eol) | ||
| 121 | (defalias 'hashcash-point-at-eol 'line-end-position))) | ||
| 122 | |||
| 123 | (defun hashcash-strip-quoted-names (addr) | ||
| 124 | (setq addr (mail-strip-quoted-names addr)) | ||
| 125 | (if (and addr (string-match "\\`\\([^+@]+\\)\\+[^@]*\\(@.+\\)" addr)) | ||
| 126 | (concat (match-string 1 addr) (match-string 2 addr)) | ||
| 127 | addr)) | ||
| 128 | |||
| 129 | (declare-function message-narrow-to-headers-or-head "message" ()) | ||
| 130 | (declare-function message-fetch-field "message" (header &optional not-all)) | ||
| 131 | (declare-function message-goto-eoh "message" ()) | ||
| 132 | (declare-function message-narrow-to-headers "message" ()) | ||
| 133 | |||
| 134 | (defun hashcash-token-substring () | ||
| 135 | (save-excursion | ||
| 136 | (let ((token "")) | ||
| 137 | (loop | ||
| 138 | (setq token | ||
| 139 | (concat token (buffer-substring (point) (hashcash-point-at-eol)))) | ||
| 140 | (goto-char (hashcash-point-at-eol)) | ||
| 141 | (forward-char 1) | ||
| 142 | (unless (looking-at "[ \t]") (return token)) | ||
| 143 | (while (looking-at "[ \t]") (forward-char 1)))))) | ||
| 144 | |||
| 145 | (defun hashcash-payment-required (addr) | ||
| 146 | "Return the hashcash payment value required for the given address." | ||
| 147 | (let ((val (assoc addr hashcash-payment-alist))) | ||
| 148 | (or (nth 2 val) (nth 1 val) hashcash-default-payment))) | ||
| 149 | |||
| 150 | (defun hashcash-payment-to (addr) | ||
| 151 | "Return the string with which hashcash payments should collide." | ||
| 152 | (let ((val (assoc addr hashcash-payment-alist))) | ||
| 153 | (or (nth 1 val) (nth 0 val) addr))) | ||
| 154 | |||
| 155 | (defun hashcash-generate-payment (str val) | ||
| 156 | "Generate a hashcash payment by finding a VAL-bit collison on STR." | ||
| 157 | (if (and (> val 0) | ||
| 158 | hashcash-path) | ||
| 159 | (save-excursion | ||
| 160 | (set-buffer (get-buffer-create " *hashcash*")) | ||
| 161 | (erase-buffer) | ||
| 162 | (apply 'call-process hashcash-path nil t nil | ||
| 163 | "-m" "-q" "-b" (number-to-string val) str | ||
| 164 | hashcash-extra-generate-parameters) | ||
| 165 | (goto-char (point-min)) | ||
| 166 | (hashcash-token-substring)) | ||
| 167 | (error "No `hashcash' binary found"))) | ||
| 168 | |||
| 169 | (defun hashcash-generate-payment-async (str val callback) | ||
| 170 | "Generate a hashcash payment by finding a VAL-bit collison on STR. | ||
| 171 | Return immediately. Call CALLBACK with process and result when ready." | ||
| 172 | (if (and (> val 0) | ||
| 173 | hashcash-path) | ||
| 174 | (let ((process (apply 'start-process "hashcash" nil | ||
| 175 | hashcash-path "-m" "-q" | ||
| 176 | "-b" (number-to-string val) str | ||
| 177 | hashcash-extra-generate-parameters))) | ||
| 178 | (setq hashcash-process-alist (cons | ||
| 179 | (cons process (current-buffer)) | ||
| 180 | hashcash-process-alist)) | ||
| 181 | (set-process-filter process `(lambda (process output) | ||
| 182 | (funcall ,callback process output)))) | ||
| 183 | (funcall callback nil nil))) | ||
| 184 | |||
| 185 | (defun hashcash-check-payment (token str val) | ||
| 186 | "Check the validity of a hashcash payment." | ||
| 187 | (if hashcash-path | ||
| 188 | (zerop (call-process hashcash-path nil nil nil "-c" | ||
| 189 | "-d" "-f" hashcash-double-spend-database | ||
| 190 | "-b" (number-to-string val) | ||
| 191 | "-r" str | ||
| 192 | token)) | ||
| 193 | (progn | ||
| 194 | (message "No hashcash binary found") | ||
| 195 | (sleep-for 1) | ||
| 196 | nil))) | ||
| 197 | |||
| 198 | (defun hashcash-version (token) | ||
| 199 | "Find the format version of a hashcash token." | ||
| 200 | ;; Version 1.2 looks like n:yymmdd:rrrrr:xxxxxxxxxxxxxxxx | ||
| 201 | ;; This carries its own version number embedded in the token, | ||
| 202 | ;; so no further format number changes should be necessary | ||
| 203 | ;; in the X-Payment header. | ||
| 204 | ;; | ||
| 205 | ;; Version 1.1 looks like yymmdd:rrrrr:xxxxxxxxxxxxxxxx | ||
| 206 | ;; You need to upgrade your hashcash binary. | ||
| 207 | ;; | ||
| 208 | ;; Version 1.0 looked like nnnnnrrrrrxxxxxxxxxxxxxxxx | ||
| 209 | ;; This is no longer supported. | ||
| 210 | (cond ((equal (aref token 1) ?:) 1.2) | ||
| 211 | ((equal (aref token 6) ?:) 1.1) | ||
| 212 | (t (error "Unknown hashcash format version")))) | ||
| 213 | |||
| 214 | (defun hashcash-already-paid-p (recipient) | ||
| 215 | "Check for hashcash token to RECIPIENT in current buffer." | ||
| 216 | (save-excursion | ||
| 217 | (save-restriction | ||
| 218 | (message-narrow-to-headers-or-head) | ||
| 219 | (let ((token (message-fetch-field "x-hashcash")) | ||
| 220 | (case-fold-search t)) | ||
| 221 | (and (stringp token) | ||
| 222 | (string-match (regexp-quote recipient) token)))))) | ||
| 223 | |||
| 224 | ;;;###autoload | ||
| 225 | (defun hashcash-insert-payment (arg) | ||
| 226 | "Insert X-Payment and X-Hashcash headers with a payment for ARG" | ||
| 227 | (interactive "sPay to: ") | ||
| 228 | (unless (hashcash-already-paid-p arg) | ||
| 229 | (let ((pay (hashcash-generate-payment (hashcash-payment-to arg) | ||
| 230 | (hashcash-payment-required arg)))) | ||
| 231 | (when pay | ||
| 232 | (insert-before-markers "X-Hashcash: " pay "\n"))))) | ||
| 233 | |||
| 234 | ;;;###autoload | ||
| 235 | (defun hashcash-insert-payment-async (arg) | ||
| 236 | "Insert X-Payment and X-Hashcash headers with a payment for ARG | ||
| 237 | Only start calculation. Results are inserted when ready." | ||
| 238 | (interactive "sPay to: ") | ||
| 239 | (unless (hashcash-already-paid-p arg) | ||
| 240 | (hashcash-generate-payment-async | ||
| 241 | (hashcash-payment-to arg) | ||
| 242 | (hashcash-payment-required arg) | ||
| 243 | `(lambda (process payment) | ||
| 244 | (hashcash-insert-payment-async-2 ,(current-buffer) process payment))))) | ||
| 245 | |||
| 246 | (defun hashcash-insert-payment-async-2 (buffer process pay) | ||
| 247 | (when (buffer-live-p buffer) | ||
| 248 | (with-current-buffer buffer | ||
| 249 | (save-excursion | ||
| 250 | (save-restriction | ||
| 251 | (setq hashcash-process-alist (delq | ||
| 252 | (assq process hashcash-process-alist) | ||
| 253 | hashcash-process-alist)) | ||
| 254 | (message-goto-eoh) | ||
| 255 | (when pay | ||
| 256 | (insert-before-markers "X-Hashcash: " pay))))))) | ||
| 257 | |||
| 258 | (defun hashcash-cancel-async (&optional buffer) | ||
| 259 | "Delete any hashcash processes associated with BUFFER. | ||
| 260 | BUFFER defaults to the current buffer." | ||
| 261 | (interactive) | ||
| 262 | (unless buffer (setq buffer (current-buffer))) | ||
| 263 | (let (entry) | ||
| 264 | (while (setq entry (rassq buffer hashcash-process-alist)) | ||
| 265 | (delete-process (car entry)) | ||
| 266 | (setq hashcash-process-alist | ||
| 267 | (delq entry hashcash-process-alist))))) | ||
| 268 | |||
| 269 | (defun hashcash-wait-async (&optional buffer) | ||
| 270 | "Wait for asynchronous hashcash processes in BUFFER to finish. | ||
| 271 | BUFFER defaults to the current buffer." | ||
| 272 | (interactive) | ||
| 273 | (unless buffer (setq buffer (current-buffer))) | ||
| 274 | (let (entry) | ||
| 275 | (while (setq entry (rassq buffer hashcash-process-alist)) | ||
| 276 | (accept-process-output (car entry))))) | ||
| 277 | |||
| 278 | (defun hashcash-processes-running-p (buffer) | ||
| 279 | "Return non-nil if hashcash processes in BUFFER are still running." | ||
| 280 | (rassq buffer hashcash-process-alist)) | ||
| 281 | |||
| 282 | (defun hashcash-wait-or-cancel () | ||
| 283 | "Ask user whether to wait for hashcash processes to finish." | ||
| 284 | (interactive) | ||
| 285 | (when (hashcash-processes-running-p (current-buffer)) | ||
| 286 | (if (y-or-n-p | ||
| 287 | "Hashcash process(es) still running; wait for them to finish? ") | ||
| 288 | (hashcash-wait-async) | ||
| 289 | (hashcash-cancel-async)))) | ||
| 290 | |||
| 291 | ;;;###autoload | ||
| 292 | (defun hashcash-verify-payment (token &optional resource amount) | ||
| 293 | "Verify a hashcash payment" | ||
| 294 | (let* ((split (split-string token ":")) | ||
| 295 | (key (if (< (hashcash-version token) 1.2) | ||
| 296 | (nth 1 split) | ||
| 297 | (case (string-to-number (nth 0 split)) | ||
| 298 | (0 (nth 2 split)) | ||
| 299 | (1 (nth 3 split)))))) | ||
| 300 | (cond ((null resource) | ||
| 301 | (let ((elt (assoc key hashcash-accept-resources))) | ||
| 302 | (and elt (hashcash-check-payment token (car elt) | ||
| 303 | (or (cadr elt) hashcash-default-accept-payment))))) | ||
| 304 | ((equal token key) | ||
| 305 | (hashcash-check-payment token resource | ||
| 306 | (or amount hashcash-default-accept-payment))) | ||
| 307 | (t nil)))) | ||
| 308 | |||
| 309 | ;;;###autoload | ||
| 310 | (defun mail-add-payment (&optional arg async) | ||
| 311 | "Add X-Payment: and X-Hashcash: headers with a hashcash payment | ||
| 312 | for each recipient address. Prefix arg sets default payment temporarily. | ||
| 313 | Set ASYNC to t to start asynchronous calculation. (See | ||
| 314 | `mail-add-payment-async')." | ||
| 315 | (interactive "P") | ||
| 316 | (let ((hashcash-default-payment (if arg (prefix-numeric-value arg) | ||
| 317 | hashcash-default-payment)) | ||
| 318 | (addrlist nil)) | ||
| 319 | (save-excursion | ||
| 320 | (save-restriction | ||
| 321 | (message-narrow-to-headers) | ||
| 322 | (let ((to (hashcash-strip-quoted-names (mail-fetch-field "To" nil t))) | ||
| 323 | (cc (hashcash-strip-quoted-names (mail-fetch-field "Cc" nil t))) | ||
| 324 | (ng (hashcash-strip-quoted-names (mail-fetch-field "Newsgroups" | ||
| 325 | nil t)))) | ||
| 326 | (when to | ||
| 327 | (setq addrlist (split-string to ",[ \t\n]*"))) | ||
| 328 | (when cc | ||
| 329 | (setq addrlist (nconc addrlist (split-string cc ",[ \t\n]*")))) | ||
| 330 | (when (and hashcash-in-news ng) | ||
| 331 | (setq addrlist (nconc addrlist (split-string ng ",[ \t\n]*"))))) | ||
| 332 | (when addrlist | ||
| 333 | (mapc (if async | ||
| 334 | #'hashcash-insert-payment-async | ||
| 335 | #'hashcash-insert-payment) | ||
| 336 | addrlist))))) | ||
| 337 | t) | ||
| 338 | |||
| 339 | ;;;###autoload | ||
| 340 | (defun mail-add-payment-async (&optional arg) | ||
| 341 | "Add X-Payment: and X-Hashcash: headers with a hashcash payment | ||
| 342 | for each recipient address. Prefix arg sets default payment temporarily. | ||
| 343 | Calculation is asynchronous." | ||
| 344 | (interactive "P") | ||
| 345 | (mail-add-payment arg t)) | ||
| 346 | |||
| 347 | ;;;###autoload | ||
| 348 | (defun mail-check-payment (&optional arg) | ||
| 349 | "Look for a valid X-Payment: or X-Hashcash: header. | ||
| 350 | Prefix arg sets default accept amount temporarily." | ||
| 351 | (interactive "P") | ||
| 352 | (let ((hashcash-default-accept-payment (if arg (prefix-numeric-value arg) | ||
| 353 | hashcash-default-accept-payment)) | ||
| 354 | (version (hashcash-version (hashcash-generate-payment "x" 1)))) | ||
| 355 | (save-excursion | ||
| 356 | (goto-char (point-min)) | ||
| 357 | (search-forward "\n\n") | ||
| 358 | (beginning-of-line) | ||
| 359 | (let ((end (point)) | ||
| 360 | (ok nil)) | ||
| 361 | (goto-char (point-min)) | ||
| 362 | (while (and (not ok) (search-forward "X-Payment: hashcash " end t)) | ||
| 363 | (let ((value (split-string (hashcash-token-substring) " "))) | ||
| 364 | (when (equal (car value) (number-to-string version)) | ||
| 365 | (setq ok (hashcash-verify-payment (cadr value)))))) | ||
| 366 | (goto-char (point-min)) | ||
| 367 | (while (and (not ok) (search-forward "X-Hashcash: " end t)) | ||
| 368 | (setq ok (hashcash-verify-payment (hashcash-token-substring)))) | ||
| 369 | (when ok | ||
| 370 | (message "Payment valid")) | ||
| 371 | ok)))) | ||
| 372 | |||
| 373 | (provide 'hashcash) | ||
| 374 | |||
| 375 | ;;; arch-tag: 0e7fe983-a124-4392-9788-0dbcbd2c4d62 | ||
diff --git a/lisp/mail/mail-extr.el b/lisp/mail/mail-extr.el index 209b1deacf8..9ef5a02bd26 100644 --- a/lisp/mail/mail-extr.el +++ b/lisp/mail/mail-extr.el | |||
| @@ -1854,7 +1854,7 @@ place. It affects how `mail-extract-address-components' works." | |||
| 1854 | ;; http://www.iso.org/iso/en/prods-services/iso3166ma/02iso-3166-code-lists/list-en1-semic.txt | 1854 | ;; http://www.iso.org/iso/en/prods-services/iso3166ma/02iso-3166-code-lists/list-en1-semic.txt |
| 1855 | ;; http://www.iana.org/domain-names.htm | 1855 | ;; http://www.iana.org/domain-names.htm |
| 1856 | ;; http://www.iana.org/cctld/cctld-whois.htm | 1856 | ;; http://www.iana.org/cctld/cctld-whois.htm |
| 1857 | ;; Latest change: Mon Jul 8 14:21:59 CEST 2002 | 1857 | ;; Latest change: 2007/11/15 |
| 1858 | 1858 | ||
| 1859 | (defconst mail-extr-all-top-level-domains | 1859 | (defconst mail-extr-all-top-level-domains |
| 1860 | (let ((ob (make-vector 739 0))) | 1860 | (let ((ob (make-vector 739 0))) |
| @@ -1867,6 +1867,7 @@ place. It affects how `mail-extract-address-components' works." | |||
| 1867 | (nth 1 x)))) | 1867 | (nth 1 x)))) |
| 1868 | '( | 1868 | '( |
| 1869 | ;; ISO 3166 codes: | 1869 | ;; ISO 3166 codes: |
| 1870 | ("ac" "Ascension Island") | ||
| 1870 | ("ad" "Andorra") | 1871 | ("ad" "Andorra") |
| 1871 | ("ae" "United Arab Emirates") | 1872 | ("ae" "United Arab Emirates") |
| 1872 | ("af" "Afghanistan") | 1873 | ("af" "Afghanistan") |
| @@ -1882,6 +1883,7 @@ place. It affects how `mail-extract-address-components' works." | |||
| 1882 | ("at" "Austria" "The Republic of %s") | 1883 | ("at" "Austria" "The Republic of %s") |
| 1883 | ("au" "Australia") | 1884 | ("au" "Australia") |
| 1884 | ("aw" "Aruba") | 1885 | ("aw" "Aruba") |
| 1886 | ("ax" "Aland Islands") | ||
| 1885 | ("az" "Azerbaijan") | 1887 | ("az" "Azerbaijan") |
| 1886 | ("ba" "Bosnia-Herzegovina") | 1888 | ("ba" "Bosnia-Herzegovina") |
| 1887 | ("bb" "Barbados") | 1889 | ("bb" "Barbados") |
| @@ -1892,6 +1894,7 @@ place. It affects how `mail-extract-address-components' works." | |||
| 1892 | ("bh" "Bahrain") | 1894 | ("bh" "Bahrain") |
| 1893 | ("bi" "Burundi") | 1895 | ("bi" "Burundi") |
| 1894 | ("bj" "Benin") | 1896 | ("bj" "Benin") |
| 1897 | ("bl" "Saint Barthelemy") | ||
| 1895 | ("bm" "Bermuda") | 1898 | ("bm" "Bermuda") |
| 1896 | ("bn" "Brunei Darussalam") | 1899 | ("bn" "Brunei Darussalam") |
| 1897 | ("bo" "Bolivia" "Republic of %s") | 1900 | ("bo" "Bolivia" "Republic of %s") |
| @@ -1933,6 +1936,7 @@ place. It affects how `mail-extract-address-components' works." | |||
| 1933 | ("er" "Eritrea") | 1936 | ("er" "Eritrea") |
| 1934 | ("es" "Spain" "The Kingdom of %s") | 1937 | ("es" "Spain" "The Kingdom of %s") |
| 1935 | ("et" "Ethiopia") | 1938 | ("et" "Ethiopia") |
| 1939 | ("eu" "European Union") | ||
| 1936 | ("fi" "Finland" "The Republic of %s") | 1940 | ("fi" "Finland" "The Republic of %s") |
| 1937 | ("fj" "Fiji") | 1941 | ("fj" "Fiji") |
| 1938 | ("fk" "Falkland Islands (Malvinas)") | 1942 | ("fk" "Falkland Islands (Malvinas)") |
| @@ -1944,6 +1948,7 @@ place. It affects how `mail-extract-address-components' works." | |||
| 1944 | ("gd" "Grenada") | 1948 | ("gd" "Grenada") |
| 1945 | ("ge" "Georgia") | 1949 | ("ge" "Georgia") |
| 1946 | ("gf" "French Guiana") | 1950 | ("gf" "French Guiana") |
| 1951 | ("gg" "Guernsey") | ||
| 1947 | ("gh" "Ghana") | 1952 | ("gh" "Ghana") |
| 1948 | ("gi" "Gibraltar") | 1953 | ("gi" "Gibraltar") |
| 1949 | ("gl" "Greenland") | 1954 | ("gl" "Greenland") |
| @@ -1973,6 +1978,7 @@ place. It affects how `mail-extract-address-components' works." | |||
| 1973 | ("ir" "Iran" "Islamic Republic of %s") | 1978 | ("ir" "Iran" "Islamic Republic of %s") |
| 1974 | ("is" "Iceland" "The Republic of %s") | 1979 | ("is" "Iceland" "The Republic of %s") |
| 1975 | ("it" "Italy" "The Italian Republic") | 1980 | ("it" "Italy" "The Italian Republic") |
| 1981 | ("je" "Jersey") | ||
| 1976 | ("jm" "Jamaica") | 1982 | ("jm" "Jamaica") |
| 1977 | ("jo" "Jordan") | 1983 | ("jo" "Jordan") |
| 1978 | ("jp" "Japan") | 1984 | ("jp" "Japan") |
| @@ -2001,6 +2007,8 @@ place. It affects how `mail-extract-address-components' works." | |||
| 2001 | ("ma" "Morocco") | 2007 | ("ma" "Morocco") |
| 2002 | ("mc" "Monaco") | 2008 | ("mc" "Monaco") |
| 2003 | ("md" "Moldova" "The Republic of %s") | 2009 | ("md" "Moldova" "The Republic of %s") |
| 2010 | ("me" "Montenegro") | ||
| 2011 | ("mf" "Saint Martin (French part)") | ||
| 2004 | ("mg" "Madagascar") | 2012 | ("mg" "Madagascar") |
| 2005 | ("mh" "Marshall Islands") | 2013 | ("mh" "Marshall Islands") |
| 2006 | ("mk" "Macedonia" "The Former Yugoslav Republic of %s") | 2014 | ("mk" "Macedonia" "The Former Yugoslav Republic of %s") |
| @@ -2049,6 +2057,7 @@ place. It affects how `mail-extract-address-components' works." | |||
| 2049 | ("qa" "Qatar") | 2057 | ("qa" "Qatar") |
| 2050 | ("re" "Reunion (Fr.)") ; In .fr domain | 2058 | ("re" "Reunion (Fr.)") ; In .fr domain |
| 2051 | ("ro" "Romania") | 2059 | ("ro" "Romania") |
| 2060 | ("rs" "Serbia") | ||
| 2052 | ("ru" "Russia" "Russian Federation") | 2061 | ("ru" "Russia" "Russian Federation") |
| 2053 | ("rw" "Rwanda") | 2062 | ("rw" "Rwanda") |
| 2054 | ("sa" "Saudi Arabia") | 2063 | ("sa" "Saudi Arabia") |
| @@ -2112,15 +2121,21 @@ place. It affects how `mail-extract-address-components' works." | |||
| 2112 | ("zw" "Zimbabwe" "Republic of %s") | 2121 | ("zw" "Zimbabwe" "Republic of %s") |
| 2113 | ;; Generic Domains: | 2122 | ;; Generic Domains: |
| 2114 | ("aero" t "Air Transport Industry") | 2123 | ("aero" t "Air Transport Industry") |
| 2124 | ("asia" t "Pan-Asia and Asia Pacific community") | ||
| 2115 | ("biz" t "Businesses") | 2125 | ("biz" t "Businesses") |
| 2126 | ("cat" t "Catalan language and culture") | ||
| 2116 | ("com" t "Commercial") | 2127 | ("com" t "Commercial") |
| 2117 | ("coop" t "Cooperative Associations") | 2128 | ("coop" t "Cooperative Associations") |
| 2118 | ("info" t "Info") | 2129 | ("info" t "Info") |
| 2130 | ("jobs" t "Employment") | ||
| 2131 | ("mobi" t "Mobile products") | ||
| 2119 | ("museum" t "Museums") | 2132 | ("museum" t "Museums") |
| 2120 | ("name" t "Individuals") | 2133 | ("name" t "Individuals") |
| 2121 | ("net" t "Network") | 2134 | ("net" t "Network") |
| 2122 | ("org" t "Non-profit Organization") | 2135 | ("org" t "Non-profit Organization") |
| 2123 | ;;("pro" t "Credentialed professionals") | 2136 | ("pro" t "Credentialed professionals") |
| 2137 | ("tel" t "Contact data") | ||
| 2138 | ("travel" t "Travel industry") | ||
| 2124 | ;;("bitnet" t "Because It's Time NET") | 2139 | ;;("bitnet" t "Because It's Time NET") |
| 2125 | ("gov" t "United States Government") | 2140 | ("gov" t "United States Government") |
| 2126 | ("edu" t "Educational") | 2141 | ("edu" t "Educational") |
diff --git a/lisp/mail/mspools.el b/lisp/mail/mspools.el index 514bf4fe5f3..b248ba7dec1 100644 --- a/lisp/mail/mspools.el +++ b/lisp/mail/mspools.el | |||
| @@ -246,6 +246,11 @@ Buffer is not displayed if SHOW is non-nil." | |||
| 246 | (mspools-mode) | 246 | (mspools-mode) |
| 247 | ) | 247 | ) |
| 248 | 248 | ||
| 249 | (declare-function rmail-get-new-mail "rmail" (&optional file-name)) | ||
| 250 | |||
| 251 | ;; External. | ||
| 252 | (declare-function vm-visit-folder "ext:vm-startup" (folder &optional read-only)) | ||
| 253 | |||
| 249 | (defun mspools-visit-spool () | 254 | (defun mspools-visit-spool () |
| 250 | "Visit the folder on the current line of the *spools* buffer." | 255 | "Visit the folder on the current line of the *spools* buffer." |
| 251 | (interactive) | 256 | (interactive) |
diff --git a/lisp/mail/reporter.el b/lisp/mail/reporter.el index 596c7ee9627..24dd9ab0c35 100644 --- a/lisp/mail/reporter.el +++ b/lisp/mail/reporter.el | |||
| @@ -168,6 +168,9 @@ composed.") | |||
| 168 | (goto-char (1+ (nth 1 state))) | 168 | (goto-char (1+ (nth 1 state))) |
| 169 | (current-column))) | 169 | (current-column))) |
| 170 | 170 | ||
| 171 | (declare-function mail-position-on-field "sendmail" (field &optional soft)) | ||
| 172 | (declare-function mail-text "sendmail" ()) | ||
| 173 | |||
| 171 | (defun reporter-dump-variable (varsym mailbuf) | 174 | (defun reporter-dump-variable (varsym mailbuf) |
| 172 | "Pretty-print the value of the variable in symbol VARSYM. | 175 | "Pretty-print the value of the variable in symbol VARSYM. |
| 173 | MAILBUF is the mail buffer being composed." | 176 | MAILBUF is the mail buffer being composed." |
diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el index 4a7bd12ba42..5d276f9c76a 100644 --- a/lisp/mail/rmail.el +++ b/lisp/mail/rmail.el | |||
| @@ -184,6 +184,10 @@ please report it with \\[report-emacs-bug].") | |||
| 184 | :group 'rmail-retrieve | 184 | :group 'rmail-retrieve |
| 185 | :type '(repeat (directory))) | 185 | :type '(repeat (directory))) |
| 186 | 186 | ||
| 187 | (declare-function mail-position-on-field "sendmail" (field &optional soft)) | ||
| 188 | (declare-function mail-text-start "sendmail" ()) | ||
| 189 | (declare-function rmail-update-summary "rmailsum" (&rest ignore)) | ||
| 190 | |||
| 187 | (defun rmail-probe (prog) | 191 | (defun rmail-probe (prog) |
| 188 | "Determine what flavor of movemail PROG is. | 192 | "Determine what flavor of movemail PROG is. |
| 189 | We do this by executing it with `--version' and analyzing its output." | 193 | We do this by executing it with `--version' and analyzing its output." |
| @@ -1515,6 +1519,15 @@ original copy." | |||
| 1515 | 1519 | ||
| 1516 | ;;;; *** Rmail input *** | 1520 | ;;;; *** Rmail input *** |
| 1517 | 1521 | ||
| 1522 | (declare-function rmail-spam-filter "rmail-spam-filter" (msg)) | ||
| 1523 | (declare-function rmail-summary-goto-msg "rmailsum" (&optional n nowarn skip-rmail)) | ||
| 1524 | (declare-function rmail-summary-mark-undeleted "rmailsum" (n)) | ||
| 1525 | (declare-function rmail-summary-mark-deleted "rmailsum" (&optional n undel)) | ||
| 1526 | (declare-function rfc822-addresses "rfc822" (header-text)) | ||
| 1527 | (declare-function mail-abbrev-make-syntax-table "mailabbrev.el" ()) | ||
| 1528 | (declare-function mail-sendmail-delimit-header "sendmail" ()) | ||
| 1529 | (declare-function mail-header-end "sendmail" ()) | ||
| 1530 | |||
| 1518 | ;; RLK feature not added in this version: | 1531 | ;; RLK feature not added in this version: |
| 1519 | ;; argument specifies inbox file or files in various ways. | 1532 | ;; argument specifies inbox file or files in various ways. |
| 1520 | 1533 | ||
| @@ -3282,7 +3295,9 @@ and more whitespace. The returned regular expressions contains | |||
| 3282 | (setq subject (regexp-quote subject)) | 3295 | (setq subject (regexp-quote subject)) |
| 3283 | (setq subject | 3296 | (setq subject |
| 3284 | (replace-regexp-in-string "[ \t\n]+" "[ \t\n]+" subject t t)) | 3297 | (replace-regexp-in-string "[ \t\n]+" "[ \t\n]+" subject t t)) |
| 3285 | (concat "^Subject: " | 3298 | ;; Some mailers insert extra spaces after "Subject:", so allow any |
| 3299 | ;; amount of them. | ||
| 3300 | (concat "^Subject:[ \t]+" | ||
| 3286 | (if (string= "\\`" (substring rmail-reply-regexp 0 2)) | 3301 | (if (string= "\\`" (substring rmail-reply-regexp 0 2)) |
| 3287 | (substring rmail-reply-regexp 2) | 3302 | (substring rmail-reply-regexp 2) |
| 3288 | rmail-reply-regexp) | 3303 | rmail-reply-regexp) |
diff --git a/lisp/mail/rmailedit.el b/lisp/mail/rmailedit.el index 04982aec349..02bc23fe0c5 100644 --- a/lisp/mail/rmailedit.el +++ b/lisp/mail/rmailedit.el | |||
| @@ -49,6 +49,9 @@ | |||
| 49 | ;; Rmail Edit mode is suitable only for specially formatted data. | 49 | ;; Rmail Edit mode is suitable only for specially formatted data. |
| 50 | (put 'rmail-edit-mode 'mode-class 'special) | 50 | (put 'rmail-edit-mode 'mode-class 'special) |
| 51 | 51 | ||
| 52 | (declare-function rmail-summary-disable "" ()) | ||
| 53 | (declare-function rmail-summary-enable "rmailsum" ()) | ||
| 54 | |||
| 52 | (defun rmail-edit-mode () | 55 | (defun rmail-edit-mode () |
| 53 | "Major mode for editing the contents of an RMAIL message. | 56 | "Major mode for editing the contents of an RMAIL message. |
| 54 | The editing commands are the same as in Text mode, together with two commands | 57 | The editing commands are the same as in Text mode, together with two commands |
diff --git a/lisp/mail/rmailkwd.el b/lisp/mail/rmailkwd.el index c479e35beb7..48e2246520b 100644 --- a/lisp/mail/rmailkwd.el +++ b/lisp/mail/rmailkwd.el | |||
| @@ -86,6 +86,15 @@ Completion is performed over known labels when reading." | |||
| 86 | rmail-last-label | 86 | rmail-last-label |
| 87 | (setq rmail-last-label (rmail-make-label result t)))))) | 87 | (setq rmail-last-label (rmail-make-label result t)))))) |
| 88 | 88 | ||
| 89 | (declare-function rmail-maybe-set-message-counters "rmail" ()) | ||
| 90 | (declare-function rmail-display-labels "rmail" ()) | ||
| 91 | (declare-function rmail-msgbeg "rmail" (n)) | ||
| 92 | (declare-function rmail-set-message-deleted-p "rmail" (n state)) | ||
| 93 | (declare-function rmail-message-labels-p "rmail" (msg labels)) | ||
| 94 | (declare-function rmail-show-message "rmail" (&optional n no-summary)) | ||
| 95 | (declare-function mail-comma-list-regexp "mail-utils" (labels)) | ||
| 96 | (declare-function mail-parse-comma-list "mail-utils.el" ()) | ||
| 97 | |||
| 89 | (defun rmail-set-label (l state &optional n) | 98 | (defun rmail-set-label (l state &optional n) |
| 90 | (with-current-buffer rmail-buffer | 99 | (with-current-buffer rmail-buffer |
| 91 | (rmail-maybe-set-message-counters) | 100 | (rmail-maybe-set-message-counters) |
diff --git a/lisp/mail/rmailmsc.el b/lisp/mail/rmailmsc.el index 3b7ccd72d02..67cea297f0e 100644 --- a/lisp/mail/rmailmsc.el +++ b/lisp/mail/rmailmsc.el | |||
| @@ -30,6 +30,9 @@ | |||
| 30 | (defvar rmail-current-message) | 30 | (defvar rmail-current-message) |
| 31 | (defvar rmail-inbox-list) | 31 | (defvar rmail-inbox-list) |
| 32 | 32 | ||
| 33 | (declare-function rmail-parse-file-inboxes "rmail" ()) | ||
| 34 | (declare-function rmail-show-message "rmail" (&optional n no-summary)) | ||
| 35 | |||
| 33 | ;;;###autoload | 36 | ;;;###autoload |
| 34 | (defun set-rmail-inbox-list (file-name) | 37 | (defun set-rmail-inbox-list (file-name) |
| 35 | "Set the inbox list of the current RMAIL file to FILE-NAME. | 38 | "Set the inbox list of the current RMAIL file to FILE-NAME. |
diff --git a/lisp/mail/rmailout.el b/lisp/mail/rmailout.el index d85bfc0bfe8..1e9f8379b7b 100644 --- a/lisp/mail/rmailout.el +++ b/lisp/mail/rmailout.el | |||
| @@ -109,6 +109,8 @@ Set `rmail-default-file' to this name as well as returning it." | |||
| 109 | (or read-file (file-name-nondirectory default-file)) | 109 | (or read-file (file-name-nondirectory default-file)) |
| 110 | (file-name-directory default-file))))))) | 110 | (file-name-directory default-file))))))) |
| 111 | 111 | ||
| 112 | (declare-function rmail-update-summary "rmailsum" (&rest ignore)) | ||
| 113 | |||
| 112 | ;;; There are functions elsewhere in Emacs that use this function; | 114 | ;;; There are functions elsewhere in Emacs that use this function; |
| 113 | ;;; look at them before you change the calling method. | 115 | ;;; look at them before you change the calling method. |
| 114 | ;;;###autoload | 116 | ;;;###autoload |
diff --git a/lisp/mail/rmailsort.el b/lisp/mail/rmailsort.el index ba496a31228..bed40cd0820 100644 --- a/lisp/mail/rmailsort.el +++ b/lisp/mail/rmailsort.el | |||
| @@ -152,6 +152,7 @@ KEYWORDS is a comma-separated list of labels." | |||
| 152 | n)))))) | 152 | n)))))) |
| 153 | 153 | ||
| 154 | ;; Basic functions | 154 | ;; Basic functions |
| 155 | (declare-function rmail-update-summary "rmailsum" (&rest ignore)) | ||
| 155 | 156 | ||
| 156 | (defun rmail-sort-messages (reverse keyfun) | 157 | (defun rmail-sort-messages (reverse keyfun) |
| 157 | "Sort messages of current Rmail file. | 158 | "Sort messages of current Rmail file. |
diff --git a/lisp/mail/rmailsum.el b/lisp/mail/rmailsum.el index fd5931fdef9..cde289ed719 100644 --- a/lisp/mail/rmailsum.el +++ b/lisp/mail/rmailsum.el | |||
| @@ -1323,6 +1323,13 @@ argument says to read a file name and use that file as the inbox." | |||
| 1323 | (end-of-buffer)) | 1323 | (end-of-buffer)) |
| 1324 | (forward-line -1)) | 1324 | (forward-line -1)) |
| 1325 | 1325 | ||
| 1326 | (declare-function rmail-abort-edit "rmailedit" ()) | ||
| 1327 | (declare-function rmail-cease-edit "rmailedit"()) | ||
| 1328 | (declare-function rmail-set-label "rmailkwd" (l state &optional n)) | ||
| 1329 | (declare-function rmail-output-read-file-name "rmailout" ()) | ||
| 1330 | (declare-function rmail-output-read-rmail-file-name "rmailout" ()) | ||
| 1331 | (declare-function mail-send-and-exit "sendmail" (&optional arg)) | ||
| 1332 | |||
| 1326 | (defvar rmail-summary-edit-map nil) | 1333 | (defvar rmail-summary-edit-map nil) |
| 1327 | (if rmail-summary-edit-map | 1334 | (if rmail-summary-edit-map |
| 1328 | nil | 1335 | nil |
diff --git a/lisp/mail/sendmail.el b/lisp/mail/sendmail.el index e8d896be246..7d66b5e7ac6 100644 --- a/lisp/mail/sendmail.el +++ b/lisp/mail/sendmail.el | |||
| @@ -1744,6 +1744,9 @@ The seventh argument ACTIONS is a list of actions to take | |||
| 1744 | (message "Auto save file for draft message exists; consider M-x mail-recover")) | 1744 | (message "Auto save file for draft message exists; consider M-x mail-recover")) |
| 1745 | initialized)) | 1745 | initialized)) |
| 1746 | 1746 | ||
| 1747 | (declare-function dired-view-file "dired" ()) | ||
| 1748 | (declare-function dired-get-filename "dired" (&optional localp no-error-if-not-filep)) | ||
| 1749 | |||
| 1747 | (defun mail-recover-1 () | 1750 | (defun mail-recover-1 () |
| 1748 | "Pop up a list of auto-saved draft messages so you can recover one of them." | 1751 | "Pop up a list of auto-saved draft messages so you can recover one of them." |
| 1749 | (interactive) | 1752 | (interactive) |
| @@ -1815,6 +1818,10 @@ The seventh argument ACTIONS is a list of actions to take | |||
| 1815 | (setq buffer-file-coding-system | 1818 | (setq buffer-file-coding-system |
| 1816 | default-buffer-file-coding-system)))))))) | 1819 | default-buffer-file-coding-system)))))))) |
| 1817 | 1820 | ||
| 1821 | (declare-function dired-move-to-filename "dired" (&optional raise-error eol)) | ||
| 1822 | (declare-function dired-get-filename "dired" (&optional localp no-error-if-not-filep)) | ||
| 1823 | (declare-function dired-view-file "dired" ()) | ||
| 1824 | |||
| 1818 | (defun mail-recover () | 1825 | (defun mail-recover () |
| 1819 | "Recover interrupted mail composition from auto-save files. | 1826 | "Recover interrupted mail composition from auto-save files. |
| 1820 | 1827 | ||
diff --git a/lisp/mail/supercite.el b/lisp/mail/supercite.el index 61e7d0a00eb..c0e581c0310 100644 --- a/lisp/mail/supercite.el +++ b/lisp/mail/supercite.el | |||
| @@ -6,11 +6,8 @@ | |||
| 6 | ;; Author: 1993 Barry A. Warsaw <bwarsaw@python.org> | 6 | ;; Author: 1993 Barry A. Warsaw <bwarsaw@python.org> |
| 7 | ;; Maintainer: Glenn Morris <rgm@gnu.org> | 7 | ;; Maintainer: Glenn Morris <rgm@gnu.org> |
| 8 | ;; Created: February 1993 | 8 | ;; Created: February 1993 |
| 9 | ;; Last Modified: 1993/09/22 18:58:46 | ||
| 10 | ;; Keywords: mail, news | 9 | ;; Keywords: mail, news |
| 11 | 10 | ||
| 12 | ;; supercite.el revision: 3.54 | ||
| 13 | |||
| 14 | ;; This file is part of GNU Emacs. | 11 | ;; This file is part of GNU Emacs. |
| 15 | 12 | ||
| 16 | ;; GNU Emacs is free software; you can redistribute it and/or modify | 13 | ;; GNU Emacs is free software; you can redistribute it and/or modify |
| @@ -510,10 +507,7 @@ string." | |||
| 510 | ;; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | 507 | ;; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 511 | ;; end user configuration variables | 508 | ;; end user configuration variables |
| 512 | 509 | ||
| 513 | (defconst sc-version "3.1" | 510 | (define-obsolete-variable-alias 'sc-version 'emacs-version "23.1") |
| 514 | "Supercite version number.") | ||
| 515 | (defconst sc-help-address "bug-supercite@gnu.org" | ||
| 516 | "Address accepting submissions of bug reports.") | ||
| 517 | 511 | ||
| 518 | (defvar sc-mail-info nil | 512 | (defvar sc-mail-info nil |
| 519 | "Alist of mail header information gleaned from reply buffer.") | 513 | "Alist of mail header information gleaned from reply buffer.") |
| @@ -2010,7 +2004,7 @@ cited." | |||
| 2010 | If MESSAGE is non-nil (interactively, with no prefix argument), | 2004 | If MESSAGE is non-nil (interactively, with no prefix argument), |
| 2011 | inserts the version string in the current buffer instead." | 2005 | inserts the version string in the current buffer instead." |
| 2012 | (interactive (not current-prefix-arg)) | 2006 | (interactive (not current-prefix-arg)) |
| 2013 | (let ((verstr (format "Using Supercite.el %s" sc-version))) | 2007 | (let ((verstr (format "Using Supercite.el %s" emacs-version))) |
| 2014 | (if message | 2008 | (if message |
| 2015 | (message verstr) | 2009 | (message verstr) |
| 2016 | (insert "`sc-version' says: " verstr)))) | 2010 | (insert "`sc-version' says: " verstr)))) |
| @@ -2023,48 +2017,7 @@ more information. Info node `(SC)Top'." | |||
| 2023 | (interactive) | 2017 | (interactive) |
| 2024 | (describe-function 'sc-describe)) | 2018 | (describe-function 'sc-describe)) |
| 2025 | 2019 | ||
| 2026 | (defun sc-submit-bug-report () | 2020 | (define-obsolete-function-alias 'sc-submit-bug-report 'report-emacs-bug "23.1") |
| 2027 | "Submit a bug report on Supercite via mail." | ||
| 2028 | (interactive) | ||
| 2029 | (require 'reporter) | ||
| 2030 | (and | ||
| 2031 | (y-or-n-p "Do you want to submit a report on Supercite? ") | ||
| 2032 | (reporter-submit-bug-report | ||
| 2033 | sc-help-address | ||
| 2034 | (concat "Supercite version " sc-version) | ||
| 2035 | (list | ||
| 2036 | 'sc-attrib-selection-list | ||
| 2037 | 'sc-auto-fill-region-p | ||
| 2038 | 'sc-blank-lines-after-headers | ||
| 2039 | 'sc-citation-leader | ||
| 2040 | 'sc-citation-delimiter | ||
| 2041 | 'sc-citation-separator | ||
| 2042 | 'sc-citation-leader-regexp | ||
| 2043 | 'sc-citation-root-regexp | ||
| 2044 | 'sc-citation-nonnested-root-regexp | ||
| 2045 | 'sc-citation-delimiter-regexp | ||
| 2046 | 'sc-citation-separator-regexp | ||
| 2047 | 'sc-cite-region-limit | ||
| 2048 | 'sc-confirm-always-p | ||
| 2049 | 'sc-default-attribution | ||
| 2050 | 'sc-default-author-name | ||
| 2051 | 'sc-downcase-p | ||
| 2052 | 'sc-electric-circular-p | ||
| 2053 | 'sc-electric-references-p | ||
| 2054 | 'sc-fixup-whitespace-p | ||
| 2055 | 'sc-mail-warn-if-non-rfc822-p | ||
| 2056 | 'sc-mumble | ||
| 2057 | 'sc-name-filter-alist | ||
| 2058 | 'sc-nested-citation-p | ||
| 2059 | 'sc-nuke-mail-headers | ||
| 2060 | 'sc-nuke-mail-header-list | ||
| 2061 | 'sc-preferred-attribution-list | ||
| 2062 | 'sc-preferred-header-style | ||
| 2063 | 'sc-reference-tag-string | ||
| 2064 | 'sc-rewrite-header-list | ||
| 2065 | 'sc-titlecue-regexp | ||
| 2066 | 'sc-use-only-preference-p | ||
| 2067 | )))) | ||
| 2068 | 2021 | ||
| 2069 | 2022 | ||
| 2070 | ;; useful stuff | 2023 | ;; useful stuff |
diff --git a/lisp/mail/uce.el b/lisp/mail/uce.el index 61afd248332..5a4e01ae9fc 100644 --- a/lisp/mail/uce.el +++ b/lisp/mail/uce.el | |||
| @@ -217,6 +217,14 @@ These are mostly meant for headers that prevent delivery errors reporting." | |||
| 217 | :type 'string | 217 | :type 'string |
| 218 | :group 'uce) | 218 | :group 'uce) |
| 219 | 219 | ||
| 220 | (declare-function mail-strip-quoted-names "mail-utils" (address)) | ||
| 221 | (declare-function rmail-msg-is-pruned "rmail" ()) | ||
| 222 | (declare-function rmail-maybe-set-message-counters "rmail" ()) | ||
| 223 | (declare-function rmail-msgbeg "rmail" (n)) | ||
| 224 | (declare-function rmail-msgend "rmail" (n)) | ||
| 225 | (declare-function rmail-toggle-header "rmail" (&optional arg)) | ||
| 226 | |||
| 227 | |||
| 220 | (defun uce-reply-to-uce (&optional ignored) | 228 | (defun uce-reply-to-uce (&optional ignored) |
| 221 | "Send reply to UCE in Rmail. | 229 | "Send reply to UCE in Rmail. |
| 222 | UCE stands for unsolicited commercial email. Function will set up reply | 230 | UCE stands for unsolicited commercial email. Function will set up reply |
diff --git a/lisp/mail/undigest.el b/lisp/mail/undigest.el index 5d6f266b3b0..9bb2f3eab90 100644 --- a/lisp/mail/undigest.el +++ b/lisp/mail/undigest.el | |||
| @@ -153,6 +153,8 @@ See rmail-digest-methods." | |||
| 153 | ;; Return the list of marker pairs | 153 | ;; Return the list of marker pairs |
| 154 | (nreverse result)))) | 154 | (nreverse result)))) |
| 155 | 155 | ||
| 156 | (declare-function rmail-update-summary "rmailsum" (&rest ignore)) | ||
| 157 | |||
| 156 | ;;;###autoload | 158 | ;;;###autoload |
| 157 | (defun undigestify-rmail-message () | 159 | (defun undigestify-rmail-message () |
| 158 | "Break up a digest message into its constituent messages. | 160 | "Break up a digest message into its constituent messages. |
diff --git a/lisp/mail/unrmail.el b/lisp/mail/unrmail.el index f1cf85a4ffc..7ad1c69b50d 100644 --- a/lisp/mail/unrmail.el +++ b/lisp/mail/unrmail.el | |||
| @@ -48,6 +48,8 @@ For example, invoke `emacs -batch -f batch-unrmail RMAIL'." | |||
| 48 | (message "Done") | 48 | (message "Done") |
| 49 | (kill-emacs (if error 1 0)))) | 49 | (kill-emacs (if error 1 0)))) |
| 50 | 50 | ||
| 51 | (declare-function mail-strip-quoted-names "mail-utils" (address)) | ||
| 52 | |||
| 51 | ;;;###autoload | 53 | ;;;###autoload |
| 52 | (defun unrmail (file to-file) | 54 | (defun unrmail (file to-file) |
| 53 | "Convert Rmail file FILE to system inbox format file TO-FILE." | 55 | "Convert Rmail file FILE to system inbox format file TO-FILE." |
diff --git a/lisp/mail/uudecode.el b/lisp/mail/uudecode.el new file mode 100644 index 00000000000..9dc430e825d --- /dev/null +++ b/lisp/mail/uudecode.el | |||
| @@ -0,0 +1,242 @@ | |||
| 1 | ;;; uudecode.el -- elisp native uudecode | ||
| 2 | |||
| 3 | ;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, | ||
| 4 | ;; 2005, 2006, 2007 Free Software Foundation, Inc. | ||
| 5 | |||
| 6 | ;; Author: Shenghuo Zhu <zsh@cs.rochester.edu> | ||
| 7 | ;; Keywords: uudecode news | ||
| 8 | |||
| 9 | ;; This file is part of GNU Emacs. | ||
| 10 | |||
| 11 | ;; GNU Emacs is free software; you can redistribute it and/or modify | ||
| 12 | ;; it under the terms of the GNU General Public License as published by | ||
| 13 | ;; the Free Software Foundation; either version 3, or (at your option) | ||
| 14 | ;; any later version. | ||
| 15 | |||
| 16 | ;; GNU Emacs is distributed in the hope that it will be useful, | ||
| 17 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 18 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 19 | ;; GNU General Public License for more details. | ||
| 20 | |||
| 21 | ;; You should have received a copy of the GNU General Public License | ||
| 22 | ;; along with GNU Emacs; see the file COPYING. If not, write to the | ||
| 23 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
| 24 | ;; Boston, MA 02110-1301, USA. | ||
| 25 | |||
| 26 | ;;; Commentary: | ||
| 27 | |||
| 28 | ;;; Code: | ||
| 29 | |||
| 30 | (eval-when-compile (require 'cl)) | ||
| 31 | |||
| 32 | (eval-and-compile | ||
| 33 | (defalias 'uudecode-char-int | ||
| 34 | (if (fboundp 'char-int) | ||
| 35 | 'char-int | ||
| 36 | 'identity))) | ||
| 37 | |||
| 38 | (defgroup uudecode nil | ||
| 39 | "Decoding of uuencoded data." | ||
| 40 | :group 'mail | ||
| 41 | :group 'news) | ||
| 42 | |||
| 43 | (defcustom uudecode-decoder-program "uudecode" | ||
| 44 | "*Non-nil value should be a string that names a uu decoder. | ||
| 45 | The program should expect to read uu data on its standard | ||
| 46 | input and write the converted data to its standard output." | ||
| 47 | :type 'string | ||
| 48 | :group 'uudecode) | ||
| 49 | |||
| 50 | (defcustom uudecode-decoder-switches nil | ||
| 51 | "*List of command line flags passed to `uudecode-decoder-program'." | ||
| 52 | :group 'uudecode | ||
| 53 | :type '(repeat string)) | ||
| 54 | |||
| 55 | (defcustom uudecode-use-external | ||
| 56 | (executable-find uudecode-decoder-program) | ||
| 57 | "*Use external uudecode program." | ||
| 58 | :version "22.1" | ||
| 59 | :group 'uudecode | ||
| 60 | :type 'boolean) | ||
| 61 | |||
| 62 | (defconst uudecode-alphabet "\040-\140") | ||
| 63 | |||
| 64 | (defconst uudecode-begin-line "^begin[ \t]+[0-7][0-7][0-7][ \t]+\\(.*\\)$") | ||
| 65 | (defconst uudecode-end-line "^end[ \t]*$") | ||
| 66 | |||
| 67 | (defconst uudecode-body-line | ||
| 68 | (let ((i 61) (str "^M")) | ||
| 69 | (while (> (setq i (1- i)) 0) | ||
| 70 | (setq str (concat str "[^a-z]"))) | ||
| 71 | (concat str ".?$"))) | ||
| 72 | |||
| 73 | (defvar uudecode-temporary-file-directory | ||
| 74 | (cond ((fboundp 'temp-directory) (temp-directory)) | ||
| 75 | ((boundp 'temporary-file-directory) temporary-file-directory) | ||
| 76 | ("/tmp"))) | ||
| 77 | |||
| 78 | ;;;###autoload | ||
| 79 | (defun uudecode-decode-region-external (start end &optional file-name) | ||
| 80 | "Uudecode region between START and END using external program. | ||
| 81 | If FILE-NAME is non-nil, save the result to FILE-NAME. The program | ||
| 82 | used is specified by `uudecode-decoder-program'." | ||
| 83 | (interactive "r\nP") | ||
| 84 | (let ((cbuf (current-buffer)) tempfile firstline status) | ||
| 85 | (save-excursion | ||
| 86 | (goto-char start) | ||
| 87 | (when (re-search-forward uudecode-begin-line nil t) | ||
| 88 | (forward-line 1) | ||
| 89 | (setq firstline (point)) | ||
| 90 | (cond ((null file-name)) | ||
| 91 | ((stringp file-name)) | ||
| 92 | (t | ||
| 93 | (setq file-name (read-file-name "File to Name:" | ||
| 94 | nil nil nil | ||
| 95 | (match-string 1))))) | ||
| 96 | (setq tempfile (if file-name | ||
| 97 | (expand-file-name file-name) | ||
| 98 | (if (fboundp 'make-temp-file) | ||
| 99 | (let ((temporary-file-directory | ||
| 100 | uudecode-temporary-file-directory)) | ||
| 101 | (make-temp-file "uu")) | ||
| 102 | (expand-file-name | ||
| 103 | (make-temp-name "uu") | ||
| 104 | uudecode-temporary-file-directory)))) | ||
| 105 | (let ((cdir default-directory) | ||
| 106 | (default-process-coding-system | ||
| 107 | (if (featurep 'xemacs) | ||
| 108 | ;; In XEmacs, `nil' is not a valid coding system. | ||
| 109 | '(binary . binary) | ||
| 110 | nil))) | ||
| 111 | (unwind-protect | ||
| 112 | (with-temp-buffer | ||
| 113 | (insert "begin 600 " (file-name-nondirectory tempfile) "\n") | ||
| 114 | (insert-buffer-substring cbuf firstline end) | ||
| 115 | (cd (file-name-directory tempfile)) | ||
| 116 | (apply 'call-process-region | ||
| 117 | (point-min) | ||
| 118 | (point-max) | ||
| 119 | uudecode-decoder-program | ||
| 120 | nil | ||
| 121 | nil | ||
| 122 | nil | ||
| 123 | uudecode-decoder-switches)) | ||
| 124 | (cd cdir) (set-buffer cbuf))) | ||
| 125 | (if (file-exists-p tempfile) | ||
| 126 | (unless file-name | ||
| 127 | (goto-char start) | ||
| 128 | (delete-region start end) | ||
| 129 | (let (format-alist) | ||
| 130 | (insert-file-contents-literally tempfile))) | ||
| 131 | (message "Can not uudecode"))) | ||
| 132 | (ignore-errors (or file-name (delete-file tempfile)))))) | ||
| 133 | |||
| 134 | (eval-and-compile | ||
| 135 | (defalias 'uudecode-string-to-multibyte | ||
| 136 | (cond | ||
| 137 | ((featurep 'xemacs) | ||
| 138 | 'identity) | ||
| 139 | ((fboundp 'string-to-multibyte) | ||
| 140 | 'string-to-multibyte) | ||
| 141 | (t | ||
| 142 | (lambda (string) | ||
| 143 | "Return a multibyte string with the same individual chars as string." | ||
| 144 | (mapconcat | ||
| 145 | (lambda (ch) (string-as-multibyte (char-to-string ch))) | ||
| 146 | string "")))))) | ||
| 147 | |||
| 148 | ;;;###autoload | ||
| 149 | (defun uudecode-decode-region-internal (start end &optional file-name) | ||
| 150 | "Uudecode region between START and END without using an external program. | ||
| 151 | If FILE-NAME is non-nil, save the result to FILE-NAME." | ||
| 152 | (interactive "r\nP") | ||
| 153 | (let ((done nil) | ||
| 154 | (counter 0) | ||
| 155 | (remain 0) | ||
| 156 | (bits 0) | ||
| 157 | (lim 0) inputpos result | ||
| 158 | (non-data-chars (concat "^" uudecode-alphabet))) | ||
| 159 | (save-excursion | ||
| 160 | (goto-char start) | ||
| 161 | (when (re-search-forward uudecode-begin-line nil t) | ||
| 162 | (cond ((null file-name)) | ||
| 163 | ((stringp file-name)) | ||
| 164 | (t | ||
| 165 | (setq file-name (expand-file-name | ||
| 166 | (read-file-name "File to Name:" | ||
| 167 | nil nil nil | ||
| 168 | (match-string 1)))))) | ||
| 169 | (forward-line 1) | ||
| 170 | (skip-chars-forward non-data-chars end) | ||
| 171 | (while (not done) | ||
| 172 | (setq inputpos (point)) | ||
| 173 | (setq remain 0 bits 0 counter 0) | ||
| 174 | (cond | ||
| 175 | ((> (skip-chars-forward uudecode-alphabet end) 0) | ||
| 176 | (setq lim (point)) | ||
| 177 | (setq remain | ||
| 178 | (logand (- (uudecode-char-int (char-after inputpos)) 32) | ||
| 179 | 63)) | ||
| 180 | (setq inputpos (1+ inputpos)) | ||
| 181 | (if (= remain 0) (setq done t)) | ||
| 182 | (while (and (< inputpos lim) (> remain 0)) | ||
| 183 | (setq bits (+ bits | ||
| 184 | (logand | ||
| 185 | (- | ||
| 186 | (uudecode-char-int (char-after inputpos)) 32) | ||
| 187 | 63))) | ||
| 188 | (if (/= counter 0) (setq remain (1- remain))) | ||
| 189 | (setq counter (1+ counter) | ||
| 190 | inputpos (1+ inputpos)) | ||
| 191 | (cond ((= counter 4) | ||
| 192 | (setq result (cons | ||
| 193 | (concat | ||
| 194 | (char-to-string (lsh bits -16)) | ||
| 195 | (char-to-string (logand (lsh bits -8) 255)) | ||
| 196 | (char-to-string (logand bits 255))) | ||
| 197 | result)) | ||
| 198 | (setq bits 0 counter 0)) | ||
| 199 | (t (setq bits (lsh bits 6))))))) | ||
| 200 | (cond | ||
| 201 | (done) | ||
| 202 | ((> 0 remain) | ||
| 203 | (error "uucode line ends unexpectly") | ||
| 204 | (setq done t)) | ||
| 205 | ((and (= (point) end) (not done)) | ||
| 206 | ;;(error "uucode ends unexpectly") | ||
| 207 | (setq done t)) | ||
| 208 | ((= counter 3) | ||
| 209 | (setq result (cons | ||
| 210 | (concat | ||
| 211 | (char-to-string (logand (lsh bits -16) 255)) | ||
| 212 | (char-to-string (logand (lsh bits -8) 255))) | ||
| 213 | result))) | ||
| 214 | ((= counter 2) | ||
| 215 | (setq result (cons | ||
| 216 | (char-to-string (logand (lsh bits -10) 255)) | ||
| 217 | result)))) | ||
| 218 | (skip-chars-forward non-data-chars end)) | ||
| 219 | (if file-name | ||
| 220 | (let (default-enable-multibyte-characters) | ||
| 221 | (with-temp-file file-name | ||
| 222 | (insert (apply 'concat (nreverse result))))) | ||
| 223 | (or (markerp end) (setq end (set-marker (make-marker) end))) | ||
| 224 | (goto-char start) | ||
| 225 | (if enable-multibyte-characters | ||
| 226 | (mapc #'(lambda (x) (insert (uudecode-string-to-multibyte x))) | ||
| 227 | (nreverse result)) | ||
| 228 | (insert (apply 'concat (nreverse result)))) | ||
| 229 | (delete-region (point) end)))))) | ||
| 230 | |||
| 231 | ;;;###autoload | ||
| 232 | (defun uudecode-decode-region (start end &optional file-name) | ||
| 233 | "Uudecode region between START and END. | ||
| 234 | If FILE-NAME is non-nil, save the result to FILE-NAME." | ||
| 235 | (if uudecode-use-external | ||
| 236 | (uudecode-decode-region-external start end file-name) | ||
| 237 | (uudecode-decode-region-internal start end file-name))) | ||
| 238 | |||
| 239 | (provide 'uudecode) | ||
| 240 | |||
| 241 | ;;; arch-tag: e1f09ed5-62b4-4677-9f13-4e81c4fe8ce3 | ||
| 242 | ;;; uudecode.el ends here | ||
diff --git a/lisp/mail/vms-pmail.el b/lisp/mail/vms-pmail.el index 022a8070a2e..9785fed71e6 100644 --- a/lisp/mail/vms-pmail.el +++ b/lisp/mail/vms-pmail.el | |||
| @@ -1,3 +1,4 @@ | |||
| 1 | ;; -*- no-byte-compile: t -*- | ||
| 1 | ;;; vms-pmail.el --- use Emacs as the editor within VMS mail | 2 | ;;; vms-pmail.el --- use Emacs as the editor within VMS mail |
| 2 | 3 | ||
| 3 | ;; Copyright (C) 1992, 2001, 2002, 2003, 2004, 2005, | 4 | ;; Copyright (C) 1992, 2001, 2002, 2003, 2004, 2005, |