viewmail-info
[Top][All Lists]
Advanced

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

Re: vm, emacs 28.2 (debian), urls in minibuffer


From: Stefan Monnier
Subject: Re: vm, emacs 28.2 (debian), urls in minibuffer
Date: Tue, 30 Jan 2024 16:29:59 -0500
User-agent: Gnus/5.13 (Gnus v5.13)

BTW, if someone's interested in bringing VM's code into the 21st century,
here's a patch to get started.

I also include the warnings given by Emacs when compiling those files
individually.  Not all of those warnings have to be fixed, but many are
serious.  E.g.

    Warning: the function ‘vm-interactive-p’ is not known to be defined.

means that the file has been incorrectly byte-compiled (IOW, the
generated `.elc` does not actually do what it is supposed to do) because
the compiler presumed this is a function whereas `vm-macros.el` (where
'vm-interactive-p' is defined) defines it as a macro.  The fix would be
to make sure `vm-macro.el` is loaded, by adding a corresponding `require`).
This specific kind of mistake will cause JIT native compilation to
generate similarly broken code.


        Stefan
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..764d4df
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,5 @@
+*.elc
+
+# ELPA-generated files.
+vm-autoloads.el
+vm-pkg.el
diff --git a/contrib/org-html-mail.el b/contrib/org-html-mail.el
index d026a95..901c65a 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
 ;;
 ;; WYSWYG, html mail composition using orgmode
 ;;
diff --git a/contrib/vm-blueman.el b/contrib/vm-blueman.el
index e93771b..8145977 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
diff --git a/contrib/vm-bogofilter.el b/contrib/vm-bogofilter.el
index a8f76cf..c53aa3c 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.
 ;;
@@ -267,7 +267,7 @@ are explicitly marked as spams by the vm-bogofilter-is-spam 
function."
   "The function used to do the actual filtering. It is used as a value for
 vm-retrieved-spooled-mail-hook."
   (save-excursion
-    (vm-save-restriction
+    (save-restriction
      (let ((tail-cons (vm-last vm-message-list))
           (buffer-read-only nil))
        (widen)
@@ -342,7 +342,7 @@ vm-retrieved-spooled-mail-hook."
        (set-buffer buffer)
        (erase-buffer))
       (set-buffer (vm-buffer-of message))
-      (vm-save-restriction
+      (save-restriction
        (vm-save-buffer-excursion
        (widen)
        (goto-char (vm-headers-of message))
diff --git a/contrib/vm-mime-display-internal-application.el 
b/contrib/vm-mime-display-internal-application.el
index 2584b26..afe1d7d 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
diff --git a/contrib/vm-sumurg.el b/contrib/vm-sumurg.el
index c9be3fc..34262d5 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
@@ -180,7 +180,7 @@
     ;; this fails with virtual folders: the modeline in the frame
     ;; of the original folder isn't updated.
     ;; I can see absolutely no non-horrible solution to this.
-    (if vm-fsfemacs-p
+    (if (not (featurep 'xemacs))
        (set-face-foreground 'modeline
                             (aref vm-sumurg-colarray maxl)
                             (selected-frame)))))
@@ -194,7 +194,7 @@
     (if (> level 0)
        (progn
          (aset vm-sumurg-counter level (1+ (aref vm-sumurg-counter level)))
-         (cond (vm-xemacs-p
+         (cond ((featurep 'xemacs)
                 ;; re-use extents, and delete them when not required
                 (let ((e (extent-at (/ (+ start end))
                                     (current-buffer) 'vm-sumurg))) 
@@ -211,14 +211,14 @@
                     )
                   (set-extent-property e 'face 
                                        (aref vm-sumurg-facearray level)))) 
-               (vm-fsfemacs-p
+               ((not (featurep 'xemacs))
                 ;; why 1- ? Because then the overlay gets deleted by
                 ;; the process of summary update.
                 (let ((e (make-overlay start (1- end))))
                   (overlay-put e 'evaporate t)
                   (overlay-put e 'face (aref vm-sumurg-facearray level))))))
       ;; level 0: emacs, delete the extent
-      (cond (vm-xemacs-p
+      (cond ((featurep 'xemacs)
             (let ((e (extent-at (/ (+ start end)) 
                                 (current-buffer) 'vm-sumurg))) 
               (if e (delete-extent e))))))
@@ -344,7 +344,7 @@
 
 
 (defconst vm-sumurg-pending-extent
-  (if vm-xemacs-p
+  (if (featurep 'xemacs)
       (let ((e (make-extent nil nil))
            (k (make-sparse-keymap)))
        (set-extent-face e 'vm-sumurg-pending-face)
@@ -356,7 +356,7 @@
        )))
 
 (defconst vm-sumurg-urgent-extent
-  (if vm-xemacs-p
+  (if (featurep 'xemacs)
       (let ((e (make-extent nil nil))
            (k (make-sparse-keymap)))
        (set-extent-face e 'vm-sumurg-urgent-face)
@@ -368,7 +368,7 @@
        )))
 
 (defconst vm-sumurg-veryurgent-extent
-  (if vm-xemacs-p
+  (if (featurep 'xemacs)
       (let ((e (make-extent nil nil))
            (k (make-sparse-keymap)))
        (set-extent-face e 'vm-sumurg-veryurgent-face)
@@ -382,7 +382,7 @@
 
 
 (defconst vm-sumurg-rightnow-extent
-  (if vm-xemacs-p
+  (if (featurep 'xemacs)
       (let ((e (make-extent nil nil))
            (k (make-sparse-keymap)))
        (set-extent-face e 'vm-sumurg-rightnow-face)
@@ -396,7 +396,7 @@
 
 
 (defconst vm-sumurg-comp-extent
-  (if vm-xemacs-p
+  (if (featurep 'xemacs)
       (let ((e (make-extent nil nil))
            (k (make-sparse-keymap)))
        (set-extent-face e 'vm-sumurg-comp-face)
@@ -411,7 +411,7 @@
 
 ; modeline element for xemacs
 (defvar vm-sumurg-modeline-element
-  (cond (vm-xemacs-p
+  (cond ((featurep 'xemacs)
         (list
          (list 'vm-sumurg-modeline-comp
                (list vm-sumurg-comp-extent "" 
@@ -428,7 +428,7 @@
          (list 'vm-sumurg-modeline-rightnow
                (list vm-sumurg-rightnow-extent "" 
                      'vm-sumurg-modeline-rightnow))))
-       (vm-fsfemacs-p
+       ((not (featurep 'xemacs))
         (list
          (list 'vm-sumurg-modeline-comp
                (list "" 'vm-sumurg-modeline-comp))
@@ -445,7 +445,7 @@
 
 ; stick it at the end
 (add-hook 'vm-summary-mode-hook
-       (if vm-xemacs-p
+       (if (featurep 'xemacs)
            (lambda ()
              (setq vm-sumurg-counter (vector 0 0 0 0 0))
              (if (memq vm-sumurg-modeline-element modeline-format)
@@ -486,8 +486,6 @@
 (add-hook 'vm-mode-hook ' vm-sumurg-vm-mode-hook-fn)
 (add-hook 'vm-presentation-mode-hook ' vm-sumurg-vm-mode-hook-fn)
 
-(require 'advice)
-
 (defadvice  vm-do-needed-mode-line-update
   (before vm-sumurg-dnmlu activate compile)
   (when (and vm-message-pointer vm-ml-sumurg-extent)
diff --git a/lisp/tapestry.el b/lisp/tapestry.el
index 561ec7a..66c9a10 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/vm-avirtual.el b/lisp/vm-avirtual.el
index 9a95cab..30f3005 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
 ;; 
@@ -94,7 +94,7 @@
 ;;               ;; HTML only messages
 ;;               (header "^Content-Type: text/html")
 ;;               ;; for 8bit encoding "chinese" spam
-;;               (header "[¡-ÿ][¡-ÿ][¡-ÿ][¡-ÿ]")
+;;               (header "[¡-ÿ][¡-ÿ][¡-ÿ][¡-ÿ]")
 ;;               ;; for qp-encoding "chinese" spam
 ;;               (header 
"=[A-F][0-9A-F]=[A-F][0-9A-F]=[A-F][0-9A-F]=[A-F][0-9A-F]=[A-F][0-9A-F]")
 ;;               ))))))
@@ -103,9 +103,8 @@
 ;;
 ;;; Code:
 
-(provide 'vm-avirtual)
-
 (require 'vm-virtual)
+(require 'vm-vars)
 
 (eval-when-compile
   (require 'vm-misc)
@@ -143,11 +142,7 @@
   :group 'vm-ext)
 
 ;;----------------------------------------------------------------------------
-(eval-when-compile
-  (require 'cl))
-
 (eval-and-compile
-  (require 'advice)
   (require 'regexp-opt)
   (require 'time-date)
                            
@@ -719,7 +714,7 @@ format:
       (setq selector (vm-virtual-get-selector
                       (vm-read-string "Virtual folder: "
                                       vm-virtual-folder-alist)))
-      (if vm-xemacs-p
+      (if (featurep 'xemacs)
          (setq function 
                (key-or-menu-binding (read-key-sequence "VM command: ")))
        (setq function
@@ -1237,4 +1232,5 @@ with the same name."
 
 ;;----------------------------------------------------------------------------
 
+(provide 'vm-avirtual)
 ;;; vm-avirtual.el ends here
diff --git a/lisp/vm-biff.el b/lisp/vm-biff.el
index fb40f55..3955853 100644
--- a/lisp/vm-biff.el
+++ b/lisp/vm-biff.el
@@ -65,10 +65,10 @@
                  (start end &optional overlay))
 (declare-function vm-summary-faces-add "vm-summary-faces" (message))
 
-(when vm-xemacs-p
+(when (featurep 'xemacs)
   (require 'overlay))
 
-(when vm-fsfemacs-p
+(when (not (featurep 'xemacs))
   (defvar horizontal-scrollbar-visible-p nil))
 
 ; group already defined in vm-vars.el
@@ -246,12 +246,12 @@ folder selectors work."
 (defvar vm-biff--folder-window nil)
 
 (defun vm-biff-x-p ()
-  (if vm-xemacs-p
+  (if (featurep 'xemacs)
       (memq (console-type) '(x mswindows))
     t))
 
 (defun vm-biff-get-buffer-window (buf)
-  (if vm-xemacs-p
+  (if (featurep 'xemacs)
       (vm-get-buffer-window buf (vm-biff-x-p) (frame-device))
     (vm-get-buffer-window buf (vm-biff-x-p))))
 
@@ -464,7 +464,7 @@ AddToFunc SelectWindow
                                 (cons (cons 'popup ff)
                                       vm-biff-frame-properties)
                               vm-biff-frame-properties))
-                     (mf (or (and (if vm-xemacs-p
+                     (mf (or (and (if (featurep 'xemacs)
                                      (vm-get-buffer-window buf t 
                                                            (frame-device))
                                    (vm-get-buffer-window buf t))
@@ -474,7 +474,7 @@ AddToFunc SelectWindow
 
                 (select-frame mf)
                 (switch-to-buffer buf)
-                (if vm-xemacs-p
+                (if (featurep 'xemacs)
                     (set-specifier horizontal-scrollbar-visible-p nil))
             
                 (if (functionp vm-biff-place-frame-function)
@@ -498,7 +498,7 @@ AddToFunc SelectWindow
               (switch-to-buffer buf)
               (if (> h vm-biff-max-height)
                   (setq h vm-biff-max-height))
-             (if vm-xemacs-p
+             (if (featurep 'xemacs)
                  (setq h (- (window-displayed-height) h))
                (setq h (- (window-height) h)))
               (if (not (one-window-p))
diff --git a/lisp/vm-build.el b/lisp/vm-build.el
index 00ee546..7778bfc 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)
@@ -56,7 +56,6 @@
 ;; (put 'inhibit-local-variables 'byte-obsolete-variable nil)
 
 ;; Preload these to get macros right 
-(require 'cl)
 (require 'sendmail)
 (when (featurep 'xemacs)
   (require 'timer-funcs))
diff --git a/lisp/vm-delete.el b/lisp/vm-delete.el
index c63da39..1ae1374 100644
--- a/lisp/vm-delete.el
+++ b/lisp/vm-delete.el
@@ -376,7 +376,7 @@ unmarked messages are not hashed or considerd for deletion."
     del-count))
 
 ;;;###autoload
-(defun* vm-expunge-folder (&key (quiet nil) 
+(cl-defun vm-expunge-folder (&key (quiet nil) 
                                ((:just-these-messages message-list)
                                 nil    ; default value
                                 just-these-messages))
@@ -468,7 +468,7 @@ ignored."
                                           'uid)
                                     vm-imap-retrieved-messages)))))
                (vm-increment vm-modification-counter)
-               (vm-save-restriction
+               (save-restriction
                 (widen)
                 (let ((buffer-read-only nil))
                   (delete-region (vm-start-of real-m)
diff --git a/lisp/vm-digest.el b/lisp/vm-digest.el
index 2abccd6..f24b0b3 100644
--- a/lisp/vm-digest.el
+++ b/lisp/vm-digest.el
@@ -98,7 +98,7 @@ to find out how KEEP-LIST and DISCARD-REGEXP are used."
     ))
 
 ;;;###autoload
-(defun* vm-mime-encapsulate-messages (message-list &key
+(cl-defun vm-mime-encapsulate-messages (message-list &key
                                                   (keep-list nil)
                                                   (discard-regexp "none")
                                                   (always-use-digest nil))
@@ -208,7 +208,7 @@ all of them will be burst."
        start part-list
        (folder-type vm-folder-type))
     (unwind-protect
-       (vm-save-restriction
+       (save-restriction
         (save-excursion
           (widen)
           (setq work-buffer (vm-make-work-buffer))
@@ -483,7 +483,7 @@ RFC 1153.  Otherwise assume RFC 934 digests."
              separator-regexp "^------------------------------\n")
       (setq prologue-separator-regexp "\\(^-[^ ].*\n+\\)+"
            separator-regexp "\\(^-[^ ].*\n+\\)+"))
-    (vm-save-restriction
+    (save-restriction
      (save-excursion
        (widen)
        (unwind-protect
diff --git a/lisp/vm-edit.el b/lisp/vm-edit.el
index 09a07d6..ce1cea1 100644
--- a/lisp/vm-edit.el
+++ b/lisp/vm-edit.el
@@ -71,14 +71,14 @@ replace the original, use C-c C-] and the edit will be 
aborted."
                                     :fail t)
       (if (and edit-buf (buffer-name edit-buf))
          (set-buffer edit-buf)
-       (vm-save-restriction
+       (save-restriction
         (widen)
         (setq edit-buf
               (generate-new-buffer
                (format "edit of %s's note re: %s"
                        (vm-su-full-name (car vm-message-pointer))
                        (vm-su-subject (car vm-message-pointer)))))
-        (if vm-fsfemacs-mule-p
+        (if (not (featurep 'xemacs))
             (set-buffer-multibyte nil)) ; for new buffer
         (vm-set-edit-buffer-of (car mp) edit-buf)
         (copy-to-buffer edit-buf
@@ -274,7 +274,7 @@ thread have their cached data discarded."
          (set-buffer (vm-buffer-of (vm-real-message-of (car mp))))
          (if (not (memq (vm-real-message-of (car mp)) vm-message-list))
              (error "The original copy of this message has been expunged."))
-         (vm-save-restriction
+         (save-restriction
           (widen)
           (goto-char (vm-headers-of (vm-real-message-of (car mp))))
           (let ((vm-message-pointer mp)
@@ -300,7 +300,7 @@ thread have their cached data discarded."
                (vm-save-buffer-excursion
                 (and vm-presentation-buffer
                      (set-buffer vm-presentation-buffer))
-                (vm-save-restriction
+                (save-restriction
                  (vm-save-buffer-excursion
                   (widen)
                   (let ((osw (selected-window))
diff --git a/lisp/vm-folder.el b/lisp/vm-folder.el
index 6b30df6..dbdf816 100644
--- a/lisp/vm-folder.el
+++ b/lisp/vm-folder.el
@@ -1200,7 +1200,7 @@ vm-folder-type is initialized here."
 ;; are ordered according to the order of the keep list.
 
 ;;;###autoload
-(defun* vm-reorder-message-headers (message ; &optional
+(cl-defun vm-reorder-message-headers (message ; &optional
                                   &key (keep-list nil)
                                   (discard-regexp nil))
   (interactive
@@ -1239,7 +1239,7 @@ vm-folder-type is initialized here."
          ;;
          ;; For free standing messages, unwanted headers are
          ;; stripped from the message, unremembered.
-         (vm-save-restriction
+         (save-restriction
           (let ((header-alist (vm-build-header-order-alist keep-list))
                 (buffer-read-only nil)
                 (work-buffer nil)
@@ -1770,7 +1770,7 @@ Supports version 4 format of attribute storage, for 
backward compatibility."
        (time nil)
        time lim oldpoint)
     (save-excursion
-      (vm-save-restriction
+      (save-restriction
        (widen)
        (goto-char (point-min))
        (vm-skip-past-folder-header)
@@ -1801,7 +1801,7 @@ Supports version 4 format of attribute storage, for 
backward compatibility."
   (let ((case-fold-search t)
        lim)
     (save-excursion
-      (vm-save-restriction
+      (save-restriction
        (widen)
        (if (eq vm-folder-type 'babyl)
           (progn
@@ -1857,7 +1857,7 @@ Supports version 4 format of attribute storage, for 
backward compatibility."
        (n nil)
        lim oldpoint)
     (save-excursion
-      (vm-save-restriction
+      (save-restriction
        (widen)
        (goto-char (point-min))
        (vm-skip-past-folder-header)
@@ -1894,7 +1894,7 @@ Supports version 4 format of attribute storage, for 
backward compatibility."
   (let ((case-fold-search t)
        ob lim oldpoint)
     (save-excursion
-      (vm-save-restriction
+      (save-restriction
        (widen)
        (goto-char (point-min))
        (vm-skip-past-folder-header)
@@ -1924,7 +1924,7 @@ Supports version 4 format of attribute storage, for 
backward compatibility."
   (let ((case-fold-search t)
        ob lim oldpoint)
     (save-excursion
-      (vm-save-restriction
+      (save-restriction
        (widen)
        (goto-char (point-min))
        (vm-skip-past-folder-header)
@@ -1952,7 +1952,7 @@ Supports version 4 format of attribute storage, for 
backward compatibility."
 
 (defun vm-gobble-visible-header-variables ()
   (save-excursion
-    (vm-save-restriction
+    (save-restriction
      (let ((case-fold-search t)
           lim)
        (widen)
@@ -2070,7 +2070,7 @@ Supports version 4 format of attribute storage, for 
backward compatibility."
   (let ((case-fold-search t)
        summary lim)
     (save-excursion
-      (vm-save-restriction
+      (save-restriction
        (widen)
        (goto-char (point-min))
        (vm-skip-past-folder-header)
@@ -2136,7 +2136,7 @@ Supports version 4 format of attribute storage, for 
backward compatibility."
 message M into the folder buffer.  The optional argument
 FOR-OTHER-FOLDER indicates <someting unknown>.  USR 2010-03-06"
   (save-excursion
-    (vm-save-restriction
+    (save-restriction
      (widen)
      (let ((old-buffer-modified-p (buffer-modified-p))
           (vm-mime-qp-encoder-program nil) ; use internal code
@@ -2217,7 +2217,7 @@ FOR-OTHER-FOLDER indicates <something unknown>.  USR 
2010-03-06"
 
 
   
-(defun* vm-stuff-folder-data (&key interactive abort-if-input-pending) 
+(cl-defun vm-stuff-folder-data (&key interactive abort-if-input-pending) 
   "Stuff the soft and cached data of all the messages that have the
 stuff-flag set in the current folder.
 Keyword parameter INTERACTIVE says whether the stuffing is being done
@@ -2248,7 +2248,7 @@ pending input.   So, presumably this is non-interactive.  
USR 2012-12-22"
     (let ((vm-key-functions '(vm-sort-compare-physical-order-r)))
       (setq mp (sort newlist 'vm-sort-compare-xxxxxx)))
     (save-excursion
-      (vm-save-restriction
+      (save-restriction
        (widen)
        (let ((old-buffer-modified-p (buffer-modified-p))
             (vm-mime-qp-encoder-program nil)     ; use internal code
@@ -2421,7 +2421,7 @@ pending input.   So, presumably this is non-interactive.  
USR 2012-12-22"
 (defun vm-stuff-labels ()
   (if vm-message-list
       (save-excursion
-       (vm-save-restriction
+       (save-restriction
         (widen)
         (let ((old-buffer-modified-p (buffer-modified-p))
               (case-fold-search t)
@@ -2480,7 +2480,7 @@ pending input.   So, presumably this is non-interactive.  
USR 2012-12-22"
 (defun vm-stuff-bookmark ()
   (if vm-message-pointer
       (save-excursion
-       (vm-save-restriction
+       (save-restriction
         (widen)
         (let ((old-buffer-modified-p (buffer-modified-p))
               (case-fold-search t)
@@ -2523,7 +2523,7 @@ pending input.   So, presumably this is non-interactive.  
USR 2012-12-22"
 (defun vm-stuff-last-modified ()
   (if vm-message-list
       (save-excursion
-       (vm-save-restriction
+       (save-restriction
         (widen)
         (let ((old-buffer-modified-p (buffer-modified-p))
               (case-fold-search t)
@@ -2566,7 +2566,7 @@ pending input.   So, presumably this is non-interactive.  
USR 2012-12-22"
 (defun vm-stuff-pop-retrieved ()
   (if vm-message-list
       (save-excursion
-       (vm-save-restriction
+       (save-restriction
         (widen)
         (let ((old-buffer-modified-p (buffer-modified-p))
               (case-fold-search t)
@@ -2619,7 +2619,7 @@ pending input.   So, presumably this is non-interactive.  
USR 2012-12-22"
 (defun vm-stuff-imap-retrieved ()
   (if vm-message-list
       (save-excursion
-       (vm-save-restriction
+       (save-restriction
         (widen)
         (let ((old-buffer-modified-p (buffer-modified-p))
               (case-fold-search t)
@@ -2673,7 +2673,7 @@ pending input.   So, presumably this is non-interactive.  
USR 2012-12-22"
 (defun vm-stuff-summary ()
   (if vm-message-list
       (save-excursion
-       (vm-save-restriction
+       (save-restriction
         (widen)
         (let ((old-buffer-modified-p (buffer-modified-p))
               (case-fold-search t)
@@ -2720,7 +2720,7 @@ pending input.   So, presumably this is non-interactive.  
USR 2012-12-22"
 (defun vm-stuff-header-variables ()
   (if vm-message-list
       (save-excursion
-       (vm-save-restriction
+       (save-restriction
         (widen)
         (let ((old-buffer-modified-p (buffer-modified-p))
               (case-fold-search t)
@@ -2768,7 +2768,7 @@ pending input.   So, presumably this is non-interactive.  
USR 2012-12-22"
 (defun vm-stuff-message-order ()
   (if (cdr vm-message-list)
       (save-excursion
-       (vm-save-restriction
+       (save-restriction
         (widen)
         (let ((old-buffer-modified-p (buffer-modified-p))
               (case-fold-search t)
@@ -2826,7 +2826,7 @@ pending input.   So, presumably this is non-interactive.  
USR 2012-12-22"
 (defun vm-remove-message-order ()
   (if (cdr vm-message-list)
       (save-excursion
-       (vm-save-restriction
+       (save-restriction
         (widen)
         (let ((old-buffer-modified-p (buffer-modified-p))
               (case-fold-search t)
@@ -3699,10 +3699,10 @@ This function is only used in background tasks.  USR 
2012-12-22."
 ;; Note that deleted messages are not expunged.
 (defun vm-write-file-hook ()
   (if (and (eq major-mode 'vm-mode) (not vm-inhibit-write-file-hook))
-    ;; The vm-save-restriction isn't really necessary here, since
+    ;; The save-restriction isn't really necessary here, since
     ;; the stuff routines clean up after themselves, but should remain
     ;; as a safeguard against the time when other stuff is added here.
-    (vm-save-restriction
+    (save-restriction
      (let ((buffer-read-only))
        (vm-discard-fetched-messages)
        (vm-inform 7 "%s: Stuffing cached data..." (buffer-name))
@@ -4143,7 +4143,7 @@ Same as \\[vm-recover-folder]."
 
 (defun vm-gobble-crash-box (crash-box)
   (save-excursion
-    (vm-save-restriction
+    (save-restriction
      (widen)
      (let ((opoint-max (point-max)) crash-buf
           (buffer-read-only nil)
@@ -4687,7 +4687,7 @@ files."
                 (error "Folder %s is not the same format as this folder."
                        folder))
             (save-excursion
-              (vm-save-restriction
+              (save-restriction
                (widen)
                (goto-char (point-max))
                (let ((coding-system-for-read (vm-binary-coding-system)))
@@ -4715,7 +4715,7 @@ files."
               (vm-inform 5 "%s: No messages gathered." folder)))))))
 
 ;; returns list of new messages if there were any new messages, nil otherwise
-(defun* vm-assimilate-new-messages (&key
+(cl-defun vm-assimilate-new-messages (&key
                                    (read-attributes t) (run-hooks t)
                                    gobble-order labels)
   ;; We are only guessing what this function does.  USR, 2010-05-20
@@ -4738,7 +4738,7 @@ files."
   (let ((tail-cons (vm-last vm-message-list))
        b-list new-messages)
     (save-excursion
-      (vm-save-restriction
+      (save-restriction
        (widen)
        (vm-build-message-list)
        (when (or (null tail-cons) (cdr tail-cons))
@@ -5090,7 +5090,7 @@ Interactively TYPE will be read from the minibuffer."
        (modulus (+ (% (vm-abs (random)) 11) 5))
        text-end opoint)
     (save-excursion
-      (vm-save-restriction
+      (save-restriction
        (widen)
        (setq vm-folder-type type)
        (goto-char (point-min))
@@ -5409,7 +5409,7 @@ thread are retrieved."
            (vm-update-summary-and-mode-line))))
       )))
 
-(defun* vm-retrieve-real-message-body (mm &key 
+(cl-defun vm-retrieve-real-message-body (mm &key 
                                          (fetch nil) (register nil) 
                                          (fail nil))
   "Retrieve the body of a real message MM from its external
@@ -5425,7 +5425,7 @@ Gives an error if unable to retrieve message."
       (message "External messages currently available only for imap folders.")
     (save-excursion
       (set-buffer (vm-buffer-of mm))
-      (vm-save-restriction
+      (save-restriction
        (widen)
        (narrow-to-region (marker-position (vm-headers-of mm)) 
                         (marker-position (vm-text-end-of mm)))
@@ -5565,7 +5565,7 @@ the folder is saved."
       (vm-set-body-to-be-discarded-flag mm nil)
     (save-current-buffer
       (set-buffer (vm-buffer-of mm))
-      (vm-save-restriction
+      (save-restriction
        (widen)
        (let ((inhibit-read-only t)
             ;; (buffer-read-only nil)     ; seems redundant
diff --git a/lisp/vm-grepmail.el b/lisp/vm-grepmail.el
index 96dc15b..e1cfa2e 100644
--- a/lisp/vm-grepmail.el
+++ b/lisp/vm-grepmail.el
@@ -87,7 +87,7 @@
 
 (defvar vm-grepmail-folder-buffer nil)
 
-(if vm-fsfemacs-p
+(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))
 
@@ -183,7 +183,7 @@ FOLDERS should be a list of files/directories to search in."
       (if (null process)
           (error "Cannot start grepmail"))
       ;; set the send-filter
-      (if vm-fsfemacs-p
+      (if (not (featurep 'xemacs))
           (set-buffer-process-coding-system 'raw-text-unix 'raw-text-unix))
       (set-process-filter process 'vm-grepmail-process-filter)
       (set-process-sentinel process 'vm-grepmail-process-done)
@@ -247,7 +247,7 @@ END the end position in the process output buffer."
   (save-excursion
     (set-buffer vm-grepmail-folder-buffer)
     (let ((buffer-read-only nil))
-      (vm-save-restriction
+      (save-restriction
        (widen)
        (goto-char (point-max))
        (insert-buffer-substring message-buffer start end)
diff --git a/lisp/vm-imap.el b/lisp/vm-imap.el
index 7924b03..f9b5fbb 100644
--- a/lisp/vm-imap.el
+++ b/lisp/vm-imap.el
@@ -1159,7 +1159,7 @@ of the current folder, or nil if none has been recorded."
 
 
 ;;;###autoload
-(defun* vm-imap-make-session (source interactive &key 
+(cl-defun vm-imap-make-session (source interactive &key 
                                     (folder-buffer nil)
                                     (purpose nil)
                                     (retry nil))
@@ -3376,7 +3376,7 @@ messages previously retrieved are ignored."
     (vm-inform 1 "VM working in offline mode")))
 
 ;;;###autoload
-(defun* vm-imap-synchronize-folder (&key 
+(cl-defun vm-imap-synchronize-folder (&key 
                                    (interactive nil)
                                    (do-remote-expunges nil)
                                    (do-local-expunges nil)
@@ -3534,7 +3534,7 @@ headers-only form."
     (save-excursion
       (vm-inform 6 "%s: Retrieving new messages... " 
                 (buffer-name folder-buffer))
-      (vm-save-restriction
+      (save-restriction
        (widen)
        (setq old-eob (point-max))
        (goto-char (point-max))
@@ -3937,7 +3937,7 @@ cached tables.  If there is no cached data, return nil.  
USR, 2012-10-19"
          (car (symbol-value uid-sym)))
       (error nil))))
 
-(defun* vm-imap-save-attributes (&optional &key
+(cl-defun vm-imap-save-attributes (&optional &key
                                           (interactive nil)
                                           (all-flags nil))
   "* Save the attributes of changed messages to the IMAP folder.
diff --git a/lisp/vm-macro.el b/lisp/vm-macro.el
index 2edea5b..72febc4 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
 ;;
@@ -174,48 +174,18 @@ current-buffer in `vm-user-interaction-buffer'."
       (vm-build-threads nil)))
 
 (defsubst vm-binary-coding-system ()
-  (cond (vm-xemacs-mule-p 'binary)
-       (vm-xemacs-file-coding-p 'binary)
+  (cond ((featurep 'xemacs) 'binary)
+       ((featurep 'xemacs) 'binary)
        (t 'no-conversion)))
 
 (defsubst vm-line-ending-coding-system ()
-  (cond (vm-xemacs-mule-p 'no-conversion)
-       (vm-xemacs-file-coding-p 'no-conversion)
+  (cond ((featurep 'xemacs) 'no-conversion)
+       ((featurep 'xemacs) 'no-conversion)
        (t 'raw-text)))
 
 ;;; can't use defsubst where quoting is needed in some places but
 ;; not others.
 
-;; save-restriction flubs restoring the clipping region if you
-;; (widen) and modify text outside the old region.
-;; This should do it right.
-(defmacro vm-save-restriction (&rest forms)
-  (let ((vm-sr-clip (make-symbol "vm-sr-clip"))
-       (vm-sr-min (make-symbol "vm-sr-min"))
-       (vm-sr-max (make-symbol "vm-sr-max")))
-    `(let ((,vm-sr-clip (> (buffer-size) (- (point-max) (point-min))))
-          ;; this shouldn't be necessary but the
-          ;; byte-compiler turns these into interned symbols
-          ;; which utterly defeats the purpose of the
-          ;; make-symbol calls above.  Soooo, until the compiler
-          ;; is fixed, these must be made into (let ...)
-          ;; temporaries so that nested calls to this macros
-          ;; won't misbehave.
-          ,vm-sr-min ,vm-sr-max)
-         (and ,vm-sr-clip
-              (setq ,vm-sr-min (set-marker (make-marker) (point-min)))
-              (setq ,vm-sr-max (set-marker (make-marker) (point-max))))
-         (unwind-protect
-             (progn ,@forms)
-           (widen)
-           (and ,vm-sr-clip
-                (progn
-                  (narrow-to-region ,vm-sr-min ,vm-sr-max)
-                  (set-marker ,vm-sr-min nil)
-                  (set-marker ,vm-sr-max nil)))))))
-
-(put 'vm-save-restriction 'edebug-form-spec t)
-
 (defmacro vm-save-buffer-excursion (&rest forms)
   `(let ((vm-sbe-buffer (current-buffer)))
     (unwind-protect
diff --git a/lisp/vm-menu.el b/lisp/vm-menu.el
index 6788e9b..befa307 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
 ;;
@@ -101,7 +101,7 @@
 
 (defconst vm-menu-folder-menu
   `("Folder"
-    ,(if vm-fsfemacs-p
+    ,(if (not (featurep 'xemacs))
        ["Manipulate Folders" ignore (ignore)]
       vm-menu-folders-menu)
     "---"
@@ -138,7 +138,7 @@
     ))
 
 (defconst vm-menu-dispose-menu
-  (let ((title (if (vm-menu-fsfemacs19-menus-p)
+  (let ((title (if nil
                   (list "Dispose"
                         "Dispose"
                         "---"
@@ -357,7 +357,7 @@ do not allow menubar buttons.")
   )
 
 (defconst vm-menu-mail-menu
-  (let ((title (if (vm-menu-fsfemacs19-menus-p)
+  (let ((title (if nil
                   (list "Mail Commands"
                         "Mail Commands"
                         "---"
@@ -371,7 +371,7 @@ do not allow menubar buttons.")
       ["Yank Original" vm-menu-yank-original vm-reply-list]
       "----"
       (
-       ,@(if (vm-menu-fsfemacs19-menus-p)
+       ,@(if nil
             (list "Send Using MIME..."
                   "Send Using MIME..."
                   "---"
@@ -389,7 +389,7 @@ do not allow menubar buttons.")
        :style radio
        :selected (not vm-send-using-mime)])
       (
-       ,@(if (vm-menu-fsfemacs19-menus-p)
+       ,@(if nil
             (list "Fragment Messages Larger Than ..."
                   "Fragment Messages Larger Than ..."
                   "---"
@@ -437,7 +437,7 @@ do not allow menubar buttons.")
        :style radio
        :selected (eq vm-mime-max-message-size 2000000)])
       (
-       ,@(if (vm-menu-fsfemacs19-menus-p)
+       ,@(if nil
             (list "Encode 8-bit Characters Using ..."
                   "Encode 8-bit Characters Using ..."
                   "---"
@@ -473,7 +473,7 @@ do not allow menubar buttons.")
       )))
 
 (defconst vm-menu-mime-dispose-menu
-  (let ((title (if (vm-menu-fsfemacs19-menus-p)
+  (let ((title (if nil
                   (list "Take Action on MIME body ..."
                         "Take Action on MIME body ..."
                         "---"
@@ -527,7 +527,7 @@ do not allow menubar buttons.")
       ["Delete" vm-delete-mime-object t])))
 
 (defconst vm-menu-url-browser-menu
-  (let ((title (if (vm-menu-fsfemacs19-menus-p)
+  (let ((title (if nil
                   (list "Send URL to ..."
                         "Send URL to ..."
                         "---"
@@ -585,7 +585,7 @@ do not allow menubar buttons.")
        vm-opera-program])))
 
 (defconst vm-menu-mailto-url-browser-menu
-  (let ((title (if (vm-menu-fsfemacs19-menus-p)
+  (let ((title (if nil
                   (list "Send Mail using ..."
                         "Send Mail using ..."
                         "---"
@@ -595,7 +595,7 @@ do not allow menubar buttons.")
       ["VM" (vm-mouse-send-url-at-position (point) 'ignore) t])))
 
 (defconst vm-menu-subject-menu
-  (let ((title (if (vm-menu-fsfemacs19-menus-p)
+  (let ((title (if nil
                   (list "Take Action on Subject..."
                         "Take Action on Subject..."
                         "---"
@@ -616,7 +616,7 @@ do not allow menubar buttons.")
       )))
 
 (defconst vm-menu-author-menu
-  (let ((title (if (vm-menu-fsfemacs19-menus-p)
+  (let ((title (if nil
                   (list "Take Action on Author..."
                         "Take Action on Author..."
                         "---"
@@ -634,7 +634,7 @@ do not allow menubar buttons.")
       )))
 
 (defconst vm-menu-attachment-menu
-  (let ((title (if (vm-menu-fsfemacs19-menus-p)
+  (let ((title (if nil
                   (list "Fiddle With Attachment"
                         "Fiddle With Attachment"
                         "---"
@@ -642,7 +642,7 @@ do not allow menubar buttons.")
                 (list "Fiddle With Attachment"))))
     `(,@title
       (
-       ,@(if (vm-menu-fsfemacs19-menus-p)
+       ,@(if nil
             (list "Set Content Disposition..."
                   "Set Content Disposition..."
                   "---"
@@ -666,7 +666,7 @@ do not allow menubar buttons.")
          :selected (eq (vm-mime-attachment-disposition-at-point)
                        'attachment)])
       (
-       ,@(if (vm-menu-fsfemacs19-menus-p)
+       ,@(if nil
             (list "Set Content Encoding..."
                   "Set Content Encoding..."
                   "---"
@@ -699,7 +699,7 @@ do not allow menubar buttons.")
          :selected (string= (vm-mime-attachment-encoding-at-point) 
"quoted-printable")]
          )
       (
-       ,@(if (vm-menu-fsfemacs19-menus-p)
+       ,@(if nil
             (list "Saved attachments"
                   "Saved attachments"
                   "---"
@@ -724,7 +724,7 @@ do not allow menubar buttons.")
       )))
 
 (defconst vm-menu-image-menu
-  (let ((title (if (vm-menu-fsfemacs19-menus-p)
+  (let ((title (if nil
                   (list "Redisplay Image"
                         "Redisplay Image"
                         "---"
@@ -766,7 +766,7 @@ do not allow menubar buttons.")
 (defvar vm-menu-vm-menubar nil)
 
 (defconst vm-menu-vm-menu
-  (let ((title (if (vm-menu-fsfemacs19-menus-p)
+  (let ((title (if nil
                   (list "VM"
                         "VM"
                         "---"
@@ -1077,11 +1077,11 @@ set to the command name so that window configuration 
will be done."
 
 (defun vm-menu-popup-mode-menu (event)
   (interactive "e")
-  (cond ((and (vm-menu-xemacs-menus-p) vm-use-menus)
+  (cond ((and (featurep 'xemacs) vm-use-menus)
         (set-buffer (window-buffer (event-window event)))
         (and (event-point event) (goto-char (event-point event)))
         (popup-mode-menu))
-       ((and (vm-menu-fsfemacs-menus-p) vm-use-menus)
+       ((and (not (featurep 'xemacs)) vm-use-menus)
         (set-buffer (window-buffer (posn-window (event-start event))))
         (goto-char (posn-point (event-start event)))
         (vm-menu-popup-fsfemacs-menu event))))
@@ -1096,7 +1096,7 @@ set to the command name so that window configuration will 
be done."
   ;; support for extents.  Any context sensitive area should be
   ;; contained in an extent with a keymap that has mouse-3 bound
   ;; to a function that will pop up a context sensitive menu.
-  (cond ((and (vm-menu-fsfemacs-menus-p) vm-use-menus)
+  (cond ((and (not (featurep 'xemacs)) vm-use-menus)
         (set-buffer (window-buffer (posn-window (event-start event))))
         (goto-char (posn-point (event-start event)))
         (if (get-text-property (point) 'vm-mime-object)
@@ -1126,7 +1126,7 @@ set to the command name so that window configuration will 
be done."
 (defvar vm-menu-fsfemacs-mime-dispose-menu)
 
 (defun vm-menu-goto-event (event)
-  (cond ((vm-menu-xemacs-menus-p)
+  (cond ((featurep 'xemacs)
         ;; Must select window instead of just set-buffer because
         ;; popup-menu returns before the user has made a
         ;; selection.  This will cause the command loop to
@@ -1134,43 +1134,43 @@ set to the command name so that window configuration 
will be done."
         (select-window (event-window event))
         (and (event-closest-point event)
              (goto-char (event-closest-point event))))
-       ((vm-menu-fsfemacs-menus-p)
+       ((not (featurep 'xemacs))
         (set-buffer (window-buffer (posn-window (event-start event))))
         (goto-char (posn-point (event-start event))))))
 
 (defun vm-menu-popup-url-browser-menu (event)
   (interactive "e")
   (vm-menu-goto-event event)
-  (cond ((and (vm-menu-xemacs-menus-p) vm-use-menus)
+  (cond ((and (featurep 'xemacs) vm-use-menus)
         (popup-menu vm-menu-url-browser-menu))
-       ((and (vm-menu-fsfemacs-menus-p) vm-use-menus)
+       ((and (not (featurep 'xemacs)) vm-use-menus)
         (vm-menu-popup-fsfemacs-menu
          event vm-menu-fsfemacs-url-browser-menu))))
 
 (defun vm-menu-popup-mailto-url-browser-menu (event)
   (interactive "e")
   (vm-menu-goto-event event)
-  (cond ((and (vm-menu-xemacs-menus-p) vm-use-menus)
+  (cond ((and (featurep 'xemacs) vm-use-menus)
         (popup-menu vm-menu-mailto-url-browser-menu))
-       ((and (vm-menu-fsfemacs-menus-p) vm-use-menus)
+       ((and (not (featurep 'xemacs)) vm-use-menus)
         (vm-menu-popup-fsfemacs-menu
          event vm-menu-fsfemacs-mailto-url-browser-menu))))
 
 (defun vm-menu-popup-mime-dispose-menu (event)
   (interactive "e")
   (vm-menu-goto-event event)
-  (cond ((and (vm-menu-xemacs-menus-p) vm-use-menus)
+  (cond ((and (featurep 'xemacs) vm-use-menus)
         (popup-menu vm-menu-mime-dispose-menu))
-       ((and (vm-menu-fsfemacs-menus-p) vm-use-menus)
+       ((and (not (featurep 'xemacs)) vm-use-menus)
         (vm-menu-popup-fsfemacs-menu
          event vm-menu-fsfemacs-mime-dispose-menu))))
 
 (defun vm-menu-popup-attachment-menu (event)
   (interactive "e")
   (vm-menu-goto-event event)
-  (cond ((and (vm-menu-xemacs-menus-p) vm-use-menus)
+  (cond ((and (featurep 'xemacs) vm-use-menus)
         (popup-menu vm-menu-attachment-menu))
-       ((and (vm-menu-fsfemacs-menus-p) vm-use-menus)
+       ((and (not (featurep 'xemacs)) vm-use-menus)
         (vm-menu-popup-fsfemacs-menu
          event vm-menu-fsfemacs-attachment-menu))))
 
@@ -1178,9 +1178,9 @@ set to the command name so that window configuration will 
be done."
 (defun vm-menu-popup-image-menu (event)
   (interactive "e")
   (vm-menu-goto-event event)
-  (cond ((and (vm-menu-xemacs-menus-p) vm-use-menus)
+  (cond ((and (featurep 'xemacs) vm-use-menus)
         (popup-menu vm-menu-image-menu))
-       ((and (vm-menu-fsfemacs-menus-p) vm-use-menus)
+       ((and (not (featurep 'xemacs)) vm-use-menus)
         (vm-menu-popup-fsfemacs-menu
          event vm-menu-fsfemacs-image-menu))))
 
@@ -1207,7 +1207,7 @@ set to the command name so that window configuration will 
be done."
           (call-interactively command)))))
 
 (defun vm-menu-mode-menu ()
-  (if (vm-menu-xemacs-menus-p)
+  (if (featurep 'xemacs)
       (cond ((eq major-mode 'mail-mode)
             vm-menu-mail-menu)
            ((memq major-mode '(vm-mode vm-presentation-mode
@@ -1221,9 +1221,9 @@ set to the command name so that window configuration will 
be done."
          (t vm-menu-fsfemacs-vm-menu))))
 
 (defun vm-menu-set-menubar-dirty-flag ()
-  (cond ((vm-menu-xemacs-menus-p)
+  (cond ((featurep 'xemacs)
         (set-menubar-dirty-flag))
-       ((vm-menu-fsfemacs-menus-p)
+       ((not (featurep 'xemacs))
         ;; force-mode-line-update seems to have been buggy in Emacs
         ;; 21, 22, and 23.  So we do it ourselves.  USR, 2011-02-26
         ;; (force-mode-line-update t)
@@ -1251,7 +1251,7 @@ menu bar.                                             
USR, 2011-02-27"
   (if buffer
       (set-buffer buffer)
     (vm-select-folder-buffer-and-validate 0 (vm-interactive-p)))
-  (cond ((vm-menu-xemacs-menus-p)
+  (cond ((featurep 'xemacs)
         (if (null (car (find-menu-item current-menubar '("[Emacs Menubar]"))))
             (set-buffer-menubar vm-menu-vm-menubar)
           ;; copy the current menubar in case it has been changed.
@@ -1271,7 +1271,7 @@ menu bar.                                             
USR, 2011-02-27"
         (and vm-presentation-buffer-handle
              (save-excursion
                (vm-menu-toggle-menubar vm-presentation-buffer-handle))))
-       ((vm-menu-fsfemacs-menus-p)
+       ((not (featurep 'xemacs))
         (if (not (eq (lookup-key vm-mode-map [menu-bar])
                      (lookup-key vm-mode-menu-map [rootmenu vm])))
             (define-key vm-mode-map [menu-bar]
@@ -1283,12 +1283,12 @@ menu bar.                                             
USR, 2011-02-27"
 
 (defun vm-menu-install-menubar ()
   "Install the dedicated menu bar of VM.              USR, 2011-02-27"
-  (cond ((vm-menu-xemacs-menus-p)
+  (cond ((featurep 'xemacs)
         (setq vm-menu-vm-menubar (vm-menu-make-xemacs-menubar))
         (set-buffer-menubar vm-menu-vm-menubar)
          (run-hooks 'vm-menu-setup-hook)
          (setq vm-menu-vm-menubar current-menubar))
-       ((and (vm-menu-fsfemacs-menus-p)
+       ((and (not (featurep 'xemacs))
              ;; menus only need to be installed once for FSF Emacs
              (not (fboundp 'vm-menu-undo-menu)))
         (vm-menu-initialize-vm-mode-menu-map)
@@ -1298,10 +1298,10 @@ menu bar.                                             
USR, 2011-02-27"
 (defun vm-menu-install-menubar-item ()
   "Install VM's menu on the current - presumably the standard - menu
 bar.                                                USR, 2011-02-27"
-  (cond ((and (vm-menu-xemacs-menus-p) (vm-menu-xemacs-global-menubar))
+  (cond ((and (featurep 'xemacs) (vm-menu-xemacs-global-menubar))
         (set-buffer-menubar (copy-sequence (vm-menu-xemacs-global-menubar)))
         (add-menu nil "VM" (cdr vm-menu-vm-menu)))
-       ((and (vm-menu-fsfemacs-menus-p)
+       ((and (not (featurep 'xemacs))
              ;; menus only need to be installed once for FSF Emacs
              (not (fboundp 'vm-menu-undo-menu)))
         (vm-menu-initialize-vm-mode-menu-map)
@@ -1312,13 +1312,13 @@ bar.                                                 
USR, 2011-02-27"
   "This function strangely does nothing!               USR, 2011-02-27."
   ;; nothing to do here.
   ;; handled in vm-mouse.el
-  (cond ((vm-menu-xemacs-menus-p)
+  (cond ((featurep 'xemacs)
         t )
-       ((vm-menu-fsfemacs-menus-p)
+       ((not (featurep 'xemacs))
         t )))
 
 (defun vm-menu-install-mail-mode-menu ()
-  (cond ((vm-menu-xemacs-menus-p)
+  (cond ((featurep 'xemacs)
         ;; mail-mode doesn't have mode-popup-menu bound to
         ;; mouse-3 by default.  fix that.
         (if vm-popup-menu-on-mouse-3
@@ -1330,7 +1330,7 @@ bar.                                                   
USR, 2011-02-27"
                (copy-sequence (vm-menu-xemacs-global-menubar)))
               (add-menu nil "Mail" (cdr vm-menu-mail-menu))))
         t )
-       ((vm-menu-fsfemacs-menus-p)
+       ((not (featurep 'xemacs))
         ;; I'd like to do this, but the result is a combination
         ;; of the Emacs and VM Mail menus glued together.
         ;; Poorly.
@@ -1378,7 +1378,7 @@ separate dedicated menu bar, depending on the value of
        (progn
          (setcdr tail menu)
          (vm-menu-set-menubar-dirty-flag)
-         (cond ((vm-menu-fsfemacs-menus-p)
+         (cond ((not (featurep 'xemacs))
                 (makunbound 'vm-menu-fsfemacs-virtual-menu)
                 (easy-menu-define vm-menu-fsfemacs-virtual-menu
                                      (list (make-sparse-keymap))
@@ -1441,7 +1441,7 @@ separate dedicated menu bar, depending on the value of
        (progn
          (setcdr tail menu)
          (vm-menu-set-menubar-dirty-flag)
-         (cond ((vm-menu-fsfemacs-menus-p)
+         (cond ((not (featurep 'xemacs))
                 (makunbound 'vm-menu-fsfemacs-folder-menu)
                 (easy-menu-define vm-menu-fsfemacs-folder-menu
                                      (list (make-sparse-keymap))
@@ -1600,7 +1600,7 @@ separate dedicated menu bar, depending on the value of
   (vm-menu-hm-install-menu))
 
 (defun vm-menu-hm-install-menu ()
-  (cond ((vm-menu-xemacs-menus-p)
+  (cond ((featurep 'xemacs)
         (cond ((car (find-menu-item current-menubar '("VM")))
                (add-menu '("VM") "Folders"
                          (cdr vm-menu-folders-menu) "Motion"))
@@ -1608,7 +1608,7 @@ separate dedicated menu bar, depending on the value of
                                     '("Folder" "Manipulate Folders")))
                (add-menu '("Folder") "Manipulate Folders"
                          (cdr vm-menu-folders-menu) "Motion"))))
-       ((vm-menu-fsfemacs-menus-p)
+       ((not (featurep 'xemacs))
         (easy-menu-define vm-menu-fsfemacs-folders-menu
                              (list (make-sparse-keymap))
                              nil
diff --git a/lisp/vm-message-history.el b/lisp/vm-message-history.el
index bc8b8f7..891ce41 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 8ea7f9d..5e0542c 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
@@ -735,7 +735,7 @@ works in all VM buffers."
 (defsubst vm-virtual-message-p (m)
   (not (eq m (vm-real-message-of m))))
 
-(defun* vm-update-virtual-messages (m &key message-changing)
+(cl-defun vm-update-virtual-messages (m &key message-changing)
   "Update all the virtual messages of M to reflect the changes made to
 the headers/body of M."
   (save-excursion
diff --git a/lisp/vm-mime.el b/lisp/vm-mime.el
index c84a645..2600ff7 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
 ;;
@@ -127,7 +127,7 @@ default for it if it's nil.  "
   ;; We can depend on the fact that, in FSF Emacsen, coding systems
   ;; have aliases that correspond to MIME charset names.
   (let ((tmp nil))
-    (cond (vm-fsfemacs-mule-p
+    (cond ((not (featurep 'xemacs))
           (cond ((vm-coding-system-p (setq tmp (intern (downcase charset))))
                   tmp)
                  ((equal charset "us-ascii")
@@ -196,10 +196,10 @@ configuration.  "
               '(iso-8859-1 "iso-8859-1")))
 
 (eval-when-compile
-  (when vm-fsfemacs-p
+  (when (not (featurep 'xemacs))
     (defvar latin-unity-character-sets nil)))
 
-(when vm-xemacs-mule-p
+(when (featurep 'xemacs)
   (require 'vm-vars)
   (vm-update-mime-charset-maps)
   ;; If the user loads Mule-UCS, re-evaluate the MIME charset maps. 
@@ -449,7 +449,7 @@ freshly parsing the message contents."
     (subst-char-in-region start end ?_ (string-to-char " ") t)
     (vm-mime-qp-decode-region start end)))
 
-(fset 'vm-mime-B-decode-region 'vm-mime-base64-decode-region)
+(fset 'vm-mime-B-decode-region 'vm-mime-base64-decode-region) ;FIXME:?
 
 (defun vm-mime-Q-encode-region (start end)
   (let ((buffer-read-only nil)
@@ -543,7 +543,7 @@ same effect."
          (insert-buffer-substring b b-start b-end)
          (setq retval (apply 'decode-coding-region (point-min) (point-max)
                              coding-system foo))
-         (and vm-fsfemacs-p (set-buffer-multibyte t)) ; is this safe?
+         (and (not (featurep 'xemacs)) (set-buffer-multibyte t)) ; is this 
safe?
          (setq start (point-min) end (point-max))
          (save-excursion
            (set-buffer b)
@@ -560,9 +560,9 @@ same effect."
 
 (defun vm-mime-charset-decode-region (charset start end)
   (or (markerp end) (setq end (vm-marker end)))
-  (cond ((or vm-xemacs-mule-p vm-fsfemacs-mule-p)
-        (if (or (and vm-xemacs-p (memq (vm-device-type) '(x gtk mswindows)))
-                vm-fsfemacs-p
+  (cond ((or (featurep 'xemacs) (not (featurep 'xemacs)))
+        (if (or (and (featurep 'xemacs) (memq (vm-device-type) '(x gtk 
mswindows)))
+                (not (featurep 'xemacs))
                 (vm-mime-tty-can-display-mime-charset charset)
                 nil)
             (let ((buffer-read-only nil)
@@ -589,7 +589,7 @@ same effect."
           (if font
               (condition-case data
                   (progn (set-face-font face font)
-                         (if vm-fsfemacs-p
+                         (if (not (featurep 'xemacs))
                              (put-text-property start end 'face face)
                            (vm-set-extent-property e 'duplicable t)
                            (vm-set-extent-property e 'face face)))
@@ -634,7 +634,7 @@ out includes base-64, quoted-printable, uuencode and CRLF 
conversion."
                 ;; of errors, which is not in the spirit of the
                 ;; MIME spec, so avoid using it. - Kyle Jones
                 ;; Let us try it out now.  USR, 2012-10-19
-                ;; (not vm-fsfemacs-p)
+                ;; (not (not (featurep 'xemacs)))
                 )
            (condition-case data
                (base64-decode-region start end)
@@ -1157,7 +1157,7 @@ previous mime decoding."
            (vm-matched-header-contents)
          nil )))))
 
-(defun* vm-mime-parse-entity (&optional m &key
+(cl-defun vm-mime-parse-entity (&optional m &key
                                        (default-type nil)
                                        (default-encoding nil)
                                        (passing-message-only nil))
@@ -1440,7 +1440,7 @@ PASSING-MESSAGE-ONLY is a boolean argument that says that 
VM is only
             'message-symbol (vm-mime-make-message-symbol m)
             )))))))
 
-(defun* vm-mime-parse-entity-safe (&optional m &key
+(cl-defun vm-mime-parse-entity-safe (&optional m &key
                                            (default-type nil)
                                            (default-encoding nil)
                                            (passing-message-only nil))
@@ -1955,10 +1955,10 @@ that recipient is outside of East Asia."
   (save-excursion
     (save-restriction
       (narrow-to-region beg end)
-       (if (or vm-xemacs-mule-p
-               (and vm-fsfemacs-mule-p enable-multibyte-characters))
+       (if (or (featurep 'xemacs)
+               (and (not (featurep 'xemacs)) enable-multibyte-characters))
            ;; Okay, we're on a MULE build.
-         (if (and vm-fsfemacs-mule-p
+         (if (and (not (featurep 'xemacs))
                   (fboundp 'check-coding-systems-region))
              ;; check-coding-systems-region appeared in GNU Emacs 23.
              (let* ((preapproved (vm-get-coding-system-priorities))
@@ -2194,7 +2194,7 @@ that recipient is outside of East Asia."
          ((vm-mime-types-match "image/xbm" type)
           (and (vm-image-type-available-p 'xbm) (vm-images-possible-here-p)))
          ((vm-mime-types-match "audio/basic" type)
-          (and vm-xemacs-p
+          (and (featurep 'xemacs)
                (or (featurep 'native-sound)
                    (featurep 'nas-sound))
                (or (device-sound-enabled-p)
@@ -2460,7 +2460,7 @@ assuming that it is text."
            (vm-warn 0 1 "Conversion from %s to %s signalled exit code %s"
                     (nth 0 ooo) (nth 1 ooo) ex))
          ;; This cannot possibly safe.  USR, 2011-02-11
-         ;; (if vm-fsfemacs-mule-p 
+         ;; (if (not (featurep 'xemacs)) 
          ;;    (set-buffer-multibyte t))
          (setq start (point-min) end (point-max))
          (with-current-buffer b
@@ -2472,7 +2472,7 @@ assuming that it is text."
       ;; unwind-protection
       (when work-buffer (kill-buffer work-buffer)))))
 
-(defun* vm-mime-should-display-button (layout &key ignore-content-disposition)
+(cl-defun vm-mime-should-display-button (layout &key 
ignore-content-disposition)
   "Checks whether MIME object with LAYOUT should be displayed as
 a button.  Optional keyword argument IGNORE-CONTENT-DISPOSITION
 says whether the Content-Disposition header of the MIME object
@@ -2662,7 +2662,7 @@ in the buffer.  The function is expected to make the 
message
          (let ((vm-display-using-mime nil))
            (vm-show-current-message)))
        (setq m (car vm-message-pointer))
-       (vm-save-restriction
+       (save-restriction
         (widen)
         (goto-char (vm-text-of m))
         (let ((buffer-read-only nil)
@@ -3669,7 +3669,7 @@ button that this LAYOUT comes from."
       (lambda (extent)
        ;; reuse the internal display code, but make sure that no new
        ;; buttons will be created for the external-body content.
-       (let ((layout (if vm-xemacs-p
+       (let ((layout (if (featurep 'xemacs)
                          (vm-extent-property extent 'vm-mime-layout)
                        (overlay-get extent 'vm-mime-layout)))
              (vm-mime-auto-displayed-content-types t)
@@ -3928,9 +3928,9 @@ it to an internal object by retrieving the body.       
USR, 2011-03-28"
 IMAGE-TYPE is its image type (png, jpeg etc.).  NAME is a string
 describing the image type.                             USR, 2011-03-25"
   (cond
-   (vm-xemacs-p
+   ((featurep 'xemacs)
     (vm-mime-display-internal-image-xemacs-xxxx layout image-type name))
-   ((and vm-fsfemacs-p (fboundp 'image-type-available-p))
+   ((and (not (featurep 'xemacs)) (fboundp 'image-type-available-p))
     (vm-mime-display-internal-image-fsfemacs-xxxx layout image-type name))
    (t
     (vm-inform 0 "Unsupported Emacs version"))
@@ -4612,7 +4612,7 @@ image when possible."
                                   vm-mime-thumbnail-max-geometry))
        ;; extract image data, don't need the image itself!
        ;; if the display was not successful, glyph will be nil
-       (setq glyph (if vm-xemacs-p
+       (setq glyph (if (featurep 'xemacs)
                        (let ((e1 (vm-extent-at start))
                              (e2 (vm-extent-at (1+ start))))
                          (or (and e1 (extent-begin-glyph e1))
@@ -4623,7 +4623,7 @@ image when possible."
        (setq start (point))
        (vm-mime-display-button-xxxx layout t)
        (when glyph
-         (if vm-xemacs-p
+         (if (featurep 'xemacs)
              (set-extent-begin-glyph (vm-extent-at start) glyph)
            (put-text-property start (1+ start) 'display glyph)))
        ;; remove the cached thumb so that full sized image will be shown
@@ -4637,7 +4637,7 @@ image when possible."
   (vm-mime-display-button-image layout))
 
 (defun vm-mime-display-internal-audio/basic (layout)
-  (if (and vm-xemacs-p
+  (if (and (featurep 'xemacs)
           (or (featurep 'native-sound)
               (featurep 'nas-sound))
           (or (device-sound-enabled-p)
@@ -4856,7 +4856,7 @@ buffer for message composition is queried from the 
minibufer."
 ;;----------------------------------------------------------------------------
 
 ;;;###autoload
-(defun* vm-mime-operate-on-attachments (count &key 
+(cl-defun vm-mime-operate-on-attachments (count &key 
                                              ((:name action-name))
                                              ((:action action))
                                              ((:included types)) 
@@ -5194,9 +5194,9 @@ confirmed before creating a new directory."
   "Set an image stamp for MIME button extent E as appropriate for
 TYPE.                                                 USR, 2011-03-25"
   (cond
-   (vm-xemacs-p
+   ((featurep 'xemacs)
     (vm-mime-xemacs-set-image-stamp-for-type e type))
-   (vm-fsfemacs-p
+   ((not (featurep 'xemacs))
     (vm-mime-fsfemacs-set-image-stamp-for-type e type))))
 
 (defconst vm-mime-type-images
@@ -5275,7 +5275,7 @@ the front and placing the image there as the display text 
property.
                                         ':type 'xpm
                                         ':file file))))))))
 
-(defun* vm-mime-insert-button (&key caption action layout (disposable nil))
+(cl-defun vm-mime-insert-button (&key caption action layout (disposable nil))
   "Display a button for a mime object, using CAPTION as the label (a
 string) and ACTION as the default action (a function).  The mime object
 is described by LAYOUT.  If DISPOSABLE is true, then the button will
@@ -5292,7 +5292,7 @@ be removed when it is expanded to display the mime 
object."
     (insert caption "\n")
     ;; we must use the same interface that the vm-extent functions
     ;; use.  if they use overlays, then we call make-overlay.
-    (if vm-fsfemacs-p
+    (if (not (featurep 'xemacs))
        ;; we MUST have the five arg make-overlay.  overlays must
        ;; advance when text is inserted at their start position or
        ;; inline text and graphics will seep into the button
@@ -5302,9 +5302,9 @@ be removed when it is expanded to display the mime 
object."
       (vm-set-extent-property e 'start-open t)
       (vm-set-extent-property e 'end-open t))
     (vm-mime-set-image-stamp-for-type e (car (vm-mm-layout-type layout)))
-    (when vm-fsfemacs-p
+    (when (not (featurep 'xemacs))
       (vm-set-extent-property e 'local-map keymap))
-    (when vm-xemacs-p
+    (when (featurep 'xemacs)
       (vm-set-extent-property e 'highlight t)
       (vm-set-extent-property e 'keymap keymap)
       (vm-set-extent-property e 'balloon-help 'vm-mouse-3-help))
@@ -5316,9 +5316,9 @@ be removed when it is expanded to display the mime 
object."
     (vm-set-extent-property e 'vm-mime-layout layout)
     (vm-set-extent-property e 'vm-mime-function action)
     ;; for vm-continue-postponed-message
-    (when vm-xemacs-p
+    (when (featurep 'xemacs)
       (vm-set-extent-property e 'duplicable t))
-    (when vm-fsfemacs-p
+    (when (not (featurep 'xemacs))
       (put-text-property (overlay-start e)
                         (overlay-end e)
                         'vm-mime-layout layout))
@@ -5771,14 +5771,14 @@ Returns non-NIL value M is a plain message."
 
 (defun vm-mime-charset-internally-displayable-p (name)
   "Can the given MIME charset be displayed within emacs by VM?"
-  (cond ((and vm-xemacs-mule-p (memq (vm-device-type) '(x gtk mswindows)))
+  (cond ((and (featurep 'xemacs) (memq (vm-device-type) '(x gtk mswindows)))
         (or (vm-mime-charset-to-coding name)
             (vm-mime-default-face-charset-p name)))
 
        ;; vm-mime-tty-can-display-mime-charset (called below) fails
        ;; for GNU Emacs. So keep things simple, since there's no harm
        ;; if replacement characters are displayed.
-       (vm-fsfemacs-mule-p)
+       ((not (featurep 'xemacs)))
        ((vm-multiple-fonts-possible-p)
         (or (vm-mime-default-face-charset-p name)
             (vm-string-assoc name vm-mime-charset-font-alist)))
@@ -6399,7 +6399,7 @@ COMPOSITION's name will be read from the minibuffer."
               'vm-attach-object-to-composition "8.2.0")
 
 
-(defun* vm-attach-object (object &key type params description 
+(cl-defun vm-attach-object (object &key type params description 
                                      (mimed nil)
                                      (disposition '("unspecified"))
                                      (no-suggested-filename nil))
@@ -6462,7 +6462,7 @@ there is no file name for this object.             USR, 
2011-03-07"
     (setq end (1- (point)))
 
 
-    (cond (vm-fsfemacs-p
+    (cond ((not (featurep 'xemacs))
           (put-text-property start end 'front-sticky nil)
           (put-text-property start end 'rear-nonsticky t)
           ;; can't be intangible because menu clicking at a position
@@ -6484,7 +6484,7 @@ there is no file name for this object.             USR, 
2011-03-07"
           (put-text-property start end 'vm-mime-encoded mimed)
           ;; (put-text-property start end 'duplicable t)
           )
-         (vm-xemacs-p
+         ((featurep 'xemacs)
           (setq e (vm-make-extent start end))
           (vm-mime-set-image-stamp-for-type e (or type "text/plain"))
           (vm-set-extent-property e 'start-open t)
@@ -6509,37 +6509,37 @@ there is no file name for this object.             USR, 
2011-03-07"
 (defalias 'vm-mime-attach-object 'vm-attach-object)
 
 (defun vm-mime-attachment-forward-local-refs-at-point ()
-  (cond (vm-fsfemacs-p
+  (cond ((not (featurep 'xemacs))
         (let ((fb (get-text-property (point) 'vm-mime-forward-local-refs)))
           (car fb) ))
-       (vm-xemacs-p
+       ((featurep 'xemacs)
         (let* ((e (vm-extent-at (point) 'vm-mime-type))
                (fb (vm-extent-property e 'vm-mime-forward-local-refs)))
           (car fb) ))))
 
 (defun vm-mime-set-attachment-forward-local-refs-at-point (val)
-  (cond (vm-fsfemacs-p
+  (cond ((not (featurep 'xemacs))
         (let ((fb (get-text-property (point) 'vm-mime-forward-local-refs)))
           (setcar fb val) ))
-       (vm-xemacs-p
+       ((featurep 'xemacs)
         (let* ((e (vm-extent-at (point) 'vm-mime-type))
                (fb (vm-extent-property e 'vm-mime-forward-local-refs)))
           (setcar fb val) ))))
 
 (defun vm-mime-delete-attachment-button ()
-  (cond (vm-fsfemacs-p
+  (cond ((not (featurep 'xemacs))
          ;; TODO
          )
-       (vm-xemacs-p
+       ((featurep 'xemacs)
         (let ((e (vm-extent-at (point) 'vm-mime-type)))
            (delete-region (vm-extent-start-position e)
                           (vm-extent-end-position e))))))
 
 (defun vm-mime-delete-attachment-button-keep-infos ()
-  (cond (vm-fsfemacs-p
+  (cond ((not (featurep 'xemacs))
          ;; TODO
          )
-       (vm-xemacs-p
+       ((featurep 'xemacs)
         (let ((e (vm-extent-at (point) 'vm-mime-type)))
            (save-excursion
              (goto-char (1+ (vm-extent-start-position e)))
@@ -6562,40 +6562,40 @@ there is no file name for this object.             USR, 
2011-03-07"
      nil t))))
 
 (defun vm-mime-attachment-disposition-at-point ()
-  (cond (vm-fsfemacs-p
+  (cond ((not (featurep 'xemacs))
         (let ((disp (get-text-property (point) 'vm-mime-disposition)))
           (intern (car disp))))
-       (vm-xemacs-p
+       ((featurep 'xemacs)
         (let* ((e (vm-extent-at (point) 'vm-mime-disposition))
                (disp (vm-extent-property e 'vm-mime-disposition)))
           (intern (car disp))))))
 
 (defun vm-mime-set-attachment-disposition-at-point (sym)
-  (cond (vm-fsfemacs-p
+  (cond ((not (featurep 'xemacs))
         (let ((disp (get-text-property (point) 'vm-mime-disposition)))
           (setcar disp (symbol-name sym))))
-       (vm-xemacs-p
+       ((featurep 'xemacs)
         (let* ((e (vm-extent-at (point) 'vm-mime-disposition))
                (disp (vm-extent-property e 'vm-mime-disposition)))
           (setcar disp (symbol-name sym))))))
 
 
 (defun vm-mime-attachment-encoding-at-point ()
-  (cond (vm-fsfemacs-p
+  (cond ((not (featurep 'xemacs))
         (let ((enc (get-text-property (point) 'vm-mime-encoding)))
           (car enc)))
-       (vm-xemacs-p
+       ((featurep 'xemacs)
         (let* ((e (vm-extent-at (point) 'vm-mime-encoding))
                (enc (vm-extent-property e 'vm-mime-encoding)))
            (if e (car enc))))))
 
 (defun vm-mime-set-attachment-encoding-at-point (sym)
-  (cond (vm-fsfemacs-p
+  (cond ((not (featurep 'xemacs))
         ;; (set-text-property (point) 'vm-mime-encoding sym)
         ;; (put-text-property (point) (point) 'vm-mime-encoding sym)
         (let ((enc (get-text-property (point) 'vm-mime-encoding)))
           (setcar enc sym)))
-       (vm-xemacs-p
+       ((featurep 'xemacs)
         (let* ((e (vm-extent-at (point) 'vm-mime-disposition))
                (enc (vm-extent-property e 'vm-mime-encoding)))
           (setcar enc sym)))))
@@ -6625,7 +6625,7 @@ extents that have the property are returned.
 In GNU Emacs version of this function, attachment buttons are expected
 to be denoted by text-properties rather than extents.  \"Fake\"
 extents are created for the purpose of this function.  USR, 2011-03-27"
-  (let ((e-list  (if vm-xemacs-p
+  (let ((e-list  (if (featurep 'xemacs)
                     (vm-extent-list start end prop)
                   (vm-mime-fake-attachment-overlays start end prop))))
     (sort e-list (function
@@ -6838,7 +6838,7 @@ describes what was deleted."
              opos
              (buffer-read-only nil))
          (save-excursion
-           (vm-save-restriction
+           (save-restriction
             (goto-char (vm-extent-start-position e))
             (setq opos (point))
             (setq label (vm-mime-sprintf 
@@ -6867,7 +6867,7 @@ describes what was deleted."
                 (not (eq (marker-buffer (vm-mm-layout-body-start layout))
                          (current-buffer))))
        (error "MIME body is not in the message"))
-      (vm-save-restriction
+      (save-restriction
        (widen)
        (if (vm-mm-layout-is-converted layout)
            (setq layout (vm-mm-layout-unconverted-layout layout)))
@@ -6971,7 +6971,7 @@ respectively).  If none is specified, quoted-printbale is 
used."
             coding (vm-mime-charset-to-coding charset))
       ;; encode coding system body
       (when (and  coding (not (eq coding 'no-conversion)))
-        (if vm-xemacs-p
+        (if (featurep 'xemacs)
            (vm-encode-coding-region start end coding)
          ;; using vm-encode-coding-region causes wrong encoding in GNU Emacs
          (encode-coding-region start end coding)))
@@ -7027,7 +7027,7 @@ should be encoded together."
           (setq end (or (and (re-search-forward "^[^ \t:]+:" body-start t)
                              (match-beginning 0))
                         body-start)))
-        (vm-save-restriction
+        (save-restriction
          (narrow-to-region start end)
          (vm-mime-encode-words))
         (goto-char end)))))
@@ -7098,7 +7098,7 @@ and the approriate content-type and boundary markup 
information is added."
          forward-local-refs already-mimed layout e e-list boundary
          type encoding charset params description disposition object
          opoint-min encoded-attachment message-smimed)
-      (when vm-xemacs-p
+      (when (featurep 'xemacs)
        ;;Make sure we don't double encode UTF-8 (for example) text.
        (setq buffer-file-coding-system (vm-binary-coding-system)))
       (goto-char (mail-text-start))
@@ -7409,7 +7409,7 @@ WHOLE-MESSAGE is true then nil is returned."
     ;; support enriched-mode for text/enriched composition
     (when enriched
       (let ((enriched-initial-annotation ""))
-       (if vm-fsfemacs-p
+       (if (not (featurep 'xemacs))
            (save-excursion
              ;; insert/delete trick needed to avoid
              ;; enriched-mode tags from seeping into the
@@ -7424,7 +7424,7 @@ WHOLE-MESSAGE is true then nil is returned."
          (enriched-encode (point-min) (point-max)))))
             
     (setq charset (vm-determine-proper-charset (point-min) (point-max)))
-    (when (vm-emacs-mule-p)
+    (when t
       (let ((coding-system
             (vm-mime-charset-to-coding charset)))
        (unless coding-system
@@ -7442,7 +7442,7 @@ WHOLE-MESSAGE is true then nil is returned."
                              coding-system)))
 
     ;; not clear why this is needed.  USR, 2011-03-27
-    (when vm-xemacs-p
+    (when (featurep 'xemacs)
       (when whole-message (enriched-mode -1)))
     (setq encoding (vm-determine-proper-content-transfer-encoding
                    (point-min) (point-max))
@@ -7764,7 +7764,7 @@ Returns marker pointing to the start of the encoded MIME 
part."
          (delete-char -1))))
 
     (setq charset (vm-determine-proper-charset (point-min) (point-max)))
-    (when vm-fsfemacs-mule-p
+    (when (not (featurep 'xemacs))
       (let ((coding-system
             (vm-mime-charset-to-coding charset)))
        (unless coding-system
@@ -8201,7 +8201,7 @@ the first sub part of a multipart/alternative is a 
text/plain part."
            (set-buffer (vm-buffer-of m))
            (let ((inhibit-read-only t)
                  (buffer-read-only nil))
-             (vm-save-restriction
+             (save-restriction
               (widen)
               (if (vm-mm-layout-is-converted layout)
                   (setq layout (vm-mm-layout-unconverted-layout layout)))
@@ -8261,7 +8261,7 @@ This is a destructive operation and cannot be undone!"
   "Replace all mime buttons in the current buffer by attachment buttons."
   ;; called vm-mime-encode-mime-attachments in vm-pine.el
   (interactive)
-  (cond (vm-xemacs-p
+  (cond ((featurep 'xemacs)
          (let ((e-list (vm-extent-list 
                        (point-min) (point-max) 'vm-mime-layout)))
            (setq e-list
@@ -8274,7 +8274,7 @@ This is a destructive operation and cannot be undone!"
            (while e-list
              (vm-mime-replace-by-attachment-button (car e-list))
              (setq e-list (cdr e-list)))))
-        (vm-fsfemacs-p
+        ((not (featurep 'xemacs))
          (let ((e-list (vm-mime-attachment-button-extents
                        (point-min) (point-max) 'vm-mime-layout)))
            (while e-list
@@ -8357,7 +8357,7 @@ This is a destructive operation and cannot be undone!"
 (defun vm-mime-insert-file-contents (file type)
   "Safely insert the contents of FILE of TYPE into the current
 buffer." 
-  (if vm-xemacs-p
+  (if (featurep 'xemacs)
       (let ((coding-system-for-read
             (if (vm-mime-text-type-p type)
                 (vm-line-ending-coding-system)
@@ -8416,7 +8416,7 @@ buffer."
 
 (defun vm-mime-insert-buffer-substring (buffer type)
   "Safe insert the contents of BUFFER of TYPE into the current buffer."
-  (if vm-xemacs-p
+  (if (featurep 'xemacs)
       (insert-buffer-substring buffer)
     ;; Under Emacs 20.7 inserting a unibyte buffer
     ;; contents that contain 8-bit characters into a
diff --git a/lisp/vm-minibuf.el b/lisp/vm-minibuf.el
index 5a21f04..06e4cb3 100644
--- a/lisp/vm-minibuf.el
+++ b/lisp/vm-minibuf.el
@@ -218,10 +218,10 @@ default the local keymap of the current buffer is used."
                               (list 'and 'string (list function 'string)))))
             (while keymaps
               (setq keymap (car keymaps))
-              (cond ((vm-mouse-xemacs-mouse-p)
+              (cond ((featurep 'xemacs)
                      (define-key keymap 'button1 command)
                      (define-key keymap 'button2 command))
-                    ((vm-mouse-fsfemacs-mouse-p)
+                    ((not (featurep 'xemacs))
                      (define-key keymap [down-mouse-1] 'ignore)
                      (define-key keymap [drag-mouse-1] 'ignore)
                      (define-key keymap [mouse-1] command)
@@ -309,12 +309,12 @@ default the local keymap of the current buffer is used."
   (if (consp (car completion-list))
       (setq completion-list (nreverse (mapcar 'car completion-list))))
   (if (and completion-list (vm-mouse-support-possible-here-p))
-      (cond ((and (vm-mouse-xemacs-mouse-p)
+      (cond ((and (featurep 'xemacs)
                  (or (button-press-event-p last-command-event)
                      (button-release-event-p last-command-event)
                      (menu-event-p last-command-event)))
             (vm-mouse-read-string prompt completion-list multi-word))
-           ((and (vm-mouse-fsfemacs-mouse-p)
+           ((and (not (featurep 'xemacs))
                  (listp last-nonmenu-event))
             (vm-mouse-read-string prompt completion-list multi-word))
            (t
@@ -352,13 +352,13 @@ default the local keymap of the current buffer is used."
   "Like `read-file-name', except a mouse interface is used if a mouse
 click mouse triggered the current command."
   (if (vm-mouse-support-possible-here-p)
-      (cond ((and (vm-mouse-xemacs-mouse-p)
+      (cond ((and (featurep 'xemacs)
                  (or (button-press-event-p last-command-event)
                      (button-release-event-p last-command-event)
                      (menu-event-p last-command-event)))
             (vm-mouse-read-file-name prompt dir default
                                      must-match initial history))
-           ((and (vm-mouse-fsfemacs-mouse-p)
+           ((and (not (featurep 'xemacs))
                  (listp last-nonmenu-event))
             (vm-mouse-read-file-name prompt dir default
                                      must-match initial history))
diff --git a/lisp/vm-misc.el b/lisp/vm-misc.el
index 9643f51..25efce2 100644
--- a/lisp/vm-misc.el
+++ b/lisp/vm-misc.el
@@ -608,8 +608,8 @@ LIST2 satisfying PRED and return the position"
 ;;     'interactive-p))
 
 (fset 'vm-device-type
-      (cond (vm-xemacs-p 'device-type)
-           (vm-fsfemacs-p 'vm-fsfemacs-device-type)))
+      (cond ((featurep 'xemacs) 'device-type)
+           ((not (featurep 'xemacs)) 'vm-fsfemacs-device-type)))
 
 (defun vm-fsfemacs-device-type (&optional _device)
   "An FSF Emacs emulation for XEmacs `device-type' function.  Returns
@@ -620,7 +620,7 @@ the type of the current screen device: one of 'x, 'gtk, 
'w32, 'ns and
     window-system))
 
 (defun vm-generate-new-unibyte-buffer (name)
-  (if vm-xemacs-p
+  (if (featurep 'xemacs)
       (generate-new-buffer name)
     (let* (;; (default-enable-multibyte-characters nil)
           ;; don't need this because of set-buffer-multibyte below
@@ -631,7 +631,7 @@ the type of the current screen device: one of 'x, 'gtk, 
'w32, 'ns and
       buffer)))
 
 (defun vm-generate-new-multibyte-buffer (name)
-  (if vm-xemacs-p
+  (if (featurep 'xemacs)
       (generate-new-buffer name)
     (let* (;; (default-enable-multibyte-characters t)
           ;; don't need this because of set-buffer-multibyte below
@@ -652,7 +652,7 @@ the type of the current screen device: one of 'x, 'gtk, 
'w32, 'ns and
 (fset 'xemacs-abbreviate-file-name 'abbreviate-file-name)
 
 (defun vm-abbreviate-file-name (path)
-  (if vm-xemacs-p
+  (if (featurep 'xemacs)
       (xemacs-abbreviate-file-name path t)
     (abbreviate-file-name path)))
 
@@ -820,7 +820,7 @@ If HACK-ADDRESSES is t, then the strings are considered to 
be mail addresses,
 
 (defun vm-run-hook-on-message (hook-variable message)
   (with-current-buffer (vm-buffer-of message)
-    (vm-save-restriction
+    (save-restriction
       (widen)
       (save-excursion
        (narrow-to-region (vm-headers-of message) (vm-text-end-of message))
@@ -832,7 +832,7 @@ If HACK-ADDRESSES is t, then the strings are considered to 
be mail addresses,
 
 (defun vm-run-hook-on-message-with-args (hook-variable message &rest args)
   (with-current-buffer (vm-buffer-of message)
-    (vm-save-restriction
+    (save-restriction
       (widen)
       (save-excursion
        (narrow-to-region (vm-headers-of message) (vm-text-end-of message))
@@ -990,7 +990,7 @@ If HACK-ADDRESSES is t, then the strings are considered to 
be mail addresses,
 ;; The following function is not working correctly on Gnu Emacs 23.
 ;; So we do it ourselves.
 (defun vm-delete-auto-save-file-if-necessary ()
-  (if vm-xemacs-p
+  (if (featurep 'xemacs)
       (delete-auto-save-file-if-necessary)
     (when (and buffer-auto-save-file-name delete-auto-save-files
               (not (string= buffer-file-name buffer-auto-save-file-name))
@@ -1043,7 +1043,7 @@ If HACK-ADDRESSES is t, then the strings are considered 
to be mail addresses,
 (fset 'vm-buffer-substring-no-properties
   (cond ((fboundp 'buffer-substring-no-properties)
         (function buffer-substring-no-properties))
-       (vm-xemacs-p
+       ((featurep 'xemacs)
         (function buffer-substring))
        (t (function vm-default-buffer-substring-no-properties))))
 
@@ -1068,64 +1068,64 @@ If HACK-ADDRESSES is t, then the strings are considered 
to be mail addresses,
     (set-buffer target-buffer)))
 
 (if (not (fboundp 'vm-extent-property))
-    (if vm-fsfemacs-p
+    (if (not (featurep 'xemacs))
        (fset 'vm-extent-property 'overlay-get)
       (fset 'vm-extent-property 'extent-property)))
 
 (if (not (fboundp 'vm-extent-object))
-    (if vm-fsfemacs-p
+    (if (not (featurep 'xemacs))
        (fset 'vm-extent-object 'overlay-buffer)
       (fset 'vm-extent-object 'extent-object)))
 
 (if (not (fboundp 'vm-set-extent-property))
-    (if vm-fsfemacs-p
+    (if (not (featurep 'xemacs))
        (fset 'vm-set-extent-property 'overlay-put)
       (fset 'vm-set-extent-property 'set-extent-property)))
 
 (if (not (fboundp 'vm-set-extent-endpoints))
-    (if vm-fsfemacs-p
+    (if (not (featurep 'xemacs))
        (fset 'vm-set-extent-endpoints 'move-overlay)
       (fset 'vm-set-extent-endpoints 'set-extent-endpoints)))
 
 (if (not (fboundp 'vm-make-extent))
-    (if vm-fsfemacs-p
+    (if (not (featurep 'xemacs))
        (fset 'vm-make-extent 'make-overlay)
       (fset 'vm-make-extent 'make-extent)))
 
 (if (not (fboundp 'vm-extent-end-position))
-    (if vm-fsfemacs-p
+    (if (not (featurep 'xemacs))
        (fset 'vm-extent-end-position 'overlay-end)
       (fset 'vm-extent-end-position 'extent-end-position)))
 
 (if (not (fboundp 'vm-extent-start-position))
-    (if vm-fsfemacs-p
+    (if (not (featurep 'xemacs))
        (fset 'vm-extent-start-position 'overlay-start)
       (fset 'vm-extent-start-position 'extent-start-position)))
 
 (if (not (fboundp 'vm-next-extent-change))
-    (if vm-fsfemacs-p
+    (if (not (featurep 'xemacs))
        (fset 'vm-next-extent-change 'next-overlay-change)
       (fset 'vm-next-extent-change 'next-extent-change)))
 
 (if (not (fboundp 'vm-previous-extent-change))
-    (if vm-fsfemacs-p
+    (if (not (featurep 'xemacs))
        (fset 'vm-previous-extent-change 'previous-overlay-change)
       (fset 'vm-previous-extent-change 'previous-extent-change)))
 
 (if (not (fboundp 'vm-detach-extent))
-    (if vm-fsfemacs-p
+    (if (not (featurep 'xemacs))
        (fset 'vm-detach-extent 'delete-overlay)
       (fset 'vm-detach-extent 'detach-extent)))
 
 (if (not (fboundp 'vm-delete-extent))
-    (if vm-fsfemacs-p
+    (if (not (featurep 'xemacs))
        ;; This doesn't actually destroy the overlay, but it is the
        ;; best there is.
        (fset 'vm-delete-extent 'delete-overlay)
       (fset 'vm-delete-extent 'delete-extent)))
 
 (if (not (fboundp 'vm-disable-extents))
-    (if (and vm-fsfemacs-p (fboundp 'remove-overlays))
+    (if (and (not (featurep 'xemacs)) (fboundp 'remove-overlays))
        (fset 'vm-disable-extents 'remove-overlays)
       ;; XEamcs doesn't need to disable extents because they don't
       ;; slow things down
@@ -1133,7 +1133,7 @@ If HACK-ADDRESSES is t, then the strings are considered 
to be mail addresses,
            (lambda (&optional _beg _end _name _val) nil))))
 
 (if (not (fboundp 'vm-extent-properties))
-    (if vm-fsfemacs-p
+    (if (not (featurep 'xemacs))
        (fset 'vm-extent-properties 'overlay-properties)
       (fset 'vm-extent-properties 'extent-properties)))
 
@@ -1162,7 +1162,7 @@ which should be ignored.  (This is included for 
compatibility with XEmacs)."
       (setq p (cdr p)))))
 
 (if (not (fboundp 'vm-map-extents))
-    (if vm-fsfemacs-p
+    (if (not (featurep 'xemacs))
        (fset 'vm-map-extents 'vm-fsfemacs-map-extents)
       (fset 'vm-map-extents 'vm-xemacs-map-extents)))
 
@@ -1387,9 +1387,9 @@ encoding/decoding, conversions, subprocess communication 
etc."
 ;; the GNU Emacs function expects a symbol.
 ;; In the non-MULE case, return nil (is this the right fallback?).
 (defun vm-coding-system-p (name)
-  (cond (vm-xemacs-mule-p
+  (cond ((featurep 'xemacs)
         (coding-system-p (find-coding-system name)))
-       (vm-fsfemacs-mule-p
+       ((not (featurep 'xemacs))
         (coding-system-p name))))
 
 (cond ((fboundp 'coding-system-name)
@@ -1405,7 +1405,7 @@ encoding/decoding, conversions, subprocess communication 
etc."
     (coding-system-change-eol-conversion coding-system nil)))
 
 (defun vm-get-file-line-ending-coding-system (file)
-  (if (not (or vm-fsfemacs-mule-p vm-xemacs-mule-p vm-xemacs-file-coding-p))
+  (if (not (or (not (featurep 'xemacs)) (featurep 'xemacs) (featurep 'xemacs)))
       nil
     (let ((coding-system-for-read  (vm-binary-coding-system))
          (work-buffer (vm-make-work-buffer)))
@@ -1416,11 +1416,11 @@ encoding/decoding, conversions, subprocess 
communication etc."
              (error nil))
            (goto-char (point-min))
            (cond ((re-search-forward "[^\r]\n" nil t)
-                  (if vm-fsfemacs-mule-p 'raw-text-unix 'no-conversion-unix))
+                  (if (not (featurep 'xemacs)) 'raw-text-unix 
'no-conversion-unix))
                  ((re-search-forward "\r[^\n]" nil t)
-                  (if vm-fsfemacs-mule-p 'raw-text-mac 'no-conversion-mac))
+                  (if (not (featurep 'xemacs)) 'raw-text-mac 
'no-conversion-mac))
                  ((search-forward "\r\n" nil t)
-                  (if vm-fsfemacs-mule-p 'raw-text-dos 'no-conversion-dos))
+                  (if (not (featurep 'xemacs)) 'raw-text-dos 
'no-conversion-dos))
                  (t (vm-line-ending-coding-system))))
        (and work-buffer (kill-buffer work-buffer))))))
 
@@ -1428,11 +1428,11 @@ encoding/decoding, conversions, subprocess 
communication etc."
   (cond ((eq vm-default-new-folder-line-ending-type nil)
         (vm-line-ending-coding-system))
        ((eq vm-default-new-folder-line-ending-type 'lf)
-        (if vm-fsfemacs-mule-p 'raw-text-unix 'no-conversion-unix))
+        (if (not (featurep 'xemacs)) 'raw-text-unix 'no-conversion-unix))
        ((eq vm-default-new-folder-line-ending-type 'crlf)
-        (if vm-fsfemacs-mule-p 'raw-text-dos 'no-conversion-dos))
+        (if (not (featurep 'xemacs)) 'raw-text-dos 'no-conversion-dos))
        ((eq vm-default-new-folder-line-ending-type 'cr)
-        (if vm-fsfemacs-mule-p 'raw-text-mac 'no-conversion-mac))
+        (if (not (featurep 'xemacs)) 'raw-text-mac 'no-conversion-mac))
        (t
         (vm-line-ending-coding-system))))
 
@@ -1574,7 +1574,7 @@ filling of GNU Emacs does not work correctly here."
           (- (window-width (get-buffer-window (current-buffer))) 1)))
        )
     (save-excursion
-      (vm-save-restriction
+      (save-restriction
        ;; longlines-wrap-region contains a (forward-line -1) which is causing
        ;; wrapping of headers which is wrong, so we restrict it here!
        (narrow-to-region start end)
@@ -1631,8 +1631,8 @@ front before adding it to the RING-VARIABLE."
 (defvar enable-multibyte-characters)
 (defvar buffer-display-table)
 (defun vm-fsfemacs-nonmule-display-8bit-chars ()
-  (cond ((and vm-fsfemacs-p
-             (or (not vm-fsfemacs-mule-p)
+  (cond ((and (not (featurep 'xemacs))
+             (or (not (not (featurep 'xemacs)))
                  (and (boundp 'enable-multibyte-characters)
                       (not enable-multibyte-characters))))
         (let* (tab (i 160))
diff --git a/lisp/vm-motion.el b/lisp/vm-motion.el
index 7776023..2645079 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
 ;;
@@ -35,7 +35,7 @@
 
 (declare-function vm-so-sortable-subject "vm-sort" (message))
 
-(defun* vm-record-and-change-message-pointer (old new &key present)
+(cl-defun vm-record-and-change-message-pointer (old new &key present)
   "Change the `vm-message-pointer' of the folder from OLD to NEW, both
 of which must be pointers into the `vm-message-list'.
 If the keyword argument PRESENT is t, then update the presentation
diff --git a/lisp/vm-mouse.el b/lisp/vm-mouse.el
index ddd6529..6945c13 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
 ;;
@@ -45,19 +45,19 @@ END.  If the optional argument OVERLAY is provided then 
that that
 overlay is moved to cover START to END.  No new overlay is created in
 that case.                                            USR, 2010-08-01"
   (if (null overlay)
-       (cond (vm-fsfemacs-p
+       (cond ((not (featurep 'xemacs))
               (let ((o (make-overlay start end)))
                 (overlay-put o 'mouse-face 'highlight)
                 o ))
-             (vm-xemacs-p
+             ((featurep 'xemacs)
               (let ((o (vm-make-extent start end)))
                 (vm-set-extent-property o 'start-open t)
                 (vm-set-extent-property o 'priority 10)
                 (vm-set-extent-property o 'highlight t)
                 o )))
-    (cond (vm-fsfemacs-p
+    (cond ((not (featurep 'xemacs))
           (move-overlay overlay start end))
-         (vm-xemacs-p
+         ((featurep 'xemacs)
           (vm-set-extent-endpoints overlay start end)))))
 
 ;;;###autoload
@@ -66,10 +66,10 @@ that case.                                            USR, 
2010-08-01"
 mouse is clicked.  See Info node `(VM) Using the Mouse'."
   (interactive "e")
   ;; go to where the event occurred
-  (cond ((vm-mouse-xemacs-mouse-p)
+  (cond ((featurep 'xemacs)
         (set-buffer (window-buffer (event-window event)))
         (and (event-point event) (goto-char (event-point event))))
-       ((vm-mouse-fsfemacs-mouse-p)
+       ((not (featurep 'xemacs))
         (set-buffer (window-buffer (posn-window (event-start event))))
         (goto-char (posn-point (event-start event)))))
   ;; now dispatch depending on where we are
@@ -97,10 +97,10 @@ Mouse'."
   (if vm-use-menus
       (progn
        ;; go to where the event occurred
-       (cond ((vm-mouse-xemacs-mouse-p)
+       (cond ((featurep 'xemacs)
               (set-buffer (window-buffer (event-window event)))
               (and (event-point event) (goto-char (event-point event))))
-             ((vm-mouse-fsfemacs-mouse-p)
+             ((not (featurep 'xemacs))
               (set-buffer (window-buffer (posn-window (event-start event))))
               (goto-char (posn-point (event-start event)))))
        ;; now dispatch depending on where we are
@@ -122,13 +122,13 @@ Mouse'."
 (defun vm-mouse-get-mouse-track-string (event)
   (save-excursion
     ;; go to where the event occurred
-    (cond ((vm-mouse-xemacs-mouse-p)
+    (cond ((featurep 'xemacs)
           (set-buffer (window-buffer (event-window event)))
           (and (event-point event) (goto-char (event-point event))))
-         ((vm-mouse-fsfemacs-mouse-p)
+         ((not (featurep 'xemacs))
           (set-buffer (window-buffer (posn-window (event-start event))))
           (goto-char (posn-point (event-start event)))))
-    (cond (vm-fsfemacs-p
+    (cond ((not (featurep 'xemacs))
           (let ((o-list (overlays-at (point)))
                 (string nil))
             (while o-list
@@ -139,7 +139,7 @@ Mouse'."
                         o-list nil)
                 (setq o-list (cdr o-list))))
             string ))
-         (vm-xemacs-p
+         ((featurep 'xemacs)
           (let ((e (vm-extent-at (point) 'highlight)))
             (if e
                 (buffer-substring (vm-extent-start-position e)
@@ -150,7 +150,7 @@ Mouse'."
 ;;;###autoload
 (defun vm-mouse-popup-or-select (event)
   (interactive "e")
-  (cond ((vm-mouse-fsfemacs-mouse-p)
+  (cond ((not (featurep 'xemacs))
         (set-buffer (window-buffer (posn-window (event-start event))))
         (goto-char (posn-point (event-start event)))
         (let (o-list (found nil))
@@ -170,7 +170,7 @@ Mouse'."
        ;; binding that points to a more specific function.  But
        ;; this might come in handy later if I want selectable
        ;; objects that don't have an extent keymap attached.
-       ((vm-mouse-xemacs-mouse-p)
+       ((featurep 'xemacs)
         (set-buffer (window-buffer (event-window event)))
         (and (event-point event) (goto-char (event-point event)))
         (let (e)
@@ -183,11 +183,11 @@ Mouse'."
 ;;;###autoload
 (defun vm-mouse-send-url-at-event (event)
   (interactive "e")
-  (cond ((vm-mouse-xemacs-mouse-p)
+  (cond ((featurep 'xemacs)
         (set-buffer (window-buffer (event-window event)))
         (and (event-point event) (goto-char (event-point event)))
         (vm-mouse-send-url-at-position (event-point event)))
-       ((vm-mouse-fsfemacs-mouse-p)
+       ((not (featurep 'xemacs))
         (set-buffer (window-buffer (posn-window (event-start event))))
         (goto-char (posn-point (event-start event)))
         (vm-mouse-send-url-at-position (posn-point (event-start event))))))
@@ -195,7 +195,7 @@ Mouse'."
 (defun vm-mouse-send-url-at-position (pos &optional browser)
   (save-restriction
     (widen)
-    (cond ((vm-mouse-xemacs-mouse-p)
+    (cond ((featurep 'xemacs)
           (let ((e (vm-extent-at pos 'vm-url))
                 url)
             (if (null e)
@@ -203,7 +203,7 @@ Mouse'."
               (setq url (buffer-substring (vm-extent-start-position e)
                                           (vm-extent-end-position e)))
               (vm-mouse-send-url url browser))))
-         ((vm-mouse-fsfemacs-mouse-p)
+         ((not (featurep 'xemacs))
           (let (o-list url o)
             (setq o-list (overlays-at pos))
             (while (and o-list (null (overlay-get (car o-list) 'vm-url)))
@@ -398,10 +398,10 @@ Mouse'."
 
 ;;;###autoload
 (defun vm-mouse-install-mouse ()
-  (cond ((vm-mouse-xemacs-mouse-p)
+  (cond ((featurep 'xemacs)
         (if (null (lookup-key vm-mode-map 'button2))
             (define-key vm-mode-map 'button2 'vm-mouse-button-2)))
-       ((vm-mouse-fsfemacs-mouse-p)
+       ((not (featurep 'xemacs))
         (if (null (lookup-key vm-mode-map [mouse-2]))
             (define-key vm-mode-map [mouse-2] 'vm-mouse-button-2))
         (if vm-popup-menu-on-mouse-3
diff --git a/lisp/vm-page.el b/lisp/vm-page.el
index 0110670..20a2652 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
 ;
@@ -316,14 +316,14 @@ Negative arg means scroll forward."
 
 (defun vm-highlight-headers ()
   (cond
-   ((and vm-xemacs-p vm-use-lucid-highlighting)
+   ((and (featurep 'xemacs) vm-use-lucid-highlighting)
     (require 'highlight-headers)
     ;; disable the url marking stuff, since VM has its own interface.
     (let ((highlight-headers-mark-urls nil)
          (highlight-headers-regexp (or vm-highlighted-header-regexp
                                        highlight-headers-regexp)))
       (highlight-headers (point-min) (point-max) t)))
-   (vm-xemacs-p
+   ((featurep 'xemacs)
     (let (e)
       (map-extents (function
                    (lambda (e ignore)
@@ -339,7 +339,7 @@ Negative arg means scroll forward."
               (vm-set-extent-property e 'face vm-highlighted-header-face)
               (vm-set-extent-property e 'vm-highlight t)))
        (goto-char (vm-matched-header-end)))))
-   (vm-fsfemacs-p
+   ((not (featurep 'xemacs))
     (let (o-lists p)
       (setq o-lists (overlay-lists)
            p (car o-lists))
@@ -376,7 +376,7 @@ Negative arg means scroll forward."
                                       (point-max))))
       (setq search-pairs (list (cons (point-min) (point-max)))))
     (cond
-     ((or vm-xemacs-p vm-fsfemacs-p)   ; should work for both cases
+     ((or (featurep 'xemacs) (not (featurep 'xemacs))) ; should work for both 
cases
       (let (e)
        (vm-map-extents (function
                         (lambda (e ignore)
@@ -405,14 +405,14 @@ Negative arg means scroll forward."
                             (looking-at "mailto:";))
                           'vm-menu-popup-mailto-url-browser-menu
                         'vm-menu-popup-url-browser-menu)))
-                 (if vm-fsfemacs-p
+                 (if (not (featurep 'xemacs))
                      (setq keymap (nconc keymap (current-local-map))))
-                 (if vm-xemacs-p
+                 (if (featurep 'xemacs)
                      (define-key keymap 'button2 'vm-mouse-send-url-at-event)
                    ;; nothing for fsfemacs?
                    )
                  (when vm-popup-menu-on-mouse-3
-                   (if vm-xemacs-p
+                   (if (featurep 'xemacs)
                        (define-key keymap 'button3 popup-function)
                      (define-key keymap [mouse-3] popup-function)))
                  (define-key keymap "\r"
@@ -432,7 +432,7 @@ Negative arg means scroll forward."
                  (vm-set-extent-property e 'duplicable t)
                  )))
          (setq search-pairs (cdr search-pairs))))))
-     (vm-fsfemacs-p
+     ((not (featurep 'xemacs))
       (let (e)
        (vm-map-extents (function
                         (lambda (e ignore)
@@ -473,7 +473,7 @@ Negative arg means scroll forward."
 
 (defun vm-energize-headers ()
   (cond
-   (vm-xemacs-p
+   ((featurep 'xemacs)
     (let ((search-tuples '(("^From:" vm-menu-author-menu)
                           ("^Subject:" vm-menu-subject-menu)))
          regexp menu keymap e)
@@ -507,7 +507,7 @@ Negative arg means scroll forward."
          (vm-set-extent-property e 'balloon-help 'vm-mouse-3-help)
          (vm-set-extent-property e 'highlight t))
        (setq search-tuples (cdr search-tuples)))))
-   ((and vm-fsfemacs-p
+   ((and (not (featurep 'xemacs))
         (fboundp 'overlay-put))
     (let ((search-tuples '(("^From:" vm-menu-fsfemacs-author-menu)
                           ("^Subject:" vm-menu-fsfemacs-subject-menu)))
@@ -538,8 +538,8 @@ Negative arg means scroll forward."
        (setq search-tuples (cdr search-tuples)))))))
 
 (defun vm-display-xface ()
-  (cond (vm-xemacs-p (vm-display-xface-xemacs))
-       ((and vm-fsfemacs-p
+  (cond ((featurep 'xemacs) (vm-display-xface-xemacs))
+       ((and (not (featurep 'xemacs))
              (and (stringp vm-uncompface-program)
                   (fboundp 'create-image)))
         (vm-display-xface-fsfemacs))))
@@ -692,7 +692,7 @@ Use mouse button 3 to choose a Web browser for the URL."
 (defun vm-highlight-headers-maybe ()
   ;; highlight the headers
   (if (or vm-highlighted-header-regexp
-         (and vm-xemacs-p vm-use-lucid-highlighting))
+         (and (featurep 'xemacs) vm-use-lucid-highlighting))
       (save-restriction
        (widen)
        (narrow-to-region (vm-headers-of (car vm-message-pointer))
@@ -709,8 +709,8 @@ Use mouse button 3 to choose a Web browser for the URL."
        (vm-energize-headers)))
   ;; display xfaces, if we can
   (if (and vm-display-xfaces
-          (or (and vm-xemacs-p (featurep 'xface))
-              (and vm-fsfemacs-p (fboundp 'create-image)
+          (or (and (featurep 'xemacs) (featurep 'xface))
+              (and (not (featurep 'xemacs)) (fboundp 'create-image)
                    (stringp vm-uncompface-program))))
       (save-restriction
        (widen)
@@ -741,7 +741,7 @@ is necessary."
             ;; cutoff line one character forward, but only if
             ;; we're doing MIME decode for preview.
             (if (and (not just-passing-through)
-                     vm-xemacs-p
+                     (featurep 'xemacs)
                      vm-mail-buffer ; in presentation buffer
                      vm-auto-decode-mime-messages
                      vm-mime-decode-for-preview
@@ -955,7 +955,7 @@ is done if necessary.  (USR, 2010-01-14)"
          ;; FIXME at this point, the folder buffer is being used for
          ;; display.  Filling will corrupt the folder.
          (debug "VM internal error #2010.  Please report it")))
-    (vm-save-restriction
+    (save-restriction
      (widen)
      (vm-fill-paragraphs-containing-long-lines
       vm-fill-paragraphs-containing-long-lines
@@ -1041,7 +1041,7 @@ is done if necessary.  (USR, 2010-01-14)"
                          (vm-text-end-of (car vm-message-pointer))))))
 
 (defun vm-narrow-to-page ()
-  (cond (vm-fsfemacs-p
+  (cond ((not (featurep 'xemacs))
         (if (not (and vm-page-end-overlay
                       (overlay-buffer vm-page-end-overlay)))
             (let ((g vm-page-continuation-glyph))
@@ -1049,7 +1049,7 @@ is done if necessary.  (USR, 2010-01-14)"
               (vm-set-extent-property vm-page-end-overlay 'vm-glyph g)
               (vm-set-extent-property vm-page-end-overlay 'before-string g)
               (overlay-put vm-page-end-overlay 'evaporate nil))))
-       (vm-xemacs-p
+       ((featurep 'xemacs)
         (if (not (and vm-page-end-overlay
                       (vm-extent-end-position vm-page-end-overlay)))
             (let ((g vm-page-continuation-glyph))
diff --git a/lisp/vm-pcrisis.el b/lisp/vm-pcrisis.el
index 8606333..5a3cafa 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
 ;;
@@ -46,8 +46,6 @@
   (require 'vm-reply))
 (eval-when-compile
   ;; get the macros we need.
-  (require 'cl)
-  (require 'advice)
   (condition-case e
       (progn 
         (require 'regexp-opt)
@@ -395,7 +393,7 @@ This is the XEmacs version of 
`vmpc-set-overlay-insertion-types'."
 In other words, EXERLAY is the name of the overlay or extent with a quote in
 front.  START and END are the equivalent of the marker insertion types for the
 start and end of the overlay/extent."
-  (if vm-xemacs-p
+  (if (featurep 'xemacs)
       (vmpc-set-extent-insertion-types (symbol-value exerlay) start end)
     (set exerlay (vmpc-set-overlay-insertion-types (symbol-value exerlay)
                                                   start end))))
@@ -403,35 +401,35 @@ start and end of the overlay/extent."
 
 (defun vmpc-exerlay-start (exerlay)
   "Return buffer position of the start of EXERLAY."
-  (if vm-xemacs-p
+  (if (featurep 'xemacs)
       (vm-extent-start-position exerlay)
     (overlay-start exerlay)))
 
 
 (defun vmpc-exerlay-end (exerlay)
   "Return buffer position of the end of EXERLAY."
-  (if vm-xemacs-p
+  (if (featurep 'xemacs)
       (vm-extent-end-position exerlay)
     (overlay-end exerlay)))
 
 
 (defun vmpc-move-exerlay (exerlay new-start new-end)
   "Change EXERLAY to cover region from NEW-START to NEW-END."
-  (if vm-xemacs-p
+  (if (featurep 'xemacs)
       (vm-set-extent-endpoints exerlay new-start new-end (current-buffer))
     (move-overlay exerlay new-start new-end (current-buffer))))
 
 
 (defun vmpc-set-exerlay-detachable-property (exerlay newval)
   "Set the 'detachable or 'evaporate property for EXERLAY to NEWVAL."
-  (if vm-xemacs-p
+  (if (featurep 'xemacs)
       (vm-set-extent-property exerlay 'detachable newval)
     (overlay-put exerlay 'evaporate newval)))
 
 
 (defun vmpc-set-exerlay-intangible-property (exerlay newval)
   "Set the 'intangible or 'atomic property for EXERLAY to NEWVAL."
-  (if vm-xemacs-p
+  (if (featurep 'xemacs)
       (progn
        (require 'atomic-extents)
        (vm-set-extent-property exerlay 'atomic newval))
@@ -440,14 +438,14 @@ start and end of the overlay/extent."
 
 (defun vmpc-set-exerlay-face (exerlay newface)
   "Set the face used by EXERLAY to NEWFACE."
-  (if vm-xemacs-p
+  (if (featurep 'xemacs)
       (set-extent-face exerlay newface)
     (overlay-put exerlay 'face newface)))
 
 
 (defun vmpc-forcefully-detach-exerlay (exerlay)
   "Leave EXERLAY in memory but detaches it from the buffer."
-  (if vm-xemacs-p
+  (if (featurep 'xemacs)
       (vm-detach-extent exerlay)
     (delete-overlay exerlay)))
 
diff --git a/lisp/vm-pgg.el b/lisp/vm-pgg.el
index c154ac2..b268aff 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
 ;; 
@@ -103,13 +103,11 @@
   (require 'vm-mime)
   (require 'vm-reply)
   (require 'vm-motion)
-
-  (require 'advice))
+)
   
 (declare-function rfc822-addresses "ext:rfc822" (header-text))
 
 (eval-when-compile
-  (require 'cl)
   ;; avoid warnings
   (defvar vm-mode-line-format)
   (defvar vm-message-pointer)
@@ -939,7 +937,7 @@ cleanup here after verification and decoding took place."
                    (insert-buffer-substring pgg-errors-buffer))
                (vm-pgg-state-set 'verified)
                (insert-buffer-substring 
-                (if vm-fsfemacs-p pgg-errors-buffer pgg-output-buffer))
+                (if (not (featurep 'xemacs)) pgg-errors-buffer 
pgg-output-buffer))
                (vm-pgg-crlf-cleanup start (point)))
              (setq end (point))
              (put-text-property start end 'face
@@ -1012,7 +1010,7 @@ cleanup here after verification and decoding took place."
     (unless (pgg-snarf-keys)
       (error "Snarfing failed"))
     (save-excursion
-      (set-buffer (if vm-fsfemacs-p pgg-errors-buffer pgg-output-buffer))
+      (set-buffer (if (not (featurep 'xemacs)) pgg-errors-buffer 
pgg-output-buffer))
       (message (buffer-substring (point-min) (point-max))))))
 
 ;;; ###autoload
diff --git a/lisp/vm-pine.el b/lisp/vm-pine.el
index 00f84a9..86de60d 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
 ;; 
@@ -84,7 +84,7 @@
 
 ;;; Code:
 
-(provide 'vm-pine)
+(require 'vm-vars)
  
 (eval-when-compile
   (require 'vm-misc)
@@ -493,7 +493,7 @@ creation). If DRAFT is non-nil, then do not delete the 
draft message."
          ;; in the postponded folder expunge them right now 
          (when (string= (buffer-name buffer)
                         (file-name-nondirectory vm-postponed-folder))
-           (if (and vm-xemacs-p (frames-of-buffer buffer t))
+           (if (and (featurep 'xemacs) (frames-of-buffer buffer t))
                (iconify-frame (car (frames-of-buffer buffer))))
            (when vm-auto-expunge-postponed-folder
               (save-excursion
@@ -635,7 +635,7 @@ Optional argument DONT-KILL is positive, then do not kill 
source message."
           (set-buffer folder-buffer)
           (vm-error-if-folder-read-only)
           (let ((buffer-read-only nil))
-            (vm-save-restriction
+            (save-restriction
              (widen)
              (goto-char (point-max))
              (vm-write-string (current-buffer) (vm-leading-message-separator))
@@ -747,7 +747,7 @@ Drafts in other folders are not recognized!"
                     (not (vm-deleted-flag (car vm-message-pointer))))
               (message "Please select a draft!")
               (select-window (car (get-buffer-window-list buffer nil 0)))
-              (if (and vm-xemacs-p (frames-of-buffer buffer))
+              (if (and (featurep 'xemacs) (frames-of-buffer buffer))
                   (deiconify-frame (car (frames-of-buffer buffer))))
               (setq action 'none))
           (setq action 'visit)))
@@ -927,7 +927,7 @@ See the variable `vm-mail-priority'."
                (insert "\n" vm-mail-priority)))))
 
 ;;-----------------------------------------------------------------------------
-(if (not vm-xemacs-p)
+(if (not (featurep 'xemacs))
     (defun user-home-directory ()
       (getenv "HOME")))
 
@@ -1048,7 +1048,7 @@ This function is a slightly changed version of 
`vm-auto-select-folder'."
                         ;; match data.
                         (save-excursion
                           (set-buffer buf)
-                          (if vm-fsfemacs-mule-p
+                          (if (not (featurep 'xemacs))
                               (set-buffer-multibyte nil)) ; for empty buffer
                           (widen)
                           (erase-buffer)
@@ -1126,4 +1126,6 @@ If optional argument RETURN-ONLY is t just returns FCC."
                                                fcc)))))))))
 
 ;;-----------------------------------------------------------------------------
+
+(provide 'vm-pine)
 ;;; vm-pine.el ends here
diff --git a/lisp/vm-pop.el b/lisp/vm-pop.el
index 41bff98..43d3013 100644
--- a/lisp/vm-pop.el
+++ b/lisp/vm-pop.el
@@ -1011,7 +1011,7 @@ popdrop
   (setq end (vm-marker end))
   (save-excursion
     ;; CRLF -> LF
-    (if vm-xemacs-mule-p
+    (if (featurep 'xemacs)
         (progn
           ;; we need this otherwise the end marker gets corrupt and
           ;; unfortunately decode-coding-region does not return the
@@ -1130,7 +1130,7 @@ LOCAL-EXPUNGE-LIST: A list of message descriptors for 
messages in the
     (list retrieve-list local-expunge-list)))
 
 ;;;###autoload
-(defun* vm-pop-synchronize-folder (&key 
+(cl-defun vm-pop-synchronize-folder (&key 
                                   (interactive nil)
                                   (do-remote-expunges nil)
                                   (do-local-expunges nil)
@@ -1171,7 +1171,7 @@ LOCAL-EXPUNGE-LIST: A list of message descriptors for 
messages in the
           (folder-buffer (current-buffer)))
       (if (and do-retrieves retrieve-list)
          (save-excursion
-           (vm-save-restriction
+           (save-restriction
             (widen)
             (goto-char (point-max))
             (condition-case error-data
diff --git a/lisp/vm-reply.el b/lisp/vm-reply.el
index 6666f48..938d247 100644
--- a/lisp/vm-reply.el
+++ b/lisp/vm-reply.el
@@ -800,7 +800,7 @@ This function is a variant of `vm-get-header-contents'."
 
 (defvar vm-dont-ask-coding-system-question nil)
 
-(cond ((and vm-fsfemacs-mule-p
+(cond ((and (not (featurep 'xemacs))
            (fboundp 'select-message-coding-system)
            (not (fboundp 'vm-old-select-message-coding-system)))
        (fset 'vm-old-select-message-coding-system
@@ -1196,7 +1196,7 @@ See `vm-forward-message-plain' for forwarding messages in 
plain text."
               (insert "Content-Description: forwarded message\n")
               ;; eight bit chars will get \201 prepended if we
               ;; don't do this.
-              (when vm-fsfemacs-mule-p
+              (when (not (featurep 'xemacs))
                 (set-buffer-multibyte t))) ; is this safe?
              ((equal vm-forwarding-digest-type "rfc934")
               (vm-rfc934-encapsulate-messages
@@ -1338,7 +1338,7 @@ You may also create a Resent-Cc header."
       (insert "Resent-To: \n")
       (if mail-self-blind
          (insert "Bcc: "
-                 (cond ((and vm-xemacs-p (fboundp 'user-mail-address))
+                 (cond ((and (featurep 'xemacs) (fboundp 'user-mail-address))
                         (user-mail-address))
                        ((and (boundp 'user-mail-address)
                              (stringp user-mail-address))
@@ -1677,7 +1677,7 @@ address is used."
 
 
 ;;;###autoload
-(defun* vm-mail-internal (&key buffer-name to guessed-to subject 
+(cl-defun vm-mail-internal (&key buffer-name to guessed-to subject 
                               in-reply-to cc references newsgroups)
     "Create a message buffer and set it up according to args.
 Fills in the headers as given by the arguments.
@@ -1692,7 +1692,7 @@ Binds the `vm-mail-mode-map' and hooks"
     (set-buffer (generate-new-buffer buffer-name))
     ;; FSF Emacs: try to prevent write-region (called to handle FCC) from
     ;; asking the user to choose a safe coding system.
-    (if (and vm-fsfemacs-mule-p (fboundp 'set-buffer-file-coding-system))
+    (if (and (not (featurep 'xemacs)) (fboundp 'set-buffer-file-coding-system))
        (set-buffer-file-coding-system 'raw-text))
     ;; avoid trying to write auto-save files in potentially
     ;; unwritable directories.
@@ -1764,7 +1764,7 @@ Binds the `vm-mail-mode-map' and hooks"
       (insert "Reply-To: " mail-default-reply-to "\n"))
     (when mail-self-blind
       (insert "Bcc: "
-             (cond ((and vm-xemacs-p (fboundp 'user-mail-address))
+             (cond ((and (featurep 'xemacs) (fboundp 'user-mail-address))
                     (user-mail-address))
                    ((and (boundp 'user-mail-address)
                          (stringp user-mail-address))
@@ -1843,7 +1843,7 @@ Binds the `vm-mail-mode-map' and hooks"
           (mail-position-on-field "To" t))
          ((null subject)
           (mail-position-on-field "Subject" t)))
-    (cond ((and vm-xemacs-p
+    (cond ((and (featurep 'xemacs)
                (fboundp 'start-itimer)
                (null (get-itimer "vm-rename-mail"))
           (start-itimer "vm-rename-mail"
diff --git a/lisp/vm-rfaddons.el b/lisp/vm-rfaddons.el
index 7e2c202..4f246fe 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
 ;; 
@@ -58,6 +58,8 @@
 ;;
 ;;; Code:
 
+(require 'vm-version)
+
 (provide 'vm-rfaddons)
 
 (eval-when-compile
@@ -98,8 +100,6 @@
 (declare-function vm-folder-buffers "ext:vm" (&optional non-virtual))
 
 (eval-when-compile
-  (require 'cl)
-  (require 'advice)
   (vm-load-features '(regexp-opt bbdb bbdb-vm))
   ;; gnus-group removed from features because it gives errors.  USR, 2011-01-26
   )
@@ -107,7 +107,7 @@
 (require 'sendmail)
 (vm-load-features '(bbdb))
 
-(if vm-xemacs-p (require 'overlay))
+(if (featurep 'xemacs) (require 'overlay))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
@@ -434,7 +434,7 @@ This does only work with my modified VM, i.e. a hacked
 ;;   (let ((buffer-read-only nil)
 ;;         (fill-column width))
 ;;     (save-excursion
-;;       (vm-save-restriction
+;;       (save-restriction
 ;;        ;; longlines-wrap-region contains a (forward-line -1) which is 
causing
 ;;        ;; wrapping of headers which is wrong, so we restrict it here!
 ;;        (narrow-to-region start end)
@@ -614,7 +614,7 @@ buffer. (Rob F)"
                      ;; predicate, require-match
                      nil t)
                     current-prefix-arg))
-  (if (or vm-xemacs-mule-p vm-fsfemacs-p)
+  (if (or (featurep 'xemacs) (not (featurep 'xemacs)))
       (error "vm-mime-8bit-composition-charset has no effect in XEmacs/MULE"))
   (if buffer-local
       (set (make-local-variable 'vm-mime-8bit-composition-charset) charset)
@@ -1175,9 +1175,9 @@ headers. (Rob F)"
   :group 'vm-rfaddons)
 
 (defconst vm-shrunken-headers-keymap
-  (let ((map (if vm-xemacs-p (make-keymap) (copy-keymap vm-mode-map))))
+  (let ((map (if (featurep 'xemacs) (make-keymap) (copy-keymap vm-mode-map))))
     (define-key map [(return)]   'vm-shrunken-headers-toggle-this)
-    (if vm-xemacs-p
+    (if (featurep 'xemacs)
         (define-key map [(button2)]  'vm-shrunken-headers-toggle-this-mouse)
       (define-key map [(mouse-2)]  'vm-shrunken-headers-toggle-this-mouse))
     map)
@@ -1419,7 +1419,7 @@ text/alternative message depending on the value of the 
variable
    ;; empty lines
    (cons "\n\n\n+"
          "\n\n")
-   ;; signature & -----Ursprüngliche Nachricht-----
+   ;; signature & -----Ursprüngliche Nachricht-----
    (cons (concat "^" vm-included-text-prefix "--[^\n]*\n"
                  "\\(" vm-included-text-prefix "[^\n]*\n\\)+")
          "\n")
diff --git a/lisp/vm-save.el b/lisp/vm-save.el
index 6403719..3e3e0f8 100644
--- a/lisp/vm-save.el
+++ b/lisp/vm-save.el
@@ -77,7 +77,7 @@ specified, use `vm-auto-folder-alist'."
                          ;; match data.
                          (save-excursion
                            (set-buffer buf)
-                           (if vm-fsfemacs-mule-p
+                           (if (not (featurep 'xemacs))
                                (set-buffer-multibyte nil)) ; for empty buffer
                            (widen)
                            (erase-buffer)
@@ -391,7 +391,7 @@ The saved messages are flagged as `filed'."
              (set-buffer (vm-buffer-of m))
              ;; FIXME the following isn't really necessary
              (vm-assert (vm-body-retrieved-of m))
-             (vm-save-restriction
+             (save-restriction
               (widen)
               ;; have to stuff the attributes in all cases because
               ;; the deleted attribute may have been stuffed
@@ -431,7 +431,7 @@ The saved messages are flagged as `filed'."
                   (when vm-folder-read-only
                     (signal 'folder-read-only (list (current-buffer))))
                   (let ((buffer-read-only nil))
-                    (vm-save-restriction
+                    (save-restriction
                      (widen)
                      (save-excursion
                        (goto-char (point-max))
@@ -572,7 +572,7 @@ This command should NOT be used to save message to mail 
folders; use
              (set-buffer (vm-buffer-of m))
              ;; FIXME the following shouldn't be necessary any more
              (vm-assert (vm-body-retrieved-of m))
-             (vm-save-restriction
+             (save-restriction
               (widen)
               (if (null file-buffer)
                   (write-region 
@@ -583,7 +583,7 @@ This command should NOT be used to save message to mail 
folders; use
                     (set-buffer file-buffer)
                     (save-excursion
                       (let (buffer-read-only)
-                        (vm-save-restriction
+                        (save-restriction
                          (widen)
                          (save-excursion
                            (goto-char (point-max))
diff --git a/lisp/vm-serial.el b/lisp/vm-serial.el
index 465eb3c..06b404f 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
@@ -79,9 +79,6 @@
   "Sending personalized serial mails and getting message templates."
   :group  'vm-ext)
 
-(eval-when-compile
-  (require 'cl))
-
 (eval-when-compile
   (require 'vm-misc)
   (require 'vm-mime))
@@ -89,8 +86,7 @@
 (eval-and-compile
   (require 'vm-pine)
   (require 'mail-utils)
-  (require 'mail-extr)
-  (require 'advice))
+  (require 'mail-extr))
 
 (declare-function bbdb-extract-address-components 
                  "ext:bbdb-snarf" (adstring &optional ignore-errors))
@@ -192,16 +188,16 @@
      "a randomly selected your-style greeting")
     ;; german
     ("hallo"    ("Hi" "Griass di" "Servus" "Hallo")
-     "ein Hallo-Gruß")
+     "ein Hallo-Gruà ")
     ("mausl"    ("Mausl" "Liebling" "Schatzi" "Hallo")
      "die Freundin")
-    ("ciao"     ("" "Ciao " "Tschüß " "Servus " "Mach's gut " "Bis denn "
+    ("ciao"     ("" "Ciao " "Tschüà " "Servus " "Mach's gut " "Bis denn "
                  "Bis die Tage mal ")
      "Verabschiedung")
     ("sg"      ("Sehr geehrte Frau/Herr")
-     "förmliche Anrede")
-    ("mfg"     ("Mit freundlichen Grüßen")
-     "förmliche Verabschiedung")
+     "förmliche Anrede")
+    ("mfg"     ("Mit freundlichen Grüà en")
+     "förmliche Verabschiedung")
     ;; french
     ("salut" ("Salut" "Bonjour")
      "Une salutation au hasard")
@@ -691,7 +687,7 @@ a warning."
                        "\\(" (regexp-quote vm-serial-cookie) "\\)*"
                        "[{\(a-zA-Z]"))
         start end expr result vm-serial-point)
-    (if (and vm-xemacs-p
+    (if (and (featurep 'xemacs)
              (region-exists-p)
              (eq (zmacs-region-buffer) (current-buffer)))
         (setq rstart (goto-char (region-beginning)) rend (region-end))
diff --git a/lisp/vm-sort.el b/lisp/vm-sort.el
index fbd749e..592218f 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
 ;;
@@ -22,7 +22,7 @@
 
 ;;; Code
 
-(provide 'vm-sort)
+(require 'vm-vars)
 
 (eval-and-compile
   (require 'vm-misc)
@@ -188,7 +188,7 @@ the folder undisturbed."
 ;; and variables containg markers before you modify this code.
 (defun vm-physically-move-message (m m-dest)
   (save-excursion
-    (vm-save-restriction
+    (save-restriction
      (widen)
 
      ;; Make sure vm-headers-of and vm-text-of are non-nil in
@@ -882,4 +882,5 @@ that, if P1 and P2 are the oldest different ancestors of M1 
and M2, then
     (string< (vm-get-header-contents m1 vm-sort-compare-header)
              (vm-get-header-contents m2 vm-sort-compare-header))))
 
+(provide 'vm-sort)
 ;;; vm-sort.el ends here
diff --git a/lisp/vm-summary-faces.el b/lisp/vm-summary-faces.el
index 3ffb27a..855f75a 100644
--- a/lisp/vm-summary-faces.el
+++ b/lisp/vm-summary-faces.el
@@ -42,7 +42,7 @@
   (require 'vm-virtual))
 
 ;; (eval-and-compile
-;;   (if vm-xemacs-p (require 'overlay)))
+;;   (if (featurep 'xemacs) (require 'overlay)))
 
 (declare-function vm-extent-property "vm-misc.el" (overlay prop) t)
 (declare-function vm-set-extent-property "vm-misc.el" (overlay prop value) t)
diff --git a/lisp/vm-summary.el b/lisp/vm-summary.el
index 19abbd1..a74b675 100644
--- a/lisp/vm-summary.el
+++ b/lisp/vm-summary.el
@@ -143,7 +143,7 @@ marked as modified."
        bidi-paragraph-direction 'left-to-right)
   ;; horizontal scrollbar off by default
   ;; user can turn it on in summary hook if desired.
-  (when (and vm-xemacs-p (featurep 'scrollbar))
+  (when (and (featurep 'xemacs) (featurep 'scrollbar))
     (set-specifier scrollbar-height (cons (current-buffer) 0)))
   (use-local-map vm-summary-mode-map)
   (when (vm-menu-support-possible-p)
@@ -151,7 +151,7 @@ marked as modified."
 ;; using the 'mouse-face property gives faster highlighting than this.
 ;;  (and vm-mouse-track-summary
 ;;       (vm-mouse-support-possible-p)
-;;       (vm-mouse-xemacs-mouse-p)
+;;       (featurep 'xemacs)
 ;;       (add-hook 'mode-motion-hook 'mode-motion-highlight-line))
   (when (and vm-mutable-frame-configuration 
             (or vm-frame-per-folder vm-frame-per-summary))
@@ -691,14 +691,14 @@ Also move the cursor (point and window-point)."
 
 (defun vm-summary-xxxx-highlight-region (start end face var)
   (let ((ooo (symbol-value var)))
-    (cond (vm-fsfemacs-p
+    (cond ((not (featurep 'xemacs))
           (if (and ooo (overlay-buffer ooo))
               (move-overlay ooo start end)
             (setq ooo (make-overlay start end))
             (set var ooo)
             (overlay-put ooo 'evaporate nil)
             (overlay-put ooo 'face face)))
-         (vm-xemacs-p
+         ((featurep 'xemacs)
           (if (and ooo (vm-extent-end-position ooo))
               (vm-set-extent-endpoints ooo start end)
             (setq ooo (vm-make-extent start end))
@@ -2364,7 +2364,7 @@ Call this function if you made changes to 
`vm-summary-format'."
        buffer-read-only t
        buffer-offer-save nil
        truncate-lines t)
-  (when (and vm-xemacs-p (featurep 'scrollbar))
+  (when (and (featurep 'xemacs) (featurep 'scrollbar))
     (set-specifier scrollbar-height (cons (current-buffer) 0)))
   (use-local-map vm-folders-summary-mode-map)
   (when (vm-menu-support-possible-p)
diff --git a/lisp/vm-thread.el b/lisp/vm-thread.el
index 2340322..4d8afbe 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
 ;;
@@ -284,7 +284,7 @@ youngest or oldest date in its thread.  CRITERION must be 
one of
 (defsubst vm-ts-set-messages-of (subject-sym ml)
   (aset (symbol-value subject-sym) 3 ml))
 
-(defun* vm-ts-set (subject-sym &key root root-date members messages)
+(cl-defun vm-ts-set (subject-sym &key root root-date members messages)
   (let ((vec (symbol-value subject-sym)))
     (aset vec 0 root)
     (aset vec 1 root-date)
@@ -1091,7 +1091,7 @@ symbols interned in vm-thread-obarray."
 ;; message must be a real (non-virtual) message
 
 ;;;###autoload
-(defun* vm-unthread-message-and-mirrors (message &key message-changing)
+(cl-defun vm-unthread-message-and-mirrors (message &key message-changing)
   "Removes MESSAGE and all its mirrored messages from their
 current threads.  If optional argument MESSAGE-CHANGING is
 non-nil, then forget information that might be different if the
@@ -1114,7 +1114,7 @@ The full functionality of this function is not entirely 
clear.
      (cons message (vm-virtual-messages-of message)))))
 
 ;;;###autoload
-(defun* vm-unthread-message (m &key message-changing)
+(cl-defun vm-unthread-message (m &key message-changing)
   "Removes message M from its thread.  If optional argument
 MESSAGE-CHANGING is non-nil, then forget information that might
 be different if the message contents changed.  The message will be
diff --git a/lisp/vm-toolbar.el b/lisp/vm-toolbar.el
index 6e9db16..edda117 100644
--- a/lisp/vm-toolbar.el
+++ b/lisp/vm-toolbar.el
@@ -388,7 +388,7 @@ s-expression like this one in your .vm file:
 (defun vm-toolbar-install-or-uninstall-toolbar ()
   (and (vm-toolbar-support-possible-p) vm-use-toolbar
        (vm-toolbar-install-toolbar))
-  (if (and vm-fsfemacs-p (not vm-use-toolbar))
+  (if (and (not (featurep 'xemacs)) (not vm-use-toolbar))
       (vm-toolbar-fsfemacs-uninstall-toolbar)))
 
 (defcustom vm-toolbar-height nil
@@ -403,7 +403,7 @@ s-expression like this one in your .vm file:
   ;; save file is newer..."
   (require 'vm-save)
   (require 'vm-summary)
-  (if vm-fsfemacs-p
+  (if (not (featurep 'xemacs))
       (if (not vm-fsfemacs-toolbar-installed-p)
          (vm-toolbar-fsfemacs-install-toolbar))
     (if (not (vm-toolbar-pixmap-directory))
@@ -494,7 +494,7 @@ s-expression like this one in your .vm file:
 
 (defun vm-toolbar-initialize ()
   (cond
-   (vm-fsfemacs-p nil)
+   ((not (featurep 'xemacs)) nil)
    ((null vm-toolbar-help-icon)
     (let ((tuples
            (list
diff --git a/lisp/vm-undo.el b/lisp/vm-undo.el
index 119825b..c9e8768 100644
--- a/lisp/vm-undo.el
+++ b/lisp/vm-undo.el
@@ -111,14 +111,14 @@
   ;; for the Undo button on the menubar, if present
   (when (and (null vm-undo-record-list)
             (vm-menu-support-possible-p)
-            (vm-menu-xemacs-menus-p))
+            (featurep 'xemacs))
     (vm-menu-set-menubar-dirty-flag)))
            
 (defun vm-undo-record (sexp)
   ;; for the Undo button on the menubar, if present
   (when (and (null vm-undo-record-list)
             (vm-menu-support-possible-p)
-            (vm-menu-xemacs-menus-p))
+            (featurep 'xemacs))
     (vm-menu-set-menubar-dirty-flag))
   (setq vm-undo-record-list (cons sexp vm-undo-record-list)))
 
diff --git a/lisp/vm-vars.el b/lisp/vm-vars.el
index bf3d523..b74f259 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
 ;;
@@ -21,8 +21,6 @@
 
 ;;; Code:
 
-(provide 'vm-vars)
-
 (require 'vm-version)
 
 (declare-function vm-parse "vm-misc" (string regexp &optional matchn matches))
@@ -1850,7 +1848,7 @@ and when you read an email."
                 regexp))
 
 (defcustom vm-mime-default-face-charsets
-  (if vm-fsfemacs-mule-p
+  (if (not (featurep 'xemacs))
       (if (eq window-system nil)
           '("us-ascii" "ansi_x3.4-1968" "iso-8859-1")
         '("us-ascii" "ansi_x3.4-1968"))
@@ -4397,7 +4395,7 @@ older VM installation."
                                 (expand-file-name vm-configure-datadir))
                            (expand-file-name "pixmaps" vm-dir)
                           (expand-file-name "../pixmaps" vm-dir)
-                          (let ((d (and vm-xemacs-p 
+                          (let ((d (and (featurep 'xemacs) 
                                         (xemacs-locate-data-directory "vm"))))
                             (and d (expand-file-name "pixmaps" d)))))
          image-dir)
@@ -5114,7 +5112,7 @@ decide the face."
 (put 'vm-summary-marked-face 'face-alias 'vm-summary-marked)
 (make-obsolete 'vm-summary-marked-face 'vm-summary-marked "8.2.0")
 
-(if vm-xemacs-p
+(if (featurep 'xemacs)
     (defface vm-summary-deleted
       '(
        (((class color) (background light))
@@ -5892,7 +5890,7 @@ The default should work on UNIX systems."
   :group 'vm-helpers
   :type '(string :tag "Shell command"))
 
-(defcustom vm-uncompface-program (and vm-fsfemacs-p
+(defcustom vm-uncompface-program (and (not (featurep 'xemacs))
                                   (fboundp 'image-type-available-p)
                                   (vm-locate-executable-file "uncompface"))
   "*Program used to convert X-Face data to Sun icon format.
@@ -5903,7 +5901,7 @@ display of X-Faces under Emacs 21."
   :type '(choice (const :tag "None" nil)
                 file))
 
-(defcustom vm-icontopbm-program (and vm-fsfemacs-p
+(defcustom vm-icontopbm-program (and (not (featurep 'xemacs))
                                  (fboundp 'image-type-available-p)
                                  (vm-locate-executable-file "icontopbm"))
   "*Program to convert Sun icon data to a PBM file.
@@ -5915,7 +5913,7 @@ data to XBM data."
                 file))
 
 (defvar vm-uncompface-accepts-dash-x
-  (and vm-fsfemacs-p (fboundp 'image-type-available-p)
+  (and (not (featurep 'xemacs)) (fboundp 'image-type-available-p)
        (stringp vm-uncompface-program)
        (eq 0 (string-match "#define"
                           (shell-command-to-string
@@ -6337,7 +6335,7 @@ Its parent keymap is mail-mode-map.")
     (define-key map "$|" 'vm-mime-reader-map-pipe-to-command)
     (define-key map "$a" 'vm-mime-reader-map-attach-to-composition)
     (define-key map "$d" 'vm-delete-mime-object)
-    (cond ((vm-mouse-xemacs-mouse-p)
+    (cond ((featurep 'xemacs)
           (define-key map 'button3 'vm-menu-popup-mime-dispose-menu)))
     (cond ((fboundp 'set-keymap-name)
           (set-keymap-name map 'vm-mime-reader-map)))
@@ -6767,7 +6765,7 @@ header line in email messages,
 (defvaralias 'vm-vs-spam-score-headers
   'vm-spam-score-headers)
 
-(defconst vm-supported-sort-keys
+(defvar vm-supported-sort-keys
   '("date" "reversed-date"
     "activity" "reversed-activity"
     "author" "reversed-author"
@@ -7384,7 +7382,7 @@ actions to be taken to destroy them.")
 (defconst vm-mime-header-list '("MIME-Version:" "Content-"))
 (defconst vm-mime-header-regexp "\\(MIME-Version:\\|Content-\\)")
 (defconst vm-mime-mule-charset-to-coding-alist
-  (cond (vm-fsfemacs-mule-p
+  (cond ((not (featurep 'xemacs))
         (let ((coding-systems (coding-system-list))
               (alist nil)
               val)
@@ -7448,7 +7446,7 @@ default alist is used.")
   "Alist that maps MULE character sets to matching MIME character sets.")
 
 (defconst vm-mime-mule-coding-to-charset-alist
-  (cond (vm-fsfemacs-mule-p
+  (cond ((not (featurep 'xemacs))
         (let ((coding-systems (coding-system-list))
               (alist nil)
               val)
@@ -7613,4 +7611,5 @@ The file names may be customized via the variables 
`vm-init-file' and
   (setq vm-init-file-loaded t)
   (vm-display nil nil '(vm-load-init-file) '(vm-load-init-file)))
 
+(provide 'vm-vars)
 ;;; vm-vars.el ends here
diff --git a/lisp/vm-version.el b/lisp/vm-version.el
index adffd47..901481f 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
@@ -19,8 +19,6 @@
 
 ;;; Code:
 
-(provide 'vm-version)
-
 ;; Don't use vm-device-type here because it may not not be loaded yet.
 (declare-function device-type "vm-xemacs" ())
 (declare-function device-matching-specifier-tag-list "vm-xemacs" ())
@@ -47,85 +45,36 @@
     (message "VM version is: %s" vm-version))
   vm-version)
 
-(defconst vm-xemacs-p
-  (featurep 'xemacs))
-(defconst vm-xemacs-mule-p
-  (and vm-xemacs-p (featurep 'mule)))
-(defconst vm-xemacs-file-coding-p
-  (and vm-xemacs-p (featurep 'file-coding)
-       ;; paranoia
-       (fboundp
-       'set-buffer-file-coding-system)))
-(defconst vm-fsfemacs-p
-  (not vm-xemacs-p))
-(defconst vm-fsfemacs-mule-p
-  (and (not vm-xemacs-mule-p) (featurep 'mule)
-       (fboundp 'set-buffer-file-coding-system)))
-
-(defconst vm-fsf-threads-p
-  (and vm-fsfemacs-p
-       (string-greaterp (emacs-version) "26.0")))
-
-(defun vm-xemacs-p () vm-xemacs-p)
-(defun vm-xemacs-mule-p () vm-xemacs-mule-p)
-(defun vm-xemacs-file-coding-p () vm-xemacs-file-coding-p)
-(defun vm-fsfemacs-p () vm-fsfemacs-p)
-(defun vm-fsfemacs-mule-p () vm-fsfemacs-mule-p)
-
-(defun vm-emacs-mule-p ()
-  (or vm-xemacs-mule-p vm-fsfemacs-mule-p))
-
-(defun vm-mouse-fsfemacs-mouse-p ()
-  (and vm-fsfemacs-p
-       (fboundp 'set-mouse-position)))
-
-(defun vm-mouse-xemacs-mouse-p ()
-  (and vm-xemacs-p
-       (fboundp 'set-mouse-position)))
-
-(defun vm-menu-fsfemacs-menus-p ()
-  (and vm-fsfemacs-p
-       (fboundp 'menu-bar-mode)))
-
-(defun vm-menu-fsfemacs19-menus-p ()
-  (and vm-fsfemacs-p
-       (fboundp 'menu-bar-mode)
-       (= emacs-major-version 19)))
-
-(defun vm-menu-xemacs-menus-p ()
-  (and vm-xemacs-p
-       (fboundp 'set-buffer-menubar)))
-
 (defun vm-menu-can-eval-item-name ()
-  (and vm-xemacs-p
+  (and (featurep 'xemacs)
        (fboundp 'check-menu-syntax)
        (condition-case nil
           (check-menu-syntax '("bar" ((identity "foo") 'ding t)))
         (error nil))))
 
 (defun vm-multiple-frames-possible-p ()
-  (cond (vm-xemacs-p
+  (cond ((featurep 'xemacs)
         (or (memq 'win (device-matching-specifier-tag-list))
             (featurep 'tty-frames)))
-        (vm-fsfemacs-p
+        ((not (featurep 'xemacs))
          (fboundp 'make-frame))))
  
 (defun vm-mouse-support-possible-p ()
-  (cond (vm-xemacs-p
+  (cond ((featurep 'xemacs)
          (featurep 'window-system))
-        (vm-fsfemacs-p
+        ((not (featurep 'xemacs))
          (fboundp 'track-mouse))))
  
 (defun vm-mouse-support-possible-here-p ()
-  (cond (vm-xemacs-p
+  (cond ((featurep 'xemacs)
         (memq 'win (device-matching-specifier-tag-list)))
-       (vm-fsfemacs-p
+       ((not (featurep 'xemacs))
         (memq window-system '(x mac w32 win32)))))
 
 (defun vm-menu-support-possible-p ()
-  (cond (vm-xemacs-p
+  (cond ((featurep 'xemacs)
         (featurep 'menubar))
-       (vm-fsfemacs-p
+       ((not (featurep 'xemacs))
         (fboundp 'menu-bar-mode))))
  
 (defun vm-menubar-buttons-possible-p ()
@@ -133,23 +82,23 @@
 Windowing toolkits do not allow such buttons.  This says whether such
 buttons are possible under the current windowing system."
   (not
-   (cond (vm-xemacs-p (memq (device-type) '(gtk ns)))
-        (vm-fsfemacs-p (or (and (eq window-system 'x) (featurep 'gtk))
+   (cond ((featurep 'xemacs) (memq (device-type) '(gtk ns)))
+        ((not (featurep 'xemacs)) (or (and (eq window-system 'x) (featurep 
'gtk))
                            (eq window-system 'ns))))))
 
 (defun vm-toolbar-support-possible-p ()
-  (or (and vm-xemacs-p (featurep 'toolbar))
-      (and vm-fsfemacs-p (fboundp 'tool-bar-mode) (boundp 'tool-bar-map))))
+  (or (and (featurep 'xemacs) (featurep 'toolbar))
+      (and (not (featurep 'xemacs)) (fboundp 'tool-bar-mode) (boundp 
'tool-bar-map))))
 
 (defun vm-multiple-fonts-possible-p ()
-  (cond (vm-xemacs-p
+  (cond ((featurep 'xemacs)
         (memq (device-type) '(x gtk mswindows)))
-       (vm-fsfemacs-p
+       ((not (featurep 'xemacs))
         (memq window-system '(x mac w32 win32)))))
 
 (defun vm-images-possible-here-p ()
-  (or (and vm-xemacs-p (memq (device-type) '(x gtk mswindows)))
-      (and vm-fsfemacs-p window-system
+  (or (and (featurep 'xemacs) (memq (device-type) '(x gtk mswindows)))
+      (and (not (featurep 'xemacs)) window-system
           (or (fboundp 'image-type-available-p)
               (and (stringp vm-imagemagick-convert-program)
                    (stringp vm-imagemagick-identify-program))))))
@@ -181,4 +130,5 @@ Return the list of loaded features."
                 feature-list))
   (delete nil feature-list))
 
+(provide 'vm-version)
 ;;; vm-version.el ends here
diff --git a/lisp/vm-w3.el b/lisp/vm-w3.el
index b8ec376..29c521b 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
 ;;
@@ -25,9 +25,9 @@
 
 ;;; Code:
 
+(require 'vm-version)
+
 (eval-when-compile
-  (require 'cl)
-  (require 'advice)
   (require 'vm-mime)
 )
 
@@ -73,3 +73,5 @@
   ;; remove read-only text properties
   (let ((inhibit-read-only t))
     (remove-text-properties start end '(read-only nil))))
+(provide 'vm-w3)
+;;; vm-w3.el ends here
diff --git a/lisp/vm-w3m.el b/lisp/vm-w3m.el
index 2890611..f31455f 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
 ;;
@@ -30,7 +30,7 @@
 
 ;;; Code:
 
-(provide 'vm-w3m)
+(require 'vm-version)
 
 (eval-when-compile
   (require 'vm-mime)
@@ -192,4 +192,5 @@ If the prefix arg is given, all images are considered to be 
safe."
          (set-buffer buffer)
          (w3m-safe-toggle-inline-images arg)))))
 
+(provide 'vm-w3m)
 ;;; vm-w3m.el ends here
diff --git a/lisp/vm-window.el b/lisp/vm-window.el
index fe51813..c4b9c2d 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
 ;;
@@ -145,7 +145,7 @@
       (unwind-protect
          (progn
            (set-buffer (setq work-buffer (get-buffer-create "*vm-wconfig*")))
-           (if vm-fsfemacs-mule-p
+           (if (not (featurep 'xemacs))
                (set-buffer-multibyte nil)) ; for empty buffer
            (erase-buffer)
            (setq vm-window-configurations
@@ -164,7 +164,7 @@
       (unwind-protect
          (progn
            (set-buffer (setq work-buffer (get-buffer-create "*vm-wconfig*")))
-           (if vm-fsfemacs-mule-p
+           (if (not (featurep 'xemacs))
                (set-buffer-multibyte nil)) ; for empty buffer
            ;; for MULE
            (if (fboundp 'set-buffer-file-coding-system)
@@ -484,7 +484,7 @@ Run the hooks in vm-iconify-frame-hook before doing so."
 
 (defun vm-bury-buffer (&optional buffer)
   (or buffer (setq buffer (current-buffer)))
-  (if vm-xemacs-p
+  (if (featurep 'xemacs)
       (if (vm-multiple-frames-possible-p)
          (vm-frame-loop 'bury buffer)
        (bury-buffer buffer))
@@ -596,7 +596,7 @@ Run the hooks in vm-iconify-frame-hook before doing so."
 (defun vm-warp-mouse-to-frame-maybe (&optional frame)
   (or frame (setq frame (vm-selected-frame)))
   (if (vm-mouse-support-possible-here-p)
-      (cond ((vm-mouse-xemacs-mouse-p)
+      (cond ((featurep 'xemacs)
             (cond ((fboundp 'mouse-position);; XEmacs 19.12 and up
                    (let ((mp (mouse-position)))
                      (if (and (car mp)
@@ -624,7 +624,7 @@ Run the hooks in vm-iconify-frame-hook before doing so."
                    ;;   (/ (apply 'screen-width frame) 2)
                    ;;   (/ (apply 'screen-height frame) 2))))
                    )))
-           ((vm-fsfemacs-p)
+           (t
             (let ((mp (mouse-position)))
               (if (and (eq (car mp) frame)
                        ;; nil coordinates mean that the mouse
@@ -692,7 +692,7 @@ Run the hooks in vm-iconify-frame-hook before doing so."
 ;; 2 April 1997, frame-totally-visible-p apparently still broken
 ;; under 19.15.  I give up for now.
 ;;(if (and (fboundp 'frame-totally-visible-p)
-;;      vm-xemacs-p
+;;      (featurep 'xemacs)
 ;;      (or (>= emacs-major-version 20)
 ;;          (>= emacs-minor-version 15)))
 ;;    (fset 'vm-frame-totally-visible-p 'frame-totally-visible-p)
diff --git a/lisp/vm.el b/lisp/vm.el
index 2ffc1ad..678a123 100644
--- a/lisp/vm.el
+++ b/lisp/vm.el
@@ -1,9 +1,10 @@
-;;; vm.el --- Entry points for VM
+;;; vm.el --- Entry points for VM  -*- lexical-binding: t; -*-
 ;;
 ;; This file is part of VM
 ;;
 ;; Copyright (C) 1994-1998, 2003 Kyle E. Jones
 ;; Copyright (C) 2003-2006 Robert Widhopf-Fenk
+;; Version: 0
 ;;
 ;; This program is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
@@ -71,12 +72,11 @@
 ;; Ensure that vm-autoloads is loaded in case the user is using VM 7.x
 ;; autoloads 
 
-(eval-when (load)
-  (if (not (featurep 'xemacs))
-      (require 'vm-autoloads)))
+(if (not (featurep 'xemacs))
+    (require 'vm-autoloads))
 
 ;;;###autoload
-(defun* vm (&optional folder &key read-only interactive
+(cl-defun vm (&optional folder &key read-only interactive
                      access-method reload just-visit)
   "Read mail under Emacs.
 Optional first arg FOLDER specifies the folder to visit.  It can
@@ -218,12 +218,12 @@ deleted messages.  Use `###' to expunge deleted messages."
 
       ;; [5] Prepare the folder buffer for MULE
 
-      (if (and vm-fsfemacs-mule-p enable-multibyte-characters)
+      (if (and (not (featurep 'xemacs)) enable-multibyte-characters)
          (set-buffer-multibyte nil))   ; is this safe?
       (defvar buffer-file-coding-system)
-      (if (or vm-xemacs-mule-p vm-xemacs-file-coding-p)
+      (if (or (featurep 'xemacs) (featurep 'xemacs))
          (vm-setup-xemacs-folder-coding-system))
-      (if vm-fsfemacs-mule-p
+      (if (not (featurep 'xemacs))
          (vm-setup-fsfemacs-folder-coding-system))
 
       ;; [6] Safeguards
@@ -480,7 +480,7 @@ deleted messages.  Use `###' to expunge deleted messages."
   (vm-gobble-labels))
 
 ;;;###autoload
-(defun* vm-other-frame (&optional folder read-only 
+(cl-defun vm-other-frame (&optional folder read-only 
                                  &key interactive)
   "Like vm, but run in a newly created frame."
   (interactive (list nil current-prefix-arg))
@@ -497,7 +497,7 @@ deleted messages.  Use `###' to expunge deleted messages."
       (vm-set-hooks-for-frame-deletion)))
 
 ;;;###autoload
-(defun* vm-other-window (&optional folder read-only
+(cl-defun vm-other-window (&optional folder read-only
                                   &key interactive)
   "Like vm, but run in a different window."
   (interactive (list nil current-prefix-arg))
@@ -529,7 +529,7 @@ Customize VM by setting variables and store them in the 
`vm-init-file'."
   (vm-display nil nil '(vm-mode) '(vm-mode)))
 
 ;;;###autoload
-(defun* vm-visit-folder (folder &optional read-only 
+(cl-defun vm-visit-folder (folder &optional read-only 
                                &key interactive just-visit)
   "Visit a mail file.
 VM will parse and present its messages to you in the usual way.
@@ -595,7 +595,7 @@ message-pointer, no retrieval of new mail."
        :just-visit just-visit)))
 
 ;;;###autoload
-(defun* vm-visit-folder-other-frame (folder &optional read-only
+(cl-defun vm-visit-folder-other-frame (folder &optional read-only
                                            &key interactive)
   "Like vm-visit-folder, but run in a newly created frame."
   (interactive
@@ -628,7 +628,7 @@ message-pointer, no retrieval of new mail."
       (vm-set-hooks-for-frame-deletion)))
 
 ;;;###autoload
-(defun* vm-visit-folder-other-window (folder &optional read-only
+(cl-defun vm-visit-folder-other-window (folder &optional read-only
                                             &key interactive)
   "Like vm-visit-folder, but run in a different window."
   (interactive
@@ -660,7 +660,7 @@ message-pointer, no retrieval of new mail."
     (vm-visit-folder folder read-only :interactive interactive)))
 
 ;;;###autoload
-(defun* vm-visit-thunderbird-folder (folder &optional read-only
+(cl-defun vm-visit-thunderbird-folder (folder &optional read-only
                                            &key interactive)
   "Visit a mail file maintained by Thunderbird.
 VM will parse and present its messages to you in the usual way.
@@ -713,7 +713,7 @@ of messages is carried out preferentially to other 
Thunderbird folders."
   )
 
 ;;;###autoload
-(defun* vm-visit-pop-folder (folder &optional read-only
+(cl-defun vm-visit-pop-folder (folder &optional read-only
                                    &key interactive)
   "Visit a POP mailbox.
 VM will present its messages to you in the usual way.  Messages
@@ -765,7 +765,7 @@ visited folder."
        :interactive interactive :read-only read-only )))
 
 ;;;###autoload
-(defun* vm-visit-pop-folder-other-frame (folder &optional read-only
+(cl-defun vm-visit-pop-folder-other-frame (folder &optional read-only
                                                &key interactive)
   "Like vm-visit-pop-folder, but run in a newly created frame."
   (interactive
@@ -797,7 +797,7 @@ visited folder."
       (vm-set-hooks-for-frame-deletion)))
 
 ;;;###autoload
-(defun* vm-visit-pop-folder-other-window (folder &optional read-only
+(cl-defun vm-visit-pop-folder-other-window (folder &optional read-only
                                                 &key interactive)
   "Like vm-visit-pop-folder, but run in a different window."
   (interactive
@@ -828,7 +828,7 @@ visited folder."
     (vm-visit-pop-folder folder read-only :interactive interactive)))
 
 ;;;###autoload
-(defun* vm-visit-imap-folder (folder &optional read-only
+(cl-defun vm-visit-imap-folder (folder &optional read-only
                                     &key interactive)
   "Visit a IMAP mailbox.
 VM will present its messages to you in the usual way.  Messages
@@ -874,7 +874,7 @@ visited folder."
       :interactive interactive :read-only read-only))
 
 ;;;###autoload
-(defun* vm-visit-imap-folder-other-frame (folder &optional read-only
+(cl-defun vm-visit-imap-folder-other-frame (folder &optional read-only
                                                 &key interactive)
   "Like vm-visit-imap-folder, but run in a newly created frame."
   (interactive
@@ -900,7 +900,7 @@ visited folder."
       (vm-set-hooks-for-frame-deletion)))
 
 ;;;###autoload
-(defun* vm-visit-imap-folder-other-window (folder &optional read-only
+(cl-defun vm-visit-imap-folder-other-window (folder &optional read-only
                                                  &key interactive)
   "Like vm-visit-imap-folder, but run in a different window."
   (interactive
@@ -1522,10 +1522,10 @@ summary buffer to select a folder."
 
 (defun vm-check-emacs-version ()
   "Checks the version of Emacs and gives an error if it is unsupported."
-  (cond ((and vm-xemacs-p (< emacs-major-version 21))
+  (cond ((and (featurep 'xemacs) (< emacs-major-version 21))
         (error "VM %s must be run on XEmacs 21 or a later version."
                (vm-version)))
-       ((and vm-fsfemacs-p (< emacs-major-version 21))
+       ((and (not (featurep 'xemacs)) (< emacs-major-version 21))
         (error "VM %s must be run on GNU Emacs 21 or a later version."
                (vm-version)))))
 
@@ -1625,14 +1625,14 @@ draft messages."
        (setq vm-buffers-needing-display-update (make-vector 29 0))
        (setq vm-buffers-needing-undo-boundaries (make-vector 29 0))
        (add-hook 'post-command-hook 'vm-add-undo-boundaries)
-       (if (if vm-xemacs-p
+       (if (if (featurep 'xemacs)
                (find-face 'vm-monochrome-image)
              (facep 'vm-monochrome-image))
            nil
          (make-face 'vm-monochrome-image)
          (set-face-background 'vm-monochrome-image "white")
          (set-face-foreground 'vm-monochrome-image "black"))
-       (if (or (not vm-fsfemacs-p)
+       (if (or (not (not (featurep 'xemacs)))
                ;; don't need this face under Emacs 21.
                (fboundp 'image-type-available-p)
                (facep 'vm-image-placeholder))
@@ -1648,7 +1648,7 @@ draft messages."
             (vm-mouse-install-mouse))
        (and (vm-menu-support-possible-p)
             vm-use-menus
-            (vm-menu-fsfemacs-menus-p)
+            (not (featurep 'xemacs))
             (vm-menu-initialize-vm-mode-menu-map))
        (setq vm-session-beginning nil)))
   ;; check for postponed messages

Attachment: +make.log
Description: Binary data


reply via email to

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