Add lexical-binding to all files and fix warnings

about free variables (declare) and unused lexical vars (prefix with "_").
This commit is contained in:
Thierry Volpiatto 2019-09-16 19:54:59 +02:00
parent 76e6ea256f
commit e4f5576cfc
No known key found for this signature in database
GPG Key ID: 28D17F5359F29997
14 changed files with 50 additions and 28 deletions

View File

@ -1,4 +1,4 @@
;;; mu4e-actions.el -- part of mu4e, the mu mail user agent
;;; mu4e-actions.el -- part of mu4e, the mu mail user agent -*- lexical-binding: t -*-
;;
;; Copyright (C) 2011-2019 Dirk-Jan C. Binnema
@ -36,6 +36,11 @@
(declare-function mu4e~proc-extract "mu4e-proc")
(declare-function mu4e-headers-search "mu4e-headers")
(defvar mu4e-headers-include-related)
(defvar mu4e-headers-show-threads)
(defvar mu4e-view-show-addresses)
(defvar mu4e-view-date-format)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun mu4e-action-count-lines (msg)

View File

@ -1,4 +1,4 @@
; mu4e-context.el -- part of mu4e, the mu mail user agent
; mu4e-context.el -- part of mu4e, the mu mail user agent -*- lexical-binding: t -*-
;;
;; Copyright (C) 2015-2016 Dirk-Jan C. Binnema
@ -27,6 +27,10 @@
(require 'cl-lib)
(require 'mu4e-utils)
(defvar mu4e-move-to-trash-patterns)
(defvar smtpmail-smtp-user)
(defvar mu4e-view-date-format)
(defvar mu4e-contexts nil "The list of `mu4e-context' objects
describing mu4e's contexts.")

View File

@ -1,4 +1,4 @@
;;; mu4e-contrib.el -- part of mu4e, the mu mail user agent
;;; mu4e-contrib.el -- part of mu4e, the mu mail user agent -*- lexical-binding: t -*-
;;
;; Copyright (C) 2013-2016 Dirk-Jan C. Binnema
@ -25,12 +25,14 @@
(require 'mu4e)
(defvar bookmark-make-record-function)
(defun mu4e-headers-mark-all-unread-read ()
"Put a ! \(read) mark on all visible unread messages."
(interactive)
(mu4e-headers-mark-for-each-if
(cons 'read nil)
(lambda (msg param)
(lambda (msg _param)
(memq 'unread (mu4e-msg-field msg :flags)))))
(defun mu4e-headers-flag-all-read ()
@ -46,7 +48,7 @@
(interactive)
(mu4e-headers-mark-for-each-if
(cons 'something nil)
(lambda (msg param) t))
(lambda (_msg _param) t))
(mu4e-mark-execute-all))
;;;

View File

@ -1,4 +1,4 @@
;; mu4e-draft.el -- part of mu4e, the mu mail user agent for emacs
;; mu4e-draft.el -- part of mu4e, the mu mail user agent for emacs -*- lexical-binding: t -*-
;;
;; Copyright (C) 2011-2019 Dirk-Jan C. Binnema
@ -77,6 +77,8 @@ If nil, only do so when sending the message."
(format "mu4e %s; emacs %s" mu4e-mu-version emacs-version)
"The User-Agent string for mu4e, or nil.")
(defvar mu4e-view-date-format)
(defun mu4e~draft-cite-original (msg)
"Return a cited version of the original message MSG as a plist.
This function uses `mu4e-compose-cite-function', and as such all
@ -413,9 +415,6 @@ You can append flags."
Replying-to-self is special; in that case, the To and Cc fields
will be the same as in the original."
(let* ((reply-to-self (mu4e-message-contact-field-matches-me origmsg :from))
(recipnum
(+ (length (mu4e~draft-create-to-lst origmsg))
(length (mu4e~draft-create-cc-lst origmsg t))))
;; reply-to-self implies reply-all
(reply-all (or reply-to-self
(eq mu4e-compose-reply-recipients 'all)

View File

@ -1,4 +1,4 @@
;;; mu4e-icalendar.el --- reply to iCalendar meeting requests (part of mu4e) -*- lexical-binding: t; -*-
;;; mu4e-icalendar.el --- reply to iCalendar meeting requests (part of mu4e) -*- lexical-binding: t; -*- -*- lexical-binding: t -*-
;;
;; Copyright (C) 2019- Christophe Troestler

View File

@ -1,4 +1,4 @@
;;; mu4e-lists.el -- part of mu4e, the mu mail user agent
;;; mu4e-lists.el -- part of mu4e, the mu mail user agent -*- lexical-binding: t -*-
;;
;; Copyright (C) 2011-2016 Dirk-Jan C. Binnema

View File

@ -1,4 +1,4 @@
;; mu4e-mark.el -- part of mu4e, the mu mail user agent
;; mu4e-mark.el -- part of mu4e, the mu mail user agent -*- lexical-binding: t -*-
;;
;; Copyright (C) 2011-2019 Dirk-Jan C. Binnema
@ -356,7 +356,7 @@ user which one)."
(let ((markpair))
(maphash
(lambda (docid val)
(let ((mark (car val)) (target (cdr val)))
(let ((mark (car val)))
(when (eql mark 'something)
(unless markpair
(setq markpair
@ -421,7 +421,7 @@ If NO-CONFIRMATION is non-nil, don't ask user for confirmation."
(when (or (null mu4e~mark-map) (zerop (hash-table-count mu4e~mark-map)))
(mu4e-warn "Nothing is marked"))
(maphash
(lambda (docid val)
(lambda (docid _val)
(save-excursion
(when (mu4e~headers-goto-docid docid)
(mu4e-mark-set 'unmark))))

View File

@ -1,4 +1,4 @@
;;; mu4e-message.el -- part of mu4e, the mu mail user agent
;;; mu4e-message.el -- part of mu4e, the mu mail user agent -*- lexical-binding: t -*-
;;
;; Copyright (C) 2012-2018 Dirk-Jan C. Binnema
@ -30,6 +30,9 @@
(require 'mu4e-utils)
(require 'flow-fill)
(defvar mu4e~view-message)
(defvar shr-inhibit-images)
(defcustom mu4e-html2text-command
(if (fboundp 'shr-insert-document)
'mu4e-shr2text
@ -231,7 +234,7 @@ unless PREFER-HTML is non-nil."
(setq body (funcall func msg body)))
body))
(defun mu4e-message-outlook-cleanup (msg body)
(defun mu4e-message-outlook-cleanup (_msg body)
"Clean-up MSG's BODY.
Esp. MS-Outlook-originating message may not advertise the correct
encoding (e.g. 'iso-8859-1' instead of 'windows-1252'), thus
@ -331,7 +334,7 @@ Emacs. Based on code by Titus von der Malsburg."
(shr-inhibit-images t))
(shr-render-region (point-min) (point-max)))) msg))
(defun mu4e~html2text-shell (msg cmd)
(defun mu4e~html2text-shell (msg _cmd)
"Convert html2 text in MSG using a shell function CMD."
(mu4e~html2text-wrapper
(lambda ()

View File

@ -1,4 +1,4 @@
;; mu4e-proc.el -- part of mu4e, the mu mail user agent
;; mu4e-proc.el -- part of mu4e, the mu mail user agent -*- lexical-binding: t -*-
;;
;; Copyright (C) 2011-2019 Dirk-Jan C. Binnema
@ -92,7 +92,7 @@ removed."
(car objcons)))))))
(defun mu4e~proc-filter (proc str)
(defun mu4e~proc-filter (_proc str)
"Filter string STR from PROC.
This process the the 'mu server' output. It accumulates the
strings into valid sexps by checking of the ';;eox' `end-of-sexp'
@ -287,7 +287,7 @@ Start the process if needed."
;; error codes are defined in src/mu-util
;;(defconst mu4e-xapian-empty 19 "Error code: xapian is empty/non-existent")
(defun mu4e~proc-sentinel (proc msg)
(defun mu4e~proc-sentinel (proc _msg)
"Function called when the server process PROC terminates with MSG."
(let ((status (process-status proc)) (code (process-exit-status proc)))
(setq mu4e~proc-process nil)

View File

@ -1,4 +1,4 @@
;;; mu4e-speedbar --- Speedbar support for mu4e
;;; mu4e-speedbar --- Speedbar support for mu4e -*- lexical-binding: t -*-
;; Copyright (C) 2012-2018 Antono Vasiljev, Dirk-Jan C. Binnema
;;
@ -88,7 +88,7 @@
maildir-name))
(mu4e-get-maildirs)))))
(defun mu4e~speedbar-maildir (&optional text token ident)
(defun mu4e~speedbar-maildir (&optional _text token _ident)
"Jump to maildir TOKEN. TEXT and INDENT are not used."
(dframe-with-attached-buffer
(mu4e-headers-search (concat "\"maildir:" token "\"")
@ -106,13 +106,13 @@
(mu4e-bookmark-query bookmark)))
(mu4e-bookmarks)))
(defun mu4e~speedbar-bookmark (&optional text token ident)
(defun mu4e~speedbar-bookmark (&optional _text token _ident)
"Run bookmarked query TOKEN. TEXT and INDENT are not used."
(dframe-with-attached-buffer
(mu4e-headers-search token current-prefix-arg)))
;;;###autoload
(defun mu4e-speedbar-buttons (&optional buffer)
(defun mu4e-speedbar-buttons (&optional _buffer)
"Create buttons for any mu4e BUFFER."
(interactive)
(erase-buffer)

View File

@ -1,4 +1,4 @@
;;; mu4e-vars.el -- part of mu4e, the mu mail user agent
;;; mu4e-vars.el -- part of mu4e, the mu mail user agent -*- lexical-binding: t -*-
;;
;; Copyright (C) 2011-2019 Dirk-Jan C. Binnema

View File

@ -1,4 +1,4 @@
;;; mu4e.el --- part of mu4e, the mu mail user agent
;;; mu4e.el --- part of mu4e, the mu mail user agent -*- lexical-binding: t -*-
;;
;; Copyright (C) 2011-2016 Dirk-Jan C. Binnema

View File

@ -1,4 +1,4 @@
;;; org-mu4e -- Support for links to mu4e messages/queries from within
;;; org-mu4e -- Support for links to mu4e messages/queries from within -*- lexical-binding: t -*-
;;; org-mode, and for writing message in org-mode, sending them as
;;; rich-text
;;
@ -39,6 +39,10 @@
(declare-function mu4e-message "mu4e-message")
(declare-function mu4e-compose-mode "mu4e-compose")
(defvar org-export-skip-text-before-1st-heading)
(defvar org-export-htmlize-output-type)
(defvar org-export-preserve-breaks)
(defvar org-export-with-LaTeX-fragments)
(defgroup org-mu4e nil
"Settings for the org-mode related functionality in mu4e."

View File

@ -1,4 +1,4 @@
;;; org-mu4e -- Support for links to mu4e messages/queries from within org-mode,
;;; org-mu4e -- Support for links to mu4e messages/queries from within org-mode, -*- lexical-binding: t -*-
;;; and for writing message in org-mode, sending them as rich-text
;;
;; Copyright (C) 2012-2016 Dirk-Jan C. Binnema
@ -34,6 +34,11 @@
(require 'org nil 'noerror)
(require 'org-exp nil 'noerror)
(defvar org-export-skip-text-before-1st-heading)
(defvar org-export-htmlize-output-type)
(defvar org-export-preserve-breaks)
(defvar org-export-with-LaTeX-fragments)
(require 'mu4e)
(defgroup org-mu4e nil