aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Marshall1995-04-25 08:27:28 +0000
committerSimon Marshall1995-04-25 08:27:28 +0000
commit4a3393e4f53f7ea2e3e86a691a36822dc1a05877 (patch)
tree6a632678f98efaf8ba5f59fe070e426c93227e2e
parentb6a786ce9eb094dca876605e17144d9e39caf880 (diff)
downloademacs-4a3393e4f53f7ea2e3e86a691a36822dc1a05877.tar.gz
emacs-4a3393e4f53f7ea2e3e86a691a36822dc1a05877.zip
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.
-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."
503 (read-string prompt initial-contents) 503 (read-string prompt initial-contents)
504 (read-string prompt initial-contents))) 504 (read-string prompt initial-contents)))
505 505
506(defun sc-submatch (matchnum &optional string) 506(if (fboundp 'match-string)
507 "Returns `match-beginning' and `match-end' sub-expression for MATCHNUM. 507 (defalias 'sc-submatch 'match-string)
508 (defun sc-submatch (matchnum &optional string)
509 "Returns `match-beginning' and `match-end' sub-expression for MATCHNUM.
508If optional STRING is provided, take sub-expression using `substring' 510If optional STRING is provided, take sub-expression using `substring'
509of argument, otherwise use `buffer-substring' on current buffer. Note 511of argument, otherwise use `buffer-substring' on current buffer. Note
510that `match-data' must have already been generated and no error 512that `match-data' must have already been generated and no error
511checking is performed by this function." 513checking is performed by this function."
512 (if string 514 (if string
513 (substring string (match-beginning matchnum) (match-end matchnum)) 515 (substring string (match-beginning matchnum) (match-end matchnum))
514 (buffer-substring (match-beginning matchnum) (match-end matchnum)))) 516 (buffer-substring (match-beginning matchnum) (match-end matchnum)))))
515 517
516(defun sc-member (elt list) 518(if (fboundp 'member)
517 "Like `memq', but uses `equal' instead of `eq'. 519 (defalias 'sc-member 'member)
520 (defun sc-member (elt list)
521 "Like `memq', but uses `equal' instead of `eq'.
518Emacs19 has a builtin function `member' which does exactly this." 522Emacs19 has a builtin function `member' which does exactly this."
519 (catch 'elt-is-member 523 (catch 'elt-is-member
520 (while list 524 (while list
521 (if (equal elt (car list)) 525 (if (equal elt (car list))
522 (throw 'elt-is-member list)) 526 (throw 'elt-is-member list))
523 (setq list (cdr list))))) 527 (setq list (cdr list))))))
524(and (memq 'v19 sc-emacs-features) 528
525 (fset 'sc-member 'member)) 529;; One day maybe Emacs will have this...
530(if (fboundp 'string-text)
531 (defalias 'sc-string-text 'string-text)
532 (defun sc-string-text (string)
533 "Return STRING with all text properties removed."
534 (let ((string (copy-sequence string)))
535 (set-text-properties 0 (length string) nil string)
536 string)))
526 537
527(defun sc-ask (alist) 538(defun sc-ask (alist)
528 "Ask a question in the minibuffer requiring a single character answer. 539 "Ask a question in the minibuffer requiring a single character answer.
@@ -645,8 +656,8 @@ the list should be unique."
645If optional ATTRIBS-P is non-nil, the key/value pair is placed in 656If optional ATTRIBS-P is non-nil, the key/value pair is placed in
646`sc-attributions' too." 657`sc-attributions' too."
647 (if (string-match "^\\(\\S *\\)\\s *:\\s +\\(.*\\)$" curline) 658 (if (string-match "^\\(\\S *\\)\\s *:\\s +\\(.*\\)$" curline)
648 (let* ((key (downcase (sc-submatch 1 curline))) 659 (let* ((key (downcase (sc-string-text (sc-submatch 1 curline))))
649 (val (sc-submatch 2 curline)) 660 (val (sc-string-text (sc-submatch 2 curline)))
650 (keyval (cons key val))) 661 (keyval (cons key val)))
651 (setq sc-mail-info (cons keyval sc-mail-info)) 662 (setq sc-mail-info (cons keyval sc-mail-info))
652 (if attribs-p 663 (if attribs-p
@@ -658,7 +669,8 @@ If optional ATTRIBS-P is non-nil, the key/value pair is placed in
658 "Append a continuation line onto the last fetched mail field's info." 669 "Append a continuation line onto the last fetched mail field's info."
659 (let ((keyval (car sc-mail-info))) 670 (let ((keyval (car sc-mail-info)))
660 (if (and keyval (string-match "^\\s *\\(.*\\)$" curline)) 671 (if (and keyval (string-match "^\\s *\\(.*\\)$" curline))
661 (setcdr keyval (concat (cdr keyval) " " (sc-submatch 1 curline))))) 672 (setcdr keyval (concat (cdr keyval) " "
673 (sc-string-text (sc-submatch 1 curline))))))
662 nil) 674 nil)
663 675
664(defun sc-mail-error-in-mail-field () 676(defun sc-mail-error-in-mail-field ()