emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/vm 89cfe9aa55 20/20: Merge branch 'activate-lexical-bindin


From: ELPA Syncer
Subject: [nongnu] elpa/vm 89cfe9aa55 20/20: Merge branch 'activate-lexical-binding' into 'main'
Date: Mon, 22 Jul 2024 13:02:30 -0400 (EDT)

branch: elpa/vm
commit 89cfe9aa550f6938b8f574908055d7c6cf8a40bc
Merge: ae8ec0e7f5 5a45e15c4b
Author: Mark Diekhans <markd@ucsc.edu>
Commit: Mark Diekhans <markd@ucsc.edu>

    Merge branch 'activate-lexical-binding' into 'main'
    
    Activate `lexical-binding`
    
    See merge request emacs-vm/vm!15
---
 contrib/org-html-mail.el                        |   7 +-
 contrib/org-vm.el                               |   5 +-
 contrib/vm-blueman.el                           |  12 ++-
 contrib/vm-bogofilter.el                        |   5 +-
 contrib/vm-mime-display-internal-application.el |   6 +-
 contrib/vm-sumurg.el                            |  19 ++--
 lisp/tapestry.el                                |   2 +-
 lisp/u-vm-color.el                              |   2 +-
 lisp/vcard.el                                   |   4 +-
 lisp/vm-autoload.el                             |   2 +-
 lisp/vm-avirtual.el                             |   6 +-
 lisp/vm-biff.el                                 |   2 +-
 lisp/vm-build.el                                |   5 +-
 lisp/vm-crypto.el                               |   2 +-
 lisp/vm-delete.el                               |   2 +-
 lisp/vm-digest.el                               |  10 +-
 lisp/vm-dired.el                                |   2 +-
 lisp/vm-edit.el                                 |   6 +-
 lisp/vm-folder.el                               |  46 ++++-----
 lisp/vm-grepmail.el                             |  11 ++-
 lisp/vm-imap.el                                 | 120 ++++++++++++------------
 lisp/vm-license.el                              |   2 +-
 lisp/vm-macro.el                                |  34 ++++++-
 lisp/vm-mark.el                                 |   4 +-
 lisp/vm-menu.el                                 |   4 +-
 lisp/vm-message-history.el                      |   5 +-
 lisp/vm-message.el                              |   4 +-
 lisp/vm-mime.el                                 | 108 +++++++++++----------
 lisp/vm-minibuf.el                              |   2 +-
 lisp/vm-misc.el                                 |  27 +++++-
 lisp/vm-motion.el                               |   2 +-
 lisp/vm-mouse.el                                |  10 +-
 lisp/vm-page.el                                 |  12 ++-
 lisp/vm-pcrisis.el                              |   4 +-
 lisp/vm-pgg.el                                  |   4 +-
 lisp/vm-pine.el                                 |   7 +-
 lisp/vm-pop.el                                  |  22 +++--
 lisp/vm-ps-print.el                             |   5 +-
 lisp/vm-reply.el                                |  60 +++++++-----
 lisp/vm-rfaddons.el                             |  29 +++---
 lisp/vm-save.el                                 |  34 +++----
 lisp/vm-search.el                               |   2 +-
 lisp/vm-serial.el                               |   4 +-
 lisp/vm-smime.el                                |   4 +-
 lisp/vm-sort.el                                 |   8 +-
 lisp/vm-startup.el                              |   2 +-
 lisp/vm-summary-faces.el                        |   2 +-
 lisp/vm-summary.el                              |  42 +++++----
 lisp/vm-thread.el                               |  36 +++----
 lisp/vm-toolbar.el                              |   8 +-
 lisp/vm-undo.el                                 |  10 +-
 lisp/vm-user.el                                 |   2 +-
 lisp/vm-vars.el                                 |   4 +-
 lisp/vm-vcard.el                                |   2 +-
 lisp/vm-version.el                              |   2 +-
 lisp/vm-virtual.el                              |  18 ++--
 lisp/vm-w3.el                                   |   2 +-
 lisp/vm-w3m.el                                  |   9 +-
 lisp/vm-window.el                               |   6 +-
 lisp/vm.el                                      |   6 +-
 60 files changed, 469 insertions(+), 355 deletions(-)

diff --git a/contrib/org-html-mail.el b/contrib/org-html-mail.el
index 94b67413e3..4a09a11ee3 100644
--- a/contrib/org-html-mail.el
+++ b/contrib/org-html-mail.el
@@ -1,4 +1,4 @@
-;; Copyright © 2008  Eric Schulte
+;; Copyright © 2008  Eric Schulte  -*- lexical-binding: t; -*-
 ;;
 ;; WYSWYG, html mail composition using orgmode
 ;;
@@ -29,6 +29,11 @@
 (require 'org-macs)
 (require 'vm-misc)
 
+(defvar orgstruct-mode)
+(defvar org-export-skip-text-before-1st-heading)
+(defvar org-export-preserve-breaks)
+(defvar org-local-vars)
+
 (defun orgstruct-hijacker-command-21 (arg)
   "In Structure, run `org-ctrl-c-ctrl-c'. Outside of Structure
 check for a prefix argument and if buffer name contains `mail',
diff --git a/contrib/org-vm.el b/contrib/org-vm.el
index e827bcb20b..a21e24eaf1 100644
--- a/contrib/org-vm.el
+++ b/contrib/org-vm.el
@@ -1,7 +1,6 @@
-;;; org-vm.el --- Support for links to VM messages from within Org-mode
+;;; org-vm.el --- Support for links to VM messages from within Org-mode  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010
-;;   Free Software Foundation, Inc.
+;; Copyright (C) 2004-2024  Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;;        Uday S Reddy <reddyuday at launchpad dot net>
diff --git a/contrib/vm-blueman.el b/contrib/vm-blueman.el
index d904be827c..29e84baffb 100644
--- a/contrib/vm-blueman.el
+++ b/contrib/vm-blueman.el
@@ -1,4 +1,4 @@
-;From: blueman <NOSPAM@nospam.com>
+;From: blueman <NOSPAM@nospam.com>  -*- lexical-binding: t; -*-
 ;Subject: Function to fit displayed mime images to width
 ;Newsgroups: gnu.emacs.vm.info
 ;Date: Tue, 12 Dec 2006 18:07:44 GMT
@@ -33,6 +33,8 @@
 ;; Functionality to add above function to standard attachment menu
 (add-hook 'vm-menu-setup-hook 
          (lambda ()
+           (defvar vm-menu-fsfemacs-image-menu)
+           (defvar vm-menu-fsfemacs-attachment-menu)
                (require 'easymenu)
                (easy-menu-add-item vm-menu-fsfemacs-image-menu
                     nil
@@ -88,6 +90,9 @@
 
 ;Note this runs the users local fetchmail process as configured by
 ;~/.fetchmailrc
+(defvar vm-fetchmail-function "/usr/bin/fetchmail"
+"Function used to fetch remote mail (JJK)")
+
 (defun vm-fetchmail ()
 "*Fetch mail asynchronously from remote server (JJK)"
   (interactive)
@@ -99,10 +104,7 @@
        (vm-inform 5 "Fetching new mail..."))
    (t (error "Error: Fetchmail not found on system!"))))
 
-(defvar vm-fetchmail-function "/usr/bin/fetchmail"
-"Function used to fetch remote mail (JJK)")
-
-(defun vm-fetchmail-sentinel (process status)
+(defun vm-fetchmail-sentinel (_process status)
   (beep t)
   (setq status (substring status -2 -1))
   (vm-inform 5 "Finished fetching... %s"
diff --git a/contrib/vm-bogofilter.el b/contrib/vm-bogofilter.el
index ae8cf8b655..e2901bcea9 100644
--- a/contrib/vm-bogofilter.el
+++ b/contrib/vm-bogofilter.el
@@ -1,4 +1,4 @@
-;;; vm-bogofilter.el version 1.1.4
+;;; vm-bogofilter.el version 1.1.4  -*- lexical-binding: t; -*-
 ;;
 ;; An interface between the VM mail reader and the bogofilter spam filter.
 ;;
@@ -361,8 +361,7 @@ vm-retrieved-spooled-mail-hook."
              (vm-inform 6 "%s: Message re-classified as %s, updating tag."
                         (buffer-name) text)
              ))
-       (let ((buffer-read-only nil)
-             (buffer (get-buffer-create "*Shell Command Output*")))
+       (let ((buffer-read-only nil))
          (call-process-region (point-min) (point-max)
                               (or shell-file-name "sh")
                               nil t nil shell-command-switch
diff --git a/contrib/vm-mime-display-internal-application.el 
b/contrib/vm-mime-display-internal-application.el
index f65e11581c..e9caee3732 100644
--- a/contrib/vm-mime-display-internal-application.el
+++ b/contrib/vm-mime-display-internal-application.el
@@ -1,7 +1,6 @@
-;;; vm-mime-display-internal-application.el --- Display application attachments
-;;; -*-unibyte: t; coding: iso-8859-1;-*-
+;;; vm-mime-display-internal-application.el --- Display application 
attachments  -*- lexical-binding: t; -*-
 
-;; Copyright � 2004 Kevin Rodgers
+;; Copyright © 2004 Kevin Rodgers
 
 ;; Author: Kevin Rodgers <ihs_4664@yahoo.com>
 ;; Created: 11 Jun 2004
@@ -135,6 +134,7 @@ See `vm-mime-internal-application-subtypes'.")
     (put (vm-mm-layout-cache layout)
          'vm-mime-display-internal-application/xxxx
          tempfile)
+    (defvar inhibit-local-variables) ;; FIXME: Unknown var.  XEmacs, maybe?
     (let* ((inhibit-local-variables t)
            (enable-local-variables nil)
            (enable-local-eval nil)
diff --git a/contrib/vm-sumurg.el b/contrib/vm-sumurg.el
index 00f76a0da3..e2dc5bfb99 100644
--- a/contrib/vm-sumurg.el
+++ b/contrib/vm-sumurg.el
@@ -1,4 +1,4 @@
-;; $Header: /home/jcb/Source/Emacs/RCS/vm-sumurg.el,v 1.30 2011/12/19 14:55:59 
jcb Exp $
+;; $Header: /home/jcb/Source/Emacs/RCS/vm-sumurg.el,v 1.30 2011/12/19 14:55:59 
jcb Exp $  -*- lexical-binding: t; -*-
 ;;; vm-sumurg.el -- Adding urgency indicators to summary
 ;; 
 ;; This file is an add-on for VM
@@ -106,11 +106,13 @@
 
 ; assuming that m is a message, highlight it in yellow, orange or red
 ; according as it has a *, **, or *** label.
-(defun vm-sumurg-highlight-message (&rest _)
+(defun vm-sumurg--highlight-message (m)
   (vm-sumurg-add-highlights (string-to-number (vm-number-of m))
                            (vm-su-start-of m) (vm-su-end-of m)
                            (vm-sumurg-level-of m) 
                            ))
+(defun vm-sumurg-highlight-message (&rest _)
+  (vm-sumurg--highlight-message m)) ;FIXME: dynbind!
 
 (advice-add 'vm-summary-highlight-region :after #'vm-sumurg-highlight-message)
 
@@ -478,7 +480,9 @@
 ;; hook into vm mode to set the modeline format
 (defun vm-sumurg-vm-mode-hook-fn ()
   (setq vm-ml-sumurg-extent (make-extent nil nil))
-  (setq modeline-format (vm-sumurg-munge-modeline modeline-format)))
+  (if (boundp 'modeline-format) ;; FIXME: XEmacs?
+      (setq modeline-format (vm-sumurg-munge-modeline modeline-format))
+    (setq mode-line-format (vm-sumurg-munge-modeline mode-line-format))))
 
 (add-hook 'vm-mode-hook ' vm-sumurg-vm-mode-hook-fn)
 (add-hook 'vm-presentation-mode-hook ' vm-sumurg-vm-mode-hook-fn)
@@ -529,7 +533,7 @@
            (aset vm-sumurg-urgency-array i 0))
          (setq i (1+ i)))
        (mapcar (lambda (m) 
-                 (vm-sumurg-check-future m) (vm-sumurg-highlight-message))
+                 (vm-sumurg-check-future m) (vm-sumurg--highlight-message m))
                m-list)))))
   
 (add-hook 'vm-summary-update-hook 'vm-sumurg-highlight-message)
@@ -541,7 +545,7 @@
 (defvar vm-sumurg-blinker-blink nil)
 (defvar vm-sumurg-blinker-timeout-id nil)
 (defvar vm-sumurg-blinker-in-focus nil)
-(defun vm-sumurg-blinker-callback (junk)
+(defun vm-sumurg-blinker-callback (_junk)
   (if vm-sumurg-blinker-in-focus
       (if vm-sumurg-blinker-blink
          (progn (setq vm-sumurg-blinker-blink nil)
@@ -722,7 +726,7 @@ happens later.)"
 ;    (let ((m (car vm-message-pointer)))
 ;      (save-excursion
 ;      (set-buffer vm-summary-buffer)
-;      (vm-sumurg-highlight-message))))
+;      (vm-sumurg--highlight-message m))))
 ;    (let ((modified (buffer-modified-p)))
 ;      (set-buffer-modified-p t)
 ;      (vm-do-needed-mode-line-update)
@@ -734,7 +738,8 @@ happens later.)"
   "Make a virtual folder containing messages whose urgency is greater
 than or equal to the given value (prompted for, when interactive)."
   (interactive "nUrgency level (1-4): ")
-  (if (or (< level 1) (> level 4)) (error "%d is not a known urgency level"))
+  (if (or (< level 1) (> level 4))
+      (error "%d is not a known urgency level" level))
   (vm-select-folder-buffer)
   (vm-check-for-killed-summary)
   (vm-error-if-folder-empty)
diff --git a/lisp/tapestry.el b/lisp/tapestry.el
index b363b619e9..06b7cb5cf4 100644
--- a/lisp/tapestry.el
+++ b/lisp/tapestry.el
@@ -1,4 +1,4 @@
-;;; tapestry.el --- Tools to configure your GNU Emacs windows
+;;; tapestry.el --- Tools to configure your GNU Emacs windows  -*- 
lexical-binding: t; -*-
 ;;
 ;; This file is part of VM
 ;;
diff --git a/lisp/u-vm-color.el b/lisp/u-vm-color.el
index f83374c7a0..073300ae4e 100644
--- a/lisp/u-vm-color.el
+++ b/lisp/u-vm-color.el
@@ -1,4 +1,4 @@
-;;; u-vm-color.el --- Font-lock support for VM.
+;;; u-vm-color.el --- Font-lock support for VM  -*- lexical-binding: t; -*-
 ;;
 ;; This file is an add-on for VM
 
diff --git a/lisp/vcard.el b/lisp/vcard.el
index 3b3d8e6332..0467b804c8 100644
--- a/lisp/vcard.el
+++ b/lisp/vcard.el
@@ -1,4 +1,4 @@
-;;; vcard.el --- vcard parsing and display routines
+;;; vcard.el --- vcard parsing and display routines  -*- lexical-binding: t; 
-*-
 ;;
 ;; This file is not part of VM; it is a utility used there.
 ;;
@@ -424,7 +424,7 @@ that element should never be deleted since it is the 
primary key."
 ;; useless for interoperability between MUAs.
 ;;
 ;; This filter does a very rudimentary job.
-(defun vcard-filter-html (proplist values)
+(defun vcard-filter-html (_proplist values)
   "Remove HTML tags from attribute values."
   (save-match-data
     (while values
diff --git a/lisp/vm-autoload.el b/lisp/vm-autoload.el
index 9ed5715ae3..10e61ebbf6 100644
--- a/lisp/vm-autoload.el
+++ b/lisp/vm-autoload.el
@@ -1,4 +1,4 @@
-;; only for compatibility with older BBDB and others
+;; only for compatibility with older BBDB and others  -*- lexical-binding: t; 
-*-
 
 (if (not (featurep 'xemacs))
    (require 'vm-autoloads))
diff --git a/lisp/vm-avirtual.el b/lisp/vm-avirtual.el
index 9dcbe3a8e8..436fa0a90a 100644
--- a/lisp/vm-avirtual.el
+++ b/lisp/vm-avirtual.el
@@ -1,4 +1,4 @@
-;;; vm-avirtual.el --- additional functions for virtual folder selectors
+;;; vm-avirtual.el --- additional functions for virtual folder selectors  -*- 
lexical-binding: t; -*-
 ;;
 ;; This file is an add-on for VM
 ;; 
@@ -146,6 +146,8 @@
       (setq feature-list (cdr feature-list)))))
 
 (defvar bbdb-get-addresses-headers)    ; dummy declaration
+(defvar bbdb-user-mail-names)
+(defvar bbdb-get-only-first-address-p)
 
 ;;----------------------------------------------------------------------------
 (defvar vm-mail-virtual-selector-function-alist
@@ -490,7 +492,7 @@ in BBDB."
     (not result)))
 
 ;; return just nil for those selectors not known for mail-mode
-(defun vm-mail-vs-unknown (&optional arg)
+(defun vm-mail-vs-unknown (&optional _arg)
   nil)
 
 (defun vm-mail-vs-any ()
diff --git a/lisp/vm-biff.el b/lisp/vm-biff.el
index 2cc4a9f684..dd7fafc094 100644
--- a/lisp/vm-biff.el
+++ b/lisp/vm-biff.el
@@ -1,4 +1,4 @@
-;;; vm-biff.el --- a xlbiff like tool for VM
+;;; vm-biff.el --- a xlbiff like tool for VM  -*- lexical-binding: t; -*-
 ;;
 ;; This file is an add-on for VM
 ;; 
diff --git a/lisp/vm-build.el b/lisp/vm-build.el
index 93709f1ee0..e7927fc4ca 100644
--- a/lisp/vm-build.el
+++ b/lisp/vm-build.el
@@ -1,4 +1,4 @@
-;; Add the current dir to the load-path
+;; Add the current dir to the load-path  -*- lexical-binding: t; -*-
 (setq load-path (cons default-directory load-path))
 ;(setq debug-on-error t)
 (setq debug-ignored-errors nil)
@@ -69,6 +69,7 @@
 
 
 (defun vm-custom-make-dependencies ()
+  (defvar generated-custom-dependencies-file)
   (if (load-library "cus-dep")
       (if (functionp 'Custom-make-dependencies)
          (Custom-make-dependencies)
@@ -87,6 +88,8 @@
         (error "Built directory %S does not exist!" source-dir))
     (message "Building autoloads file %S\nin directory %S." autoloads-file 
source-dir)
     (load-library "autoload")
+    (defvar generated-autoload-file)
+    (defvar autoload-package-name) ;; FIXME: XEmacs?
     (set-buffer (find-file-noselect autoloads-file))
     (erase-buffer)
     (setq generated-autoload-file autoloads-file)
diff --git a/lisp/vm-crypto.el b/lisp/vm-crypto.el
index 0b00018961..950d350275 100644
--- a/lisp/vm-crypto.el
+++ b/lisp/vm-crypto.el
@@ -1,4 +1,4 @@
-;;; vm-crypto.el --- Encryption and related functions for VM
+;;; vm-crypto.el --- Encryption and related functions for VM  -*- 
lexical-binding: t; -*-
 ;;
 ;; This file is part of VM
 ;;
diff --git a/lisp/vm-delete.el b/lisp/vm-delete.el
index 2414d94af7..ef886edcae 100644
--- a/lisp/vm-delete.el
+++ b/lisp/vm-delete.el
@@ -1,4 +1,4 @@
-;;; vm-delete.el --- Delete and expunge commands for VM.
+;;; vm-delete.el --- Delete and expunge commands for VM  -*- lexical-binding: 
t; -*-
 ;;
 ;; This file is part of VM
 ;;
diff --git a/lisp/vm-digest.el b/lisp/vm-digest.el
index 79dd75bb8d..47d7b5df25 100644
--- a/lisp/vm-digest.el
+++ b/lisp/vm-digest.el
@@ -1,4 +1,4 @@
-;;; vm-digest.el --- Message encapsulation
+;;; vm-digest.el --- Message encapsulation  -*- lexical-binding: t; -*-
 ;;
 ;; This file is part of VM
 ;;
@@ -34,7 +34,7 @@
 (declare-function vm-yank-message "vm-reply" (message))
 
 ;;;###autoload
-(defun vm-no-frills-encapsulate-message (m keep-list discard-regexp)
+(defun vm-no-frills-encapsulate-message (m _keep-list _discard-regexp)
   "Encapsulate a message M for forwarding, simply.
 No message encapsulation standard is used.  The message is
 inserted at point in the current buffer, surrounded by two dashed
@@ -116,7 +116,7 @@ If multipart/digest encapsulation is done, the function 
returns
 the multipart boundary parameter (string) that should be used in
 the Content-Type header.  Otherwise nil is returned."
   (if message-list
-      (let ((target-buffer (current-buffer))
+      (let (;; (target-buffer (current-buffer))
            (boundary-positions nil)
            (mlist message-list)
            (boundary nil)
@@ -739,7 +739,7 @@ burst."
   (or digest-type (setq digest-type vm-digest-burst-type))
   (vm-follow-summary-cursor)
   (vm-select-folder-buffer-and-validate 1 (vm-interactive-p))
-  (let ((start-buffer (current-buffer)) m totals-blurb
+  (let ((start-buffer (current-buffer)) m ;; totals-blurb
        (mlist (vm-select-operable-messages
                1 (vm-interactive-p) "Burst digest of"))
        (work-buffer nil))
@@ -822,7 +822,7 @@ Returns either \"rfc934\", \"rfc1153\" or \"mime\"."
              (t "rfc934"))))))
 
 (defun vm-digest-get-header-contents (header-name-regexp)
-  (let ((contents nil)
+  (let (;; (contents nil)
        regexp)
     (setq regexp (concat "^\\(" header-name-regexp "\\)\\|\\(^$\\)"))
     (save-excursion
diff --git a/lisp/vm-dired.el b/lisp/vm-dired.el
index 81404ee5d4..21db23b0d4 100644
--- a/lisp/vm-dired.el
+++ b/lisp/vm-dired.el
@@ -1,4 +1,4 @@
-;;; vm-dired.el --- VM interface to dired
+;;; vm-dired.el --- VM interface to dired  -*- lexical-binding: t; -*-
 ;;
 ;; This file is part of VM
 ;;
diff --git a/lisp/vm-edit.el b/lisp/vm-edit.el
index 78dce145d3..35181198e0 100644
--- a/lisp/vm-edit.el
+++ b/lisp/vm-edit.el
@@ -1,4 +1,4 @@
-;;; vm-edit.el --- Editing VM messages
+;;; vm-edit.el --- Editing VM messages  -*- lexical-binding: t; -*-
 ;;
 ;; This file is part of VM
 ;;
@@ -267,9 +267,9 @@ thread have their cached data discarded."
           (widen)
           (goto-char (vm-headers-of (vm-real-message-of (car mp))))
           (let ((vm-message-pointer mp)
-                opoint
+                ;; opoint
                 (buffer-read-only nil))
-            (setq opoint (point))
+            ;; (setq opoint (point))
             (insert-buffer-substring edit-buf)
             (delete-region
              (point) (vm-text-end-of (vm-real-message-of (car mp))))
diff --git a/lisp/vm-folder.el b/lisp/vm-folder.el
index ac13ba2075..c3efcab644 100644
--- a/lisp/vm-folder.el
+++ b/lisp/vm-folder.el
@@ -1,4 +1,4 @@
-;;; vm-folder.el --- VM folder related functions
+;;; vm-folder.el --- VM folder related functions  -*- lexical-binding: t; -*-
 ;;
 ;; This file is part of VM
 ;;
@@ -1757,7 +1757,7 @@ Supports version 4 format of attribute storage, for 
backward compatibility."
 (defun vm-gobble-last-modified ()
   (let ((case-fold-search t)
        (time nil)
-       time lim oldpoint)
+       lim oldpoint)
     (save-excursion
       (save-restriction
        (widen)
@@ -2018,7 +2018,7 @@ Supports version 4 format of attribute storage, for 
backward compatibility."
 
 (defun vm-has-message-order ()
   (let ((case-fold-search t)
-       lim order)
+       lim) ;; order
     (save-excursion
       (save-restriction
        (widen)
@@ -3243,7 +3243,7 @@ thread are affected."
   (interactive "p")
   (or count (setq count 1))
   (let ((used-marks (eq last-command 'vm-next-command-uses-marks))
-        (del-count 0))
+        ) ;; (del-count 0)
     (vm-follow-summary-cursor)
     (vm-select-folder-buffer-and-validate 1 (vm-interactive-p))
     (let ((mlist (vm-select-operable-messages
@@ -3276,9 +3276,9 @@ Buffer Menu."
   (if (not (memq major-mode '(vm-mode vm-virtual-mode)))
       (error "%s must be invoked from a VM buffer." this-command))
 
-  (let ((virtual (eq major-mode 'vm-virtual-mode))
-       (no-expunge t)
-       (no-change nil))
+  (vm--dlet ((virtual (eq major-mode 'vm-virtual-mode))
+            (no-expunge t)
+            (no-change nil))
     (save-excursion (run-hooks 'vm-quit-hook)))
 
   (vm-garbage-collect-message)
@@ -3305,9 +3305,9 @@ The folder is not altered and Emacs is still visiting it."
   (if (not (memq major-mode '(vm-mode vm-virtual-mode)))
       (error "%s must be invoked from a VM buffer." this-command))
 
-  (let ((virtual (eq major-mode 'vm-virtual-mode))
-       (no-expunge t)
-       (no-change nil))
+  (vm--dlet ((virtual (eq major-mode 'vm-virtual-mode))
+            (no-expunge t)
+            (no-change nil))
     (save-excursion (run-hooks 'vm-quit-hook)))
 
   (vm-garbage-collect-message)
@@ -3478,7 +3478,7 @@ changes should be discarded."
   (cond ((and (not (natnump vm-flush-interval))
              (not (natnump vm-auto-get-new-mail))
              (not (natnump vm-mail-check-interval))))
-       ((condition-case data
+       ((condition-case _data
             (progn (require 'itimer) t)
           (error nil))
         (when (and (natnump vm-flush-interval) (not (get-itimer "vm-flush")))
@@ -3494,7 +3494,7 @@ changes should be discarded."
                    (not (get-itimer "vm-check-mail")))
           (start-itimer "vm-check-mail" 'vm-check-mail-itimer-function
                         vm-mail-check-interval nil)))
-       ((condition-case data
+       ((condition-case _data
             (progn (require 'timer) t)
           (error nil))
         (let (timer)
@@ -3811,7 +3811,7 @@ folder."
   (if (eq major-mode 'vm-virtual-mode)
       (vm-virtual-save-folder prefix)
     (if (buffer-modified-p)
-       (let (mp (newlist nil) (buffer-undo-list t))
+       (let ((buffer-undo-list t)) ;; (mp nil) (newlist nil)
          (when vm-expunge-before-save
            (vm-expunge-folder))
          (cond ((eq vm-folder-access-method 'pop)
@@ -3925,6 +3925,8 @@ run `vm-expunge-folder' followed by `vm-save-folder'."
        (vm-expunge-folder :quiet t)))
   (vm-save-folder prefix))
 
+(defvar inhibit-local-variables) ;; FIXME: Unknown var.  XEmacs, maybe?
+
 ;;;###autoload
 (defun vm-read-folder (folder &optional remote-spec folder-name)
   "Reads the FOLDER from the file system and creates a buffer.
@@ -4424,7 +4426,7 @@ interactive queries to the user.  The possible values are 
t,
          (vm-imap-ok-to-ask interactive)
          ;; for string-match calls below
          (case-fold-search nil)
-         non-file-maildrop crash in safe-maildrop maildrop popdrop
+         non-file-maildrop crash in safe-maildrop maildrop ;; popdrop
          retrieval-function
          (got-mail nil))
       (if (and (not (verify-visited-file-modtime (current-buffer)))
@@ -5076,7 +5078,7 @@ Interactively TYPE will be read from the minibuffer."
        (n 0)
        ;; Just for laughs, make the update interval vary.
        (modulus (+ (% (vm-abs (random)) 11) 5))
-       text-end opoint)
+       text-end) ;; opoint
     (save-excursion
       (save-restriction
        (widen)
@@ -5085,7 +5087,7 @@ Interactively TYPE will be read from the minibuffer."
        (vm-convert-folder-header old-type type)
        (while mp
         (goto-char (vm-start-of (car mp)))
-        (setq opoint (point))
+        ;; (setq opoint (point))
         (insert (vm-leading-message-separator type (car mp)))
         (if (> (vm-headers-of (car mp)) (vm-start-of (car mp)))
             (delete-region (point) (vm-headers-of (car mp)))
@@ -5297,9 +5299,9 @@ thread are loaded."
   (when (null count) (setq count 1))
   (let ((mlist (vm-select-operable-messages
                count (vm-interactive-p) "Load"))
-       (errors 0)
+       ;; (errors 0)
        (n 0)
-       fetch-method
+       ;; fetch-method
        m mm
        (need-refresh (not (vm-body-retrieved-of (vm-current-message)))))
     (setq count 0)
@@ -5364,11 +5366,11 @@ thread are retrieved."
   (save-current-buffer
     (vm-select-folder-buffer-and-validate 1 (vm-interactive-p))
     (when (null count) (setq count 1))
-    (let ((used-marks (eq last-command 'vm-next-command-uses-marks))
+    (let (;; (used-marks (eq last-command 'vm-next-command-uses-marks))
          (vm-external-fetched-message-limit nil)
-         (errors 0)
+         ;; (errors 0)
          (n 0)
-         fetch-method
+         ;; fetch-method
          m mm)
       ;;     (if (not used-marks) 
       ;;       (setq mlist (list (car vm-message-pointer))))
@@ -5511,7 +5513,7 @@ the folder is saved."
   (let ((mlist (vm-select-operable-messages
                count (vm-interactive-p) "Unload"))
        (buffer-undo-list t)
-       (errors 0)
+       ;; (errors 0)
        m mm)
     (save-excursion
       (setq count 0)
diff --git a/lisp/vm-grepmail.el b/lisp/vm-grepmail.el
index 29d64a2429..8f1fa3f74e 100644
--- a/lisp/vm-grepmail.el
+++ b/lisp/vm-grepmail.el
@@ -1,4 +1,4 @@
-;;; vm-grepmail.el --- VM interface for grepmail
+;;; vm-grepmail.el --- VM interface for grepmail  -*- lexical-binding: t; -*-
 ;;
 ;; This file is part of VM
 ;; 
@@ -85,7 +85,7 @@
 
 (if (not (featurep 'xemacs))
     ;; For sixth arg of read-file-name in Emacs 21. cf vm-folder-history.
-    (defun vm-grepmail-folders-history (&rest ignored) t))
+    (defun vm-grepmail-folders-history (&rest _ignored) t))
 
 ;;;###autoload
 (defun vm-grepmail (arguments folders)
@@ -113,16 +113,17 @@ FOLDERS should be a list of files/directories to search 
in."
                                       (if folders
                                           (concat "("
                                                   (mapconcat 'identity
-                                                             folders ", ") ")")
+                                                   folders ", ")
+                                                  ")")
                                         ""))
                               default
                               default
                               t nil 'vm-grepmail-folders-history)
                           fd (expand-file-name fd))
                     (if (not (string= fd (expand-file-name default)))
-                        (setq folders (add-to-list 'folders fd))))
+                        (cl-pushnew fd folders :test #'equal)))
                   (if (null folders)
-                      (setq folders (add-to-list 'folders fd)))
+                      (setq folders (list fd)))
                   folders)))
 
   (setq vm-grepmail-arguments arguments)
diff --git a/lisp/vm-imap.el b/lisp/vm-imap.el
index ab8880f37f..e5b4988ca6 100644
--- a/lisp/vm-imap.el
+++ b/lisp/vm-imap.el
@@ -1,4 +1,4 @@
-;;; vm-imap.el ---  Simple IMAP4 (RFC 2060) client for VM
+;;; vm-imap.el ---  Simple IMAP4 (RFC 2060) client for VM  -*- 
lexical-binding: t; -*-
 ;;
 ;; This file is part of VM
 ;;
@@ -43,7 +43,7 @@
 ;;                                  (purpose nil)
 ;;                                  (retry nil)))
 
-(defvar selectable-only)               ; used with dynamic binding
+(defvar selectable-only) ;; FIXME: Add `vm-' prefix!
 
 ;;; To-Do  (USR)
 ;; - Need to ensure that new imap sessions get created as and when needed.
@@ -194,7 +194,7 @@ using cached data."
     (cancel-timer (vm-imap-status-timer status-blob))))
 
 (defun vm-imap-report-retrieval-status (o)
-  (condition-case err
+  (condition-case _err
       (progn 
        (vm-set-imap-status-did-report o t)
        (cond ((null (vm-imap-status-got o)) t)
@@ -408,7 +408,7 @@ for accessing MAILBOX."
               ":")))
 
 (defun vm-imap-spec-list-to-host-alist (spec-list)
-  (let (host-alist spec host)
+  (let (host-alist spec) ;;  host
     (while spec-list
       (setq spec (vm-imapdrop-sans-password-and-mailbox (car spec-list)))
       (setq host-alist (cons
@@ -477,9 +477,6 @@ thrown.  In such a situation, typically VM cannot proceed."
       (vm-imap-protocol-error "Timed out for response from the IMAP server"))))
 
 
-;; Mollify the pesky compiler
-(defvar selectable-only)
-
 ;; (defvar vm-imap-connection-mode 'online)  ; moved to vm-vars.el
 
 
@@ -563,7 +560,7 @@ from which mail is to be moved and DESTINATION is the VM 
folder."
        (source-nopwd (vm-imapdrop-sans-password source))
        use-body-peek auto-expunge x select source-list uid
        can-delete read-write uid-validity
-       mailbox mailbox-count recent-count message-size response
+       mailbox mailbox-count message-size response ;; recent-count
        n (retrieved 0) retrieved-bytes process-buffer)
     (setq auto-expunge 
          (cond ((setq x (assoc source vm-imap-auto-expunge-alist))
@@ -601,7 +598,7 @@ from which mail is to be moved and DESTINATION is the VM 
folder."
                  mailbox (nth 3 source-list))
            (setq select (vm-imap-select-mailbox process mailbox t))
            (setq mailbox-count (nth 0 select)
-                 recent-count (nth 1 select)
+                 ;; recent-count (nth 1 select)
                  uid-validity (nth 2 select)
                  read-write (nth 3 select)
                  can-delete (nth 4 select)
@@ -729,9 +726,9 @@ Returns a boolean value."
        (retrieved vm-imap-retrieved-messages)
        (imapdrop (vm-imapdrop-sans-password source))
        (count 0)
-       msg-count recent-count uid-validity 
+       msg-count uid-validity ;; recent-count
        x response select mailbox source-list
-       result)
+       ) ;; result
     (unwind-protect
        (prog1
            (save-excursion             ; = save-current-buffer?
@@ -752,7 +749,7 @@ Returns a boolean value."
                      mailbox (nth 3 source-list))
                (setq select (vm-imap-select-mailbox process mailbox t)
                      msg-count (car select)
-                     recent-count (nth 1 select)
+                     ;; recent-count (nth 1 select)
                      uid-validity (nth 2 select))
                (when (zerop msg-count)
                  (vm-store-folder-totals source '(0 0 0 0))
@@ -1169,7 +1166,7 @@ Returns the process or nil if the session could not be 
created."
        (session-name "IMAP")
        (process-connection-type nil)
        greeting
-       protocol host port mailbox auth user pass authinfo
+       protocol host port mailbox auth user pass ;; authinfo
        source-list imap-buffer source-nopwd-nombox)
     (vm-imap-log-token 'make)
     ;; parse the maildrop
@@ -1432,7 +1429,7 @@ as well in auth-source (if it is being used)."
   )
 
 (defun vm-imap-check-for-server-spec (source host port auth user pass 
-                                            use-ssl use-ssh)
+                                            _use-ssl use-ssh)
   (when (null host)
     (error "No host in IMAP maildrop specification, \"%s\"" source))
   (when (or (null port) (not (string-match "^[0-9]+$" port)))
@@ -1903,7 +1900,7 @@ available for the IMAP server."
     (vm-set-imap-status-got statblob 0)
     (let* ((func
            (function
-            (lambda (beg end len)
+            (lambda (_beg end _len)
               (if vm-imap-read-point
                   (progn
                     (vm-set-imap-status-got statblob (- end ***start))
@@ -1913,7 +1910,7 @@ available for the IMAP server."
           ;; reenabled.  USR, 2010-09-17
           (after-change-functions (cons func after-change-functions))
           
-          (need-ok t)
+          ;; (need-ok t)
           response)
 
       (condition-case err
@@ -1997,6 +1994,7 @@ available for the IMAP server."
        ;; the CRLF or the LF newline convention is used on the inbox
        ;; associated with this crashbox.  This setting assumes the LF
        ;; newline convention is used.
+       (defvar buffer-file-type) ;; FIXME: Removed in Emacs-24.4.
        (let ((buffer-file-type t)
              (selective-display nil))
          (write-region ***start end target t 0))
@@ -2235,7 +2233,7 @@ May throw exceptions."
          (setcdr tail (cons obj nil))
          (setq tail (cdr tail)))))))
 
-(defun vm-imap-read-response-and-verify (process &optional command-desc)
+(defun vm-imap-read-response-and-verify (process &optional _command-desc)
   "Reads a line of response from the imap PROCESS and checks for
 standard errors like \"BAD\" and \"BYE\".  Returns a list of tokens.
 
@@ -2266,7 +2264,7 @@ printed with the error message."
        (vm-imap-normal-error "server disconnected"))
       response)))
 
-(defun vm-imap-read-error-message (process pos)
+(defun vm-imap-read-error-message (_process pos)
   "Return the error message in the PROCESS buffer starting at position POS."
   (buffer-substring 
    pos
@@ -2543,7 +2541,7 @@ that the session is active.  Returns t or nil."
              (vm-inform 7 "%s: Checking IMAP connection to %s..." "server"
                         (buffer-name vm-mail-buffer))
              (vm-imap-send-command process "NOOP")
-             (condition-case err
+             (condition-case _err
                  (let ((response nil)
                        (need-ok t))
                    (while need-ok
@@ -2572,7 +2570,7 @@ into the process buffer for tracing purposes. Optional 
argument
 JUST-RETRIEVE says whether the session will only be used for
 retrieval of mail. Returns the IMAP process or nil if
 unsuccessful."
-  (let ((process (vm-folder-imap-process)) temp)
+  (let ((process (vm-folder-imap-process))) ;; temp
     (if (and (processp process)
             (vm-imap-poke-session process))
        process
@@ -2663,7 +2661,7 @@ IMAP process or nil if unsuccessful."
 (defun vm-re-establish-writable-imap-session (&optional interactive purpose)
   "If the IMAP session for the current folder has died, re-establish a
 new one.  Returns the IMAP process or nil if unsuccessful."
-  (let ((process (vm-folder-imap-process)) temp)
+  (let ((process (vm-folder-imap-process))) ;; temp
     (if  (and (processp process)
              (vm-imap-poke-session process))
        process
@@ -2678,8 +2676,8 @@ Optional argument PURPOSE is inserted into the process 
buffer for
 tracing purposes. Returns the IMAP process or nil if unsuccessful."
   (let (process 
        (vm-imap-ok-to-ask (eq interactive t))
-       mailbox select mailbox-count recent-count uid-validity permanent-flags
-       read-write can-delete body-peek)
+       mailbox select ;; mailbox-count recent-count uid-validity 
permanent-flags
+       read-write) ;; can-delete body-peek
     (vm-imap-log-token 'new)
     (setq process 
          (vm-imap-make-session maildrop interactive :purpose purpose
@@ -2694,13 +2692,14 @@ tracing purposes. Returns the IMAP process or nil if 
unsuccessful."
              ;;----------------------------
              (set-buffer (process-buffer process))
              (setq select (vm-imap-select-mailbox process mailbox nil))
-             (setq mailbox-count (nth 0 select)
-                   recent-count (nth 1 select)
-                   uid-validity (nth 2 select)
+             (setq ;; mailbox-count (nth 0 select)
+                   ;; recent-count (nth 1 select)
+                   ;; uid-validity (nth 2 select)
                    read-write (nth 3 select)
-                   can-delete (nth 4 select)
-                   permanent-flags (nth 5 select)
-                   body-peek (vm-imap-capability 'IMAP4REV1))
+                   ;; can-delete (nth 4 select)
+                   ;; permanent-flags (nth 5 select)
+                   ;; body-peek (vm-imap-capability 'IMAP4REV1)
+                   )
              ;;---------------------------------
              (vm-imap-session-type:set 'active)
              (vm-buffer-type:exit)
@@ -2717,7 +2716,7 @@ tracing purposes. Returns the IMAP process or nil if 
unsuccessful."
       nil)))
 
 
-(defun vm-kill-folder-imap-session  (&optional interactive)
+(defun vm-kill-folder-imap-session  (&optional _interactive)
   (let ((process (vm-folder-imap-process)))
     (if (processp process)
        (vm-imap-end-session process))))
@@ -2743,7 +2742,7 @@ fetches flags in addition to uid's and stores them in 
obarrays."
          (flags (make-vector 67 0))
          (process (vm-folder-imap-process))
          (mailbox-count (vm-folder-imap-mailbox-count))
-         list tuples tuple uid)
+         list tuples tuple) ;; uid
       (unwind-protect
          (with-current-buffer (process-buffer process)
            ;;----------------------------
@@ -3164,9 +3163,9 @@ operation of the server to minimize I/O."
   ;;-----------------------------
   (vm-buffer-type:set 'folder)
   ;;-----------------------------
-  (let ((uid (vm-imap-uid-of m))
+  (let (;; (uid (vm-imap-uid-of m))
        (uid-validity (vm-imap-uid-validity-of m))
-       need-ok response string)
+       need-ok response) ;; string
     (if (not (equal uid-validity (vm-folder-imap-uid-validity)))
        (error "Message does not have a valid UID"))
     (unwind-protect
@@ -3272,7 +3271,7 @@ messages previously retrieved are ignored."
   (vm-buffer-type:assert 'folder)
   ;;-----------------------------
   (let ((here (make-vector 67 0))      ; OBARRAY(uid, vm-message)
-       there flags
+       there ;; flags
        (uid-validity (vm-folder-imap-uid-validity))
        (do-full-retrieve (eq do-retrieves 'full))
        retrieve-list remote-expunge-list local-expunge-list stale-list uid
@@ -3377,11 +3376,11 @@ messages previously retrieved are ignored."
     (let* ((folder-buffer (current-buffer))
           (folder-name (buffer-name folder-buffer))
           (process (vm-folder-imap-process))
-          (imap-buffer (process-buffer process))
+          ;; (imap-buffer (process-buffer process))
           (uid-validity (vm-folder-imap-uid-validity))
-          (imapdrop (vm-folder-imap-maildrop-spec))
-          (folder (or (vm-imap-folder-for-spec imapdrop)
-                      (vm-safe-imapdrop-string imapdrop)))
+          ;; (imapdrop (vm-folder-imap-maildrop-spec))
+          ;; (folder (or (vm-imap-folder-for-spec imapdrop)
+          ;;             (vm-safe-imapdrop-string imapdrop)))
           new-messages
           (sync-data (vm-imap-get-synchronization-data do-retrieves))
           (retrieve-list (nth 0 sync-data))
@@ -3411,7 +3410,7 @@ messages previously retrieved are ignored."
                       folder-name))))
       (when retrieve-attributes
        (let ((mp vm-message-list)
-             (len (length vm-message-list))
+             ;; (len (length vm-message-list))
              (n 0)
              uid m mflags)
          (vm-inform 6 "%s: Retrieving message attributes and labels... "
@@ -3604,7 +3603,7 @@ headers-only form."
         (uid-validity (vm-folder-imap-uid-validity))
         (mailbox-count (vm-folder-imap-mailbox-count))
         (expunge-count (length vm-imap-messages-to-expunge))
-        uids-to-delete m-list d-list message e-list count)
+        uids-to-delete m-list d-list e-list count) ;; message
     (vm-inform 6 "%s: Expunging messages on the server... "
               (buffer-name folder-buffer))
     ;; uids-to-delete to have UID's of all UID-valid messages in
@@ -3735,7 +3734,7 @@ headers-only form."
   same headers-only flag."
   (let ((ranges nil)
        pair headers-only
-       beg last last-headers-only next diff)
+       beg last last-headers-only next) ;; diff
     (when retrieve-list
       (setq pair (car retrieve-list)
            beg (car pair)
@@ -3764,7 +3763,7 @@ headers-only form."
   list of bunched message sequences, each of the form 
   (begin-num . end-num)."
   (let ((seqs nil)
-       beg last next diff)
+       beg last next) ;; diff
     (when seq-nums
       (setq beg (car seq-nums))
       (setq last beg)
@@ -3792,7 +3791,7 @@ otherwise.
   vm-imap-fetch-message.)"
 
   (let ((body-buffer (current-buffer))
-       (statblob nil))
+       ) ;; (statblob nil)
     (unwind-protect
        (save-excursion           ; save-current-buffer?
          ;;----------------------------------
@@ -3877,14 +3876,14 @@ otherwise.
   "Given an IMAP message M, return its message size by looking up the
 cached tables.  If there is no cached data, return nil.  USR, 2012-10-19"
   (with-current-buffer (vm-buffer-of m)
-    (condition-case error
+    (condition-case _error
        (let ((uid-sym (intern-soft (vm-imap-uid-of m)
                                    (vm-folder-imap-flags-obarray))))
          (car (symbol-value uid-sym)))
       (error nil))))
 
 (cl-defun vm-imap-save-attributes (&optional &key
-                                          (interactive nil)
+                                          ;; (interactive nil)
                                           (all-flags nil))
   "* Save the attributes of changed messages to the IMAP folder.
    INTERACTIVE, true if the function was invoked interactively, e.g., as
@@ -3896,7 +3895,7 @@ cached tables.  If there is no cached data, return nil.  
USR, 2012-10-19"
   (vm-buffer-type:set 'folder)
   ;;--------------------------
   (let* ((process (vm-folder-imap-process))
-        (uid-validity (vm-folder-imap-uid-validity))
+        ;; (uid-validity (vm-folder-imap-uid-validity))
         (mp vm-message-list)
         (errors 0))
       ;;  (perm-flags (vm-folder-imap-permanent-flags))
@@ -4023,7 +4022,7 @@ is being invoked interactively."
 
 ;; ----------- missing functions-----------
 ;;;###autoload
-(defun vm-imap-find-name-for-spec (spec)
+(defun vm-imap-find-name-for-spec (_spec)
   "This is a stub for a function that has not been defined."
   (error "vm-imap-find-name-for-spec has not been defined.  Please report it."
         ))
@@ -4116,15 +4115,16 @@ See Info node `(elisp)Programmed Completion'."
           (try-completion folder completion-list predicate)))))
 
 ;;;###autoload
-(defun vm-read-imap-folder-name (prompt &optional selectable-only
-                                       newone default) 
+(defun vm-read-imap-folder-name (prompt &optional selectable--only
+                                       _newone default) 
   "Read an IMAP folder name in the format account:mailbox, return an
 IMAP mailbox spec." 
-  (let* (folder-input completion-list spec process list 
+  (let* ((selectable-only selectable--only)
+        folder-input spec list ;; completion-list process
         default-account default-folder
         (vm-imap-ok-to-ask t)
         (account-list (mapcar 'cadr vm-imap-account-alist))
-        account-and-folder account folder mailbox-list)
+        account-and-folder account folder) ;; mailbox-list
     (if (null account-list)
        (error "No known IMAP accounts.  Please set vm-imap-account-alist."))
     (if default 
@@ -4174,7 +4174,7 @@ IMAP mailbox spec."
     ))
 
 (defun vm-imap-directory-separator (process ref)
-  (let ((c-list nil)
+  (let (;; (c-list nil)
        sep p r response need-ok)
     (vm-imap-check-connection process)
     (unwind-protect
@@ -4207,11 +4207,12 @@ IMAP mailbox spec."
       ;;-------------------
       )))
 
-(defun vm-imap-mailbox-list (process selectable-only)
+(defun vm-imap-mailbox-list (process selectable--only)
   "Query the IMAP PROCESS to get a list of the mailboxes (folders)
 available in the IMAP account.  SELECTABLE-ONLY flag asks only
 selectable mailboxes to be listed.  Returns a list of mailbox names."
-  (let ((c-list nil)
+  (let ((selectable-only selectable--only)
+       (c-list nil)
        p r response need-ok)
     (vm-imap-check-connection process)
     (unwind-protect
@@ -4248,11 +4249,12 @@ selectable mailboxes to be listed.  Returns a list of 
mailbox names."
       )))
 
 ;; This is unfinished
-(defun vm-imap-mailbox-p (process mailbox selectable-only)
+(defun vm-imap-mailbox-p (process mailbox selectable--only)
   "Query the IMAP PROCESS to check if MAILBOX exists as a folder.
 SELECTABLE-ONLY flag asks whether the mailbox is selectable as
 well. Returns a boolean value."
-  (let ((c-list nil)
+  (let ((selectable-only selectable--only)
+       (c-list nil)
        p r response need-ok)
     (vm-imap-check-connection process)
     (unwind-protect
@@ -4557,7 +4559,7 @@ them."
   (require 'ehelp)
   (setq vm-last-visit-imap-account account)
   (let ((vm-imap-ok-to-ask t)
-       folder spec process mailbox-list mailbox-status-list buffer)
+       spec process mailbox-list mailbox-status-list buffer) ;; folder
     (setq spec (vm-imap-spec-for-account account))
     (setq process (and spec (vm-imap-make-session spec t :purpose "folders")))
                                        ; new session required for STATUS
@@ -4572,7 +4574,7 @@ them."
          (setq mailbox-status-list
                (mapcar
                 (lambda (mailbox)
-                  (condition-case err
+                  (condition-case _err
                       (cons mailbox
                             (vm-imap-get-mailbox-status process mailbox))
                     (error (list mailbox 0 0))))
@@ -4667,7 +4669,7 @@ May throw exceptions."
        (mailboxes nil)
        (fcc-string (vm-mail-get-header-contents "FCC:" ","))
        fcc-list fcc maildrop spec-list 
-       process flags response string m
+       process flags string m ;; response
        (vm-imap-ok-to-ask t))
     (if (null mailbox)
        (setq mailboxes nil)
diff --git a/lisp/vm-license.el b/lisp/vm-license.el
index 2e195c6d1f..06171657ec 100644
--- a/lisp/vm-license.el
+++ b/lisp/vm-license.el
@@ -1,4 +1,4 @@
-;;; vm-license.el --- Code to show VM's warranty and copying restrictions
+;;; vm-license.el --- Code to show VM's warranty and copying restrictions  -*- 
lexical-binding: t; -*-
 ;;
 ;; This file is part of VM
 ;;
diff --git a/lisp/vm-macro.el b/lisp/vm-macro.el
index cf241c1e98..8f11e6395f 100644
--- a/lisp/vm-macro.el
+++ b/lisp/vm-macro.el
@@ -1,4 +1,4 @@
-;;; vm-macro.el ---  Random VM macros
+;;; vm-macro.el ---  Random VM macros  -*- lexical-binding: t; -*-
 ;;
 ;; This file is part of VM
 ;;
@@ -38,10 +38,10 @@
       `(save-current-buffer (set-buffer ,buf) ,@body)))
 
   (unless (fboundp 'defvaralias)
-    (defmacro defvaralias (&rest args)))
+    (defmacro defvaralias (&rest _args)))
 
   (unless (fboundp 'declare-function)
-    (defmacro declare-function (fn file &optional arglist fileonly))))
+    (defmacro declare-function (_fn _file &optional _arglist _fileonly))))
 
 (defmacro vm-interactive-p ()
   (if (featurep 'xemacs)
@@ -55,6 +55,34 @@
 (declare-function vm-error-if-folder-empty "vm-misc" ())
 (declare-function vm-build-threads "vm-thread" (message-list))
 
+(defvar vm-assertion-checking-off)
+(defvar vm-buffer-types)
+(defvar vm-current-warning)
+(defvar vm-folder-read-only)
+(defvar vm-mail-buffer)
+(defvar vm-recognize-imap-maildrops)
+(defvar vm-recognize-pop-maildrops)
+(defvar vm-summary-buffer)
+(defvar vm-thread-obarray)
+(defvar vm-user-interaction-buffer)
+
+(defmacro vm--dlet (binders &rest body)
+  ;; Copied from `calendar-dlet'.
+  "Like `dlet' but without warnings about non-prefixed var names."
+  (declare (indent 1) (debug let))
+  (let ((vars (mapcar (lambda (binder)
+                        (if (consp binder) (car binder) binder))
+                      binders)))
+    ;; (defvar FOO) only affects the current scope, but in order for this
+    ;; not to affect code after the main `let' we need to create a new scope,
+    ;; which is what the surrounding `let' is for.
+    ;; FIXME: (let () ...) currently doesn't actually create a new scope,
+    ;; which is why we use (let (_) ...).
+    `(let (_)
+       (with-suppressed-warnings ((lexical ,@vars))
+         ,@(mapcar (lambda (var) `(defvar ,var)) vars)
+         (dlet ,binders ,@body)))))
+
 (defmacro vm-add-to-list (elem list)
   "Like add-to-list, but compares elements by `eq' rather than `equal'."
   `(if (not (memq ,elem ,list))
diff --git a/lisp/vm-mark.el b/lisp/vm-mark.el
index fec395f4dc..8f404103a6 100644
--- a/lisp/vm-mark.el
+++ b/lisp/vm-mark.el
@@ -1,4 +1,4 @@
-;;; vm-mark.el ---  Commands for handling messages marks
+;;; vm-mark.el ---  Commands for handling messages marks  -*- lexical-binding: 
t; -*-
 ;;
 ;; This file is part of VM
 ;;
@@ -95,7 +95,7 @@ previous N-1 messages."
   (vm-select-folder-buffer-and-validate 1 (vm-interactive-p))
   (let ((direction (if (< count 0) 'backward 'forward))
        (count (vm-abs count))
-       (oldmp vm-message-pointer)
+       ;; (oldmp vm-message-pointer)
        (vm-message-pointer vm-message-pointer))
     (while (not (zerop count))
       (if (not (vm-mark-of (car vm-message-pointer)))
diff --git a/lisp/vm-menu.el b/lisp/vm-menu.el
index d72bcffab2..91ab703ff3 100644
--- a/lisp/vm-menu.el
+++ b/lisp/vm-menu.el
@@ -1,4 +1,4 @@
-;;; vm-menu.el --- Menu related functions and commands
+;;; vm-menu.el --- Menu related functions and commands  -*- lexical-binding: 
t; -*-
 ;;
 ;; This file is part of VM
 ;;
@@ -1001,7 +1001,7 @@ set to the command name so that window configuration will 
be done."
         (if (get-text-property (point) 'vm-mime-object)
             (vm-menu-popup-fsfemacs-menu
              event vm-menu-fsfemacs-attachment-menu)
-          (let (o-list o menu (found nil))
+          (let (o-list menu (found nil)) ;; o
             (setq o-list (overlays-at (point)))
             (while (and o-list (not found))
               (cond ((overlay-get (car o-list) 'vm-url)
diff --git a/lisp/vm-message-history.el b/lisp/vm-message-history.el
index 0d8dde5d49..842aac6d40 100644
--- a/lisp/vm-message-history.el
+++ b/lisp/vm-message-history.el
@@ -1,9 +1,8 @@
-;;; vm-message-history.el --- Move backward & forward through selected messages
-;; -*-unibyte: t; coding: iso-8859-1;-*-
+;;; vm-message-history.el --- Move backward & forward through selected 
messages  -*- lexical-binding: t; -*-
 ;;
 ;; This file is an add-on for VM
 
-;; Copyright � 2003 Kevin Rodgers, 2008 Robert Widhopf-Fenk
+;; Copyright © 2003 Kevin Rodgers, 2008 Robert Widhopf-Fenk
 
 ;; Author: Kevin Rodgers <ihs_4664@yahoo.com>
 ;; Created: 6 Oct 2003
diff --git a/lisp/vm-message.el b/lisp/vm-message.el
index c805de3c25..fd0edecfc5 100644
--- a/lisp/vm-message.el
+++ b/lisp/vm-message.el
@@ -1,4 +1,4 @@
-;;; vm-message.el --- Macros and functions dealing with accessing VM
+;;; vm-message.el --- Macros and functions dealing with accessing VM  -*- 
lexical-binding: t; -*-
 ;; message struct fields
 ;;
 ;; This file is part of VM
@@ -500,7 +500,7 @@ works in all VM buffers."
   (aset (aref message 3) 19 val))
 (defsubst vm-set-references-of (message val)
   (aset (aref message 3) 20 val))
-(defsubst vm-set-headers-to-be-retrieved-of (message val)
+(defsubst vm-set-headers-to-be-retrieved-of (_message _val)
   nil)
 (defsubst vm-set-body-to-be-discarded-of (message val)
   (aset (aref message 3) 21 val))
diff --git a/lisp/vm-mime.el b/lisp/vm-mime.el
index 196f230ef4..c61c3c3cac 100644
--- a/lisp/vm-mime.el
+++ b/lisp/vm-mime.el
@@ -1,4 +1,4 @@
-;;; vm-mime.el ---  MIME support functions
+;;; vm-mime.el ---  MIME support functions  -*- lexical-binding: t; -*-
 ;;
 ;; This file is part of VM
 ;;
@@ -568,6 +568,8 @@ out includes base-64, quoted-printable, uuencode and CRLF 
conversion."
                         (vm-mm-layout-encoding layout))
           (vm-mime-uuencode-decode-region start end crlf)))))
 
+(defvar binary-process-output) ;; FIXME: Unknown var.  XEmacs?
+
 (defun vm-mime-base64-decode-region (start end &optional crlf)
   (or (markerp end) (setq end (vm-marker end)))
   (and (> (- end start) 10000)
@@ -694,7 +696,7 @@ out includes base-64, quoted-printable, uuencode and CRLF 
conversion."
   (and (> (- end start) 200)
        (vm-inform 7 "Encoding quoted-printable..."))
   (let ((work-buffer nil)
-       (buf (current-buffer))
+       ;; (buf (current-buffer))
        (cols 0)
        (hex-digit-alist '((?0 .  0)  (?1 .  1)  (?2 .  2)  (?3 .  3)
                           (?4 .  4)  (?5 .  5)  (?6 .  6)  (?7 .  7)
@@ -952,7 +954,7 @@ previous mime decoding."
 (fset 'vm-mime-parse-content-header 'vm-parse-structured-header)
 
 (defun vm-mime-get-header-contents (header-name-regexp)
-  (let ((contents nil)
+  (let (;; (contents nil)
        regexp)
     (setq regexp (concat "^\\(" header-name-regexp "\\)\\|\\(^$\\)"))
     (save-excursion
@@ -984,7 +986,7 @@ PASSING-MESSAGE-ONLY is a boolean argument that says that 
VM is only
            (set-buffer (vm-buffer-of m))))
       (let ((case-fold-search t) version type qtype encoding id description
            disposition qdisposition boundary boundary-regexp start end
-           multipart-list pos-list c-t c-t-e done p returnval)
+           multipart-list pos-list c-t c-t-e done p) ;; returnval
        (save-excursion
          (save-restriction
            (if (and m (not passing-message-only))
@@ -1422,7 +1424,7 @@ a string denoting the folder name."
   "Create a copy of the message M in the Presentation Buffer.  If
 the message is external then the copy is made from the external
 source of the message."
-  (let ((mail-buffer (current-buffer))
+  (let (;; (mail-buffer (current-buffer))
        pres-buf mm
        (real-m (vm-real-message-of m))
        (modified (buffer-modified-p)))
@@ -1726,7 +1728,7 @@ The STORAGE specification is given in the same format as 
for
   (apply (intern (format "vm-fetch-%s-message-size" (car storage)))
         mm (cdr storage)))
 
-(defun vm-fetch-file-message (m filename)
+(defun vm-fetch-file-message (_m filename)
   "Insert the message with message descriptor MM stored in the given FILENAME."
   (insert-file-contents filename nil nil nil t)
   t)
@@ -2129,7 +2131,7 @@ triple (source-type target-type command).  Otherwise, 
return nil."
   "Finds an appropriate MIME character set for the current buffer,
 assuming that it is text."
   (let ((coding-systems
-        (condition-case err
+        (condition-case _err
             (detect-coding-region (point-min) (point-max))
           (error nil)))
        (coding-system nil) (n nil))
@@ -2712,7 +2714,7 @@ possible.  Returns a boolean flag indicating success."
               vm-w3m-program charset charset)
        nil t))))
   
-(defun vm-mime-display-internal-lynx-text/html (start end layout)
+(defun vm-mime-display-internal-lynx-text/html (start end _layout)
   (shell-command-on-region 
    start (1- end)
    ;; (concat vm-lynx-program " -force_html /dev/stdin" )
@@ -2735,7 +2737,7 @@ possible.  Returns a boolean flag indicating success."
                (start (point))
                (charset (or (vm-mime-get-parameter layout "charset")
                             "us-ascii"))
-               end buffer-size)
+               end) ;; buffer-size
            (vm-emit-mime-decoding-message
             "Inlining text/html by %s..." vm-mime-text/html-handler)
            (vm-mime-insert-mime-body layout)
@@ -2830,6 +2832,7 @@ in the text are highlighted and energized."
 
 (defun vm-mime-display-internal-text/enriched (layout)
   (require 'enriched)
+  (defvar enriched-verbose)
   (let ((start (point)) end
        (buffer-read-only nil)
        (enriched-verbose t)
@@ -2867,11 +2870,11 @@ determined by `vm-mime-external-content-types-alist'."
                       (vm-mime-find-external-viewer
                        (car (vm-mm-layout-type layout)))))
        (buffer-read-only nil)
-       start
+       ;; start
        (coding-system-for-read (vm-binary-coding-system))
        (coding-system-for-write (vm-binary-coding-system))
        (append-file t)
-       process tempfile cache end suffix basename)
+       process tempfile cache suffix basename) ;; end
     (setq cache (get (vm-mm-layout-cache layout)
                     'vm-mime-display-external-generic)
          process (nth 0 cache)
@@ -3472,7 +3475,7 @@ button that this LAYOUT comes from."
 (defun vm-mime-fetch-url-with-programs (url buffer)
   (when
       (eq t (cond ((if (and (memq 'wget vm-url-retrieval-methods)
-                           (condition-case data
+                           (condition-case _data
                                (vm-run-command-on-region 
                                 (point) (point) buffer
                                 vm-wget-program "-q" "-O" "-" url)
@@ -3482,7 +3485,7 @@ button that this LAYOUT comes from."
                       (erase-buffer)
                       nil )))
                  ((if (and (memq 'w3m vm-url-retrieval-methods)
-                           (condition-case data
+                           (condition-case _data
                                (vm-run-command-on-region 
                                 (point) (point) buffer
                                 vm-w3m-program "-dump_source" url)
@@ -3492,7 +3495,7 @@ button that this LAYOUT comes from."
                       (erase-buffer)
                       nil )))
                  ((if (and (memq 'fetch vm-url-retrieval-methods)
-                           (condition-case data
+                           (condition-case _data
                                (vm-run-command-on-region 
                                 (point) (point) buffer
                                 vm-fetch-program "-o" "-" url)
@@ -3502,7 +3505,7 @@ button that this LAYOUT comes from."
                       (erase-buffer)
                       nil )))
                  ((if (and (memq 'curl vm-url-retrieval-methods)
-                           (condition-case data
+                           (condition-case _data
                                (vm-run-command-on-region 
                                 (point) (point) buffer
                                 vm-curl-program url)
@@ -3512,7 +3515,7 @@ button that this LAYOUT comes from."
                       (erase-buffer)
                       nil )))
                  ((if (and (memq 'lynx vm-url-retrieval-methods)
-                           (condition-case data
+                           (condition-case _data
                                (vm-run-command-on-region 
                                 (point) (point) buffer
                                 vm-lynx-program "-source" url)
@@ -3537,11 +3540,11 @@ it to an internal object by retrieving the body.       
USR, 2011-03-28"
                   (vm-make-multibyte-work-buffer
                    (format "*%s mime object*"
                            (car (vm-mm-layout-type child-layout))))))
-            (let (oldsize)
+            (let () ;;
               (with-current-buffer work-buffer
                 (vm-mime-retrieve-external-body layout))
               (goto-char (vm-mm-layout-body-start child-layout))
-              (setq oldsize (buffer-size))
+              ;; (setq oldsize (buffer-size))
               (condition-case data
                   (insert-buffer-substring work-buffer)
                 (error (signal 'vm-mime-error (cdr data))))
@@ -3577,9 +3580,9 @@ it to an internal object by retrieving the body.       
USR, 2011-03-28"
     (vm-inform 6 "Assembling message...")
     (let ((parts nil)
          (missing nil)
-         (work-buffer nil)
-         extent id o number total m i prev part-header-pos
-         p-id p-number p-total p-list)
+         ;; (work-buffer nil)
+         extent id o total m i prev part-header-pos ;; number
+         p-number p-total p-list)                   ;; p-id
       (setq extent layout
            layout (vm-extent-property extent 'vm-mime-layout)
            id (vm-mime-get-parameter layout "id"))
@@ -3598,7 +3601,7 @@ it to an internal object by retrieving the body.       
USR, 2011-03-28"
                  nil
                (setq p-list (vm-mime-find-message/partials o id))
                (while p-list
-                 (setq p-id (vm-mime-get-parameter (car p-list) "id"))
+                 ;; (setq p-id (vm-mime-get-parameter (car p-list) "id"))
                  (setq p-total (vm-mime-get-parameter (car p-list) "total"))
                  (if (null p-total)
                      nil
@@ -4045,7 +4048,7 @@ describing the image type.                            
USR, 2011-03-25"
            (nreverse image-list)))
       (and work-buffer (kill-buffer work-buffer)))))
 
-(defun vm-process-sentinel-display-image-strips (process what-happened)
+(defun vm-process-sentinel-display-image-strips (process _what-happened)
   (with-current-buffer (process-buffer process)
     (cond ((and (boundp 'vm-extent-list)
                (boundp 'vm-image-list))
@@ -4352,7 +4355,7 @@ image when possible."
           vm-mime-thumbnail-max-geometry
           (vm-images-possible-here-p))
       ;; create a thumbnail and display it
-      (let (tempfile start end thumb-extent glyph)
+      (let (tempfile start thumb-extent glyph) ;; end
        ;; fake an extent to display the image as thumb
        (setq start (point))
        (insert " ")
@@ -4502,7 +4505,7 @@ If optional argument FUNCTION is given, run it instead.
   ;; where it was when the user triggered the button.
   (save-excursion
     (let ((extent (vm-find-layout-extent-at-point))
-         retval )
+         ) ;; retval
       (and extent
           (funcall 
            (or function (vm-extent-property extent 'vm-mime-function))
@@ -4657,7 +4660,7 @@ ACTION will get called with four arguments: MSG LAYOUT 
TYPE FILENAME."
     (vm-retrieve-operable-messages count mlist :fail t)
     (save-excursion
       (while mlist
-        (let (m parts layout filename type disposition o)
+        (let (parts layout filename type disposition o) ;; m
           (setq o (vm-mm-layout (car mlist)))
           (when (stringp o)
             (setq o 'none)
@@ -4753,7 +4756,7 @@ are also included."
      count
      :name "deleting"
      :action
-     (lambda (msg layout type file)
+     (lambda (_msg layout type file)
        (vm-inform 7 "Deleting `%s%s" type (if file (format " (%s)" file) ""))
        (vm-mime-discard-layout-contents layout)
        (setq successes (+ 1 successes)))
@@ -4778,7 +4781,7 @@ are also included."
 ;;;###autoload
 (defun vm-save-all-attachments (&optional count
                                          directory
-                                         no-delete-after-saving)
+                                         _no-delete-after-saving)
   "Save all attachments in the next COUNT messages or marked
 messages.  For the purpose of this function, an \"attachment\" is
 a mime part part which has \"attachment\" as its disposition or
@@ -4876,7 +4879,7 @@ created."
   'vm-save-all-attachments "8.2.0")
 
 (defun vm-save-attachments (&optional count
-                                     no-delete-after-saving)
+                                     _no-delete-after-saving)
   "Save all attachments in the next COUNT messages or marked
 messages.  For the purpose of this function, an \"attachment\" is
 a mime part part which has \"attachment\" as its disposition or
@@ -4906,7 +4909,7 @@ confirmed before creating a new directory."
      :excluded vm-mime-saveable-type-exceptions
      :name "saving"
      :action
-     (lambda (msg layout type file-name)
+     (lambda (_msg layout type file-name)
        (let ((file (vm-read-file-name
                    (if file-name                       ; prompt
                        (format "Save (default %s): " file-name)
@@ -4988,7 +4991,7 @@ TYPE.                                                  
USR, 2011-03-25"
           (> (device-bitplanes) 7))
       (let ((dir (vm-image-directory))
            (tuples vm-mime-type-images)
-           glyph file sym p)
+           glyph file sym) ;; p
        (setq file (catch 'done
                     (while tuples
                       (if (vm-mime-types-match (car (car tuples)) type)
@@ -5268,6 +5271,8 @@ file with the name should be overwritten."
              file )
          (when work-buffer (kill-buffer work-buffer)))))))
 
+(defvar binary-process-input) ;; FIXME: Unknown var.  XEmacs?
+
 (defun vm-mime-pipe-body-to-command (command layout &optional discard-output)
   (unless (vectorp layout)
     (setq layout (vm-extent-property layout 'vm-mime-layout)))
@@ -5606,8 +5611,9 @@ Returns non-NIL value M is a plain message."
        o ))))
 
 (defun vm-mime-find-leaf-content-id (layout id)
-  (let ((list nil)
-       (type (vm-mm-layout-type layout)))
+  (let (;; (list nil)
+       ;; (type (vm-mm-layout-type layout))
+       )
     (catch 'done
       (cond ((vm-mime-composite-type-p (car (vm-mm-layout-type layout)))
             (let ((parts (vm-mm-layout-parts layout)) o)
@@ -5644,7 +5650,7 @@ Returns non-NIL value M is a plain message."
 
 (defun vm-mime-extract-filename-suffix (layout)
   (let ((filename (vm-mime-get-disposition-filename layout))
-       (suffix nil) i)
+       (suffix nil)) ;; i
     (if (and filename (string-match "\\.[^.]+$" filename))
        (setq suffix (substring filename (match-beginning 0) (match-end 0))))
     suffix ))
@@ -5664,7 +5670,7 @@ Returns non-NIL value M is a plain message."
 
 
 (defun vm-attach-file (file type &optional charset description
-                           no-suggested-filename)
+                           _no-suggested-filename)
   "Attach a file to a VM composition buffer to be sent along with the message.
 The file is not inserted into the buffer and MIME encoded until
 you execute `vm-mail-send' or `vm-mail-send-and-exit'.  A visible tag
@@ -5828,7 +5834,7 @@ this case and not prompt you for it in the minibuffer."
    (let ((last-command last-command)
         (this-command this-command)
         (charset nil)
-        description file default-type type buffer buffer-name)
+        description default-type type buffer-name) ;; file buffer
      (unless vm-send-using-mime
        (error (concat "MIME attachments disabled, "
                      "set vm-send-using-mime non-nil to enable.")))
@@ -6372,7 +6378,7 @@ there is no file name for this object.             USR, 
2011-03-07"
           (setcar enc sym)))))
 
 (defun vm-disallow-overlay-endpoint-insertion 
-  (overlay after start end &optional old-size)
+  (overlay after start end &optional _old-size)
   "Hook function called before and after text is inserted at the
 endpoint of an OVERLAY.  AFTER is true if the call is being made after
 insertion.  Otherwise, it is being made before insertion.  START and
@@ -6558,7 +6564,7 @@ quoted-printable or binary).                            
USR, 2011-03-27"
              (insert "CONTENT-TRANSFER-ENCODING: " encoding "\n"))
          encoding )))))
 
-(defun vm-mime-text-description (start end)
+(defun vm-mime-text-description (start _end)
   (save-excursion
     (goto-char start)
     (if (looking-at "[ \t\n]*-- \n")
@@ -6761,7 +6767,7 @@ If none is specified, quoted-printable is used."
       (goto-char end))))
 
 ;;;###autoload
-(defun vm-mime-encode-words-in-string (string &optional encoding)
+(defun vm-mime-encode-words-in-string (string &optional _encoding)
   (and string
        (vm-with-string-as-temp-buffer 
        (vm-substring-no-properties string 0)
@@ -6780,7 +6786,7 @@ should be encoded together."
   (save-excursion 
     (let ((headers (concat "^\\(" vm-mime-encode-headers-regexp "\\):"))
           (case-fold-search nil)
-          (encoding vm-mime-encode-headers-type)
+          ;; (encoding vm-mime-encode-headers-type)
           body-start
           start end)
       (goto-char (point-min))
@@ -6851,6 +6857,7 @@ and the approriate content-type and boundary markup 
information is added."
           (setq buffer-undo-list (primitive-undo 1 buffer-undo-list))))))
 
 (defvar enriched-mode)
+(defvar enriched-initial-annotation)
 
 ;; This function was originally XEmacs-specific.  It has now been
 ;; generalized to both XEmacs and GNU Emacs.  USR, 2011-03-27
@@ -6868,7 +6875,7 @@ and the approriate content-type and boundary markup 
information is added."
          (boundary-positions nil)      ; position markers for the parts
          text-result                   ; results from text encodings
          forward-local-refs already-mimed layout e e-list boundary
-         type encoding charset params description disposition object
+         type encoding params description disposition object ;; charset
          opoint-min encoded-attachment message-smimed)
       (when (featurep 'xemacs)
        ;;Make sure we don't double encode UTF-8 (for example) text.
@@ -7176,7 +7183,7 @@ Returns a pair consisting of a marker pointing to the 
start of the
 encoded MIME part and the transfer-encoding used.  But if
 WHOLE-MESSAGE is true then nil is returned."
   (let ((enriched (and (boundp 'enriched-mode) enriched-mode))
-       type encoding charset params description marker)
+       encoding charset description marker) ;; type params
     (narrow-to-region beg end)
     ;; support enriched-mode for text/enriched composition
     (when enriched
@@ -7268,7 +7275,7 @@ WHOLE-MESSAGE is true then nil is returned."
          (boundary-positions nil)      ; markers for the start of parts
          marker
          forward-local-refs already-mimed layout e e-list boundary
-         type encoding charset params description disposition object
+         type encoding params description disposition object ;; charset
          opoint-min postponed-attachment)
       (goto-char (mail-text-start))
       (setq e-list (vm-mime-attachment-button-extents 
@@ -7518,7 +7525,7 @@ true, then encode it as the entire message.
 
 Returns marker pointing to the start of the encoded MIME part."
   (let ((enriched (and (boundp 'enriched-mode) enriched-mode))
-       type encoding charset params description marker)
+       encoding charset description marker) ;; type params
     (narrow-to-region beg end)
     ;; support enriched-mode for text/enriched composition
     (when enriched
@@ -7872,7 +7879,7 @@ Returns marker pointing to the start of the encoded MIME 
part."
       (vm-mime-get-parameter layout "name")
       "<no suggested filename>"))
 
-(defun vm-mf-event-for-default-action (layout)
+(defun vm-mf-event-for-default-action (_layout)
   (if (vm-mouse-support-possible-here-p)
       "Click mouse-2"
     "Press RETURN"))
@@ -7885,7 +7892,7 @@ Returns marker pointing to the start of the encoded MIME 
part."
 
 (defun vm-mf-default-action (layout)
   (or vm-mf-default-action
-      (let (cons)
+      (let () ;; cons
         (cond ((or (vm-mime-can-display-internal layout)
                   (vm-mime-find-external-viewer
                    (car (vm-mm-layout-type layout))))
@@ -7897,8 +7904,9 @@ Returns marker pointing to the start of the encoded MIME 
part."
                         (throw 'done (cdr (car p)))
                       (setq p (cdr p))))
                   nil )))
-             ((setq cons (vm-mime-can-convert
-                          (car (vm-mm-layout-type layout))))
+             (;; (setq cons 
+               (vm-mime-can-convert
+                          (car (vm-mm-layout-type layout))) ;;)
               "convert")
              (t "save")))
       ;; should not be reached
@@ -7935,7 +7943,7 @@ end of the path."
                               (vm-su-subject m))))
        (vm-mime-map-layout-parts
        m
-       (lambda (m layout path)
+       (lambda (_m layout path)
          (if verbose
              (princ (format "%s%S\n" (make-string (length path) ? ) layout))
            (princ (format "%s%S%s%s%s\n" (make-string (length path) ? )
@@ -8064,7 +8072,7 @@ This is a destructive operation and cannot be undone!"
   (save-excursion
     (let* ((layout (vm-extent-property x 'vm-mime-layout))
           (xstart (vm-extent-start-position x))
-          (xend   (vm-extent-end-position x))
+          ;; (xend   (vm-extent-end-position x))
           (hstart (vm-mm-layout-header-start layout))
           (bstart (vm-mm-layout-body-start layout))
           (end    (vm-mm-layout-body-end   layout))
diff --git a/lisp/vm-minibuf.el b/lisp/vm-minibuf.el
index c3e547d92a..f49d7f16cf 100644
--- a/lisp/vm-minibuf.el
+++ b/lisp/vm-minibuf.el
@@ -1,4 +1,4 @@
-;;; vm-minibuf.el --- Minibuffer read functions for VM
+;;; vm-minibuf.el --- Minibuffer read functions for VM  -*- lexical-binding: 
t; -*-
 ;;
 ;; This file is part of VM
 ;;
diff --git a/lisp/vm-misc.el b/lisp/vm-misc.el
index 0643af83d2..5572240248 100644
--- a/lisp/vm-misc.el
+++ b/lisp/vm-misc.el
@@ -81,6 +81,31 @@
 (declare-function vm-decode-mime-encoded-words-in-string "vm-mime" (string))
 (declare-function vm-su-subject "vm-summary" (message))
 
+(require 'vm-vars)
+;; (defvar vm-chop-full-name-function)
+;; (defvar vm-current-warning)
+;; (defvar vm-default-new-folder-line-ending-type)
+;; (defvar vm-delete-duplicates-obarray)
+;; (defvar vm-fill-paragraphs-containing-long-lines)
+;; (defvar vm-folder-type)
+;; (defvar vm-folders-summary-buffer)
+;; (defvar vm-index-file-suffix)
+;; (defvar vm-mail-buffer)
+;; (defvar vm-message-list)
+;; (defvar vm-message-pointer)
+;; (defvar vm-parse-date-workspace)
+;; (defvar vm-paragraph-fill-column)
+;; (defvar vm-presentation-buffer)
+;; (defvar vm-presentation-buffer-handle)
+;; (defvar vm-search-other-frames)
+;; (defvar vm-sortable-date-alist)
+;; (defvar vm-startup-with-summary)
+;; (defvar vm-summary-buffer)
+;; (defvar vm-temp-file-directory)
+;; (defvar vm-tempfile-counter)
+;; (defvar vm-verbosity)
+;; (defvar vm-verbal-time)
+;; (defvar vm-word-wrap-paragraphs)
 
 ;; This file contains various low-level operations that address
 ;; incomaptibilities between Gnu and XEmacs.  Expect compiler warnings.
@@ -1283,7 +1308,7 @@ encoding/decoding, conversions, subprocess communication 
etc."
      (fset 'vm-insert-char 'vm-xemacs-compatible-insert-char)
      (vm-insert-char char count ignored buffer))))
 
-(defun vm-xemacs-compatible-insert-char (char &optional count ignored buffer)
+(defun vm-xemacs-compatible-insert-char (char &optional count _ignored buffer)
   (if (and buffer (eq buffer (current-buffer)))
       (insert-char char count)
     (with-current-buffer buffer
diff --git a/lisp/vm-motion.el b/lisp/vm-motion.el
index 092b2089df..211f457ba4 100644
--- a/lisp/vm-motion.el
+++ b/lisp/vm-motion.el
@@ -1,4 +1,4 @@
-;;; vm-motion.el --- Commands to move around in a VM folder
+;;; vm-motion.el --- Commands to move around in a VM folder  -*- 
lexical-binding: t; -*-
 ;;
 ;; This file is part of VM
 ;;
diff --git a/lisp/vm-mouse.el b/lisp/vm-mouse.el
index a9ee7337aa..67b3d29f29 100644
--- a/lisp/vm-mouse.el
+++ b/lisp/vm-mouse.el
@@ -1,4 +1,4 @@
-;;; vm-mouse.el --- Mouse related functions and commands
+;;; vm-mouse.el --- Mouse related functions and commands  -*- lexical-binding: 
t; -*-
 ;;
 ;; This file is part of VM
 ;;
@@ -103,7 +103,7 @@ Mouse'."
              ((eq major-mode 'mail-mode)
               (vm-menu-popup-context-menu event))))))
 
-(defun vm-mouse-3-help (object)
+(defun vm-mouse-3-help (_object)
   nil
   "Use mouse button 3 to see a menu of options.")
 
@@ -346,7 +346,7 @@ Mouse'."
        (vm-mouse-send-url-to-konqueror url t)))
   (vm-inform 5 "Sending URL to Konqueror... done"))
 
-(defun vm-mouse-send-url-to-firefox (url &optional new-window)
+(defun vm-mouse-send-url-to-firefox (url &optional _new-window)
   (vm-inform 5 "Sending URL to Mozilla Firefox...")
   (if t                                        ; new-window parameter ignored
       (apply 'vm-run-background-command vm-firefox-program
@@ -411,6 +411,8 @@ Mouse'."
          (get-buffer-create (concat " *" command "*"))
          nil arg-list))
 
+(defvar binary-process-input) ;; FIXME: Unknown var.  XEmacs?
+
 ;; return t on zero exit status
 ;; return (exit-status . stderr-string) on nonzero exit status
 (defun vm-run-command-on-region (start end output-buffer command
@@ -617,7 +619,7 @@ HISTORY argument is ignored."
   (let ((key-doc  "Click here for keyboard interface.")
        (bs-doc   "      .... to go back one word.")
        (done-doc "      .... when you're done.")
-       start list)
+       start) ;; list
     (if string
        (cond ((equal string key-doc)
               (condition-case nil
diff --git a/lisp/vm-page.el b/lisp/vm-page.el
index d3281051bf..c02a3b0775 100644
--- a/lisp/vm-page.el
+++ b/lisp/vm-page.el
@@ -1,4 +1,4 @@
-;;; vm-page.el ---  Commands to move around within a VM message
+;;; vm-page.el ---  Commands to move around within a VM message  -*- 
lexical-binding: t; -*-
 ;;
 ;; This file is part of VM
 ;
@@ -79,7 +79,7 @@ Prefix argument N means scroll forward N lines."
     (when vm-presentation-buffer
       (set-buffer vm-presentation-buffer))
     ;; We are either in the Presentation buffer or the Folder buffer
-    (let ((point (point))
+    (let (;; (point (point))
          (w (vm-get-visible-buffer-window (current-buffer))))
       (unless (and w (vm-frame-totally-visible-p (vm-window-frame w)))
        (vm-display (current-buffer) t
@@ -228,6 +228,8 @@ Prefix argument N means scroll forward N lines."
               (set-window-point w (point))
               'end-of-message)))))))
 
+(defvar scroll-in-place-replace-original) ;; FIXME: Unknown var.  XEmacs?
+
 ;; exploratory scrolling, what a concept.
 ;;
 ;; we do this because pos-visible-in-window-p checks the current
@@ -367,7 +369,7 @@ Negative arg means scroll forward."
       (setq search-pairs (list (cons (point-min) (point-max)))))
     (let (e)
       (vm-map-extents (function
-                      (lambda (e ignore)
+                      (lambda (e _ignore)
                         (when (vm-extent-property e 'vm-url)
                           (vm-delete-extent e))
                         nil))
@@ -497,7 +499,7 @@ Negative arg means scroll forward."
 (defun vm-display-xface-xemacs ()
   (let ((case-fold-search t) e g h)
     (if (map-extents (function
-                     (lambda (e ignore)
+                     (lambda (e _ignore)
                        (if (vm-extent-property e 'vm-xface)
                            t
                          nil)))
@@ -611,7 +613,7 @@ Negative arg means scroll forward."
                    ':data (buffer-string))))
        (and work-buffer (kill-buffer work-buffer))))))
 
-(defun vm-url-help (object)
+(defun vm-url-help (_object)
   (format
    "Use mouse button 2 to send the URL to %s.
 Use mouse button 3 to choose a Web browser for the URL."
diff --git a/lisp/vm-pcrisis.el b/lisp/vm-pcrisis.el
index 1fb5ff2a89..6cb3291d70 100644
--- a/lisp/vm-pcrisis.el
+++ b/lisp/vm-pcrisis.el
@@ -1,4 +1,4 @@
-;;; vm-pcrisis.el --- wide-ranging auto-setup for personalities in VM
+;;; vm-pcrisis.el --- wide-ranging auto-setup for personalities in VM  -*- 
lexical-binding: t; -*-
 ;;
 ;; This file is an add-on for VM
 ;;
@@ -1082,7 +1082,7 @@ whitespace."
   "Read a list of actions to run and store it in `vmpc-actions-to-run'.
 The special action \"none\" will result in an empty action list."
   (interactive (list "VMPC actions%s: "))
-  (let ((actions ()) (read-count 0) a)
+  (let ((actions ())) ;; (read-count 0) (a nil)
     (setq actions (vm-read-string 
                    (format prompt (if default (format " %s" default) ""))
                    (append '(("none")) vmpc-actions)
diff --git a/lisp/vm-pgg.el b/lisp/vm-pgg.el
index 35ca9bc7f1..321cd29e61 100644
--- a/lisp/vm-pgg.el
+++ b/lisp/vm-pgg.el
@@ -1,4 +1,4 @@
-;;; vm-pgg.el --- PGP/MIME support for VM by pgg.el
+;;; vm-pgg.el --- PGP/MIME support for VM by pgg.el  -*- lexical-binding: t; 
-*-
 ;;
 ;; This file is an add-on for VM
 ;; 
@@ -1070,7 +1070,7 @@ seed and thus creates the same boundery when called twice 
in a short period."
 (defun vm-pgg-save-work (function &rest args)
   "Call FUNCTION with ARGS without messing up the composition in case of an 
error."
   (let ((composition-buffer (current-buffer))
-        (undo-list-backup buffer-undo-list)
+        ;; (undo-list-backup buffer-undo-list)
         (work-buffer (get-buffer-create " *VM-PGG-WORK*")))
     (with-current-buffer work-buffer
       (buffer-disable-undo)
diff --git a/lisp/vm-pine.el b/lisp/vm-pine.el
index 97fca6ba41..80f438e804 100644
--- a/lisp/vm-pine.el
+++ b/lisp/vm-pine.el
@@ -1,4 +1,4 @@
-;;; vm-pine.el --- draft handling and other neat functions for VM
+;;; vm-pine.el --- draft handling and other neat functions for VM  -*- 
lexical-binding: t; -*-
 ;;
 ;; This file is an add-on for VM
 ;; 
@@ -270,7 +270,7 @@ This is only for internal use of vm-pine.el!!!")
       (if mid
           (if f
               (setcdr f (cons mid (cdr f)))
-            (add-to-list 'midlist (list folder mid))))
+            (push (list folder mid) midlist)))
       (setq mlist (cdr mlist)))
     midlist))
   
@@ -312,6 +312,9 @@ MSGIDLIST is a list as returned by 
`vm-get-persistent-message-ids-for'."
         (setq msgidlist (cdr msgidlist))))
     vm-message-pointers))
 
+(defvar mail-mode-hook)
+(defvar mail-setup-hook)
+
 ;;-----------------------------------------------------------------------------
 ;;;###autoload
 (defun vm-continue-postponed-message (&optional silent draft)
diff --git a/lisp/vm-pop.el b/lisp/vm-pop.el
index cb0cf3b404..9a97112f49 100644
--- a/lisp/vm-pop.el
+++ b/lisp/vm-pop.el
@@ -1,4 +1,4 @@
-;;; vm-pop.el --- Simple POP (RFC 1939) client for VM
+;;; vm-pop.el --- Simple POP (RFC 1939) client for VM  -*- lexical-binding: t; 
-*-
 ;;
 ;; This file is part of VM
 ;;
@@ -119,7 +119,7 @@ a POP server, find its cache file on the file system"
        (msgid (list nil (vm-popdrop-sans-password source) 'uidl))
        (pop-retrieved-messages vm-pop-retrieved-messages)
        auto-expunge x
-       mailbox-count mailbox-size message-size response
+       mailbox-count message-size response;; mailbox-size
        n (retrieved 0) retrieved-bytes process-buffer uidl)
     (setq auto-expunge 
          (cond ((setq x (assoc source vm-pop-auto-expunge-alist))
@@ -150,7 +150,8 @@ a POP server, find its cache file on the file system"
            (vm-pop-send-command process "STAT")
            (setq response (vm-pop-read-stat-response process)
                  mailbox-count (nth 0 response)
-                 mailbox-size (nth 1 response))
+                 ;; mailbox-size (nth 1 response)
+                 )
            ;; forget it if the command fails
            ;; or if there are no messages present.
            (if (or (null mailbox-count)
@@ -443,8 +444,8 @@ Returns the process or nil if the session could not be 
created."
        (use-ssh nil)
        (session-name "POP")
        (process-connection-type nil)
-       greeting timestamp ssh-process
-       protocol host port auth user pass authinfo
+       greeting timestamp ;; ssh-process
+       protocol host port auth user pass ;; authinfo
        source-list pop-buffer source-nopwd)
     ;; parse the maildrop
     (setq source-list (vm-pop-parse-spec-to-list source)
@@ -905,8 +906,8 @@ killed as well."
 
 (defun vm-pop-ask-about-no-uidl (popdrop)
   (let ((work-buffer nil)
-       (pop-buffer (current-buffer))
-       start end)
+       ;; (pop-buffer (current-buffer))
+       ) ;; start end
     (unwind-protect
        (save-excursion
          (save-window-excursion
@@ -934,7 +935,7 @@ popdrop
       (let* ((opoint (point))
             (func
              (function
-              (lambda (beg end len)
+              (lambda (_beg end _len)
                 (if vm-pop-read-point
                     (progn
                       (vm-set-pop-stat-x-got statblob (- end start))
@@ -987,6 +988,7 @@ popdrop
        ;; the CRLF or the LF newline convention is used on the inbox
        ;; associated with this crashbox.  This setting assumes the LF
        ;; newline convention is used.
+       (defvar buffer-file-type) ;; FIXME: Removed in Emacs-24.4.
        (let ((buffer-file-type t)
              (selective-display nil))
          (write-region start end target t 0))
@@ -1088,9 +1090,9 @@ LOCAL-EXPUNGE-LIST: A list of message descriptors for 
messages in the
   ;; If the argument DO-RETRIEVES is 'full, then all the messages that
   ;; are not presently in cache are retrieved.  Otherwise, the
   ;; messages previously retrieved are ignored.
-  (let ((here (make-vector 67 0))
+  (let ((here (obarray-make))
        (there (vm-pop-get-uidl-data))
-       (process (vm-folder-pop-process))
+       ;; (process (vm-folder-pop-process))
        retrieve-list local-expunge-list uid 
        mp)
     (setq mp vm-message-list)
diff --git a/lisp/vm-ps-print.el b/lisp/vm-ps-print.el
index 11d4c4628b..7e4f321c3a 100644
--- a/lisp/vm-ps-print.el
+++ b/lisp/vm-ps-print.el
@@ -1,4 +1,4 @@
-;;; vm-ps-print.el --- PS-printing functions for VM
+;;; vm-ps-print.el --- PS-printing functions for VM  -*- lexical-binding: t; 
-*-
 ;;
 ;; This file is part of VM
 ;;
@@ -167,7 +167,7 @@ See `vm-summary-format' for a description of the conversion 
specifiers."
   :type 'string)
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-(defun vm-ps-print-message-internal (filename each folder-name mcount msg)
+(defun vm-ps-print-message-internal (filename each _folder-name _mcount _msg)
   "This function does the actual call to the ps-printing function.
 This is not a function to call interactively!
 
@@ -179,6 +179,7 @@ the header line and MCOUNT is the number of messages to 
print, while
 MSG is a VM message pointer.
 
 See:   `vm-ps-print-message-function'"
+  (defvar dd-mon-yyyy) ;; FIXME: Namespace!
   (let* ((dd-mon-yyyy (format-time-string "%d %b %Y   %T" (current-time)))
         (ps-left-header (if each (eval vm-ps-print-each-message-left-header)
                           (eval vm-ps-print-message-left-header)))
diff --git a/lisp/vm-reply.el b/lisp/vm-reply.el
index 32750a135f..b9f2b9e22d 100644
--- a/lisp/vm-reply.el
+++ b/lisp/vm-reply.el
@@ -1,4 +1,4 @@
-;;; vm-reply.el --- Mailing, forwarding, and replying commands
+;;; vm-reply.el --- Mailing, forwarding, and replying commands  -*- 
lexical-binding: t; -*-
 ;;
 ;; This file is part of VM
 ;;
@@ -140,7 +140,7 @@ messages of the folder are involved in this reply."
   (let ((mlist (vm-select-operable-messages
                count (vm-interactive-p) "Reply to"))
         (dir default-directory)
-        (message-pointer vm-message-pointer)
+        ;; (message-pointer vm-message-pointer)
         (case-fold-search t)
         to cc subject in-reply-to references
         mp tmp tmp2 newsgroups)
@@ -152,12 +152,12 @@ messages of the folder are involved in this reply."
     (while mp
       (cond ((setq tmp (vm-get-header-contents (car mp) "Reply-To:" ", "))
              (unless (vm-ignored-reply-to tmp)
-                 (add-to-list 'to tmp t)))
+               (cl-pushnew tmp to :test #'equal)))
             ((setq tmp (vm-get-header-contents (car mp) "From:" ", "))
-             (add-to-list 'to tmp t))
+             (cl-pushnew tmp to :test #'equal))
             ;; bad, but better than nothing for some
             ((setq tmp (vm-grok-From_-author (car mp)))
-             (add-to-list 'to tmp t))
+             (cl-pushnew tmp to :test #'equal))
             (t (error "No From: or Reply-To: header in message")))
       (let ((this-subject (vm-get-header-contents (car mp) "Subject:"))
             (this-reply-to (and vm-in-reply-to-format
@@ -202,12 +202,7 @@ messages of the folder are involved in this reply."
       (setq mp (cdr mp)))
 
     (when to
-      (setq tmp (car to))
-      (setq to (cdr to))
-      (while to
-        (setq tmp (concat tmp ", " (car to)))
-        (setq to (cdr to)))
-      (setq to tmp))
+      (setq to (mapconcat #'identity (nreverse to) ", ")))
 
     (when vm-strip-reply-headers
       (let ((mail-use-rfc822 t))
@@ -268,7 +263,7 @@ messages of the folder are involved in this reply."
 
 (defun vm-strip-ignored-addresses (addresses)
   (setq addresses (copy-sequence addresses))
-  (let (re-list list addr-list)
+  (let (re-list addr-list) ;; list
     (setq re-list vm-reply-ignored-addresses)
     (while re-list
       (setq addr-list addresses)
@@ -289,6 +284,8 @@ messages of the folder are involved in this reply."
            (setq re-list (cdr re-list))))
        result)))
 
+(defvar zmacs-regions) ;; XEmacs.
+
 (defun vm-mail-yank-default (&optional message)
   "The default message yank handler when `mail-citation-hook' is set to nil."
   (save-excursion
@@ -551,7 +548,7 @@ specified by `vm-included-text-headers' and
 
 (defun vm-yank-message-text (message layout)
   ;; This is the original code for included text
-  (let (new-layout type alternatives parts res insert-start)
+  (let (new-layout alternatives parts res insert-start) ;; type
     (if (null (vectorp (vm-mm-layout message)))
        (let ((b (current-buffer)))
          (set-buffer (vm-buffer-of message))
@@ -562,7 +559,7 @@ specified by `vm-included-text-headers' and
            (append-to-buffer b (vm-headers-of message)
                              (vm-text-end-of message))
            (set-buffer b)))
-      (setq type (car (vm-mm-layout-type layout)))
+      ;; (setq type (car (vm-mm-layout-type layout)))
       (setq parts (list layout))
       (setq alternatives 0)
 
@@ -625,7 +622,7 @@ specified by `vm-included-text-headers' and
               (setq alternatives (1- alternatives))
               (setq parts (cdr parts))))))))
 
-(defun vm-mail-send-and-exit (&rest ignored)
+(defun vm-mail-send-and-exit (&rest _ignored)
   "Send message and maybe delete the composition buffer.
 The value of `vm-keep-sent-mesages' determines whether the composition buffer
 is deleted.  If the composition is a reply to a message in a currently visited
@@ -732,24 +729,26 @@ folder, that message is marked as having been replied to."
 
 (defun vm-mail-mode-remove-message-id-maybe ()
   (if vm-mail-header-insert-message-id
-      (let ((resent nil))
+      (let () ;; (resent nil)
        (if (or (vm-mail-mode-get-header-contents "Resent-To:")
                (vm-mail-mode-get-header-contents "Resent-Cc:")
                (vm-mail-mode-get-header-contents "Resent-Bcc:"))
            (progn
              (vm-mail-mode-remove-header "Resent-Message-ID:")
-             (setq resent t))
+             ;; (setq resent t)
+             t)
          (vm-mail-mode-remove-header "Message-ID:")))))
 
 (defun vm-mail-mode-remove-date-maybe ()
   (if vm-mail-header-insert-date
-      (let ((resent nil))
+      (let ();; (resent nil)
        (if (or (vm-mail-mode-get-header-contents "Resent-To:")
                (vm-mail-mode-get-header-contents "Resent-Cc:")
                (vm-mail-mode-get-header-contents "Resent-Bcc:"))
            (progn
              (vm-mail-mode-remove-header "Resent-Date:")
-             (setq resent t))
+             ;; (setq resent t)
+             t)
          (vm-mail-mode-remove-header "Date:")))))
 
 ;;;###autoload
@@ -799,6 +798,7 @@ This function is a variant of `vm-get-header-contents'."
 (defvar select-safe-coding-system-function)
 
 (defvar coding-system-for-write)
+(defvar mail-send-nonascii)
 
 (defun vm-mail-send ()
   "Just like mail-send except that VM flags the appropriate message(s)
@@ -1371,8 +1371,8 @@ included in the digest."
   (vm-select-folder-buffer-and-validate 1 (vm-interactive-p))
   (let ((dir default-directory)
        (miming (and vm-send-using-mime (equal vm-digest-send-type "mime")))
-       mp mail-buffer work-buffer b
-       ms start header-end boundary)
+       mp mail-buffer work-buffer ;; b
+       start header-end boundary) ;; ms
     (unless mlist
       ;; prefix arg doesn't have "normal" meaning here, so only call
       ;; vm-select-operable-messages for marks or threads.
@@ -1480,7 +1480,8 @@ included in the digest."
        (while mp
          (let ((vm-summary-uninteresting-senders nil))
            (insert (vm-summary-sprintf vm-digest-preamble-format
-                                       (car mp)) "\n"))
+                                       (car mp))
+                   "\n"))
          (if vm-digest-center-preamble
              (progn
                (forward-char -1)
@@ -1575,7 +1576,14 @@ command can be invoked from external agents via an 
emacsclient."
        (if (member header '("subject" "in-reply-to" "cc"
                             "references" "newsgroups" "body"))
            ;; set the variable let-bound above
-           (set (intern header) value)
+           (setf (pcase header
+                  ("subject"     subject)
+                  ("in-reply-to" in-reply-to)
+                  ("cc"          cc)
+                  ("references"  references)
+                  ("newsgroups"  newsgroups)
+                  ("body"        body))
+                 value)
          ;; we'll insert the header later
          (setq header-list (cons header (cons value header-list)))))
       (setq list (cdr list)))
@@ -2013,7 +2021,7 @@ message."
   (let ((temp-buffer nil)
        (mail-buffer (current-buffer))
        (enriched (and (boundp 'enriched-mode) enriched-mode))
-       e-list)
+       ) ;; e-list
     (unwind-protect
        (progn
          (setq temp-buffer (generate-new-buffer "composition preview"))
@@ -2115,7 +2123,7 @@ With a prefix arg, call `vm-mail-mode-show-headers' 
instead."
   (let ((case-fold-search t)
         (header-regexp (regexp-opt vm-mail-mode-hidden-headers))
         (header-end (save-excursion (mail-text) (point)))
-        start end o)
+        start end) ;; o
     (setq header-regexp (concat "^" header-regexp))
     (setq line-move-ignore-invisible t)
     (save-excursion
@@ -2131,7 +2139,7 @@ With a prefix arg, call `vm-mail-mode-show-headers' 
instead."
             (overlay-put o 'read-only t)))))))
 
 ;;;###autoload
-(defun vm-dnd-attach-file (uri action)
+(defun vm-dnd-attach-file (uri _action)
   "Insert a drag and drop file as a MIME attachment in a VM
 composition buffer.  URI is the url of the file as described in
 `dnd-protocol-alist'.  ACTION is ignored."
diff --git a/lisp/vm-rfaddons.el b/lisp/vm-rfaddons.el
index a26438d8f7..45ad881fba 100644
--- a/lisp/vm-rfaddons.el
+++ b/lisp/vm-rfaddons.el
@@ -1,4 +1,4 @@
-;;; vm-rfaddons.el --- a collections of various useful VM helper functions
+;;; vm-rfaddons.el --- a collections of various useful VM helper functions  
-*- lexical-binding: t; -*-
 ;;
 ;; This file is an add-on for VM
 ;; 
@@ -111,6 +111,16 @@
   :group 'vm-ext)
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Sometimes it's handy to fake a date.
+;; I overwrite the standard function by a slightly different version.
+(defcustom vm-mail-mode-fake-date-p t
+  "Non-nil means `vm-mail-mode-insert-date-maybe' keeps an existing date 
header.
+Otherwise, overwrite existing date headers (Rob F)"
+  :group 'vm-rfaddons
+  :type '(boolean))
+
 (defmacro vm-rfaddons-check-option (option option-list &rest body)
   "Evaluate body if option is in OPTION-LIST or OPTION-LIST is
 nil. (Rob F)"
@@ -521,14 +531,14 @@ Use `vm-rmail-toggle' to switch between normal and this 
mode. (Rob F)"
                 (list this-command))
     (vm-update-summary-and-mode-line)))
   
-(defun vm-toggle-mark (count &optional m)
+(defun vm-toggle-mark (count &optional _m)
   (interactive "p")
   (vm-do-with-message
    count
    (lambda (m) (vm-set-mark-of m (not (vm-mark-of m))))
    '(vm-toggle-mark vm-mark-message marking-message)))
 
-(defun vm-toggle-deleted (count &optional m)
+(defun vm-toggle-deleted (count &optional _m)
   (interactive "p")
   (vm-do-with-message
    count
@@ -1193,7 +1203,7 @@ headers. (Rob F)"
   (vm-shrunken-headers-toggle-this))
 
 ;;;###autoload
-(defun vm-shrunken-headers-toggle-this-widget (widget &rest event)
+(defun vm-shrunken-headers-toggle-this-widget (widget &rest _event)
   (goto-char (widget-get widget :to))
   (end-of-line)
   (vm-shrunken-headers-toggle-this))
@@ -1466,7 +1476,7 @@ and add an \"%0UA\" to your `vm-summary-format'. (Rob F)"
     (setq msg (vm-real-message-of msg))
     (vm-mime-action-on-all-attachments
      nil
-     (lambda (msg layout type file)
+     (lambda (_msg _layout _type _file)
        (setq attachments (1+ attachments)))
      vm-summary-attachment-mime-types
      vm-summary-attachment-mime-type-exceptions
@@ -1820,15 +1830,6 @@ not end the comment.  Blank lines do not get comments. 
(Rob F)"
             (search-forward "\n" nil 'move)))))))
 
 
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; Sometimes it's handy to fake a date.
-;; I overwrite the standard function by a slightly different version.
-(defcustom vm-mail-mode-fake-date-p t
-  "Non-nil means `vm-mail-mode-insert-date-maybe' keeps an existing date 
header.
-Otherwise, overwrite existing date headers (Rob F)"
-  :group 'vm-rfaddons
-  :type '(boolean))
-
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (defun vm-isearch-presentation ()
diff --git a/lisp/vm-save.el b/lisp/vm-save.el
index 77b5fd4d86..9856010a94 100644
--- a/lisp/vm-save.el
+++ b/lisp/vm-save.el
@@ -1,4 +1,4 @@
-;;; vm-save.el --- Saving and piping messages under VM
+;;; vm-save.el --- Saving and piping messages under VM  -*- lexical-binding: 
t; -*-
 ;;
 ;; This file is part of VM
 ;;
@@ -288,7 +288,9 @@ thread are saved."
         (vm-save-message-to-imap-folder folder count mlist quiet))
        (t
         (vm-save-message-to-local-folder folder count mlist quiet))))
-   
+
+(defvar inhibit-local-variables) ;; FIXME: Unknown var.  XEmacs?
+
 ;;;###autoload
 (defun vm-save-message-to-local-folder (folder &optional count mlist quiet)
   "Save the current message to a mail folder.
@@ -608,7 +610,7 @@ This command should NOT be used to save message to mail 
folders; use
                   command output-bytes)
        (display-buffer buffer)))))
 
-(defun vm-pipe-message-part (m arg)
+(defun vm-pipe-message-part (m _arg)
   "Return (START END) bounds for piping to external command, based on ARG."
   (cond ((equal prefix-arg '(4))
         (list (vm-text-of m) (vm-text-end-of m)))
@@ -620,7 +622,7 @@ This command should NOT be used to save message to mail 
folders; use
         (list (vm-headers-of m) (vm-text-end-of m)))))
 
 ;;;###autoload
-(defun vm-pipe-message-to-command (command &optional prefix-arg discard-output)
+(defun vm-pipe-message-to-command (command &optional prefixarg discard-output)
   "Runs a shell command with contents from the current message as input.
 By default, the entire message is used.  Message separators are
 included if `vm-message-includes-separators' is non-Nil.
@@ -666,7 +668,7 @@ Output, if any, is displayed.  The message is not altered."
              ;; call-process-region calls write-region.
              ;; don't let it do CR -> LF translation.
              (selective-display nil)
-             (region (vm-pipe-message-part m prefix-arg)))
+             (region (vm-pipe-message-part m prefixarg)))
          (call-process-region (nth 0 region) (nth 1 region)
                               (or shell-file-name "sh")
                               nil buffer nil shell-command-switch command)))
@@ -676,15 +678,15 @@ Output, if any, is displayed.  The message is not 
altered."
     (vm-switch-to-command-output-buffer command buffer discard-output)
     buffer))
 
-(defun vm-pipe-message-to-command-to-string (command &optional prefix-arg)
+(defun vm-pipe-message-to-command-to-string (command &optional prefixarg)
   "Run a shell command with contents from the current message as input.
 This function is like `vm-pipe-message-to-command', but will not display the
 output of the command, but return it as a string."
-  (with-current-buffer (vm-pipe-message-to-command command prefix-arg t)
+  (with-current-buffer (vm-pipe-message-to-command command prefixarg t)
     (buffer-substring-no-properties (point-min) (point-max))))
 
 ;;;###autoload
-(defun vm-pipe-message-to-command-discard-output (command &optional prefix-arg)
+(defun vm-pipe-message-to-command-discard-output (command &optional prefixarg)
   "Run a shell command with contents from the current message as input.
 This function is like `vm-pipe-message-to-command', but will not display the
 output of the command."
@@ -697,7 +699,7 @@ output of the command."
      (vm-select-folder-buffer)
      (list (read-string "Pipe to command: " vm-last-pipe-command)
           current-prefix-arg))))
-  (vm-pipe-message-to-command command prefix-arg t))
+  (vm-pipe-message-to-command command prefixarg t))
 
 (defun vm-pipe-command-exit-handler (process command discard-output 
                                             &optional exit-handler)
@@ -728,7 +730,7 @@ If set to `t', then use the trailing message separator 
stored in the VM
 folder.  If set to nil, no trailing separator is included.")
 
 ;;;###autoload
-(defun vm-pipe-messages-to-command (command &optional prefix-arg 
+(defun vm-pipe-messages-to-command (command &optional prefixarg 
                                            discard-output no-wait)
   "Run a shell command with contents from messages as input.
 
@@ -795,7 +797,7 @@ arguments after the command finished."
                                    (vm-start-of m) (vm-headers-of m)))
              (vm-pipe-messages-to-command-start
               (process-send-string process vm-pipe-messages-to-command-start)))
-       (let ((region (vm-pipe-message-part m prefix-arg)))
+       (let ((region (vm-pipe-message-part m prefixarg)))
          (process-send-region process (nth 0 region) (nth 1 region)))
        (cond ((eq vm-pipe-messages-to-command-end t)
               (process-send-region process 
@@ -813,7 +815,7 @@ arguments after the command finished."
       (vm-pipe-command-exit-handler process command discard-output))
     buffer))
 
-(defun vm-pipe-messages-to-command-to-string (command &optional prefix-arg)
+(defun vm-pipe-messages-to-command-to-string (command &optional prefixarg)
   "Runs a shell command with contents from the current message as input.
 This function is like `vm-pipe-messages-to-command', but will not display the
 output of the command, but return it as a string."
@@ -826,11 +828,11 @@ output of the command, but return it as a string."
      (vm-select-folder-buffer)
      (list (read-string "Pipe to command: " vm-last-pipe-command)
           current-prefix-arg))))
-  (with-current-buffer (vm-pipe-messages-to-command command prefix-arg t)
+  (with-current-buffer (vm-pipe-messages-to-command command prefixarg t)
     (buffer-substring-no-properties (point-min) (point-max))))
 
 ;;;###autoload
-(defun vm-pipe-messages-to-command-discard-output (command &optional 
prefix-arg)
+(defun vm-pipe-messages-to-command-discard-output (command &optional prefixarg)
   "Runs a shell command with contents from the current message as input.
 This function is like `vm-pipe-messages-to-command', but will not display the
 output of the command."
@@ -843,7 +845,7 @@ output of the command."
      (vm-select-folder-buffer)
      (list (read-string "Pipe to command: " vm-last-pipe-command)
           current-prefix-arg))))
-  (vm-pipe-messages-to-command command prefix-arg t))
+  (vm-pipe-messages-to-command command prefixarg t))
 
 ;;;###autoload
 (defun vm-print-message (&optional count)
@@ -939,7 +941,7 @@ Output, if any, is displayed.  The message is not altered."
     (vm-switch-to-command-output-buffer command buffer nil)))
 
 ;;;###autoload
-(defun vm-save-message-to-imap-folder (folder &optional count mlist quiet)
+(defun vm-save-message-to-imap-folder (folder &optional count mlist _quiet)
   "Save the current message to an IMAP folder.
 Prefix arg COUNT means save this message and the next COUNT-1
 messages.  A negative COUNT means save this message and the
diff --git a/lisp/vm-search.el b/lisp/vm-search.el
index f81ec6005b..b34ef2e1a4 100644
--- a/lisp/vm-search.el
+++ b/lisp/vm-search.el
@@ -1,4 +1,4 @@
-;;; vm-search.el --- Incremental search through a mail folder
+;;; vm-search.el --- Incremental search through a mail folder  -*- 
lexical-binding: t; -*-
 ;;
 ;; This file is part of VM
 ;;
diff --git a/lisp/vm-serial.el b/lisp/vm-serial.el
index 711875666c..911fb9f540 100644
--- a/lisp/vm-serial.el
+++ b/lisp/vm-serial.el
@@ -1,4 +1,4 @@
-;;; vm-serial.el --- automatic creation of personalized message bodies
+;;; vm-serial.el --- automatic creation of personalized message bodies  -*- 
lexical-binding: t; -*-
 ;;                   and sending of personalized serial mails
 ;;
 ;; This file is an add-on for VM
@@ -112,8 +112,10 @@
 (defvar vm-reply-list nil)
 (defvar vm-redistribute-list nil)
 (defvar vm-forward-list)
+(defvar vm-serial-point)
 
 ;;-----------------------------------------------------------------------------
+
 (defcustom vm-serial-token-alist
   '(;; standard tokens you should not change (or need not)
     ("to"       (vm-serial-get-to)
diff --git a/lisp/vm-smime.el b/lisp/vm-smime.el
index 738cef83d4..ceeac84d5d 100644
--- a/lisp/vm-smime.el
+++ b/lisp/vm-smime.el
@@ -1,4 +1,4 @@
-;;; vm-smime.el ---  MIME support functions
+;;; vm-smime.el ---  MIME support functions  -*- lexical-binding: t; -*-
 ;;
 ;; This file is part of VM
 ;;
@@ -124,7 +124,7 @@ smime code always asks for a password so this might mess up 
your
 normal flow"
   (let ((start (point)) end
        (buffer-read-only nil)
-       msg sub-layout retval
+       msg sub-layout ;; retval
        (real-content-type (vm-mm-layout-type layout)))
     ;; find the most appropriate key for this mail. First search in
     ;; smime keys for a recipient then fall back to user-mail-address,
diff --git a/lisp/vm-sort.el b/lisp/vm-sort.el
index d698ea34da..c50ad2421a 100644
--- a/lisp/vm-sort.el
+++ b/lisp/vm-sort.el
@@ -1,4 +1,4 @@
-;;; vm-sort.el ---  Sorting and moving messages inside VM
+;;; vm-sort.el ---  Sorting and moving messages inside VM  -*- 
lexical-binding: t; -*-
 ;;
 ;; This file is part of VM
 ;;
@@ -346,7 +346,7 @@ folder in the order in which the messages arrived."
   (let (key-list key-funcs key ml-keys
        physical-order-list old-message-list new-message-list mp-old mp-new
        old-start
-       doomed-start doomed-end offset
+       ;; doomed-start doomed-end offset
        (order-did-change nil)
        virtual
        physical
@@ -616,7 +616,7 @@ that, if P1 and P2 are the oldest different ancestors of M1 
and M2, then
        ;; (criterion (if vm-sort-threads-by-youngest-date 
        ;;             'youngest-date
        ;;           'oldest-date))
-       p1 p2 d1 d2)
+       p1 p2) ;; d1 d2
     (catch 'done
       (cond 
            ;; ((not (eq (car list1) (car list2)))
@@ -854,7 +854,7 @@ that, if P1 and P2 are the oldest different ancestors of M1 
and M2, then
        (set-buffer (vm-buffer-of m))
        (goto-char (vm-start-of m))
        (while (re-search-forward "^[^: \n\t]+:" end t)
-         (add-to-list 'headers (match-string 0)))
+         (cl-pushnew (match-string 0) headers :test #'equal))
        headers))))
 
 (defun vm-sort-compare-header (m1 m2)
diff --git a/lisp/vm-startup.el b/lisp/vm-startup.el
index c8e21bed0e..6461729ff0 100644
--- a/lisp/vm-startup.el
+++ b/lisp/vm-startup.el
@@ -1,3 +1,3 @@
-;; This file is only here for compatibility with older VM versions
+;; This file is only here for compatibility with older VM versions  -*- 
lexical-binding: t; -*-
 (require 'vm)
 (provide 'vm-startup)
diff --git a/lisp/vm-summary-faces.el b/lisp/vm-summary-faces.el
index 108a0bc2f2..005f062f30 100644
--- a/lisp/vm-summary-faces.el
+++ b/lisp/vm-summary-faces.el
@@ -1,4 +1,4 @@
-;;; vm-summary-faces.el --- faces support for VM summary buffers
+;;; vm-summary-faces.el --- faces support for VM summary buffers  -*- 
lexical-binding: t; -*-
 ;;
 ;; This file is part of VM
 ;; 
diff --git a/lisp/vm-summary.el b/lisp/vm-summary.el
index 9425e1f006..bd43ce706c 100644
--- a/lisp/vm-summary.el
+++ b/lisp/vm-summary.el
@@ -1,4 +1,4 @@
-;;; vm-summary.el --- Summary gathering and formatting routines for VM
+;;; vm-summary.el --- Summary gathering and formatting routines for VM  -*- 
lexical-binding: t; -*-
 ;;
 ;; This file is part of VM
 ;;
@@ -311,7 +311,9 @@ the messages in the current folder."
              (setq mp (cdr mp))))
          (set-buffer-modified-p modified))
 
-       (run-hooks 'vm-summary-redo-hook)))
+       ;; FIXME: sumurg's hook function uses `m-list' via dynbind!
+       (vm--dlet ((m-list m-list))
+         (run-hooks 'vm-summary-redo-hook))))
 
     (if (>= n modulus)
        (unless vm-summary-debug 
@@ -452,7 +454,7 @@ of action."
       (set-buffer vm-summary-buffer)
       (let ((buffer-read-only nil)
            (msg (vm-summary-message-at-point))
-           root next)
+           root) ;; next
        (when msg
          (setq root (vm-thread-root msg))
          (if (vm-expanded-root-p root)
@@ -488,14 +490,14 @@ buffer by a regenerated summary line."
   (if (and (buffer-name (vm-buffer-of m)) ; ignore deleted folders and
           (markerp (vm-su-start-of m))   ; markers into deleted buffers
           (marker-buffer (vm-su-start-of m)))
-      (let ((modified (buffer-modified-p)) ; Folder or Presentation
+      (let (;; (modified (buffer-modified-p)) ; Folder or Presentation
            (do-mouse-track
             (or (and vm-mouse-track-summary
                      (vm-mouse-support-possible-p))
                 vm-summary-enable-faces))
-           summary)
+           ) ;; summary
        (with-current-buffer (marker-buffer (vm-su-start-of m))
-         (setq summary (vm-su-summary m))
+         ;; (setq summary (vm-su-summary m))
          (let ((buffer-read-only nil)
                s e i
                (selected nil)
@@ -544,7 +546,9 @@ buffer by a regenerated summary line."
                      (insert vm-summary-=>)))
                  (vm-tokenized-summary-insert m (vm-su-summary m))
                  (delete-char 1)       ; delete "z"
-                 (run-hooks 'vm-summary-update-hook)
+                 ;; FIXME: sumurg's hook function uses `m' via dynbind!
+                 (vm--dlet ((m m))
+                   (run-hooks 'vm-summary-update-hook))
                  (when do-mouse-track
                    (vm-mouse-set-mouse-track-highlight
                     (vm-su-start-of m)
@@ -554,9 +558,11 @@ buffer by a regenerated summary line."
                      (vm-summary-faces-add m)
                    (if (and selected 
                             (facep vm-summary-highlight-face))
-                       (vm-summary-highlight-region 
-                        (vm-su-start-of m) (point)
-                        vm-summary-highlight-face))))
+                       ;; FIXME: sumurg's advice uses `m' via dynbind!
+                       (vm--dlet ((m m))
+                         (vm-summary-highlight-region 
+                          (vm-su-start-of m) (point)
+                          vm-summary-highlight-face)))))
              (when s
                (put-text-property s e 'vm-message m)
                (put-text-property s e 'invisible i))
@@ -1168,7 +1174,7 @@ attachments.                                      USR, 
2010-05-13."
     (vm-mime-operate-on-attachments
      nil
      :action
-     (lambda (msg layout type file)
+     (lambda (_msg _layout _type _file)
        (setq attachments (1+ attachments)))
      :included vm-summary-attachment-mime-types
      :excluded vm-summary-attachment-mime-type-exceptions
@@ -1453,7 +1459,7 @@ cached-data-vector."
   (when (and (vm-su-weekday m) (vm-su-month m) (vm-su-monthday m)
             (vm-su-hour m) (vm-su-year m))
     (format "%s %s %s %s %s"
-           (condition-case error
+           (condition-case _error
                (substring (vm-su-weekday m) 0 3)
              (error "Sun"))            ; make up a valid weekday
            (substring (vm-su-month m) 0 3)
@@ -1846,7 +1852,7 @@ mime-decoded string with text properties.  USR 2010-05-13"
        m
        (let ((subject (vm-decode-mime-encoded-words-in-string
                        (or (vm-get-header-contents m "Subject:") "")))
-            (i nil))
+            ) ;; (i nil)
         (while (string-match "\n[ \t]*" subject)
           (setq subject (replace-match " " nil t subject)))
         subject ))))
@@ -1863,7 +1869,7 @@ necessary.  It is a mime-decoded string with text 
properties.
        m
        (let ((subject (vm-decode-mime-encoded-words-in-string
                        (or (vm-get-header-contents m "Subject:") "")))
-            (i nil))
+            ) ;; (i nil)
         (setq subject (vm-su-trim-subject subject))
         (while (string-match "\n[ \t]*" subject)
           (setq subject (replace-match " " nil t subject)))
@@ -2063,7 +2069,7 @@ Call this function if you made changes to 
`vm-summary-format'."
           nil )))
 
 (defun vm-get-folder-totals (folder)
-  (let ((default "(0 0 0 0)") fs db key data)
+  (let ((default "(0 0 0 0)") db key data) ;; fs
     (catch 'done
       (if (null vm-folders-summary-database)
          (throw 'done (read default)))
@@ -2117,13 +2123,13 @@ Call this function if you made changes to 
`vm-summary-format'."
          (throw 'done nil))
       (setq totals (read totals))
       (cond ((eq action 'arrived)
-            (let ((arrived (car objects)) c n)
+            (let ((arrived (car objects)) c) ;; n
               (setcar totals (+ (car totals) arrived))
               (setq c (cdr totals))
               (setcar c (+ (car c) arrived))))
            ((eq action 'saved)
             (let ((arrived (car objects))
-                  (m (nth 1 objects)) c n)
+                  (m (nth 1 objects)) c) ;; n
               (setcar totals (+ (car totals) arrived))
               ;; increment new and unread counts if necessary.
               ;; messages are never saved with the deleted flag
@@ -2284,7 +2290,7 @@ Call this function if you made changes to 
`vm-summary-format'."
             (or (and vm-mouse-track-summary
                      (vm-mouse-support-possible-p))
                 vm-summary-enable-faces))
-           summary)
+           ) ;;summary
        (with-current-buffer (marker-buffer (vm-fs-start-of fs))
          (let ((buffer-read-only nil))
            (unwind-protect
diff --git a/lisp/vm-thread.el b/lisp/vm-thread.el
index 20b0fb4092..d57e42b285 100644
--- a/lisp/vm-thread.el
+++ b/lisp/vm-thread.el
@@ -1,4 +1,4 @@
-;;; vm-thread.el ---  Thread support for VM
+;;; vm-thread.el ---  Thread support for VM  -*- lexical-binding: t; -*-
 ;;
 ;; This file is part of VM
 ;;
@@ -533,9 +533,9 @@ indentation all the way to 0."
   (interactive "p")
   (vm-follow-summary-cursor)
   (vm-select-folder-buffer-and-validate 1 (vm-interactive-p))
-  (let ((modified (buffer-modified-p))
+  (let (;; (modified (buffer-modified-p))
        (msg (car vm-message-pointer))
-       (indent 0))
+       ) ;; (indent 0)
     (if (= n 0)                                ; special case, set to 0
       (let ((indent (or (vm-thread-indentation-of msg) 0)))
        (mapc (lambda (m)
@@ -559,7 +559,7 @@ indentation back to the normal indentation, i.e., no offset 
is used."
   (interactive "p")
   (vm-follow-summary-cursor)
   (vm-select-folder-buffer-and-validate 1 (vm-interactive-p))
-  (let ((modified (buffer-modified-p))
+  (let (;; (modified (buffer-modified-p))
        (msg (car vm-message-pointer)))
     (if (= n 0)
        (mapc (lambda (m) (vm-set-thread-indentation-offset-of m 0))
@@ -590,7 +590,7 @@ is nil, do it for all the messages in the folder.  USR, 
2010-07-15"
        ;; no need to schedule reindents of reparented messages
        ;; unless there were already messages present.
        (schedule-reindents message-list)
-       m parent parent-sym id id-sym date refs old-parent-sym)
+       ) ;; m parent parent-sym id id-sym date refs old-parent-sym
   (when initializing
     (setq vm-thread-obarray (make-vector 641 0)
          vm-thread-subject-obarray (make-vector 641 0)))
@@ -623,7 +623,7 @@ being initialized."
   (let ((n 0)
        (mp mlist)
        modulus total
-       m parent parent-sym id id-sym date refs old-parent-sym)
+       m parent parent-sym id id-sym refs old-parent-sym) ;; date
     (setq total (* 2 (length mlist)))
     (setq modulus (max 10 (/ (length mlist) 50)))
     (while mp
@@ -705,7 +705,7 @@ being initialized."
       (if (member id vm-traced-message-ids)
          (vm-thread-debug 'vm-build-reference-threads-2 m))
       (if (cdr (setq refs (vm-references m)))
-         (let (parent-sym id-sym msgs msg-syms)
+         (let (parent-sym id-sym) ;; msgs msg-syms
            (setq parent-sym (intern (car refs) vm-thread-obarray)
                  refs (cdr refs))
            (while refs
@@ -763,7 +763,7 @@ all its ancestors, followed via the parent links."
   ;; requires: BASIC /\ LINKS (ancestors(id-sym))
   ;; ensures: TREE0(ancestors(id-sym))
   (let ((msg (vm-th-message-of id-sym))
-       subject subject-sym)
+       subject-sym) ;; subject
     (vm-th-clear-subtree-of id-sym)
     (while (vm-th-parent-of id-sym)
       (setq id-sym (vm-th-parent-of id-sym))
@@ -922,12 +922,12 @@ whereas dates are updated for both reference and 
subject-based ancestors."
   (dolist (m mlist)
     (let ((done nil)
          (subject-thread nil)
-         (loop-recovery-point nil)
+         ;; (loop-recovery-point nil)
          (date (vm-so-sortable-datestring m))
          (subject (vm-so-sortable-subject m))
          id-sym subject-sym loop-sym 
-         root-date root-subject youngest-date
-         root)
+         root-date youngest-date ;; root-subject
+         ) ;; root
       (with-current-buffer (vm-buffer-of m)
        ;; thread trees do not have loops any more, but better to be
        ;; safe than sorry.  USR, 2011-05-13
@@ -939,7 +939,7 @@ whereas dates are updated for both reference and 
subject-based ancestors."
        (while (not done)
          ;; save the date of the oldest message in this thread
          (setq root-date (vm-th-oldest-date-of id-sym))
-         (setq root-subject (vm-th-oldest-subject-of id-sym))
+         ;; (setq root-subject (vm-th-oldest-subject-of id-sym))
          (when (or (null root-date) (string< date root-date))
            (vm-th-set-oldest-date-of id-sym date)
            (unless subject-thread
@@ -976,7 +976,7 @@ whereas dates are updated for both reference and 
subject-based ancestors."
                 (if (boundp loop-sym)
                     ;; loop detected, bail...
                     (setq done t)
-                  (setq root (vm-th-message-of id-sym))
+                  ;; (setq root (vm-th-message-of id-sym))
                   (set loop-sym t)
                   (setq m (vm-th-message-of id-sym))))))
        ))))
@@ -991,7 +991,7 @@ symbols interned in vm-thread-obarray."
        (date (vm-so-sortable-datestring message))
        (subject (vm-so-sortable-subject message))
        m thread-list id-sym subject-sym loop-sym 
-       root-date root-subject youngest-date
+       root-date youngest-date ;; root-subject
        root ancestors)
     (setq m message)
     (with-current-buffer (vm-buffer-of m)
@@ -1012,7 +1012,7 @@ symbols interned in vm-thread-obarray."
       (while (not done)
        ;; save the date of the oldest message in this thread
        (setq root-date (vm-th-oldest-date-of id-sym))
-       (setq root-subject (vm-th-oldest-subject-of id-sym))
+       ;; (setq root-subject (vm-th-oldest-subject-of id-sym))
        (when (or (null root-date)
                  (string< date root-date))
          (vm-th-set-oldest-date-of id-sym date)
@@ -1204,7 +1204,7 @@ been already removed from its symbol node."
                  ;; subject thread is empty
                  (makunbound s-sym)
                ;; subject thread nonempty
-               (let (new-sub new-s-sym)
+               (let () ;; new-sub new-s-sym
                  (setq root-sym (vm-th-thread-symbol oldest-msg))
                  ;; (setq children (vm-th-visible-children-of id-sym))
                  (setq children (cons id-sym (vm-ts-members-of s-sym)))
@@ -1253,7 +1253,7 @@ been already removed from its symbol node."
   (vm-build-threads-if-unbuilt)
   (unless vm-last-message-pointer
     (error "No last message visited"))
-  (let ((new-parent (car vm-last-message-pointer))
+  (let (;; (new-parent (car vm-last-message-pointer))
        (p-sym (vm-thread-symbol (car vm-last-message-pointer)))
        (m (car vm-message-pointer))
        (m-sym (vm-thread-symbol (car vm-message-pointer))))
@@ -1410,7 +1410,7 @@ See also: `vm-thread-root'."
 otherwise.  No exceptions are thrown for errors."
   ;; Threads may not be turned on.  So, ignore errors.
   ;; requires: LIST0(m)
-  (condition-case err
+  (condition-case _err
       (and (eq m (vm-thread-root m))
           (> (vm-thread-count m) 1))
     (vm-thread-error
diff --git a/lisp/vm-toolbar.el b/lisp/vm-toolbar.el
index 210e9ba19d..c385603430 100644
--- a/lisp/vm-toolbar.el
+++ b/lisp/vm-toolbar.el
@@ -1,4 +1,4 @@
-;;; vm-toolbar.el --- Toolbar related functions and commands
+;;; vm-toolbar.el --- Toolbar related functions and commands  -*- 
lexical-binding: t; -*-
 ;;
 ;; This file is part of VM
 ;;
@@ -272,12 +272,12 @@ s-expression like this one in your .vm file:
     (error nil)))
 
 ;;;###autoload
-(defun vm-toolbar-delete/undelete-message (&optional prefix-arg)
+(defun vm-toolbar-delete/undelete-message (&optional prefixarg)
   (interactive "P")
   (vm-follow-summary-cursor)
   (vm-select-folder-buffer-and-validate 1 (vm-interactive-p))
   (vm-error-if-folder-read-only)
-  (let ((current-prefix-arg prefix-arg))
+  (let ((current-prefix-arg prefixarg))
     (if (vm-deleted-flag (car vm-message-pointer))
        (call-interactively 'vm-undelete-message)
       (call-interactively 'vm-delete-message))))
@@ -686,7 +686,7 @@ s-expression like this one in your .vm file:
       (setq button-list (cdr button-list))))
   (setq vm-fsfemacs-toolbar-installed-p t))
 
-(defun vm-toolbar-make-fsfemacs-toolbar-image-spec (name extension dir mask)
+(defun vm-toolbar-make-fsfemacs-toolbar-image-spec (name extension dir _mask)
   (if vm-gtk-emacs-p
       ;; the GTK-toolbar will not display icons when providing a vector since
       ;; some version of GTK resp. Emacs 22 ...
diff --git a/lisp/vm-undo.el b/lisp/vm-undo.el
index fb6eb2b05d..77ae9d4b50 100644
--- a/lisp/vm-undo.el
+++ b/lisp/vm-undo.el
@@ -1,4 +1,4 @@
-;;; vm-undo.el --- Commands to undo message attribute changes in VM
+;;; vm-undo.el --- Commands to undo message attribute changes in VM  -*- 
lexical-binding: t; -*-
 ;;
 ;; This file is part of VM
 ;;
@@ -424,7 +424,7 @@ nil        delete the label
   (let ((action-labels (vm-parse string
 "[\000-\040,\177-\377]*\\([^\000-\040,\177-\377]+\\)[\000-\040,\177-\377]*"))
        (ignored-labels nil)
-       labels act-labels m mm-list)
+       labels act-labels m) ;; mm-list
     (when (and add m-list)
        (if (eq add 'all)
            (progn
@@ -485,7 +485,7 @@ as the real message underlying M.
 Normally, a record of the change is kept for the purpose of undo, and
 the changed attributes are stuffed into the folder, but NORECORD
  suppresses all of this.                             USR 2010-04-06" 
-  (let ((m-list nil) vmp)
+  (let ((m-list nil)) ;; vmp
     (when (and (not vm-folder-read-only)
               (or (not (vm-virtual-messages-of m))
                   (not (with-current-buffer
@@ -529,7 +529,7 @@ as the real message underlying M.
 Normally, a record of the change is kept for the purpose of undo, and
 the changed attributes are stuffed into the folder, but NORECORD
 suppresses all of this.                             USR 2010-04-06" 
-  (let ((m-list nil) vmp)
+  (let ((m-list nil)) ;; vmp
     (when
      (and (not vm-folder-read-only)
           (or (not (vm-virtual-messages-of m))
@@ -603,7 +603,7 @@ changed attributes are stuffed into the folder.        USR 
2010-04-06"
 
 
 ;; This flag is defunct, replaced by body-to-be-discarded.  USR, 2010-06-08
-(defun vm-set-headers-to-be-retrieved-flag (m flag &optional norecord)
+(defun vm-set-headers-to-be-retrieved-flag (_m _flag &optional _norecord)
   nil)
 
 (defun vm-set-body-to-be-discarded-flag (m flag &optional norecord)
diff --git a/lisp/vm-user.el b/lisp/vm-user.el
index 9ebeb70538..a196c1db01 100644
--- a/lisp/vm-user.el
+++ b/lisp/vm-user.el
@@ -1,4 +1,4 @@
-;;; vm-user.el --- Interface functions to VM internal data
+;;; vm-user.el --- Interface functions to VM internal data  -*- 
lexical-binding: t; -*-
 ;;
 ;; This file is part of VM
 ;;
diff --git a/lisp/vm-vars.el b/lisp/vm-vars.el
index 37228f0ba7..7a7d152b09 100644
--- a/lisp/vm-vars.el
+++ b/lisp/vm-vars.el
@@ -1,4 +1,4 @@
-;;; vm-vars.el --- VM user and internal variable initialization
+;;; vm-vars.el --- VM user and internal variable initialization  -*- 
lexical-binding: t; -*-
 ;;
 ;; This file is part of VM
 ;;
@@ -6294,7 +6294,7 @@ Its parent keymap is mail-mode-map.")
   "List of folders used with `vm-switch-to-folder'.")
 
 ;; for sixth arg of read-file-name in early version of Emacs 21.
-(defun vm-folder-history (&rest ignored) t)
+(defun vm-folder-history (&rest _ignored) t)
 
 ;; internal vars
 (defvar vm-skip-collapsed-sub-threads t)
diff --git a/lisp/vm-vcard.el b/lisp/vm-vcard.el
index 2b34bf78ae..5f3034fc31 100644
--- a/lisp/vm-vcard.el
+++ b/lisp/vm-vcard.el
@@ -1,4 +1,4 @@
-;;; vm-vcard.el --- vcard parsing and formatting routines for VM
+;;; vm-vcard.el --- vcard parsing and formatting routines for VM  -*- 
lexical-binding: t; -*-
 ;;
 ;; This file is an add-on for VM
 
diff --git a/lisp/vm-version.el b/lisp/vm-version.el
index d4fdc82f77..7c1bd102b8 100644
--- a/lisp/vm-version.el
+++ b/lisp/vm-version.el
@@ -1,4 +1,4 @@
-;;; vm-version.el --- Version information about VM and the Emacs running VM.
+;;; vm-version.el --- Version information about VM and the Emacs running VM.  
-*- lexical-binding: t; -*-
 ;;
 ;; Copyright (C) Kyle E. Jones, Robert Widhopf-Fenk
 ;; Copyright (C) 2003-2007 Robert Widhopf-Fenk
diff --git a/lisp/vm-virtual.el b/lisp/vm-virtual.el
index 571b569079..8f9a799cc9 100644
--- a/lisp/vm-virtual.el
+++ b/lisp/vm-virtual.el
@@ -1,4 +1,4 @@
-;;; vm-virtual.el --- Virtual folders for VM
+;;; vm-virtual.el --- Virtual folders for VM  -*- lexical-binding: t; -*-
 ;;
 ;; This file is part of VM
 ;;
@@ -48,6 +48,8 @@
                  (folder))
 
 
+(defvar inhibit-local-variables) ;; FIXME: Unknown var.  XEmacs?
+
 ;;;###autoload
 (defun vm-build-virtual-message-list (new-messages &optional dont-finalize)
   "Builds a list of messages matching the virtual folder definition
@@ -84,7 +86,7 @@ all the real folder buffers involved."
        (new-message-list nil)
        virtual location-vector
        message folders folder buffer
-       selectors sel-list selector arglist i
+       selectors i ;; sel-list selector arglist
        real-buffers-used components)
     (if dont-finalize
        nil
@@ -827,7 +829,7 @@ by a Lisp EXPRESSION.  The EXPRESSION should use the 
variable
   (let ((vm-virtual-message (car selectors)))
     (eval (cadr selectors))))
 
-(defun vm-vs-any (m) 
+(defun vm-vs-any (_m) 
   "Virtual selector that always selects any message."
   t)
 
@@ -902,7 +904,7 @@ insignificant characters.  (See `vm-subject-ignored-prefix',
 than a given DATE.  The DATE is specified in the format
           \"31 Dec 1999 23:59:59 GMT\"
 but you can leave out any part of it to get a sensible default."
-  (condition-case error
+  (condition-case _error
       (string< (vm-so-sortable-datestring m)
               (vm-timezone-make-date-sortable date))
     (error t)))
@@ -912,7 +914,7 @@ but you can leave out any part of it to get a sensible 
default."
 than a given DATE.  The DATE is specified in the format
           \"31 Dec 1999 23:59:59 GMT\"
 but you can leave out any part of it to get a sensible default."
-  (condition-case error
+  (condition-case _error
       (string< (vm-timezone-make-date-sortable date)
               (vm-so-sortable-datestring m))
        (error t)))
@@ -922,7 +924,7 @@ but you can leave out any part of it to get a sensible 
default."
 given DAYS ago.  (Today is considered 0 days ago, and yesterday is
 1 day ago.)"
   (let ((date (vm-su-datestring m)))
-    (condition-case error
+    (condition-case _error
         (> (days-between (current-time-string) date) days)
       (error t))))
 
@@ -931,7 +933,7 @@ given DAYS ago.  (Today is considered 0 days ago, and 
yesterday is
 given DAYS ago.  (Today is considered 0 days ago, and yesterday is
 1 day ago.)"
   (let ((date (vm-su-datestring m)))
-    (condition-case error
+    (condition-case _error
         (<= (days-between (current-time-string) date) days)
       (error t))))
 
@@ -1331,7 +1333,7 @@ real or virtual)."
     (setq vm-real-buffers (vm-delete 'buffer-name vm-real-buffers t))
     (dolist (real-buf vm-real-buffers)
       (set-buffer real-buf)
-      (condition-case error-data
+      (condition-case _error-data
          (vm-get-new-mail)
        ;; handlers
        (folder-read-only
diff --git a/lisp/vm-w3.el b/lisp/vm-w3.el
index e3405eb055..c2f724b317 100644
--- a/lisp/vm-w3.el
+++ b/lisp/vm-w3.el
@@ -1,4 +1,4 @@
-;;; vm-w3.el --- additional functions to make VM use w3 for HTML mails
+;;; vm-w3.el --- additional functions to make VM use w3 for HTML mails  -*- 
lexical-binding: t; -*-
 ;;
 ;; This file is part of VM
 ;;
diff --git a/lisp/vm-w3m.el b/lisp/vm-w3m.el
index d77678f5d0..b9d204c843 100644
--- a/lisp/vm-w3m.el
+++ b/lisp/vm-w3m.el
@@ -1,4 +1,4 @@
-;;; vm-w3m.el --- additional functions to make VM use emacs-w3m for HTML mails
+;;; vm-w3m.el --- additional functions to make VM use emacs-w3m for HTML mails 
 -*- lexical-binding: t; -*-
 ;;
 ;; This file is part of VM
 ;;
@@ -121,7 +121,10 @@ This keymap will be bound only when Emacs 20 is running 
and overwritten
 by the minor-mode-keymap for emacs-w3m text, as determined by
 `vm-presentation-minor-modes'.")))
 
-(defun vm-w3m-cid-retrieve (url &rest args)
+(defvar w3m-display-inline-images)
+(defvar w3m-safe-url-regexp)
+
+(defun vm-w3m-cid-retrieve (url &rest _args)
   "Insert a content of URL."
   (let ((message (with-current-buffer w3m-current-buffer                   
(car vm-message-pointer)))
         part
@@ -156,7 +159,7 @@ by the minor-mode-keymap for emacs-w3m text, as determined 
by
                    vm-w3m-mode-map)))))))
 
 ;;;###autoload
-(defun vm-mime-display-internal-emacs-w3m-text/html (start end layout)
+(defun vm-mime-display-internal-emacs-w3m-text/html (start end _layout)
   "Use emacs-w3m to inline HTML mails in the VM presentation buffer."
   (let ((w3m-display-inline-images vm-w3m-display-inline-images)
         (w3m-safe-url-regexp vm-w3m-safe-url-regexp))
diff --git a/lisp/vm-window.el b/lisp/vm-window.el
index 64a85b5a29..61baa93850 100644
--- a/lisp/vm-window.el
+++ b/lisp/vm-window.el
@@ -1,4 +1,4 @@
-;;; vm-window.el --- Window management code for VM
+;;; vm-window.el --- Window management code for VM  -*- lexical-binding: t; -*-
 ;;
 ;; This file is part of VM
 ;;
@@ -177,7 +177,7 @@
        (throw 'done nil))
     (let ((nonexistent " *vm-nonexistent*")
          (nonexistent-summary " *vm-nonexistent-summary*")
-         (selected-frame (vm-selected-frame))
+         ;; (selected-frame (vm-selected-frame))
          folders-summary summary message composition edit config)
       (while (and tags (null config))
        (setq config (assq (car tags) vm-window-configurations)
@@ -489,7 +489,7 @@ Run the hooks in vm-iconify-frame-hook before doing so."
       ;; catch errors--- the selected window might be a dedicated
       ;; window or a minibuffer window.  We don't care and we
       ;; don't want to crash because of it.
-      (condition-case data
+      (condition-case _data
          (switch-to-buffer buffer)
        (error nil)))))
 
diff --git a/lisp/vm.el b/lisp/vm.el
index 228988a4a3..7090642279 100644
--- a/lisp/vm.el
+++ b/lisp/vm.el
@@ -1,4 +1,4 @@
-;;; vm.el --- Entry points for VM
+;;; vm.el --- Entry points for VM  -*- lexical-binding: t; -*-
 ;;
 ;; This file is part of VM
 ;;
@@ -1000,7 +1000,7 @@ non-virtual folders should be returned."
 
 (put 'vm-virtual-mode 'mode-class 'special)
 
-(defun vm-virtual-mode (&rest ignored)
+(defun vm-virtual-mode (&rest _ignored)
   "Mode for reading multiple mail folders as one folder.
 
 The commands available are the same commands that are found in
@@ -1313,7 +1313,7 @@ summary buffer to select a folder."
 ;;;###autoload
 (defun vm-compose-mail (&optional to subject other-headers continue
                        switch-function yank-action
-                       send-actions return-action &rest ignored)
+                       send-actions return-action &rest _ignored)
   (interactive)
   (vm-session-initialization)
   (require 'vm-reply)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]