mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2025-01-07 15:21:46 +00:00
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.
This commit is contained in:
parent
b6a786ce9e
commit
4a3393e4f5
@ -503,26 +503,37 @@ In version 18, the HISTORY argument is ignored."
|
|||||||
(read-string prompt initial-contents)
|
(read-string prompt initial-contents)
|
||||||
(read-string prompt initial-contents)))
|
(read-string prompt initial-contents)))
|
||||||
|
|
||||||
(defun sc-submatch (matchnum &optional string)
|
(if (fboundp 'match-string)
|
||||||
"Returns `match-beginning' and `match-end' sub-expression for MATCHNUM.
|
(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'
|
If optional STRING is provided, take sub-expression using `substring'
|
||||||
of argument, otherwise use `buffer-substring' on current buffer. Note
|
of argument, otherwise use `buffer-substring' on current buffer. Note
|
||||||
that `match-data' must have already been generated and no error
|
that `match-data' must have already been generated and no error
|
||||||
checking is performed by this function."
|
checking is performed by this function."
|
||||||
(if string
|
(if string
|
||||||
(substring string (match-beginning matchnum) (match-end matchnum))
|
(substring string (match-beginning matchnum) (match-end matchnum))
|
||||||
(buffer-substring (match-beginning matchnum) (match-end matchnum))))
|
(buffer-substring (match-beginning matchnum) (match-end matchnum)))))
|
||||||
|
|
||||||
(defun sc-member (elt list)
|
(if (fboundp 'member)
|
||||||
"Like `memq', but uses `equal' instead of `eq'.
|
(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."
|
Emacs19 has a builtin function `member' which does exactly this."
|
||||||
(catch 'elt-is-member
|
(catch 'elt-is-member
|
||||||
(while list
|
(while list
|
||||||
(if (equal elt (car list))
|
(if (equal elt (car list))
|
||||||
(throw 'elt-is-member list))
|
(throw 'elt-is-member list))
|
||||||
(setq list (cdr list)))))
|
(setq list (cdr list))))))
|
||||||
(and (memq 'v19 sc-emacs-features)
|
|
||||||
(fset 'sc-member 'member))
|
;; 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)
|
(defun sc-ask (alist)
|
||||||
"Ask a question in the minibuffer requiring a single character answer.
|
"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
|
If optional ATTRIBS-P is non-nil, the key/value pair is placed in
|
||||||
`sc-attributions' too."
|
`sc-attributions' too."
|
||||||
(if (string-match "^\\(\\S *\\)\\s *:\\s +\\(.*\\)$" curline)
|
(if (string-match "^\\(\\S *\\)\\s *:\\s +\\(.*\\)$" curline)
|
||||||
(let* ((key (downcase (sc-submatch 1 curline)))
|
(let* ((key (downcase (sc-string-text (sc-submatch 1 curline))))
|
||||||
(val (sc-submatch 2 curline))
|
(val (sc-string-text (sc-submatch 2 curline)))
|
||||||
(keyval (cons key val)))
|
(keyval (cons key val)))
|
||||||
(setq sc-mail-info (cons keyval sc-mail-info))
|
(setq sc-mail-info (cons keyval sc-mail-info))
|
||||||
(if attribs-p
|
(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."
|
"Append a continuation line onto the last fetched mail field's info."
|
||||||
(let ((keyval (car sc-mail-info)))
|
(let ((keyval (car sc-mail-info)))
|
||||||
(if (and keyval (string-match "^\\s *\\(.*\\)$" curline))
|
(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)
|
nil)
|
||||||
|
|
||||||
(defun sc-mail-error-in-mail-field ()
|
(defun sc-mail-error-in-mail-field ()
|
||||||
|
Loading…
Reference in New Issue
Block a user