comparison lisp/mail/supercite.el @ 61044:17207b620cf3

(sc-mail-field): Use assoc-string. (sc-get-address): Simplify regexps.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Mon, 28 Mar 2005 20:02:54 +0000
parents fb2b49a3a4e0
children 73d56a93d9fd 4da4a09e8b1b
comparison
equal deleted inserted replaced
61043:9306183f7d44 61044:17207b620cf3
836 ;; let the user change mail field information 836 ;; let the user change mail field information
837 (defun sc-mail-field (field) 837 (defun sc-mail-field (field)
838 "Return the mail header field value associated with FIELD. 838 "Return the mail header field value associated with FIELD.
839 If there was no mail header with FIELD as its key, return the value of 839 If there was no mail header with FIELD as its key, return the value of
840 `sc-mumble'. FIELD is case insensitive." 840 `sc-mumble'. FIELD is case insensitive."
841 (or (cdr (assoc (downcase field) sc-mail-info)) sc-mumble)) 841 (or (cdr (assoc-string field sc-mail-info 'case-fold)) sc-mumble))
842 842
843 (defun sc-mail-field-query (arg) 843 (defun sc-mail-field-query (arg)
844 "View the value of a mail field. 844 "View the value of a mail field.
845 With `\\[universal-argument]', prompts for action on mail field. 845 With `\\[universal-argument]', prompts for action on mail field.
846 Action can be one of: View, Modify, Add, or Delete." 846 Action can be one of: View, Modify, Add, or Delete."
914 914
915 (defun sc-get-address (from author) 915 (defun sc-get-address (from author)
916 "Get the full email address path from FROM. 916 "Get the full email address path from FROM.
917 AUTHOR is the author's name (which is removed from the address)." 917 AUTHOR is the author's name (which is removed from the address)."
918 (let ((eos (length from))) 918 (let ((eos (length from)))
919 (if (string-match (concat "\\(^\\|^\"\\)" author 919 (if (string-match (concat "\\`\"?" (regexp-quote author)
920 "\\(\\s +\\|\"\\s +\\)") from 0) 920 "\"?\\s +") from 0)
921 (let ((address (substring from (match-end 0) eos))) 921 (let ((address (substring from (match-end 0) eos)))
922 (if (and (= (aref address 0) ?<) 922 (if (and (= (aref address 0) ?<)
923 (= (aref address (1- (length address))) ?>)) 923 (= (aref address (1- (length address))) ?>))
924 (substring address 1 (1- (length address))) 924 (substring address 1 (1- (length address)))
925 address)) 925 address))
2052 2052
2053 ;; useful stuff 2053 ;; useful stuff
2054 (provide 'supercite) 2054 (provide 'supercite)
2055 (run-hooks 'sc-load-hook) 2055 (run-hooks 'sc-load-hook)
2056 2056
2057 ;;; arch-tag: a5d5bfa6-3bd5-4414-8c65-0afc83e45cd3 2057 ;; arch-tag: a5d5bfa6-3bd5-4414-8c65-0afc83e45cd3
2058 ;;; supercite.el ends here 2058 ;;; supercite.el ends here