diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2021-03-11 14:32:42 -0500 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2021-03-11 14:32:42 -0500 |
commit | d9c94e93b7013d575aeb2a8e8077564a80b04f7c (patch) | |
tree | 0eb0b9d2c5263c1d6a1665e17774b846a802405a /lisp/mail/mailheader.el | |
parent | b90c658492a2548f183bf072be50f4a57a2b5f0b (diff) | |
download | emacs-d9c94e93b7013d575aeb2a8e8077564a80b04f7c.tar.gz emacs-d9c94e93b7013d575aeb2a8e8077564a80b04f7c.tar.bz2 emacs-d9c94e93b7013d575aeb2a8e8077564a80b04f7c.zip |
* 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.
Diffstat (limited to 'lisp/mail/mailheader.el')
-rw-r--r-- | lisp/mail/mailheader.el | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/lisp/mail/mailheader.el b/lisp/mail/mailheader.el index cbc01e4a442..0443279be84 100644 --- a/lisp/mail/mailheader.el +++ b/lisp/mail/mailheader.el @@ -1,4 +1,4 @@ -;;; mailheader.el --- mail header parsing, merging, formatting +;;; mailheader.el --- mail header parsing, merging, formatting -*- lexical-binding: t; -*- ;; Copyright (C) 1996, 2001-2021 Free Software Foundation, Inc. @@ -99,23 +99,23 @@ value." headers) ;; Advertised part of the interface; see mail-header, mail-header-set. -(with-suppressed-warnings ((lexical headers)) - (defvar headers)) -(defsubst mail-header (header &optional header-alist) +(defun mail-header (header &optional header-alist) "Return the value associated with header HEADER in HEADER-ALIST. If the value is a string, it is the original value of the header. If the value is a list, its first element is the original value of the header, -with any subsequent elements being the result of parsing the value. -If HEADER-ALIST is nil, the dynamically bound variable `headers' is used." +with any subsequent elements being the result of parsing the value." (declare (gv-setter (lambda (value) `(mail-header-set ,header ,value ,header-alist)))) + (with-suppressed-warnings ((lexical headers)) (defvar headers)) (cdr (assq header (or header-alist headers)))) (defun mail-header-set (header value &optional header-alist) "Set the value associated with header HEADER to VALUE in HEADER-ALIST. HEADER-ALIST defaults to the dynamically bound variable `headers' if nil. See `mail-header' for the semantics of VALUE." + (declare (obsolete alist-get "28.1")) + (with-suppressed-warnings ((lexical headers)) (defvar headers)) (let* ((alist (or header-alist headers)) (entry (assq header alist))) (if entry @@ -131,10 +131,13 @@ should be a string or a list of string. The first element may be nil to denote that the formatting functions must use the remaining elements, or skip the header altogether if there are no other elements. The macro `mail-header' can be used to access headers in HEADERS." - (mapcar - (lambda (rule) - (cons (car rule) (eval (cdr rule)))) - merge-rules)) + (declare (obsolete alist-get "28.1")) + (with-suppressed-warnings ((lexical headers)) (defvar headers)) + (let ((headers headers)) + (mapcar + (lambda (rule) + (cons (car rule) (eval (cdr rule) t))) + merge-rules))) (defvar mail-header-format-function (lambda (header value) @@ -167,7 +170,7 @@ A key of nil has as its value a list of defaulted headers to ignore." (mapcar #'car format-rules)))) (dolist (rule format-rules) (let* ((header (car rule)) - (value (mail-header header))) + (value (alist-get header headers))) (if (stringp header) (setq header (intern header))) (cond ((null header) 'ignore) @@ -176,13 +179,11 @@ A key of nil has as its value a list of defaulted headers to ignore." (unless (memq (car defaulted) ignore) (let* ((header (car defaulted)) (value (cdr defaulted))) - (if (cdr rule) - (funcall (cdr rule) header value) - (funcall mail-header-format-function header value)))))) + (funcall (or (cdr rule) mail-header-format-function) + header value))))) (value - (if (cdr rule) - (funcall (cdr rule) header value) - (funcall mail-header-format-function header value)))))) + (funcall (or (cdr rule) mail-header-format-function) + header value))))) (insert "\n"))) (provide 'mailheader) |