From d9c94e93b7013d575aeb2a8e8077564a80b04f7c Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Thu, 11 Mar 2021 14:32:42 -0500 Subject: * lisp/mail/: Use lexical-binding Remove some redundant `:group` args as well. * lisp/mail/supercite.el: Use lexical-binding. (completer-disable): Declare var. (sc-set-variable): Don't rely on dynbind to access `help` variable. * lisp/mail/mail-extr.el: Use lexical-binding. (mail-extract-address-components): Avoid use of dynamic scoping to refer to local vars. * lisp/mail/mailabbrev.el: Use lexical-binding. (mail-abbrev-make-syntax-table): Rename `_` variable to `syntax-_`. * lisp/mail/mailheader.el: Use lexical-binding. (headers): Don't declare as dynbound globally. (mail-header-set, mail-header-merge): Declare `headers` as dynbound locally, instead. Mark those functions as obsolete. (mail-header-format): Use `alist-get` instead of `mail-header`. * lisp/mail/binhex.el (binhex-decode-region-external): Remove always-nil var `firstline`. * lisp/mail/emacsbug.el: Use lexical-binding. (report-emacs-bug): Remove always-nil var `message-end-point`. * lisp/mail/rmail-spam-filter.el: Use lexical-binding. (bbdb/mail_auto_create_p): Declare variable. * lisp/mail/rmail.el (rmail-get-new-mail): Remove always-nil var `delete-files`. * lisp/mail/rmailout.el: Use lexical-binding. (rmail-output-read-file-name): Remove unused var `err`. (rmail-convert-to-babyl-format): Remove unused var `count`. (rmail-output-as-mbox): Remove unused vars `from` and `date`. * lisp/mail/rmailsort.el: Use lexical-binding. (rmail-sort-messages): Remove unused var `msginfo`. * lisp/mail/rfc822.el: Use lexical-binding. * lisp/mail/rmailedit.el: Use lexical-binding. * lisp/mail/mailclient.el: Use lexical-binding. * lisp/mail/blessmail.el: Use lexical-binding. * lisp/mail/mail-hist.el: Use lexical-binding. * lisp/mail/rmailkwd.el: Use lexical-binding. * lisp/mail/rmailmsc.el: Use lexical-binding. * lisp/mail/uce.el: Use lexical-binding. * lisp/mail/unrmail.el: Use lexical-binding. --- lisp/mail/mail-extr.el | 47 +++++++++++++++++++++-------------------------- 1 file changed, 21 insertions(+), 26 deletions(-) (limited to 'lisp/mail/mail-extr.el') diff --git a/lisp/mail/mail-extr.el b/lisp/mail/mail-extr.el index 4e3bf78c807..7fbdfefc461 100644 --- a/lisp/mail/mail-extr.el +++ b/lisp/mail/mail-extr.el @@ -1,4 +1,4 @@ -;;; mail-extr.el --- extract full name and address from email header +;;; mail-extr.el --- extract full name and address from email header -*- lexical-binding: t; -*- ;; Copyright (C) 1991-1994, 1997, 2001-2021 Free Software Foundation, ;; Inc. @@ -222,23 +222,20 @@ "Whether to try to guess middle initial from mail address. If true, then when we see an address like \"John Smith \" we will assume that \"John Q. Smith\" is the fellow's name." - :type 'boolean - :group 'mail-extr) + :type 'boolean) (defcustom mail-extr-ignore-single-names nil "Whether to ignore a name that is just a single word. If true, then when we see an address like \"Idiot \" we will act as though we couldn't find a full name in the address." :type 'boolean - :version "22.1" - :group 'mail-extr) + :version "22.1") (defcustom mail-extr-ignore-realname-equals-mailbox-name t "Whether to ignore a name that is equal to the mailbox name. If true, then when the address is like \"Single \" we will act as though we couldn't find a full name in the address." - :type 'boolean - :group 'mail-extr) + :type 'boolean) ;; Matches a leading title that is not part of the name (does not ;; contribute to uniquely identifying the person). @@ -248,19 +245,16 @@ we will act as though we couldn't find a full name in the address." "Matches prefixes to the full name that identify a person's position. These are stripped from the full name because they do not contribute to uniquely identifying the person." - :type 'regexp - :group 'mail-extr) + :type 'regexp) (defcustom mail-extr-@-binds-tighter-than-! nil "Whether the local mail transport agent looks at ! before @." - :type 'boolean - :group 'mail-extr) + :type 'boolean) (defcustom mail-extr-mangle-uucp nil "Whether to throw away information in UUCP addresses by translating things like \"foo!bar!baz@host\" into \"baz@bar.UUCP\"." - :type 'boolean - :group 'mail-extr) + :type 'boolean) ;;---------------------------------------------------------------------- ;; what orderings are meaningful????? @@ -760,7 +754,6 @@ non-display use, you should probably use end-of-address <-pos >-pos @-pos colon-pos comma-pos !-pos %-pos \;-pos group-:-pos group-\;-pos route-addr-:-pos - record-pos-symbol first-real-pos last-real-pos phrase-beg phrase-end ;; Dynamically set in mail-extr-voodoo. @@ -852,13 +845,16 @@ non-display use, you should probably use ) ;; record the position of various interesting chars, determine ;; validity later. - ((setq record-pos-symbol - (cdr (assq char - '((?< . <-pos) (?> . >-pos) (?@ . @-pos) - (?: . colon-pos) (?, . comma-pos) (?! . !-pos) - (?% . %-pos) (?\; . \;-pos))))) - (set record-pos-symbol - (cons (point) (symbol-value record-pos-symbol))) + ((memq char '(?< ?> ?@ ?: ?, ?! ?% ?\;)) + (push (point) (pcase-exhaustive char + (?< <-pos) + (?> >-pos) + (?@ @-pos) + (?: colon-pos) + (?, comma-pos) + (?! !-pos) + (?% %-pos) + (?\; \;-pos))) (forward-char 1)) ((eq char ?.) (forward-char 1)) @@ -1065,7 +1061,7 @@ non-display use, you should probably use (mail-extr-demarkerize route-addr-:-pos) (setq route-addr-:-pos nil >-pos (mail-extr-demarkerize >-pos) - %-pos (mapcar 'mail-extr-demarkerize %-pos))) + %-pos (mapcar #'mail-extr-demarkerize %-pos))) ;; de-listify @-pos (setq @-pos (car @-pos)) @@ -1122,7 +1118,7 @@ non-display use, you should probably use (setq insert-point (point-max))) (%-pos (setq insert-point (car (last %-pos)) - saved-%-pos (mapcar 'mail-extr-markerize %-pos) + saved-%-pos (mapcar #'mail-extr-markerize %-pos) %-pos nil @-pos (mail-extr-markerize @-pos))) (@-pos @@ -1162,7 +1158,7 @@ non-display use, you should probably use "uucp")) (setq !-pos (cdr !-pos)))) (and saved-%-pos - (setq %-pos (append (mapcar 'mail-extr-demarkerize + (setq %-pos (append (mapcar #'mail-extr-demarkerize saved-%-pos) %-pos))) (setq @-pos (mail-extr-demarkerize @-pos)) @@ -1461,8 +1457,7 @@ If it is neither nil nor a string, modifying of names will never take place. It affects how `mail-extract-address-components' works." :type '(choice (regexp :size 0) (const :tag "Always enabled" nil) - (const :tag "Always disabled" t)) - :group 'mail-extr) + (const :tag "Always disabled" t))) (defun mail-extr-voodoo (mbox-beg mbox-end canonicalization-buffer) (unless (and mail-extr-disable-voodoo -- cgit v1.2.3