comparison lisp/mail/mail-extr.el @ 18816:92913b38a478

(mail-extr-voodoo): Get rid of comments at an early stage.
author Richard M. Stallman <rms@gnu.org>
date Wed, 16 Jul 1997 04:37:17 +0000
parents 45d9891b03b2
children 8a0265f609ff
comparison
equal deleted inserted replaced
18815:4c16f9e92a6e 18816:92913b38a478
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the 23 ;; along with GNU Emacs; see the file COPYING. If not, write to the
24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, 24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
25 ;; Boston, MA 02111-1307, USA. 25 ;; Boston, MA 02111-1307, USA.
26 26
27 ;;; Commentary: 27 ;;; Commentary:
28
29 ;;; This file has been censored by the Communications Decency Act.
30 ;;; That law was passed under the guise of a ban on pornography, but
31 ;;; it bans far more than that. This file did not contain pornography,
32 ;;; but it was censored nonetheless.
33
34 ;;; For information on US government censorship of the Internet, and
35 ;;; what you can do to bring back freedom of the press, see the web
36 ;;; site http://www.vtw.org/
37 28
38 ;; The entry point of this code is 29 ;; The entry point of this code is
39 ;; 30 ;;
40 ;; mail-extract-address-components: (address) 31 ;; mail-extract-address-components: (address)
41 ;; 32 ;;
1315 (save-restriction 1306 (save-restriction
1316 (narrow-to-region atom-beg atom-end) 1307 (narrow-to-region atom-beg atom-end)
1317 (cond 1308 (cond
1318 1309
1319 ;; Handle X.400 addresses encoded in RFC-822. 1310 ;; Handle X.400 addresses encoded in RFC-822.
1320 ;; *** This has to handle the case where it is 1311 ;; *** Shit! This has to handle the case where it is
1321 ;; *** embedded in a quote too! 1312 ;; *** embedded in a quote too!
1322 ;; *** The input is being broken up into atoms 1313 ;; *** Shit! The input is being broken up into atoms
1323 ;; *** by periods! 1314 ;; *** by periods!
1324 ((looking-at mail-extr-x400-encoded-address-pattern) 1315 ((looking-at mail-extr-x400-encoded-address-pattern)
1325 1316
1326 ;; Copy the contents of the individual fields that 1317 ;; Copy the contents of the individual fields that
1327 ;; might hold name data to the beginning. 1318 ;; might hold name data to the beginning.
1454 name-beg name-end 1445 name-beg name-end
1455 name-done-flag 1446 name-done-flag
1456 ) 1447 )
1457 (save-excursion 1448 (save-excursion
1458 (set-syntax-table mail-extr-address-text-syntax-table) 1449 (set-syntax-table mail-extr-address-text-syntax-table)
1450
1451 ;; Get rid of comments.
1452 (goto-char (point-min))
1453 (while (not (eobp))
1454 ;; Initialize for this iteration of the loop.
1455 (skip-chars-forward "^({[\"'`")
1456 (let ((cbeg (point)))
1457 (set-syntax-table mail-extr-address-text-comment-syntax-table)
1458 (cond ((memq (following-char) '(?\' ?\`))
1459 (search-forward "'" nil t
1460 (if (eq ?\' (following-char)) 2 1)))
1461 (t
1462 (or (mail-extr-safe-move-sexp 1)
1463 (goto-char (point-max)))))
1464 (set-syntax-table mail-extr-address-text-syntax-table)
1465 (when (eq (char-after cbeg) ?\()
1466 ;; Delete the comment itself.
1467 (delete-region cbeg (point))
1468 ;; Canonicalize whitespace where the comment was.
1469 (skip-chars-backward " \t")
1470 (if (looking-at "\\([ \t]+$\\|[ \t]+,\\)")
1471 (replace-match "")
1472 (setq cbeg (point))
1473 (skip-chars-forward " \t")
1474 (if (bobp)
1475 (delete-region (point) cbeg)
1476 (just-one-space))))))
1459 1477
1460 ;; This was moved above. 1478 ;; This was moved above.
1461 ;; Fix . used as space 1479 ;; Fix . used as space
1462 ;; But it belongs here because it occurs not only as 1480 ;; But it belongs here because it occurs not only as
1463 ;; rypens@reks.uia.ac.be (Piet.Rypens) 1481 ;; rypens@reks.uia.ac.be (Piet.Rypens)