emacs: use lexical-bindings in all libraries

Doing so causes many new compile warnings.  Some of these warnings
concern genuine changes in behavior that have to be addressed right
away.

Many other warnings are due to unused variables.  Nothing has changed
here, except that the byte-compiler can now detect these pre-existing
and harmless issues.  We delay addressing these issues so that we can
focus on the important ones here.

A third group of warnings concern arguments that are not actually used
inside the function but which cannot be removed because the functions
signature is dictated by some outside convention.  Silencing these
warning is also delayed until subsequent commits.
This commit is contained in:
Jonas Bernoulli 2021-01-10 15:00:47 +01:00 committed by David Bremner
parent 2ca941163d
commit fc4cda07a9
21 changed files with 39 additions and 28 deletions

View file

@ -1,4 +1,4 @@
;;; coolj.el --- automatically wrap long lines -*- coding:utf-8 -*- ;;; coolj.el --- automatically wrap long lines -*- lexical-binding: t; coding: utf-8 -*-
;; Copyright (C) 2000, 2001, 2004-2009 Free Software Foundation, Inc. ;; Copyright (C) 2000, 2001, 2004-2009 Free Software Foundation, Inc.

View file

@ -1,4 +1,4 @@
;;; make-deps.el --- compute make dependencies for Elisp sources ;;; make-deps.el --- compute make dependencies for Elisp sources -*- lexical-binding: t -*-
;; ;;
;; Copyright © Austin Clements ;; Copyright © Austin Clements
;; ;;

View file

@ -1,4 +1,4 @@
;;; notmuch-address.el --- address completion with notmuch ;;; notmuch-address.el --- address completion with notmuch -*- lexical-binding: t -*-
;; ;;
;; Copyright © David Edmondson ;; Copyright © David Edmondson
;; ;;

View file

@ -1,4 +1,4 @@
;;; notmuch-compat.el --- compatibility functions for earlier versions of emacs ;;; notmuch-compat.el --- compatibility functions for earlier versions of emacs -*- lexical-binding: t -*-
;; ;;
;; The functions in this file are copied from more modern versions of ;; The functions in this file are copied from more modern versions of
;; emacs and are Copyright (C) 1985-1986, 1992, 1994-1995, 1999-2017 ;; emacs and are Copyright (C) 1985-1986, 1992, 1994-1995, 1999-2017

View file

@ -1,4 +1,4 @@
;;; notmuch-crypto.el --- functions for handling display of cryptographic metadata ;;; notmuch-crypto.el --- functions for handling display of cryptographic metadata -*- lexical-binding: t -*-
;; ;;
;; Copyright © Jameson Rollins ;; Copyright © Jameson Rollins
;; ;;

View file

@ -1,4 +1,4 @@
;;; notmuch-draft.el --- functions for postponing and editing drafts ;;; notmuch-draft.el --- functions for postponing and editing drafts -*- lexical-binding: t -*-
;; ;;
;; Copyright © Mark Walters ;; Copyright © Mark Walters
;; Copyright © David Bremner ;; Copyright © David Bremner

View file

@ -1,4 +1,4 @@
;;; notmuch-hello.el --- welcome to notmuch, a frontend ;;; notmuch-hello.el --- welcome to notmuch, a frontend -*- lexical-binding: t -*-
;; ;;
;; Copyright © David Edmondson ;; Copyright © David Edmondson
;; ;;

View file

@ -1,4 +1,4 @@
;;; notmuch-jump.el --- User-friendly shortcut keys ;;; notmuch-jump.el --- User-friendly shortcut keys -*- lexical-binding: t -*-
;; ;;
;; Copyright © Austin Clements ;; Copyright © Austin Clements
;; ;;

View file

@ -1,4 +1,4 @@
;;; notmuch-lib.el --- common variables, functions and function declarations ;;; notmuch-lib.el --- common variables, functions and function declarations -*- lexical-binding: t -*-
;; ;;
;; Copyright © Carl Worth ;; Copyright © Carl Worth
;; ;;

View file

@ -1,4 +1,4 @@
;;; notmuch-maildir-fcc.el --- inserting using a fcc handler ;;; notmuch-maildir-fcc.el --- inserting using a fcc handler -*- lexical-binding: t -*-
;; Copyright © Jesse Rosenthal ;; Copyright © Jesse Rosenthal
;; ;;

View file

@ -1,4 +1,4 @@
;;; notmuch-message.el --- message-mode functions specific to notmuch ;;; notmuch-message.el --- message-mode functions specific to notmuch -*- lexical-binding: t -*-
;; ;;
;; Copyright © Jesse Rosenthal ;; Copyright © Jesse Rosenthal
;; ;;

View file

@ -1,4 +1,4 @@
;;; notmuch-mua.el --- emacs style mail-user-agent ;;; notmuch-mua.el --- emacs style mail-user-agent -*- lexical-binding: t -*-
;; ;;
;; Copyright © David Edmondson ;; Copyright © David Edmondson
;; ;;
@ -38,6 +38,11 @@
(declare-function notmuch-draft-postpone "notmuch-draft" ()) (declare-function notmuch-draft-postpone "notmuch-draft" ())
(declare-function notmuch-draft-save "notmuch-draft" ()) (declare-function notmuch-draft-save "notmuch-draft" ())
(defvar notmuch-show-indent-multipart)
(defvar notmuch-show-insert-header-p-function)
(defvar notmuch-show-max-text-part-size)
(defvar notmuch-show-insert-text/plain-hook)
;;; Options ;;; Options
(defcustom notmuch-mua-send-hook nil (defcustom notmuch-mua-send-hook nil

View file

@ -1,4 +1,4 @@
;;; notmuch-parser.el --- streaming S-expression parser ;;; notmuch-parser.el --- streaming S-expression parser -*- lexical-binding: t -*-
;; ;;
;; Copyright © Austin Clements ;; Copyright © Austin Clements
;; ;;

View file

@ -1,4 +1,4 @@
;;; notmuch-print.el --- printing messages from notmuch ;;; notmuch-print.el --- printing messages from notmuch -*- lexical-binding: t -*-
;; ;;
;; Copyright © David Edmondson ;; Copyright © David Edmondson
;; ;;

View file

@ -1,4 +1,4 @@
;;; notmuch-query.el --- provide an emacs api to query notmuch ;;; notmuch-query.el --- provide an emacs api to query notmuch -*- lexical-binding: t -*-
;; ;;
;; Copyright © David Bremner ;; Copyright © David Bremner
;; ;;

View file

@ -1,4 +1,4 @@
;;; notmuch-show.el --- displaying notmuch forests ;;; notmuch-show.el --- displaying notmuch forests -*- lexical-binding: t -*-
;; ;;
;; Copyright © Carl Worth ;; Copyright © Carl Worth
;; Copyright © David Edmondson ;; Copyright © David Edmondson
@ -59,6 +59,10 @@
(declare-function notmuch-read-query "notmuch" (prompt)) (declare-function notmuch-read-query "notmuch" (prompt))
(declare-function notmuch-draft-resume "notmuch-draft" (id)) (declare-function notmuch-draft-resume "notmuch-draft" (id))
(defvar shr-blocked-images)
(defvar gnus-blocked-images)
(defvar shr-content-function)
;;; Options ;;; Options
(defcustom notmuch-message-headers '("Subject" "To" "Cc" "Date") (defcustom notmuch-message-headers '("Subject" "To" "Cc" "Date")

View file

@ -1,4 +1,4 @@
;;; notmuch-tag.el --- tag messages within emacs ;;; notmuch-tag.el --- tag messages within emacs -*- lexical-binding: t -*-
;; ;;
;; Copyright © Damien Cassou ;; Copyright © Damien Cassou
;; Copyright © Carl Worth ;; Copyright © Carl Worth
@ -295,22 +295,24 @@ This can be used with `notmuch-tag-format-image-data'."
(and (eq (string-match key tag) 0) (and (eq (string-match key tag) 0)
(= (match-end 0) (length tag))))))) (= (match-end 0) (length tag)))))))
(defun notmuch-tag--do-format (tag formatted-tag formats) (defun notmuch-tag--do-format (bare-tag tag formats)
"Apply a tag-formats entry to TAG." "Apply a tag-formats entry to TAG."
(cond ((null formats) ;; - Tag not in `formats', (cond ((null formats) ;; - Tag not in `formats',
formatted-tag) ;; the format is the tag itself. tag) ;; the format is the tag itself.
((null (cdr formats)) ;; - Tag was deliberately hidden, ((null (cdr formats)) ;; - Tag was deliberately hidden,
nil) ;; no format must be returned nil) ;; no format must be returned
(t (t
;; Tag was found and has formats, we must apply all the ;; Tag was found and has formats, we must apply all the
;; formats. TAG may be null so treat that as a special case. ;; formats. TAG may be null so treat that as a special case.
(let ((bare-tag tag) (let ((return-tag (copy-sequence (or tag ""))))
(tag (copy-sequence (or formatted-tag ""))))
(dolist (format (cdr formats)) (dolist (format (cdr formats))
(setq tag (eval format))) (setq return-tag
(if (and (null formatted-tag) (equal tag "")) (eval format
`((bare-tag . ,bare-tag)
(tag . ,return-tag)))))
(if (and (null tag) (equal return-tag ""))
nil nil
tag))))) return-tag)))))
(defun notmuch-tag-format-tag (tags orig-tags tag) (defun notmuch-tag-format-tag (tags orig-tags tag)
"Format TAG according to `notmuch-tag-formats'. "Format TAG according to `notmuch-tag-formats'.

View file

@ -1,4 +1,4 @@
;;; notmuch-tree.el --- displaying notmuch forests ;;; notmuch-tree.el --- displaying notmuch forests -*- lexical-binding: t -*-
;; ;;
;; Copyright © Carl Worth ;; Copyright © Carl Worth
;; Copyright © David Edmondson ;; Copyright © David Edmondson

View file

@ -1,4 +1,4 @@
;;; notmuch-wash.el --- cleaning up message bodies ;;; notmuch-wash.el --- cleaning up message bodies -*- lexical-binding: t -*-
;; ;;
;; Copyright © Carl Worth ;; Copyright © Carl Worth
;; Copyright © David Edmondson ;; Copyright © David Edmondson

View file

@ -1,4 +1,4 @@
;;; notmuch.el --- run notmuch within emacs ;;; notmuch.el --- run notmuch within emacs -*- lexical-binding: t -*-
;; ;;
;; Copyright © Carl Worth ;; Copyright © Carl Worth
;; ;;