aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerd Moellmann2000-04-03 21:21:42 +0000
committerGerd Moellmann2000-04-03 21:21:42 +0000
commit62f20204b7f740042e4e34c651c8f1d9e1aa07c1 (patch)
tree9e4c35961f70b68da5fdcb9fe2dd2b39d602b255
parent92d8844ebed3a174abad28bceede2a45fced32d5 (diff)
downloademacs-62f20204b7f740042e4e34c651c8f1d9e1aa07c1.tar.gz
emacs-62f20204b7f740042e4e34c651c8f1d9e1aa07c1.zip
*** empty log message ***
-rw-r--r--etc/NEWS3
-rw-r--r--lisp/ChangeLog3
-rw-r--r--lisp/mail/rfc2368.el167
-rw-r--r--lispref/keymaps.texi2
-rw-r--r--src/ChangeLog3
5 files changed, 177 insertions, 1 deletions
diff --git a/etc/NEWS b/etc/NEWS
index 70e590e080f..c9e92f2c04c 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1086,6 +1086,9 @@ Note that +++ before an item means the Lisp manual has been updated.
1086When you add a new item, please add it without either +++ or --- 1086When you add a new item, please add it without either +++ or ---
1087so I will know I still need to look at it -- rms. 1087so I will know I still need to look at it -- rms.
1088 1088
1089** The functions base64-decode-region and base64-decode-string now
1090signal an error instead of returning nil if decoding fails.
1091
1089** The function sendmail-user-agent-compose now recognizes a `body' 1092** The function sendmail-user-agent-compose now recognizes a `body'
1090header is the list of headers passed to it. 1093header is the list of headers passed to it.
1091 1094
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index b112a37c445..671f92599d9 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,8 @@
12000-04-03 Gerd Moellmann <gerd@gnu.org> 12000-04-03 Gerd Moellmann <gerd@gnu.org>
2 2
3 * progmodes/compile.el (compile-internal): Display the compilation
4 buffer in a different frame, if it's already displayed there.
5
3 * mail/rfc2368.el: New file. 6 * mail/rfc2368.el: New file.
4 7
5 * simple.el (sendmail-user-agent-compose): Recognize a `body' 8 * simple.el (sendmail-user-agent-compose): Recognize a `body'
diff --git a/lisp/mail/rfc2368.el b/lisp/mail/rfc2368.el
new file mode 100644
index 00000000000..368fcf405d1
--- /dev/null
+++ b/lisp/mail/rfc2368.el
@@ -0,0 +1,167 @@
1;;; rfc2368.el --- support for rfc2368
2
3;;; Copyright 1999 Sen Nagata <sen@eccosys.com>
4
5;; Author: Sen Nagata <sen_ml@eccosys.com>
6;; Keywords: mail
7
8;; Copyright (C) 1998, 2000 Free Software Foundation, Inc.
9
10;; This file is part of GNU Emacs.
11
12;; GNU Emacs is free software; you can redistribute it and/or modify
13;; it under the terms of the GNU General Public License as published by
14;; the Free Software Foundation; either version 2, or (at your option)
15;; any later version.
16
17;; GNU Emacs is distributed in the hope that it will be useful,
18;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20;; GNU General Public License for more details.
21
22;; You should have received a copy of the GNU General Public License
23;; along with GNU Emacs; see the file COPYING. If not, write to the
24;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
25;; Boston, MA 02111-1307, USA.
26
27;;; Commentary:
28;;
29;; notes:
30;;
31;; -repeat after me: "the colon is not part of the header name..."
32;; -if w3 becomes part of emacs, then it may make sense to have this
33;; file depend on w3 -- the maintainer of w3 says merging w/ Emacs
34;; is planned!
35;;
36;; historical note:
37;;
38;; this is intended as a replacement for mailto.el
39;;
40;; acknowledgements:
41;;
42;; the functions that deal w/ unhexifying in this file were basically
43;; taken from w3 -- i hope to replace them w/ something else soon OR
44;; perhaps if w3 becomes a part of emacs soon, use the functions from w3.
45
46;;; History:
47;;
48;; 0.3:
49;;
50;; added the constant rfc2368-version
51;; implemented first potential fix for a bug in rfc2368-mailto-regexp
52;; implemented first potential fix for a bug in rfc2368-parse-mailto
53;; (both bugs reported by Kenichi OKADA)
54;;
55;; 0.2:
56;;
57;; started to use checkdoc
58;;
59;; 0.1:
60;;
61;; initial implementation
62
63;;; Code:
64
65;; only an approximation?
66;; see rfc 1738
67(defconst rfc2368-mailto-regexp
68 "^\\(mailto:\\)\\([^?]+\\)*\\(\\?\\(.*\\)\\)*"
69 "Regular expression to match and aid in parsing a mailto url.")
70
71;; describes 'mailto:'
72(defconst rfc2368-mailto-scheme-index 1
73 "Describes the 'mailto:' portion of the url.")
74;; i'm going to call this part the 'prequery'
75(defconst rfc2368-mailto-prequery-index 2
76 "Describes the portion of the url between 'mailto:' and '?'.")
77;; i'm going to call this part the 'query'
78(defconst rfc2368-mailto-query-index 4
79 "Describes the portion of the url after '?'.")
80
81;; for dealing w/ unhexifying strings, my preferred approach is to use
82;; a 'string-replace-match-using-function' which can perform a
83;; string-replace-match and compute the replacement text based on a
84;; passed function -- however, emacs doesn't seem to have such a
85;; function yet :-(
86
87;; for the moment a rip-off of url-unhex (w3/url.el)
88(defun rfc2368-unhexify-char (char)
89 "Unhexify CHAR -- e.g. %20 -> <SPC>."
90 (if (> char ?9)
91 (if (>= char ?a)
92 (+ 10 (- char ?a))
93 (+ 10 (- char ?A)))
94 (- char ?0)))
95
96;; for the moment a rip-off of url-unhex-string (w3/url.el) (slightly modified)
97(defun rfc2368-unhexify-string (string)
98 "Unhexify STRING -- e.g. 'hello%20there' -> 'hello there'."
99 (let ((case-fold-search t)
100 (result ""))
101 (while (string-match "%[0-9a-f][0-9a-f]" string)
102 (let* ((start (match-beginning 0))
103 (hex-code (+ (* 16
104 (rfc2368-unhexify-char (elt string (+ start 1))))
105 (rfc2368-unhexify-char (elt string (+ start 2))))))
106 (setq result (concat
107 result (substring string 0 start)
108 (char-to-string hex-code))
109 string (substring string (match-end 0)))))
110 ;; it seems clearer to do things this way than to just return:
111 ;; (concat result string)
112 (setq result (concat result string))
113 result))
114
115(defun rfc2368-parse-mailto-url (mailto-url)
116 "Parse MAILTO-URL, and return an alist of header-name, header-value pairs.
117MAILTO-URL should be a RFC 2368 (mailto) compliant url. A cons cell w/ a
118key of 'Body' is a special case and is considered a header for this purpose.
119The returned alist is intended for use w/ the `compose-mail' interface.
120Note: make sure MAILTO-URL has been 'unhtmlized' (e.g. &amp; -> &), before
121calling this function."
122 (let ((case-fold-search t)
123 prequery query headers-alist)
124
125 (if (string-match rfc2368-mailto-regexp mailto-url)
126 (progn
127
128 (setq prequery
129 (match-string rfc2368-mailto-prequery-index mailto-url))
130
131 (setq query
132 (match-string rfc2368-mailto-query-index mailto-url))
133
134 ;; build alist of header name-value pairs
135 (if (not (null query))
136 (setq headers-alist
137 (mapcar
138 (lambda (x)
139 (let* ((temp-list (split-string x "="))
140 (header-name (car temp-list))
141 (header-value (cadr temp-list)))
142 ;; return ("Header-Name" . "header-value")
143 (cons
144 (capitalize (rfc2368-unhexify-string header-name))
145 (rfc2368-unhexify-string header-value))))
146 (split-string query "&"))))
147
148 ;; deal w/ multiple 'To' recipients
149 (if prequery
150 (progn
151 (if (assoc "To" headers-alist)
152 (let* ((our-cons-cell
153 (assoc "To" headers-alist))
154 (our-cdr
155 (cdr our-cons-cell)))
156 (setcdr our-cons-cell (concat our-cdr ", " prequery)))
157 (setq headers-alist
158 (cons (cons "To" prequery) headers-alist)))))
159
160 headers-alist)
161
162 (error "Failed to match a mailto: url"))
163 ))
164
165(provide 'rfc2368)
166
167;;; rfc2368.el ends here
diff --git a/lispref/keymaps.texi b/lispref/keymaps.texi
index 23f31a7c4bf..eef616b8a79 100644
--- a/lispref/keymaps.texi
+++ b/lispref/keymaps.texi
@@ -465,7 +465,7 @@ active keymap.
465@defun define-prefix-command symbol &optional mapvar prompt 465@defun define-prefix-command symbol &optional mapvar prompt
466@cindex prefix command 466@cindex prefix command
467This function prepares @var{symbol} for use as a prefix key's binding: 467This function prepares @var{symbol} for use as a prefix key's binding:
468it creates a full keymap and stores it as @var{symbol}'s function 468it creates a sparse keymap and stores it as @var{symbol}'s function
469definition. Subsequently binding a key sequence to @var{symbol} will 469definition. Subsequently binding a key sequence to @var{symbol} will
470make that key sequence into a prefix key. The return value is @code{symbol}. 470make that key sequence into a prefix key. The return value is @code{symbol}.
471 471
diff --git a/src/ChangeLog b/src/ChangeLog
index 2f80f3e727d..498afe84959 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,8 @@
12000-04-03 Gerd Moellmann <gerd@gnu.org> 12000-04-03 Gerd Moellmann <gerd@gnu.org>
2 2
3 * fns.c (Fbase64_decode_region, Fbase64_decode_string): Signal
4 an error if decoding fails.
5
3 * keyboard.c (lispy_mouse_names): Variable removed. 6 * keyboard.c (lispy_mouse_names): Variable removed.
4 (Vlispy_mouse_stem): New variable. 7 (Vlispy_mouse_stem): New variable.
5 (syms_of_keyboard): Initialize Vlispy_mouse_stem. 8 (syms_of_keyboard): Initialize Vlispy_mouse_stem.