summaryrefslogtreecommitdiff
path: root/lisp/mail/supercite.el
diff options
context:
space:
mode:
authorSimon Marshall <simon@gnu.org>1995-04-25 08:27:28 +0000
committerSimon Marshall <simon@gnu.org>1995-04-25 08:27:28 +0000
commit4a3393e4f53f7ea2e3e86a691a36822dc1a05877 (patch)
tree6a632678f98efaf8ba5f59fe070e426c93227e2e /lisp/mail/supercite.el
parentb6a786ce9eb094dca876605e17144d9e39caf880 (diff)
downloademacs-4a3393e4f53f7ea2e3e86a691a36822dc1a05877.tar.gz
Made sc-string-text to strip of text properties of buffer text, so string
comparison wouldn't fail in sc-mail-fetch-field and sc-mail-append-field.
Diffstat (limited to 'lisp/mail/supercite.el')
-rw-r--r--lisp/mail/supercite.el48
1 files changed, 30 insertions, 18 deletions
diff --git a/lisp/mail/supercite.el b/lisp/mail/supercite.el
index a4d32d6e94c..21b1308bba1 100644
--- a/lisp/mail/supercite.el
+++ b/lisp/mail/supercite.el
@@ -503,26 +503,37 @@ In version 18, the HISTORY argument is ignored."
(read-string prompt initial-contents)
(read-string prompt initial-contents)))
-(defun sc-submatch (matchnum &optional string)
- "Returns `match-beginning' and `match-end' sub-expression for MATCHNUM.
+(if (fboundp 'match-string)
+ (defalias 'sc-submatch 'match-string)
+ (defun sc-submatch (matchnum &optional string)
+ "Returns `match-beginning' and `match-end' sub-expression for MATCHNUM.
If optional STRING is provided, take sub-expression using `substring'
of argument, otherwise use `buffer-substring' on current buffer. Note
that `match-data' must have already been generated and no error
checking is performed by this function."
- (if string
- (substring string (match-beginning matchnum) (match-end matchnum))
- (buffer-substring (match-beginning matchnum) (match-end matchnum))))
-
-(defun sc-member (elt list)
- "Like `memq', but uses `equal' instead of `eq'.
+ (if string
+ (substring string (match-beginning matchnum) (match-end matchnum))
+ (buffer-substring (match-beginning matchnum) (match-end matchnum)))))
+
+(if (fboundp 'member)
+ (defalias 'sc-member 'member)
+ (defun sc-member (elt list)
+ "Like `memq', but uses `equal' instead of `eq'.
Emacs19 has a builtin function `member' which does exactly this."
- (catch 'elt-is-member
- (while list
- (if (equal elt (car list))
- (throw 'elt-is-member list))
- (setq list (cdr list)))))
-(and (memq 'v19 sc-emacs-features)
- (fset 'sc-member 'member))
+ (catch 'elt-is-member
+ (while list
+ (if (equal elt (car list))
+ (throw 'elt-is-member list))
+ (setq list (cdr list))))))
+
+;; One day maybe Emacs will have this...
+(if (fboundp 'string-text)
+ (defalias 'sc-string-text 'string-text)
+ (defun sc-string-text (string)
+ "Return STRING with all text properties removed."
+ (let ((string (copy-sequence string)))
+ (set-text-properties 0 (length string) nil string)
+ string)))
(defun sc-ask (alist)
"Ask a question in the minibuffer requiring a single character answer.
@@ -645,8 +656,8 @@ the list should be unique."
If optional ATTRIBS-P is non-nil, the key/value pair is placed in
`sc-attributions' too."
(if (string-match "^\\(\\S *\\)\\s *:\\s +\\(.*\\)$" curline)
- (let* ((key (downcase (sc-submatch 1 curline)))
- (val (sc-submatch 2 curline))
+ (let* ((key (downcase (sc-string-text (sc-submatch 1 curline))))
+ (val (sc-string-text (sc-submatch 2 curline)))
(keyval (cons key val)))
(setq sc-mail-info (cons keyval sc-mail-info))
(if attribs-p
@@ -658,7 +669,8 @@ If optional ATTRIBS-P is non-nil, the key/value pair is placed in
"Append a continuation line onto the last fetched mail field's info."
(let ((keyval (car sc-mail-info)))
(if (and keyval (string-match "^\\s *\\(.*\\)$" curline))
- (setcdr keyval (concat (cdr keyval) " " (sc-submatch 1 curline)))))
+ (setcdr keyval (concat (cdr keyval) " "
+ (sc-string-text (sc-submatch 1 curline))))))
nil)
(defun sc-mail-error-in-mail-field ()