emacs-diffs
[Top][All Lists]
Advanced

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

master 1697507: * lisp/emulation/: Use lexical-binding


From: Stefan Monnier
Subject: master 1697507: * lisp/emulation/: Use lexical-binding
Date: Sat, 6 Mar 2021 13:03:35 -0500 (EST)

branch: master
commit 16975078b421b6b88caecf6d6143789fb44f1ddc
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>

    * lisp/emulation/: Use lexical-binding
    
    * lisp/emulation/cua-base.el: Use lexical-binding.
    Remove redundant `:group` arguments.
    (cua-mode): Don't use `:require` since the autoload on `define-minor-mode`
    takes care of loading the mode when custom-setting it.
    
    * lisp/emulation/cua-gmrk.el: Use lexical-binding.
    (cua--copy-rectangle-to-global-mark): Remove unused var `src-buf`.
    
    * lisp/emulation/edt-mapper.el: Use lexical-binding.
    
    * lisp/emulation/edt.el: Use lexical-binding.
    Remove redundant `:group` arguments.
    (edt-with-position): Allow `top`, `left`, and `far` to be left unused
    in `body`.
    
    * lisp/emulation/keypad.el: Use lexical-binding.
    
    * lisp/emulation/viper-cmd.el: Move `provide` to the end.
    (viper-read-string-with-history): Strength reduce `eval` to `symbol-value`.
    
    * lisp/emulation/viper-ex.el: Use lexical-binding.
    Remove redundant `:group` arguments.
    Move `provide` to the end.
    
    * lisp/emulation/viper-init.el: Use lexical-binding.
    
    * lisp/emulation/viper-keym.el (viper-toggle-key): Use `dolist`.
    (viper-insert-diehard-map): Use `string`.
    (viper-modify-major-mode): Use `alist-get` and `setf`.
    
    * lisp/emulation/viper-macs.el (viper-ex-work-buf):
    Move `provide` to the end.
    (viper-record-kbd-macro): Strength reduce `eval` to `symbol-value`.
    (viper-describe-kbd-macros): Return value is not significant.
    (viper-keyseq-is-a-possible-macro): Use `seq-some`.
    (viper-common-seq-prefix): Use `seq-every-p`.
    
    * lisp/emulation/viper-mous.el: Use lexical-binding.
    Remove redundant `:group` arguments.
    Move `provide` to the end.
    (viper-remember-current-frame): Accept arbitrary ignored args.
    (viper-parse-mouse-key): Strength reduce `eval` to `symbol-value`.
    Remove unused var `key-spec`.
    (viper-bind-mouse-search-key, viper-bind-mouse-insert-key):
    Apply de Morgan.
    
    * lisp/emulation/viper-util.el: Move `provide` to the end.
    (viper-move-marker-locally, viper-push-onto-ring, viper-save-setting):
    Strength reduce `eval` to `symbol-value`.
    (viper-event-vector-p, viper-char-symbol-sequence-p, viper-char-array-p):
    Use `seq-every-p`.
    
    * lisp/emulation/viper.el (viper-non-hook-settings): Eta-reduce use of
    `viper-remember-current-frame`.
---
 lisp/emulation/cua-base.el   | 211 ++++++++++++++++++++-----------------------
 lisp/emulation/cua-gmrk.el   |  53 +++++++----
 lisp/emulation/cua-rect.el   | 140 ++++++++++++++--------------
 lisp/emulation/edt-mapper.el |   4 +-
 lisp/emulation/edt.el        | 112 +++++++++++------------
 lisp/emulation/keypad.el     |  18 ++--
 lisp/emulation/viper-cmd.el  | 137 ++++++++++++++--------------
 lisp/emulation/viper-ex.el   |  35 +++----
 lisp/emulation/viper-init.el |   6 +-
 lisp/emulation/viper-keym.el |  66 ++++++--------
 lisp/emulation/viper-macs.el |  65 +++++++------
 lisp/emulation/viper-mous.el |  53 +++++------
 lisp/emulation/viper-util.el |  96 ++++++++++----------
 lisp/emulation/viper.el      |   6 +-
 14 files changed, 487 insertions(+), 515 deletions(-)

diff --git a/lisp/emulation/cua-base.el b/lisp/emulation/cua-base.el
index a64274b..54f881b 100644
--- a/lisp/emulation/cua-base.el
+++ b/lisp/emulation/cua-base.el
@@ -1,4 +1,4 @@
-;;; cua-base.el --- emulate CUA key bindings
+;;; cua-base.el --- emulate CUA key bindings  -*- lexical-binding: t; -*-
 
 ;; Copyright (C) 1997-2021 Free Software Foundation, Inc.
 
@@ -272,19 +272,16 @@ a shifted movement key.  If the value is nil, these keys 
are never
 enabled."
   :type '(choice (const :tag "Disabled" nil)
                 (const :tag "Shift region only" shift)
-                (other :tag "Enabled" t))
-  :group 'cua)
+                (other :tag "Enabled" t)))
 
 (defcustom cua-remap-control-v t
   "If non-nil, C-v binding is used for paste (yank).
 Also, M-v is mapped to `delete-selection-repeat-replace-region'."
-  :type 'boolean
-  :group 'cua)
+  :type 'boolean)
 
 (defcustom cua-remap-control-z t
   "If non-nil, C-z binding is used for undo."
-  :type 'boolean
-  :group 'cua)
+  :type 'boolean)
 
 (defcustom cua-highlight-region-shift-only nil
   "If non-nil, only highlight region if marked with S-<move>.
@@ -292,8 +289,7 @@ When this is non-nil, CUA toggles `transient-mark-mode' on 
when the region
 is marked using shifted movement keys, and off when the mark is cleared.
 But when the mark was set using \\[cua-set-mark], Transient Mark mode
 is not turned on."
-  :type 'boolean
-  :group 'cua)
+  :type 'boolean)
 (make-obsolete-variable 'cua-highlight-region-shift-only
                         'transient-mark-mode "24.4")
 
@@ -307,33 +303,28 @@ first prefix key is discarded, so typing a prefix key 
twice in quick
 succession will also inhibit overriding the prefix key.
 If the value is nil, use a shifted prefix key to inhibit the override."
   :type '(choice (number :tag "Inhibit delay")
-                (const :tag "No delay" nil))
-  :group 'cua)
+                (const :tag "No delay" nil)))
 
 (defcustom cua-delete-selection t
   "If non-nil, typed text replaces text in the active selection."
   :type '(choice (const :tag "Disabled" nil)
-                (other :tag "Enabled" t))
-  :group 'cua)
+                (other :tag "Enabled" t)))
 
 (defcustom cua-keep-region-after-copy nil
   "If non-nil, don't deselect the region after copying."
-  :type 'boolean
-  :group 'cua)
+  :type 'boolean)
 
 (defcustom cua-toggle-set-mark t
   "If non-nil, the `cua-set-mark' command toggles the mark."
   :type '(choice (const :tag "Disabled" nil)
-                (other :tag "Enabled" t))
-  :group 'cua)
+                (other :tag "Enabled" t)))
 
 (defcustom cua-auto-mark-last-change nil
   "If non-nil, set implicit mark at position of last buffer change.
 This means that \\[universal-argument] \\[cua-set-mark] will jump to the 
position
 of the last buffer change before jumping to the explicit marks on the mark 
ring.
 See `cua-set-mark' for details."
-  :type 'boolean
-  :group 'cua)
+  :type 'boolean)
 
 (defcustom cua-enable-register-prefix 'not-ctrl-u
   "If non-nil, registers are supported via numeric prefix arg.
@@ -346,32 +337,27 @@ interpreted as a register number."
   :type '(choice (const :tag "Disabled" nil)
                 (const :tag "Enabled, but C-u arg is not a register" 
not-ctrl-u)
                 (const :tag "Enabled, but only for C-u arg" ctrl-u-only)
-                (other :tag "Enabled" t))
-  :group 'cua)
+                (other :tag "Enabled" t)))
 
 (defcustom cua-delete-copy-to-register-0 t
   ;; FIXME: Obey delete-selection-save-to-register rather than hardcoding
   ;; register 0.
   "If non-nil, save last deleted region or rectangle to register 0."
-  :type 'boolean
-  :group 'cua)
+  :type 'boolean)
 
 (defcustom cua-enable-region-auto-help nil
   "If non-nil, automatically show help for active region."
-  :type 'boolean
-  :group 'cua)
+  :type 'boolean)
 
 (defcustom cua-enable-modeline-indications nil
   "If non-nil, use minor-mode hook to show status in mode line."
-  :type 'boolean
-  :group 'cua)
+  :type 'boolean)
 
 (defcustom cua-check-pending-input t
   "If non-nil, don't override prefix key if input pending.
 It is rumored that `input-pending-p' is unreliable under some window
 managers, so try setting this to nil, if prefix override doesn't work."
-  :type 'boolean
-  :group 'cua)
+  :type 'boolean)
 
 (defcustom cua-paste-pop-rotate-temporarily nil
   "If non-nil, \\[cua-paste-pop] only rotates the kill-ring temporarily.
@@ -380,8 +366,7 @@ insert the most recently killed text.  Each immediately 
following \\[cua-paste-p
 replaces the previous text with the next older element on the `kill-ring'.
 With prefix arg, \\[universal-argument] \\[yank-pop] inserts the same text as 
the
 most recent \\[yank-pop] (or \\[yank]) command."
-  :type 'boolean
-  :group 'cua)
+  :type 'boolean)
 
 ;;; Rectangle Customization
 
@@ -390,8 +375,7 @@ most recent \\[yank-pop] (or \\[yank]) command."
 Note that although rectangles are always DISPLAYED with straight edges, the
 buffer is NOT modified, until you execute a command that actually modifies it.
 M-p toggles this feature when a rectangle is active."
-  :type 'boolean
-  :group 'cua)
+  :type 'boolean)
 
 (defcustom cua-auto-tabify-rectangles 1000
   "If non-nil, automatically tabify after rectangle commands.
@@ -403,11 +387,12 @@ present.  The number specifies then number of characters 
before
 and after the region marked by the rectangle to search."
   :type '(choice (number :tag "Auto detect (limit)")
                 (const :tag "Disabled" nil)
-                (other :tag "Enabled" t))
-  :group 'cua)
+                (other :tag "Enabled" t)))
 
 (defvar cua-global-keymap)             ; forward
 (defvar cua--region-keymap)            ; forward
+(declare-function cua-clear-rectangle-mark "cua-rect" ())
+(declare-function cua-mouse-set-rectangle-mark "cua-rect" (event))
 
 (defcustom cua-rectangle-mark-key [(control return)]
   "Global key used to toggle the cua rectangle mark."
@@ -416,14 +401,13 @@ and after the region marked by the rectangle to search."
           (when (and (boundp 'cua--keymaps-initialized)
                      cua--keymaps-initialized)
             (define-key cua-global-keymap value
-              'cua-set-rectangle-mark)
+              #'cua-set-rectangle-mark)
             (when (boundp 'cua--rectangle-keymap)
               (define-key cua--rectangle-keymap value
-                'cua-clear-rectangle-mark)
+                #'cua-clear-rectangle-mark)
               (define-key cua--region-keymap value
-                'cua-toggle-rectangle-mark))))
-  :type 'key-sequence
-  :group 'cua)
+                #'cua-toggle-rectangle-mark))))
+  :type 'key-sequence)
 
 (defcustom cua-rectangle-modifier-key 'meta
   "Modifier key used for rectangle commands bindings.
@@ -432,8 +416,7 @@ Must be set prior to enabling CUA."
   :type '(choice (const :tag "Meta key" meta)
                 (const :tag "Alt key" alt)
                 (const :tag "Hyper key" hyper)
-                (const :tag "Super key" super))
-  :group 'cua)
+                (const :tag "Super key" super)))
 
 (defcustom cua-rectangle-terminal-modifier-key 'meta
   "Modifier key used for rectangle commands bindings in terminals.
@@ -442,54 +425,46 @@ Must be set prior to enabling CUA."
                 (const :tag "Alt key" alt)
                 (const :tag "Hyper key" hyper)
                 (const :tag "Super key" super))
-  :group 'cua
   :version "27.1")
 
 (defcustom cua-enable-rectangle-auto-help t
   "If non-nil, automatically show help for region, rectangle and global mark."
-  :type 'boolean
-  :group 'cua)
+  :type 'boolean)
 
 (defface cua-rectangle
   '((default :inherit region)
     (((class color)) :foreground "white" :background "maroon"))
-  "Font used by CUA for highlighting the rectangle."
-  :group 'cua)
+  "Font used by CUA for highlighting the rectangle.")
 
 (defface cua-rectangle-noselect
   '((default :inherit region)
     (((class color)) :foreground "white" :background "dimgray"))
-  "Font used by CUA for highlighting the non-selected rectangle lines."
-  :group 'cua)
+  "Font used by CUA for highlighting the non-selected rectangle lines.")
 
 
 ;;; Global Mark Customization
 
 (defcustom cua-global-mark-keep-visible t
   "If non-nil, always keep global mark visible in other window."
-  :type 'boolean
-  :group 'cua)
+  :type 'boolean)
 
 (defface cua-global-mark
   '((((min-colors 88)(class color)) :foreground "black" :background "yellow1")
     (((class color)) :foreground "black" :background "yellow")
     (t :weight bold))
-  "Font used by CUA for highlighting the global mark."
-  :group 'cua)
+  "Font used by CUA for highlighting the global mark.")
 
 (defcustom cua-global-mark-blink-cursor-interval 0.20
   "Blink cursor at this interval when global mark is active."
   :type '(choice (number :tag "Blink interval")
-                (const :tag "No blink" nil))
-  :group 'cua)
+                (const :tag "No blink" nil)))
 
 
 ;;; Cursor Indication Customization
 
 (defcustom cua-enable-cursor-indications nil
   "If non-nil, use different cursor colors for indications."
-  :type 'boolean
-  :group 'cua)
+  :type 'boolean)
 
 (defcustom cua-normal-cursor-color (or (and (boundp 'initial-cursor-color) 
initial-cursor-color)
                                       (and (boundp 'initial-frame-alist)
@@ -507,7 +482,7 @@ If the value is a COLOR name, then only the `cursor-color' 
attribute will be
 affected.  If the value is a cursor TYPE (one of: box, hollow, bar, or hbar),
 then only the `cursor-type' property will be affected.  If the value is
 a cons (TYPE . COLOR), then both properties are affected."
-  :initialize 'custom-initialize-default
+  :initialize #'custom-initialize-default
   :type '(choice
          (color :tag "Color")
          (choice :tag "Type"
@@ -521,8 +496,7 @@ a cons (TYPE . COLOR), then both properties are affected."
                        (const :tag "Vertical bar" bar)
                        (const :tag "Horizontal bar" hbar)
                        (const :tag "Hollow box" hollow))
-               (color :tag "Color")))
-  :group 'cua)
+               (color :tag "Color"))))
 
 (defcustom cua-read-only-cursor-color "darkgreen"
   "Cursor color used in read-only buffers, if non-nil.
@@ -545,8 +519,7 @@ a cons (TYPE . COLOR), then both properties are affected."
                        (const :tag "Vertical bar" bar)
                        (const :tag "Horizontal bar" hbar)
                        (const :tag "Hollow box" hollow))
-               (color :tag "Color")))
-  :group 'cua)
+               (color :tag "Color"))))
 
 (defcustom cua-overwrite-cursor-color "yellow"
   "Cursor color used when overwrite mode is set, if non-nil.
@@ -569,8 +542,7 @@ a cons (TYPE . COLOR), then both properties are affected."
                        (const :tag "Vertical bar" bar)
                        (const :tag "Horizontal bar" hbar)
                        (const :tag "Hollow box" hollow))
-               (color :tag "Color")))
-  :group 'cua)
+               (color :tag "Color"))))
 
 (defcustom cua-global-mark-cursor-color "cyan"
   "Indication for active global mark.
@@ -594,8 +566,7 @@ a cons (TYPE . COLOR), then both properties are affected."
                        (const :tag "Vertical bar" bar)
                        (const :tag "Horizontal bar" hbar)
                        (const :tag "Hollow box" hollow))
-               (color :tag "Color")))
-  :group 'cua)
+               (color :tag "Color"))))
 
 
 ;;; Rectangle support is in cua-rect.el
@@ -710,7 +681,7 @@ a cons (TYPE . COLOR), then both properties are affected."
           (<= cua-prefix-override-inhibit-delay 0)
           ;; In state [1], start [T] and change to state [2]
           (run-with-timer cua-prefix-override-inhibit-delay nil
-                          'cua--prefix-override-timeout)))
+                          #'cua--prefix-override-timeout)))
     ;; Don't record this command
     (setq this-command last-command)
     ;; Restore the prefix arg
@@ -1243,6 +1214,8 @@ If ARG is the atom `-', scroll upward by nearly full 
screen."
   (interactive)
   (cua--shift-control-prefix ?\C-x))
 
+(declare-function delete-selection-repeat-replace-region "delsel" (arg))
+
 (defun cua--init-keymaps ()
   ;; Cache actual rectangle modifier key.
   (setq cua--rectangle-modifier-key
@@ -1250,68 +1223,84 @@ If ARG is the atom `-', scroll upward by nearly full 
screen."
            cua-rectangle-terminal-modifier-key
          cua-rectangle-modifier-key))
   ;; C-return always toggles rectangle mark
-  (define-key cua-global-keymap cua-rectangle-mark-key 'cua-set-rectangle-mark)
+  (define-key cua-global-keymap cua-rectangle-mark-key 
#'cua-set-rectangle-mark)
   (unless (eq cua--rectangle-modifier-key 'meta)
-    (cua--M/H-key cua-global-keymap ?\s                        
'cua-set-rectangle-mark)
+    (cua--M/H-key cua-global-keymap ?\s                       
#'cua-set-rectangle-mark)
     (define-key cua-global-keymap
-      (vector (list cua--rectangle-modifier-key 'mouse-1)) 
'cua-mouse-set-rectangle-mark))
+      (vector (list cua--rectangle-modifier-key 'mouse-1))
+      #'cua-mouse-set-rectangle-mark))
 
-  (define-key cua-global-keymap [(shift control ?\s)]  'cua-toggle-global-mark)
+  (define-key cua-global-keymap [(shift control ?\s)]  
#'cua-toggle-global-mark)
 
   ;; replace region with rectangle or element on kill ring
-  (define-key cua-global-keymap [remap yank]           'cua-paste)
-  (define-key cua-global-keymap [remap clipboard-yank] 'cua-paste)
-  (define-key cua-global-keymap [remap x-clipboard-yank] 'cua-paste)
+  (define-key cua-global-keymap [remap yank]            #'cua-paste)
+  (define-key cua-global-keymap [remap clipboard-yank]  #'cua-paste)
+  (define-key cua-global-keymap [remap x-clipboard-yank] #'cua-paste)
   ;; replace current yank with previous kill ring element
-  (define-key cua-global-keymap [remap yank-pop]               'cua-paste-pop)
+  (define-key cua-global-keymap [remap yank-pop]              #'cua-paste-pop)
   ;; set mark
-  (define-key cua-global-keymap [remap set-mark-command]       'cua-set-mark)
-  (define-key cua-global-keymap [remap exchange-point-and-mark] 
'cua-exchange-point-and-mark)
+  (define-key cua-global-keymap [remap set-mark-command]       #'cua-set-mark)
+  (define-key cua-global-keymap [remap exchange-point-and-mark]
+    #'cua-exchange-point-and-mark)
 
   ;; scrolling
-  (define-key cua-global-keymap [remap scroll-up]      'cua-scroll-up)
-  (define-key cua-global-keymap [remap scroll-down]    'cua-scroll-down)
-  (define-key cua-global-keymap [remap scroll-up-command]   'cua-scroll-up)
-  (define-key cua-global-keymap [remap scroll-down-command] 'cua-scroll-down)
+  (define-key cua-global-keymap [remap scroll-up]      #'cua-scroll-up)
+  (define-key cua-global-keymap [remap scroll-down]    #'cua-scroll-down)
+  (define-key cua-global-keymap [remap scroll-up-command]   #'cua-scroll-up)
+  (define-key cua-global-keymap [remap scroll-down-command] #'cua-scroll-down)
 
-  (define-key cua--cua-keys-keymap [(control x) timeout] 'kill-region)
-  (define-key cua--cua-keys-keymap [(control c) timeout] 'copy-region-as-kill)
+  (define-key cua--cua-keys-keymap [(control x) timeout] #'kill-region)
+  (define-key cua--cua-keys-keymap [(control c) timeout] #'copy-region-as-kill)
   (when cua-remap-control-z
-    (define-key cua--cua-keys-keymap [(control z)] 'undo))
+    (define-key cua--cua-keys-keymap [(control z)] #'undo))
   (when cua-remap-control-v
-    (define-key cua--cua-keys-keymap [(control v)] 'yank)
+    (define-key cua--cua-keys-keymap [(control v)] #'yank)
     (define-key cua--cua-keys-keymap [(meta v)]
-      'delete-selection-repeat-replace-region))
+      #'delete-selection-repeat-replace-region))
 
-  (define-key cua--prefix-override-keymap [(control x)] 
'cua--prefix-override-handler)
-  (define-key cua--prefix-override-keymap [(control c)] 
'cua--prefix-override-handler)
+  (define-key cua--prefix-override-keymap [(control x)]
+    #'cua--prefix-override-handler)
+  (define-key cua--prefix-override-keymap [(control c)]
+    #'cua--prefix-override-handler)
 
-  (define-key cua--prefix-repeat-keymap [(control x) (control x)] 
'cua--prefix-repeat-handler)
-  (define-key cua--prefix-repeat-keymap [(control c) (control c)] 
'cua--prefix-repeat-handler)
+  (define-key cua--prefix-repeat-keymap [(control x) (control x)]
+    #'cua--prefix-repeat-handler)
+  (define-key cua--prefix-repeat-keymap [(control c) (control c)]
+    #'cua--prefix-repeat-handler)
   (dolist (key '(up down left right home end next prior))
-    (define-key cua--prefix-repeat-keymap (vector '(control x) key) 
'cua--prefix-cut-handler)
-    (define-key cua--prefix-repeat-keymap (vector '(control c) key) 
'cua--prefix-copy-handler))
+    (define-key cua--prefix-repeat-keymap (vector '(control x) key)
+      #'cua--prefix-cut-handler)
+    (define-key cua--prefix-repeat-keymap (vector '(control c) key)
+      #'cua--prefix-copy-handler))
 
   ;; Enable shifted fallbacks for C-x and C-c when region is active
-  (define-key cua--region-keymap [(shift control x)] 
'cua--shift-control-x-prefix)
-  (define-key cua--region-keymap [(shift control c)] 
'cua--shift-control-c-prefix)
+  (define-key cua--region-keymap [(shift control x)]
+    #'cua--shift-control-x-prefix)
+  (define-key cua--region-keymap [(shift control c)]
+    #'cua--shift-control-c-prefix)
 
   ;; delete current region
-  (define-key cua--region-keymap [remap delete-backward-char]  
'cua-delete-region)
-  (define-key cua--region-keymap [remap backward-delete-char]  
'cua-delete-region)
-  (define-key cua--region-keymap [remap backward-delete-char-untabify] 
'cua-delete-region)
-  (define-key cua--region-keymap [remap delete-char]           
'cua-delete-region)
-  (define-key cua--region-keymap [remap delete-forward-char]    
'cua-delete-region)
+  (define-key cua--region-keymap [remap delete-backward-char]
+    #'cua-delete-region)
+  (define-key cua--region-keymap [remap backward-delete-char]
+    #'cua-delete-region)
+  (define-key cua--region-keymap [remap backward-delete-char-untabify]
+    #'cua-delete-region)
+  (define-key cua--region-keymap [remap delete-char]
+    #'cua-delete-region)
+  (define-key cua--region-keymap [remap delete-forward-char]
+    #'cua-delete-region)
   ;; kill region
-  (define-key cua--region-keymap [remap kill-region]           'cua-cut-region)
-  (define-key cua--region-keymap [remap clipboard-kill-region] 'cua-cut-region)
+  (define-key cua--region-keymap [remap kill-region]          #'cua-cut-region)
+  (define-key cua--region-keymap [remap clipboard-kill-region] 
#'cua-cut-region)
   ;; copy region
-  (define-key cua--region-keymap [remap copy-region-as-kill]   
'cua-copy-region)
-  (define-key cua--region-keymap [remap kill-ring-save]                
'cua-copy-region)
-  (define-key cua--region-keymap [remap clipboard-kill-ring-save] 
'cua-copy-region)
+  (define-key cua--region-keymap [remap copy-region-as-kill]  
#'cua-copy-region)
+  (define-key cua--region-keymap [remap kill-ring-save]              
#'cua-copy-region)
+  (define-key cua--region-keymap [remap clipboard-kill-ring-save]
+    #'cua-copy-region)
   ;; cancel current region/rectangle
-  (define-key cua--region-keymap [remap keyboard-escape-quit]  'cua-cancel)
-  (define-key cua--region-keymap [remap keyboard-quit]         'cua-cancel)
+  (define-key cua--region-keymap [remap keyboard-escape-quit]  #'cua-cancel)
+  (define-key cua--region-keymap [remap keyboard-quit]         #'cua-cancel)
   )
 
 
@@ -1344,11 +1333,9 @@ You can customize `cua-enable-cua-keys' to completely 
disable the
 CUA bindings, or `cua-prefix-override-inhibit-delay' to change
 the prefix fallback behavior."
   :global t
-  :group 'cua
   :set-after '(cua-enable-modeline-indications
               cua-remap-control-v cua-remap-control-z
               cua-rectangle-mark-key cua-rectangle-modifier-key)
-  :require 'cua-base
   :link '(emacs-commentary-link "cua-base.el")
   (setq mark-even-if-inactive t)
   (setq highlight-nonselected-windows nil)
@@ -1359,15 +1346,15 @@ the prefix fallback behavior."
 
   (if cua-mode
       (progn
-       (add-hook 'pre-command-hook 'cua--pre-command-handler)
-       (add-hook 'post-command-hook 'cua--post-command-handler)
+       (add-hook 'pre-command-hook #'cua--pre-command-handler)
+       (add-hook 'post-command-hook #'cua--post-command-handler)
        (if (and cua-enable-modeline-indications (not (assoc 'cua-mode 
minor-mode-alist)))
            (setq minor-mode-alist (cons '(cua-mode cua--status-string) 
minor-mode-alist)))
        (if cua-enable-cursor-indications
            (cua--update-indications)))
 
-    (remove-hook 'pre-command-hook 'cua--pre-command-handler)
-    (remove-hook 'post-command-hook 'cua--post-command-handler))
+    (remove-hook 'pre-command-hook #'cua--pre-command-handler)
+    (remove-hook 'post-command-hook #'cua--post-command-handler))
 
   (if (not cua-mode)
       (setq emulation-mode-map-alists
diff --git a/lisp/emulation/cua-gmrk.el b/lisp/emulation/cua-gmrk.el
index 6f6b9fc..7014330 100644
--- a/lisp/emulation/cua-gmrk.el
+++ b/lisp/emulation/cua-gmrk.el
@@ -1,4 +1,4 @@
-;;; cua-gmrk.el --- CUA unified global mark support
+;;; cua-gmrk.el --- CUA unified global mark support  -*- lexical-binding: t; 
-*-
 
 ;; Copyright (C) 1997-2021 Free Software Foundation, Inc.
 
@@ -186,7 +186,7 @@ With prefix argument, don't jump to global mark when 
canceling it."
 (defun cua--copy-rectangle-to-global-mark (as-text)
   ;; Copy rectangle to global mark buffer/position.
   (if (cua--global-mark-active)
-      (let ((src-buf (current-buffer))
+      (let (;; (src-buf (current-buffer))
            (text (cua--extract-rectangle)))
        (with-current-buffer (marker-buffer cua--global-mark-marker)
          (goto-char (marker-position cua--global-mark-marker))
@@ -351,29 +351,44 @@ With prefix argument, don't jump to global mark when 
canceling it."
 ;;; Initialization
 
 (defun cua--init-global-mark ()
-  (define-key cua--global-mark-keymap [remap copy-region-as-kill]      
'cua-copy-to-global-mark)
-  (define-key cua--global-mark-keymap [remap kill-ring-save]           
'cua-copy-to-global-mark)
-  (define-key cua--global-mark-keymap [remap kill-region]              
'cua-cut-to-global-mark)
-  (define-key cua--global-mark-keymap [remap yank]                     
'cua-copy-next-to-global-mark)
-
-  (define-key cua--global-mark-keymap [remap keyboard-escape-quit]     
'cua-cancel-global-mark)
-  (define-key cua--global-mark-keymap [remap keyboard-quit]            
'cua-cancel-global-mark)
-
-  (define-key cua--global-mark-keymap [(control ?d)]                   
'cua-cut-next-to-global-mark)
-  (define-key cua--global-mark-keymap [remap delete-backward-char]     
'cua-delete-backward-char-at-global-mark)
-  (define-key cua--global-mark-keymap [remap backward-delete-char]     
'cua-delete-backward-char-at-global-mark)
-  (define-key cua--global-mark-keymap [remap backward-delete-char-untabify] 
'cua-delete-backward-char-at-global-mark)
-  (define-key cua--global-mark-keymap [remap self-insert-command]      
'cua-insert-char-at-global-mark)
+  (define-key cua--global-mark-keymap [remap copy-region-as-kill]
+    #'cua-copy-to-global-mark)
+  (define-key cua--global-mark-keymap [remap kill-ring-save]
+    #'cua-copy-to-global-mark)
+  (define-key cua--global-mark-keymap [remap kill-region]
+    #'cua-cut-to-global-mark)
+  (define-key cua--global-mark-keymap [remap yank]
+    #'cua-copy-next-to-global-mark)
+
+  (define-key cua--global-mark-keymap [remap keyboard-escape-quit]
+    #'cua-cancel-global-mark)
+  (define-key cua--global-mark-keymap [remap keyboard-quit]
+    #'cua-cancel-global-mark)
+
+  (define-key cua--global-mark-keymap [(control ?d)]
+    #'cua-cut-next-to-global-mark)
+  (define-key cua--global-mark-keymap [remap delete-backward-char]
+    #'cua-delete-backward-char-at-global-mark)
+  (define-key cua--global-mark-keymap [remap backward-delete-char]
+    #'cua-delete-backward-char-at-global-mark)
+  (define-key cua--global-mark-keymap [remap backward-delete-char-untabify]
+    #'cua-delete-backward-char-at-global-mark)
+  (define-key cua--global-mark-keymap [remap self-insert-command]
+    #'cua-insert-char-at-global-mark)
 
   ;; Catch self-inserting characters which are "stolen" by other modes
   (define-key cua--global-mark-keymap [t]
     '(menu-item "sic" cua-insert-char-at-global-mark :filter 
cua--self-insert-char-p))
 
-  (define-key cua--global-mark-keymap [remap newline]                  
'cua-insert-newline-at-global-mark)
-  (define-key cua--global-mark-keymap [remap newline-and-indent]       
'cua-insert-newline-at-global-mark)
-  (define-key cua--global-mark-keymap "\r"                             
'cua-insert-newline-at-global-mark)
+  (define-key cua--global-mark-keymap [remap newline]
+    #'cua-insert-newline-at-global-mark)
+  (define-key cua--global-mark-keymap [remap newline-and-indent]
+    #'cua-insert-newline-at-global-mark)
+  (define-key cua--global-mark-keymap "\r"
+    #'cua-insert-newline-at-global-mark)
 
-  (define-key cua--global-mark-keymap "\t"                             
'cua-indent-to-global-mark-column)
+  (define-key cua--global-mark-keymap "\t"
+    #'cua-indent-to-global-mark-column)
 
   (setq cua--global-mark-initialized t))
 
diff --git a/lisp/emulation/cua-rect.el b/lisp/emulation/cua-rect.el
index b734fd1..e66050b 100644
--- a/lisp/emulation/cua-rect.el
+++ b/lisp/emulation/cua-rect.el
@@ -90,7 +90,7 @@ See `cua--rectangle'.")
 
 (defvar cua--overlay-keymap
   (let ((map (make-sparse-keymap)))
-    (define-key map "\r" 'cua-rotate-rectangle)))
+    (define-key map "\r" #'cua-rotate-rectangle)))
 
 (defvar cua--virtual-edges-debug nil)
 
@@ -104,7 +104,7 @@ See `cua--rectangle'.")
          (e (cua--rect-end-position)))
       (undo-boundary)
       (push (list 'apply 0 s e
-                 'cua--rect-undo-handler
+                 #'cua--rect-undo-handler
                  (copy-sequence cua--rectangle) t s e)
             buffer-undo-list))))
 
@@ -114,7 +114,7 @@ See `cua--rectangle'.")
     (setq cua--restored-rectangle (copy-sequence rect))
     (setq cua--buffer-and-point-before-command nil))
   (push (list 'apply 0 s (if on e s)
-             'cua--rect-undo-handler rect on s e)
+             #'cua--rect-undo-handler rect on s e)
        buffer-undo-list))
 
 ;;;###autoload
@@ -1483,79 +1483,79 @@ With prefix arg, indent to that column."
   (cua--M/H-key cua--rectangle-keymap key cmd))
 
 (defun cua--init-rectangles ()
-  (define-key cua--rectangle-keymap cua-rectangle-mark-key 
'cua-clear-rectangle-mark)
-  (define-key cua--region-keymap    cua-rectangle-mark-key 
'cua-toggle-rectangle-mark)
+  (define-key cua--rectangle-keymap cua-rectangle-mark-key 
#'cua-clear-rectangle-mark)
+  (define-key cua--region-keymap    cua-rectangle-mark-key 
#'cua-toggle-rectangle-mark)
   (unless (eq cua--rectangle-modifier-key 'meta)
-    (cua--rect-M/H-key ?\s                            
'cua-clear-rectangle-mark)
-    (cua--M/H-key cua--region-keymap ?\s              
'cua-toggle-rectangle-mark))
-
-  (define-key cua--rectangle-keymap [remap set-mark-command]    
'cua-toggle-rectangle-mark)
-
-  (define-key cua--rectangle-keymap [remap forward-char]        
'cua-resize-rectangle-right)
-  (define-key cua--rectangle-keymap [remap right-char]          
'cua-resize-rectangle-right)
-  (define-key cua--rectangle-keymap [remap backward-char]       
'cua-resize-rectangle-left)
-  (define-key cua--rectangle-keymap [remap left-char]           
'cua-resize-rectangle-left)
-  (define-key cua--rectangle-keymap [remap next-line]           
'cua-resize-rectangle-down)
-  (define-key cua--rectangle-keymap [remap previous-line]       
'cua-resize-rectangle-up)
-  (define-key cua--rectangle-keymap [remap end-of-line]         
'cua-resize-rectangle-eol)
-  (define-key cua--rectangle-keymap [remap beginning-of-line]   
'cua-resize-rectangle-bol)
-  (define-key cua--rectangle-keymap [remap end-of-buffer]       
'cua-resize-rectangle-bot)
-  (define-key cua--rectangle-keymap [remap beginning-of-buffer] 
'cua-resize-rectangle-top)
-  (define-key cua--rectangle-keymap [remap scroll-down]         
'cua-resize-rectangle-page-up)
-  (define-key cua--rectangle-keymap [remap scroll-up]           
'cua-resize-rectangle-page-down)
-  (define-key cua--rectangle-keymap [remap scroll-down-command] 
'cua-resize-rectangle-page-up)
-  (define-key cua--rectangle-keymap [remap scroll-up-command]   
'cua-resize-rectangle-page-down)
-
-  (define-key cua--rectangle-keymap [remap delete-backward-char] 
'cua-delete-char-rectangle)
-  (define-key cua--rectangle-keymap [remap backward-delete-char] 
'cua-delete-char-rectangle)
-  (define-key cua--rectangle-keymap [remap backward-delete-char-untabify] 
'cua-delete-char-rectangle)
-  (define-key cua--rectangle-keymap [remap self-insert-command]         
'cua-insert-char-rectangle)
+    (cua--rect-M/H-key ?\s                            
#'cua-clear-rectangle-mark)
+    (cua--M/H-key cua--region-keymap ?\s              
#'cua-toggle-rectangle-mark))
+
+  (define-key cua--rectangle-keymap [remap set-mark-command]    
#'cua-toggle-rectangle-mark)
+
+  (define-key cua--rectangle-keymap [remap forward-char]        
#'cua-resize-rectangle-right)
+  (define-key cua--rectangle-keymap [remap right-char]          
#'cua-resize-rectangle-right)
+  (define-key cua--rectangle-keymap [remap backward-char]       
#'cua-resize-rectangle-left)
+  (define-key cua--rectangle-keymap [remap left-char]           
#'cua-resize-rectangle-left)
+  (define-key cua--rectangle-keymap [remap next-line]           
#'cua-resize-rectangle-down)
+  (define-key cua--rectangle-keymap [remap previous-line]       
#'cua-resize-rectangle-up)
+  (define-key cua--rectangle-keymap [remap end-of-line]         
#'cua-resize-rectangle-eol)
+  (define-key cua--rectangle-keymap [remap beginning-of-line]   
#'cua-resize-rectangle-bol)
+  (define-key cua--rectangle-keymap [remap end-of-buffer]       
#'cua-resize-rectangle-bot)
+  (define-key cua--rectangle-keymap [remap beginning-of-buffer] 
#'cua-resize-rectangle-top)
+  (define-key cua--rectangle-keymap [remap scroll-down]         
#'cua-resize-rectangle-page-up)
+  (define-key cua--rectangle-keymap [remap scroll-up]           
#'cua-resize-rectangle-page-down)
+  (define-key cua--rectangle-keymap [remap scroll-down-command] 
#'cua-resize-rectangle-page-up)
+  (define-key cua--rectangle-keymap [remap scroll-up-command]   
#'cua-resize-rectangle-page-down)
+
+  (define-key cua--rectangle-keymap [remap delete-backward-char] 
#'cua-delete-char-rectangle)
+  (define-key cua--rectangle-keymap [remap backward-delete-char] 
#'cua-delete-char-rectangle)
+  (define-key cua--rectangle-keymap [remap backward-delete-char-untabify] 
#'cua-delete-char-rectangle)
+  (define-key cua--rectangle-keymap [remap self-insert-command]         
#'cua-insert-char-rectangle)
 
   ;; Catch self-inserting characters which are "stolen" by other modes
   (define-key cua--rectangle-keymap [t]
     '(menu-item "sic" cua-insert-char-rectangle :filter 
cua--self-insert-char-p))
 
-  (define-key cua--rectangle-keymap "\r"     'cua-rotate-rectangle)
-  (define-key cua--rectangle-keymap "\t"     'cua-indent-rectangle)
-
-  (define-key cua--rectangle-keymap [(control ??)] 'cua-help-for-rectangle)
-
-  (define-key cua--rectangle-keymap [mouse-1]     
'cua-mouse-set-rectangle-mark)
-  (define-key cua--rectangle-keymap [down-mouse-1] 'cua--mouse-ignore)
-  (define-key cua--rectangle-keymap [drag-mouse-1] 'cua--mouse-ignore)
-  (define-key cua--rectangle-keymap [mouse-3]     
'cua-mouse-save-then-kill-rectangle)
-  (define-key cua--rectangle-keymap [down-mouse-3] 'cua--mouse-ignore)
-  (define-key cua--rectangle-keymap [drag-mouse-3] 'cua--mouse-ignore)
-
-  (cua--rect-M/H-key 'up    'cua-move-rectangle-up)
-  (cua--rect-M/H-key 'down  'cua-move-rectangle-down)
-  (cua--rect-M/H-key 'left  'cua-move-rectangle-left)
-  (cua--rect-M/H-key 'right 'cua-move-rectangle-right)
-
-  (cua--rect-M/H-key '(control up)   'cua-scroll-rectangle-up)
-  (cua--rect-M/H-key '(control down) 'cua-scroll-rectangle-down)
-
-  (cua--rect-M/H-key ?a        'cua-align-rectangle)
-  (cua--rect-M/H-key ?b        'cua-blank-rectangle)
-  (cua--rect-M/H-key ?c        'cua-close-rectangle)
-  (cua--rect-M/H-key ?f        'cua-fill-char-rectangle)
-  (cua--rect-M/H-key ?i        'cua-incr-rectangle)
-  (cua--rect-M/H-key ?k        'cua-cut-rectangle-as-text)
-  (cua--rect-M/H-key ?l        'cua-downcase-rectangle)
-  (cua--rect-M/H-key ?m        'cua-copy-rectangle-as-text)
-  (cua--rect-M/H-key ?n        'cua-sequence-rectangle)
-  (cua--rect-M/H-key ?o        'cua-open-rectangle)
-  (cua--rect-M/H-key ?p        'cua-toggle-rectangle-virtual-edges)
-  (cua--rect-M/H-key ?P        'cua-do-rectangle-padding)
-  (cua--rect-M/H-key ?q        'cua-refill-rectangle)
-  (cua--rect-M/H-key ?r        'cua-replace-in-rectangle)
-  (cua--rect-M/H-key ?R        'cua-reverse-rectangle)
-  (cua--rect-M/H-key ?s        'cua-string-rectangle)
-  (cua--rect-M/H-key ?t        'cua-text-fill-rectangle)
-  (cua--rect-M/H-key ?u        'cua-upcase-rectangle)
-  (cua--rect-M/H-key ?|        'cua-shell-command-on-rectangle)
-  (cua--rect-M/H-key ?'        'cua-restrict-prefix-rectangle)
-  (cua--rect-M/H-key ?/        'cua-restrict-regexp-rectangle)
+  (define-key cua--rectangle-keymap "\r"     #'cua-rotate-rectangle)
+  (define-key cua--rectangle-keymap "\t"     #'cua-indent-rectangle)
+
+  (define-key cua--rectangle-keymap [(control ??)] #'cua-help-for-rectangle)
+
+  (define-key cua--rectangle-keymap [mouse-1]     
#'cua-mouse-set-rectangle-mark)
+  (define-key cua--rectangle-keymap [down-mouse-1] #'cua--mouse-ignore)
+  (define-key cua--rectangle-keymap [drag-mouse-1] #'cua--mouse-ignore)
+  (define-key cua--rectangle-keymap [mouse-3]     
#'cua-mouse-save-then-kill-rectangle)
+  (define-key cua--rectangle-keymap [down-mouse-3] #'cua--mouse-ignore)
+  (define-key cua--rectangle-keymap [drag-mouse-3] #'cua--mouse-ignore)
+
+  (cua--rect-M/H-key 'up    #'cua-move-rectangle-up)
+  (cua--rect-M/H-key 'down  #'cua-move-rectangle-down)
+  (cua--rect-M/H-key 'left  #'cua-move-rectangle-left)
+  (cua--rect-M/H-key 'right #'cua-move-rectangle-right)
+
+  (cua--rect-M/H-key '(control up)   #'cua-scroll-rectangle-up)
+  (cua--rect-M/H-key '(control down) #'cua-scroll-rectangle-down)
+
+  (cua--rect-M/H-key ?a        #'cua-align-rectangle)
+  (cua--rect-M/H-key ?b        #'cua-blank-rectangle)
+  (cua--rect-M/H-key ?c        #'cua-close-rectangle)
+  (cua--rect-M/H-key ?f        #'cua-fill-char-rectangle)
+  (cua--rect-M/H-key ?i        #'cua-incr-rectangle)
+  (cua--rect-M/H-key ?k        #'cua-cut-rectangle-as-text)
+  (cua--rect-M/H-key ?l        #'cua-downcase-rectangle)
+  (cua--rect-M/H-key ?m        #'cua-copy-rectangle-as-text)
+  (cua--rect-M/H-key ?n        #'cua-sequence-rectangle)
+  (cua--rect-M/H-key ?o        #'cua-open-rectangle)
+  (cua--rect-M/H-key ?p        #'cua-toggle-rectangle-virtual-edges)
+  (cua--rect-M/H-key ?P        #'cua-do-rectangle-padding)
+  (cua--rect-M/H-key ?q        #'cua-refill-rectangle)
+  (cua--rect-M/H-key ?r        #'cua-replace-in-rectangle)
+  (cua--rect-M/H-key ?R        #'cua-reverse-rectangle)
+  (cua--rect-M/H-key ?s        #'cua-string-rectangle)
+  (cua--rect-M/H-key ?t        #'cua-text-fill-rectangle)
+  (cua--rect-M/H-key ?u        #'cua-upcase-rectangle)
+  (cua--rect-M/H-key ?|        #'cua-shell-command-on-rectangle)
+  (cua--rect-M/H-key ?'        #'cua-restrict-prefix-rectangle)
+  (cua--rect-M/H-key ?/        #'cua-restrict-regexp-rectangle)
 
   (setq cua--rectangle-initialized t))
 
diff --git a/lisp/emulation/edt-mapper.el b/lisp/emulation/edt-mapper.el
index 98085c6..c1c1772 100644
--- a/lisp/emulation/edt-mapper.el
+++ b/lisp/emulation/edt-mapper.el
@@ -1,4 +1,4 @@
-;;; edt-mapper.el --- create an EDT LK-201 map file for X-Windows Emacs
+;;; edt-mapper.el --- create an EDT LK-201 map file for X-Windows Emacs  -*- 
lexical-binding: t; -*-
 
 ;; Copyright (C) 1994-1995, 2000-2021 Free Software Foundation, Inc.
 
@@ -176,7 +176,7 @@
   (mapc
    (lambda (function-key)
      (if (not (lookup-key (current-global-map) function-key))
-        (define-key (current-global-map) function-key 'forward-char)))
+        (define-key (current-global-map) function-key #'forward-char)))
    '([kp-0] [kp-1] [kp-2] [kp-3] [kp-4]
      [kp-5] [kp-6] [kp-7] [kp-8] [kp-9]
      [kp-space]
diff --git a/lisp/emulation/edt.el b/lisp/emulation/edt.el
index 7760a7f..b8dea2f 100644
--- a/lisp/emulation/edt.el
+++ b/lisp/emulation/edt.el
@@ -1,4 +1,4 @@
-;;; edt.el --- enhanced EDT keypad mode emulation for GNU Emacs
+;;; edt.el --- enhanced EDT keypad mode emulation for GNU Emacs  -*- 
lexical-binding: t; -*-
 
 ;; Copyright (C) 1986, 1992-1995, 2000-2021 Free Software Foundation,
 ;; Inc.
@@ -192,8 +192,7 @@ Emulation.  If set to nil (the default), the 
`page-delimiter' variable
 is set to \"\\f\" when edt-emulation-on is first invoked.  This
 setting replicates EDT's page delimiter behavior.  The original value
 is restored when edt-emulation-off is called."
-  :type 'boolean
-  :group 'edt)
+  :type 'boolean)
 
 (defcustom edt-use-EDT-control-key-bindings nil
   "Emacs MUST be restarted for a change in value to take effect!
@@ -201,8 +200,7 @@ Non-nil causes the control key bindings to be replaced with 
EDT
 bindings.  If set to nil (the default), EDT control key bindings are
 not used and the current Emacs control key bindings are retained for
 use within the EDT emulation."
-  :type 'boolean
-  :group 'edt)
+  :type 'boolean)
 
 (defcustom edt-word-entities '(?\t)
   "Specifies the list of EDT word entity characters.
@@ -226,22 +224,19 @@ representations, which you can also use:
 
 In EDT Emulation movement-by-word commands, each character in the list
 will be treated as if it were a separate word."
-  :type '(repeat integer)
-  :group 'edt)
+  :type '(repeat integer))
 
 (defcustom edt-top-scroll-margin 10
   "Scroll margin at the top of the screen.
 Interpreted as a percent of the current window size with a default
 setting of 10%.  If set to 0, top scroll margin is disabled."
-  :type 'integer
-  :group 'edt)
+  :type 'integer)
 
 (defcustom edt-bottom-scroll-margin 15
   "Scroll margin at the bottom of the screen.
 Interpreted as a percent of the current window size with a default
 setting of 15%.  If set to 0, bottom scroll margin is disabled."
-  :type 'integer
-  :group 'edt)
+  :type 'integer)
 
 ;;;
 ;;; Internal Variables
@@ -323,31 +318,31 @@ This means that an edt-user.el file was found in the 
user's `load-path'.")
 ;;;; EDT Emulation Commands
 ;;;;
 
-;;; Almost all of EDT's keypad mode commands have equivalent Emacs
-;;; function counterparts.  But many of these counterparts behave
-;;; somewhat differently in Emacs.
-;;;
-;;; So, the following Emacs functions emulate, where practical, the
-;;; exact behavior of the corresponding EDT keypad mode commands.  In
-;;; a few cases, the emulation is not exact, but it should be close
-;;; enough for most EDT die-hards.
-;;;
+;; Almost all of EDT's keypad mode commands have equivalent Emacs
+;; function counterparts.  But many of these counterparts behave
+;; somewhat differently in Emacs.
+;;
+;; So, the following Emacs functions emulate, where practical, the
+;; exact behavior of the corresponding EDT keypad mode commands.  In
+;; a few cases, the emulation is not exact, but it should be close
+;; enough for most EDT die-hards.
+;;
 
 ;;;
 ;;; PAGE
 ;;;
-;;; Emacs uses the regexp assigned to page-delimiter to determine what
-;;; marks a page break.  This is normally "^\f", which causes the
-;;; edt-page command to ignore form feeds not located at the beginning
-;;; of a line.  To emulate the EDT PAGE command exactly,
-;;; page-delimiter is set to "\f" when EDT emulation is turned on, and
-;;; restored to its original value when EDT emulation is turned off.
-;;; But this can be overridden if the EDT definition is not desired by
-;;; placing
-;;;
-;;;         (setq edt-keep-current-page-delimiter t)
-;;;
-;;; in your init file.
+;; Emacs uses the regexp assigned to page-delimiter to determine what
+;; marks a page break.  This is normally "^\f", which causes the
+;; edt-page command to ignore form feeds not located at the beginning
+;; of a line.  To emulate the EDT PAGE command exactly,
+;; page-delimiter is set to "\f" when EDT emulation is turned on, and
+;; restored to its original value when EDT emulation is turned off.
+;; But this can be overridden if the EDT definition is not desired by
+;; placing
+;;
+;;         (setq edt-keep-current-page-delimiter t)
+;;
+;; in your init file.
 
 (defun edt-page-forward (num)
   "Move forward to just after next page delimiter.
@@ -384,12 +379,12 @@ Argument NUM is the number of page delimiters to move."
 ;;;
 ;;; SECT
 ;;;
-;;; EDT defaults a section size to be 16 lines of its one and only
-;;; 24-line window.  That's two-thirds of the window at a time.  The
-;;; EDT SECT commands moves the cursor, not the window.
-;;;
-;;; This emulation of EDT's SECT moves the cursor approximately
-;;; two-thirds of the current window at a time.
+;; EDT defaults a section size to be 16 lines of its one and only
+;; 24-line window.  That's two-thirds of the window at a time.  The
+;; EDT SECT commands moves the cursor, not the window.
+;;
+;; This emulation of EDT's SECT moves the cursor approximately
+;; two-thirds of the current window at a time.
 
 (defun edt-sect-forward (num)
   "Move cursor forward two-thirds of a window's number of lines.
@@ -417,8 +412,8 @@ Argument NUM is the number of sections to move."
 ;;;
 ;;; BEGINNING OF LINE
 ;;;
-;;; EDT's beginning-of-line command is not affected by current
-;;; direction, for some unknown reason.
+;; EDT's beginning-of-line command is not affected by current
+;; direction, for some unknown reason.
 
 (defun edt-beginning-of-line (num)
   "Move backward to next beginning of line mark.
@@ -470,13 +465,13 @@ Argument NUM is the number of EOL marks to move."
 ;;;
 ;;; WORD
 ;;;
-;;; This one is a tad messy.  To emulate EDT's behavior everywhere in
-;;; the file (beginning of file, end of file, beginning of line, end
-;;; of line, etc.) it takes a bit of special handling.
-;;;
-;;; The variable edt-word-entities contains a list of characters which
-;;; are to be viewed as distinct words wherever they appear in the
-;;; buffer.  This emulates the EDT line mode command SET ENTITY WORD.
+;; This one is a tad messy.  To emulate EDT's behavior everywhere in
+;; the file (beginning of file, end of file, beginning of line, end
+;; of line, etc.) it takes a bit of special handling.
+;;
+;; The variable edt-word-entities contains a list of characters which
+;; are to be viewed as distinct words wherever they appear in the
+;; buffer.  This emulates the EDT line mode command SET ENTITY WORD.
 
 
 (defun edt-one-word-forward ()
@@ -567,9 +562,9 @@ Argument NUM is the number of characters to move."
 ;;;
 ;;; LINE
 ;;;
-;;; When direction is set to BACKUP, LINE behaves just like BEGINNING
-;;; OF LINE in EDT.  So edt-line-backward is not really needed as a
-;;; separate function.
+;; When direction is set to BACKUP, LINE behaves just like BEGINNING
+;; OF LINE in EDT.  So edt-line-backward is not really needed as a
+;; separate function.
 
 (defun edt-line-backward (num)
   "Move backward to next beginning of line mark.
@@ -655,6 +650,7 @@ Argument NUM is the number of lines to move."
           (far (save-excursion
                  (goto-char bottom)
                  (point-at-bol (1- height)))))
+     (ignore top left far)
      ,@body))
 
 ;;;
@@ -1203,9 +1199,9 @@ Argument BOTTOM is the bottom margin in number of lines 
or percent of window."
 ;;;;
 
 ;;;
-;;; Several enhancements and additions to EDT keypad mode commands are
-;;; provided here.  Some of these have been motivated by similar
-;;; TPU/EVE and EVE-Plus commands.  Others are new.
+;; Several enhancements and additions to EDT keypad mode commands are
+;; provided here.  Some of these have been motivated by similar
+;; TPU/EVE and EVE-Plus commands.  Others are new.
 
 ;;;
 ;;; CHANGE DIRECTION
@@ -1378,8 +1374,8 @@ Definition is stored in 
`edt-last-replaced-key-definition'."
 ;;;
 ;;; SCROLL WINDOW
 ;;;
-;;; Scroll a window (less one line) at a time.  Leave cursor in center of
-;;; window.
+;; Scroll a window (less one line) at a time.  Leave cursor in center of
+;; window.
 
 (defun edt-scroll-window-forward (num)
   "Scroll forward one window in buffer, less one line.
@@ -2051,7 +2047,7 @@ Optional argument USER-SETUP non-nil means  called from 
function
       (fset 'edt-emulation-on (symbol-function 'edt-select-default-global-map))
       (edt-select-default-global-map)))
   ;; Keep the menu bar Buffers menu up-to-date in edt-default-global-map.
-  (add-hook 'menu-bar-update-hook 'edt-default-menu-bar-update-buffers))
+  (add-hook 'menu-bar-update-hook #'edt-default-menu-bar-update-buffers))
 
 (defun edt-user-emulation-setup ()
   "Setup user custom emulation of DEC's EDT editor."
@@ -2072,7 +2068,7 @@ Optional argument USER-SETUP non-nil means  called from 
function
       (edt-setup-user-bindings))
   (edt-select-user-global-map)
   ;; Keep the menu bar Buffers menu up-to-date in edt-user-global-map.
-  (add-hook 'menu-bar-update-hook 'edt-user-menu-bar-update-buffers))
+  (add-hook 'menu-bar-update-hook #'edt-user-menu-bar-update-buffers))
 
 (defun edt-select-default-global-map()
   "Select default EDT emulation key bindings."
@@ -2490,7 +2486,7 @@ G-C-\\: Split Window                     |  FNDNXT  |   
Yank   |   CUT    |
                   (and b
                        (with-current-buffer b
                          (set-buffer-modified-p t)))
-                  (fset 'help-print-return-message 'ignore)
+                  (fset 'help-print-return-message #'ignore)
                   (call-interactively fun)
                   (and (get-buffer name)
                        (get-buffer-window (get-buffer name))
diff --git a/lisp/emulation/keypad.el b/lisp/emulation/keypad.el
index e4f3c4d..56202c7 100644
--- a/lisp/emulation/keypad.el
+++ b/lisp/emulation/keypad.el
@@ -1,4 +1,4 @@
-;;; keypad.el --- simplified keypad bindings
+;;; keypad.el --- simplified keypad bindings  -*- lexical-binding: t; -*-
 
 ;; Copyright (C) 2002-2021 Free Software Foundation, Inc.
 
@@ -101,10 +101,10 @@
   "Specifies the keypad setup for unshifted keypad keys when NumLock is off.
 When selecting the plain numeric keypad setup, the character returned by the
 decimal key must be specified."
-  :set (lambda (symbol value)
+  :set (lambda (_symbol value)
         (if value
             (keypad-setup value nil nil value)))
-  :initialize 'custom-initialize-default
+  :initialize #'custom-initialize-default
   :link '(emacs-commentary-link "keypad.el")
   :version "22.1"
   :type '(choice (const :tag "Plain numeric keypad" numeric)
@@ -124,10 +124,10 @@ decimal key must be specified."
   "Specifies the keypad setup for unshifted keypad keys when NumLock is on.
 When selecting the plain numeric keypad setup, the character returned by the
 decimal key must be specified."
-  :set (lambda (symbol value)
+  :set (lambda (_symbol value)
         (if value
             (keypad-setup value t nil value)))
-  :initialize 'custom-initialize-default
+  :initialize #'custom-initialize-default
   :link '(emacs-commentary-link "keypad.el")
   :version "22.1"
   :type '(choice (const :tag "Plain numeric keypad" numeric)
@@ -147,10 +147,10 @@ decimal key must be specified."
   "Specifies the keypad setup for shifted keypad keys when NumLock is off.
 When selecting the plain numeric keypad setup, the character returned by the
 decimal key must be specified."
-  :set (lambda (symbol value)
+  :set (lambda (_symbol value)
         (if value
             (keypad-setup value nil t value)))
-  :initialize 'custom-initialize-default
+  :initialize #'custom-initialize-default
   :link '(emacs-commentary-link "keypad.el")
   :version "22.1"
   :type '(choice (const :tag "Plain numeric keypad" numeric)
@@ -170,10 +170,10 @@ decimal key must be specified."
   "Specifies the keypad setup for shifted keypad keys when NumLock is off.
 When selecting the plain numeric keypad setup, the character returned by the
 decimal key must be specified."
-  :set (lambda (symbol value)
+  :set (lambda (_symbol value)
         (if value
             (keypad-setup value t t value)))
-  :initialize 'custom-initialize-default
+  :initialize #'custom-initialize-default
   :link '(emacs-commentary-link "keypad.el")
   :version "22.1"
   :type '(choice (const :tag "Plain numeric keypad" numeric)
diff --git a/lisp/emulation/viper-cmd.el b/lisp/emulation/viper-cmd.el
index f38be90..42d6c1e 100644
--- a/lisp/emulation/viper-cmd.el
+++ b/lisp/emulation/viper-cmd.el
@@ -24,8 +24,6 @@
 
 ;;; Code:
 
-(provide 'viper-cmd)
-
 ;; Compiler pacifier
 (defvar viper-minibuffer-current-face)
 (defvar viper-minibuffer-insert-face)
@@ -293,15 +291,15 @@
   ;; desirable that viper-pre-command-sentinel is the last hook and
   ;; viper-post-command-sentinel is the first hook.
 
-  (remove-hook 'post-command-hook 'viper-post-command-sentinel)
-  (add-hook 'post-command-hook 'viper-post-command-sentinel)
-  (remove-hook 'pre-command-hook 'viper-pre-command-sentinel)
-  (add-hook 'pre-command-hook 'viper-pre-command-sentinel t)
+  (remove-hook 'post-command-hook #'viper-post-command-sentinel)
+  (add-hook 'post-command-hook #'viper-post-command-sentinel)
+  (remove-hook 'pre-command-hook #'viper-pre-command-sentinel)
+  (add-hook 'pre-command-hook #'viper-pre-command-sentinel t)
   ;; These hooks will be added back if switching to insert/replace mode
   (remove-hook 'viper-post-command-hooks
-              'viper-insert-state-post-command-sentinel 'local)
+              #'viper-insert-state-post-command-sentinel 'local)
   (remove-hook 'viper-pre-command-hooks
-              'viper-insert-state-pre-command-sentinel 'local)
+              #'viper-insert-state-pre-command-sentinel 'local)
   (setq viper-intermediate-command nil)
   (cond ((eq new-state 'vi-state)
         (cond ((member viper-current-state '(insert-state replace-state))
@@ -344,9 +342,9 @@
         (viper-move-marker-locally
          'viper-last-posn-while-in-insert-state (point))
         (add-hook 'viper-post-command-hooks
-                  'viper-insert-state-post-command-sentinel t 'local)
+                  #'viper-insert-state-post-command-sentinel t 'local)
         (add-hook 'viper-pre-command-hooks
-                  'viper-insert-state-pre-command-sentinel t 'local))
+                  #'viper-insert-state-pre-command-sentinel t 'local))
        ) ; outermost cond
 
   ;; Nothing needs to be done to switch to emacs mode! Just set some
@@ -378,12 +376,12 @@
   (cond ((memq state '(insert-state replace-state))
         (if viper-auto-indent
             (progn
-              (define-key viper-insert-basic-map "\C-m" 'viper-autoindent)
+              (define-key viper-insert-basic-map "\C-m" #'viper-autoindent)
               (if viper-want-emacs-keys-in-insert
                   ;; expert
                   (define-key viper-insert-basic-map "\C-j" nil)
                 ;; novice
-                (define-key viper-insert-basic-map "\C-j" 'viper-autoindent)))
+                (define-key viper-insert-basic-map "\C-j" #'viper-autoindent)))
           (define-key viper-insert-basic-map "\C-m" nil)
           (define-key viper-insert-basic-map "\C-j" nil))
 
@@ -392,25 +390,24 @@
 
         (if viper-want-ctl-h-help
             (progn
-              (define-key viper-insert-basic-map "\C-h" 'help-command)
-              (define-key viper-replace-map "\C-h" 'help-command))
+              (define-key viper-insert-basic-map "\C-h" #'help-command)
+              (define-key viper-replace-map "\C-h" #'help-command))
           (define-key viper-insert-basic-map
-            "\C-h" 'viper-del-backward-char-in-insert)
+            "\C-h" #'viper-del-backward-char-in-insert)
           (define-key viper-replace-map
-            "\C-h" 'viper-del-backward-char-in-replace))
+            "\C-h" #'viper-del-backward-char-in-replace))
         ;; In XEmacs, C-h overrides backspace, so we make sure it doesn't.
         (define-key viper-insert-basic-map
-          [backspace] 'viper-del-backward-char-in-insert)
+          [backspace] #'viper-del-backward-char-in-insert)
         (define-key viper-replace-map
-          [backspace] 'viper-del-backward-char-in-replace)
+          [backspace] #'viper-del-backward-char-in-replace)
         ) ; end insert/replace case
        (t ; Vi state
         (setq viper-vi-diehard-minor-mode (not viper-want-emacs-keys-in-vi))
-        (if viper-want-ctl-h-help
-            (define-key viper-vi-basic-map "\C-h" 'help-command)
-          (define-key viper-vi-basic-map "\C-h" 'viper-backward-char))
+        (define-key viper-vi-basic-map "\C-h"
+          (if viper-want-ctl-h-help #'help-command #'viper-backward-char))
         ;; In XEmacs, C-h overrides backspace, so we make sure it doesn't.
-        (define-key viper-vi-basic-map [backspace] 'viper-backward-char))
+        (define-key viper-vi-basic-map [backspace] #'viper-backward-char))
        ))
 
 
@@ -831,7 +828,7 @@ Vi's prefix argument will be used.  Otherwise, the prefix 
argument passed to
 
     (condition-case nil
        (let (viper-vi-kbd-minor-mode) ; execute without kbd macros
-         (setq result (eval form)))
+         (setq result (eval form t)))
       (error
        (signal 'quit nil)))
 
@@ -847,7 +844,7 @@ Similar to `viper-escape-to-emacs', but accepts forms 
rather than keystrokes."
   (let ((buff (current-buffer))
        result)
     (viper-set-mode-vars-for 'emacs-state)
-    (setq result (eval form))
+    (setq result (eval form t))
     (if (not (equal buff (current-buffer))) ; cmd switched buffer
        (with-current-buffer buff
          (viper-set-mode-vars-for viper-current-state)))
@@ -1411,17 +1408,17 @@ as a Meta key and any number of multiple escapes are 
allowed."
 ;; without affecting other functions.  Buffer search can now be bound
 ;; to any character.
 
-(aset viper-exec-array ?c 'viper-exec-change)
-(aset viper-exec-array ?C 'viper-exec-Change)
-(aset viper-exec-array ?d 'viper-exec-delete)
-(aset viper-exec-array ?D 'viper-exec-Delete)
-(aset viper-exec-array ?y 'viper-exec-yank)
-(aset viper-exec-array ?Y 'viper-exec-Yank)
-(aset viper-exec-array ?r 'viper-exec-dummy)
-(aset viper-exec-array ?! 'viper-exec-bang)
-(aset viper-exec-array ?< 'viper-exec-shift)
-(aset viper-exec-array ?> 'viper-exec-shift)
-(aset viper-exec-array ?= 'viper-exec-equals)
+(aset viper-exec-array ?c #'viper-exec-change)
+(aset viper-exec-array ?C #'viper-exec-Change)
+(aset viper-exec-array ?d #'viper-exec-delete)
+(aset viper-exec-array ?D #'viper-exec-Delete)
+(aset viper-exec-array ?y #'viper-exec-yank)
+(aset viper-exec-array ?Y #'viper-exec-Yank)
+(aset viper-exec-array ?r #'viper-exec-dummy)
+(aset viper-exec-array ?! #'viper-exec-bang)
+(aset viper-exec-array ?< #'viper-exec-shift)
+(aset viper-exec-array ?> #'viper-exec-shift)
+(aset viper-exec-array ?= #'viper-exec-equals)
 
 
 
@@ -1560,7 +1557,7 @@ invokes the command before that, etc."
 (defun viper-undo-sentinel (beg end length)
   (run-hook-with-args 'viper-undo-functions beg end length))
 
-(add-hook 'after-change-functions 'viper-undo-sentinel)
+(add-hook 'after-change-functions #'viper-undo-sentinel)
 
 ;; Hook used in viper-undo
 (defun viper-after-change-undo-hook (beg end _len)
@@ -1570,7 +1567,7 @@ invokes the command before that, etc."
     ;; some other hooks may be changing various text properties in
     ;; the buffer in response to 'undo'; so remove this hook to avoid
     ;; its repeated invocation
-    (remove-hook 'viper-undo-functions 'viper-after-change-undo-hook 'local)
+    (remove-hook 'viper-undo-functions #'viper-after-change-undo-hook 'local)
   ))
 
 (defun viper-undo ()
@@ -1581,7 +1578,7 @@ invokes the command before that, etc."
        undo-beg-posn undo-end-posn)
 
     ;; the viper-after-change-undo-hook removes itself after the 1st invocation
-    (add-hook 'viper-undo-functions 'viper-after-change-undo-hook nil 'local)
+    (add-hook 'viper-undo-functions #'viper-after-change-undo-hook nil 'local)
 
     (undo-start)
     (undo-more 2)
@@ -1853,8 +1850,8 @@ Undo previous insertion and inserts new."
 ;;; Minibuffer business
 
 (defsubst viper-set-minibuffer-style ()
-  (add-hook 'minibuffer-setup-hook 'viper-minibuffer-setup-sentinel)
-  (add-hook 'post-command-hook 'viper-minibuffer-post-command-hook))
+  (add-hook 'minibuffer-setup-hook #'viper-minibuffer-setup-sentinel)
+  (add-hook 'post-command-hook #'viper-minibuffer-post-command-hook))
 
 
 (defun viper-minibuffer-setup-sentinel ()
@@ -2017,11 +2014,12 @@ problems."
          padding (viper-array-to-string (this-command-keys))
          temp-msg "")
     ;; the following tries to be smart about what to put in history
-    (if (not (string= val (car (eval history-var))))
-       (set history-var (cons val (eval history-var))))
-    (if (or (string= (nth 0 (eval history-var)) (nth 1 (eval history-var)))
-           (string= (nth 0 (eval history-var)) ""))
-       (set history-var (cdr (eval history-var))))
+    (if (not (string= val (car (symbol-value history-var))))
+       (push val (symbol-value history-var)))
+    (if (or (string= (nth 0 (symbol-value history-var))
+                    (nth 1 (symbol-value history-var)))
+           (string= (nth 0 (symbol-value history-var)) ""))
+       (pop (symbol-value history-var)))
     ;; If the user enters nothing but the prev cmd wasn't viper-ex,
     ;; viper-command-argument, or `! shell-command', this probably means
     ;; that the user typed something then erased.  Return "" in this case, not
@@ -2192,22 +2190,22 @@ problems."
        viper-sitting-in-replace t
        viper-replace-chars-to-delete 0)
   (add-hook
-   'viper-after-change-functions 'viper-replace-mode-spy-after t 'local)
+   'viper-after-change-functions #'viper-replace-mode-spy-after t 'local)
   (add-hook
-   'viper-before-change-functions 'viper-replace-mode-spy-before t 'local)
+   'viper-before-change-functions #'viper-replace-mode-spy-before t 'local)
   ;; this will get added repeatedly, but no harm
-  (add-hook 'after-change-functions 'viper-after-change-sentinel t)
-  (add-hook 'before-change-functions 'viper-before-change-sentinel t)
+  (add-hook 'after-change-functions #'viper-after-change-sentinel t)
+  (add-hook 'before-change-functions #'viper-before-change-sentinel t)
   (viper-move-marker-locally
    'viper-last-posn-in-replace-region (viper-replace-start))
   (add-hook
-   'viper-post-command-hooks 'viper-replace-state-post-command-sentinel
+   'viper-post-command-hooks #'viper-replace-state-post-command-sentinel
    t 'local)
   (add-hook
-   'viper-pre-command-hooks 'viper-replace-state-pre-command-sentinel t 'local)
+   'viper-pre-command-hooks #'viper-replace-state-pre-command-sentinel t 
'local)
   ;; guard against a smarty who switched from R-replace to normal replace
   (remove-hook
-   'viper-post-command-hooks 'viper-R-state-post-command-sentinel 'local)
+   'viper-post-command-hooks #'viper-R-state-post-command-sentinel 'local)
   (if overwrite-mode (overwrite-mode -1))
   )
 
@@ -2281,13 +2279,13 @@ problems."
 ;; Don't delete anything if current point is past the end of the overlay.
 (defun viper-finish-change ()
   (remove-hook
-   'viper-after-change-functions 'viper-replace-mode-spy-after 'local)
+   'viper-after-change-functions #'viper-replace-mode-spy-after 'local)
   (remove-hook
-   'viper-before-change-functions 'viper-replace-mode-spy-before 'local)
+   'viper-before-change-functions #'viper-replace-mode-spy-before 'local)
   (remove-hook
-   'viper-post-command-hooks 'viper-replace-state-post-command-sentinel 'local)
+   'viper-post-command-hooks #'viper-replace-state-post-command-sentinel 
'local)
   (remove-hook
-   'viper-pre-command-hooks 'viper-replace-state-pre-command-sentinel 'local)
+   'viper-pre-command-hooks #'viper-replace-state-pre-command-sentinel 'local)
   (viper-restore-cursor-color 'after-replace-mode)
   (setq viper-sitting-in-replace nil) ; just in case we'll need to know it
   (save-excursion
@@ -2317,21 +2315,21 @@ problems."
 
 (defun viper-finish-R-mode ()
   (remove-hook
-   'viper-post-command-hooks 'viper-R-state-post-command-sentinel 'local)
+   'viper-post-command-hooks #'viper-R-state-post-command-sentinel 'local)
   (remove-hook
-   'viper-pre-command-hooks 'viper-replace-state-pre-command-sentinel 'local)
+   'viper-pre-command-hooks #'viper-replace-state-pre-command-sentinel 'local)
   (viper-downgrade-to-insert))
 
 (defun viper-start-R-mode ()
   ;; Leave arg as 1, not t: XEmacs insists that it must be a pos number
   (overwrite-mode 1)
   (add-hook
-   'viper-post-command-hooks 'viper-R-state-post-command-sentinel t 'local)
+   'viper-post-command-hooks #'viper-R-state-post-command-sentinel t 'local)
   (add-hook
-   'viper-pre-command-hooks 'viper-replace-state-pre-command-sentinel t 'local)
+   'viper-pre-command-hooks #'viper-replace-state-pre-command-sentinel t 
'local)
   ;; guard against a smarty who switched from R-replace to normal replace
   (remove-hook
-   'viper-post-command-hooks 'viper-replace-state-post-command-sentinel 'local)
+   'viper-post-command-hooks #'viper-replace-state-post-command-sentinel 
'local)
   )
 
 
@@ -3467,7 +3465,8 @@ controlled by the sign of prefix numeric value."
            '(viper-command-argument viper-digit-argument viper-repeat))
       (setq viper-this-command-keys (this-command-keys)))
   (let* ((keymap (let ((keymap (copy-keymap minibuffer-local-map)))
-                   (define-key keymap [(control ?s)] 
'viper-insert-isearch-string)
+                   (define-key keymap [(control ?s)]
+                     #'viper-insert-isearch-string)
                    keymap))
          (s (viper-read-string-with-history
            prompt
@@ -3776,8 +3775,8 @@ Null string will repeat previous search."
           (char-to-string viper-buffer-search-char))
          (t (error "viper-buffer-search-char: wrong value type, %S"
                    viper-buffer-search-char)))
-    'viper-command-argument)
-  (aset viper-exec-array viper-buffer-search-char 'viper-exec-buffer-search)
+    #'viper-command-argument)
+  (aset viper-exec-array viper-buffer-search-char #'viper-exec-buffer-search)
   (setq viper-prefix-commands
        (cons viper-buffer-search-char viper-prefix-commands)))
 
@@ -4368,7 +4367,7 @@ One can use \\=`\\=` and \\='\\=' to temporarily jump 1 
step back."
 
 ;; Input Mode Indentation
 
-(define-obsolete-function-alias 'viper-looking-back 'looking-back "24.4")
+(define-obsolete-function-alias 'viper-looking-back #'looking-back "24.4")
 
 
 (defun viper-forward-indent ()
@@ -4511,8 +4510,8 @@ One can use \\=`\\=` and \\='\\=' to temporarily jump 1 
step back."
 ;; standard value.  Otherwise, get the value saved in the alist STORAGE.  If
 ;; STORAGE is nil, use viper-saved-user-settings.
 (defun viper-standard-value (symbol &optional storage)
-  (or (eval (car (get symbol 'customized-value)))
-      (eval (car (get symbol 'saved-value)))
+  (or (eval (car (get symbol 'customized-value)) t)
+      (eval (car (get symbol 'saved-value)) t)
       (nth 1 (assoc symbol (or storage viper-saved-user-settings)))))
 
 
@@ -4849,7 +4848,5 @@ Mail anyway (y or n)? ")
           nil 'delete-other-windows
           salutation)))
 
-
-
-
+(provide 'viper-cmd)
 ;;; viper-cmd.el ends here
diff --git a/lisp/emulation/viper-ex.el b/lisp/emulation/viper-ex.el
index 238faed..5b2fa04 100644
--- a/lisp/emulation/viper-ex.el
+++ b/lisp/emulation/viper-ex.el
@@ -1,4 +1,4 @@
-;;; viper-ex.el --- functions implementing the Ex commands for Viper
+;;; viper-ex.el --- functions implementing the Ex commands for Viper  -*- 
lexical-binding: t; -*-
 
 ;; Copyright (C) 1994-1998, 2000-2021 Free Software Foundation, Inc.
 
@@ -24,8 +24,6 @@
 
 ;;; Code:
 
-(provide 'viper-ex)
-
 ;; Compiler pacifier
 (defvar read-file-name-map)
 (defvar viper-use-register)
@@ -190,7 +188,7 @@
 
 ;; Executes the function associated with the command
 (defun ex-cmd-execute (cmd)
-  (eval (cadr cmd)))
+  (eval (cadr cmd) t))
 
 ;; If this is a one-letter magic command, splice in args.
 (defun ex-splice-args-in-1-letr-cmd (key list)
@@ -299,8 +297,7 @@
           "\\)")
          shell-file-name)))
   "Is the user using a unix-type shell under a non-OS?"
-  :type 'boolean
-  :group 'viper-ex)
+  :type 'boolean)
 
 (defcustom ex-unix-type-shell-options
   (let ((case-fold-search t))
@@ -312,13 +309,11 @@
              )))
   "Options to pass to the Unix-style shell.
 Don't put `-c' here, as it is added automatically."
-  :type '(choice (const nil) string)
-  :group 'viper-ex)
+  :type '(choice (const nil) string))
 
 (defcustom ex-compile-command "make"
   "The command to run when the user types :make."
-  :type 'string
-  :group 'viper-ex)
+  :type 'string)
 
 (defcustom viper-glob-function
   (cond (ex-unix-type-shell 'viper-glob-unix-files)
@@ -331,8 +326,7 @@ The default tries to set this variable to work with Unix or 
MS Windows.
 However, if it doesn't work right for some types of Unix shells or some OS,
 the user should supply the appropriate function and set this variable to the
 corresponding function symbol."
-  :type 'symbol
-  :group 'viper-ex)
+  :type 'symbol)
 
 
 ;; Remembers the previous Ex tag.
@@ -363,13 +357,11 @@ corresponding function symbol."
   "If t, :n and :b cycles through files and buffers in other window.
 Then :N and :B cycles in the current window.  If nil, this behavior is
 reversed."
-  :type 'boolean
-  :group 'viper-ex)
+  :type 'boolean)
 
 (defcustom ex-cycle-through-non-files nil
   "Cycle through *scratch* and other buffers that don't visit any file."
-  :type 'boolean
-  :group 'viper-ex)
+  :type 'boolean)
 
 ;; Last shell command executed with :! command.
 (defvar viper-ex-last-shell-com nil)
@@ -1314,7 +1306,7 @@ reversed."
   (let ((nonstandard-filename-chars "[^-a-zA-Z0-9_./,~$\\]"))
     (cond ((file-exists-p filespec) (find-file filespec))
          ((string-match nonstandard-filename-chars  filespec)
-          (mapcar 'find-file (funcall viper-glob-function filespec)))
+          (mapcar #'find-file (funcall viper-glob-function filespec)))
          (t (find-file filespec)))
     ))
 
@@ -1639,7 +1631,7 @@ reversed."
 ;; this function fixes ex-history for some commands like ex-read, ex-edit
 (defun ex-fixup-history (&rest args)
   (setq viper-ex-history
-       (cons (mapconcat 'identity args " ") (cdr viper-ex-history))))
+       (cons (mapconcat #'identity args " ") (cdr viper-ex-history))))
 
 
 ;; Ex recover from emacs \#file\#
@@ -1672,8 +1664,8 @@ reversed."
        (cursor-in-echo-area t)
        str batch)
     (define-key
-      minibuffer-local-completion-map " " 'minibuffer-complete-and-exit)
-    (define-key minibuffer-local-completion-map "=" 'exit-minibuffer)
+      minibuffer-local-completion-map " " #'minibuffer-complete-and-exit)
+    (define-key minibuffer-local-completion-map "=" #'exit-minibuffer)
     (if (viper-set-unread-command-events
         (ex-get-inline-cmd-args "[ \t]*[a-zA-Z]*[ \t]*" nil "\C-m"))
        (progn
@@ -1837,7 +1829,7 @@ reversed."
                     (format "%S" val)
                   val)))
     (if actual-lisp-cmd
-       (eval (car (read-from-string actual-lisp-cmd))))
+       (eval (car (read-from-string actual-lisp-cmd)) t))
     (if (string= var "fill-column")
        (if (> val2 0)
            (auto-fill-mode 1)
@@ -2319,4 +2311,5 @@ Type `mak ' (including the space) to run make with no 
args."
       (with-output-to-temp-buffer " *viper-info*"
        (princ lines))))))
 
+(provide 'viper-ex)
 ;;; viper-ex.el ends here
diff --git a/lisp/emulation/viper-init.el b/lisp/emulation/viper-init.el
index c05cf6a..8188971 100644
--- a/lisp/emulation/viper-init.el
+++ b/lisp/emulation/viper-init.el
@@ -1,4 +1,4 @@
-;;; viper-init.el --- some common definitions for Viper
+;;; viper-init.el --- some common definitions for Viper  -*- lexical-binding: 
t; -*-
 
 ;; Copyright (C) 1997-2021 Free Software Foundation, Inc.
 
@@ -46,7 +46,7 @@
 
 ;; Tell whether we are running as a window application or on a TTY
 
-(define-obsolete-function-alias 'viper-device-type 'window-system "27.1")
+(define-obsolete-function-alias 'viper-device-type #'window-system "27.1")
 
 (defun viper-color-display-p ()
   (condition-case nil
@@ -141,7 +141,7 @@ docstring.  The variable becomes buffer-local whenever set."
   (append (vconcat string) nil))
 
 (defsubst viper-charlist-to-string (list)
-  (mapconcat 'char-to-string list ""))
+  (mapconcat #'char-to-string list ""))
 
 ;; like char-after/before, but saves typing
 (defun viper-char-at-pos (direction &optional offset)
diff --git a/lisp/emulation/viper-keym.el b/lisp/emulation/viper-keym.el
index 1d80c9c..4a9070e 100644
--- a/lisp/emulation/viper-keym.el
+++ b/lisp/emulation/viper-keym.el
@@ -155,29 +155,26 @@ In insert mode, this key also functions as Meta."
         (let ((old-value (if (boundp 'viper-toggle-key)
                              viper-toggle-key
                            [(control ?z)])))
-          (mapc
-           (lambda (buf)
-             (with-current-buffer buf
-               (when (and (boundp 'viper-insert-basic-map)
-                          (keymapp viper-insert-basic-map))
-                 (when old-value
-                   (define-key viper-insert-basic-map old-value nil))
-                 (define-key viper-insert-basic-map value 'viper-escape-to-vi))
-               (when (and (boundp 'viper-vi-intercept-map)
-                          (keymapp viper-vi-intercept-map))
-                 (when old-value
-                   (define-key viper-vi-intercept-map old-value nil))
-                 (define-key
-                   viper-vi-intercept-map value 'viper-toggle-key-action))
-               (when (and (boundp 'viper-emacs-intercept-map)
-                          (keymapp viper-emacs-intercept-map))
-                 (define-key viper-emacs-intercept-map old-value nil)
-                 (define-key
-                   viper-emacs-intercept-map value 'viper-change-state-to-vi))
-               ))
-           (buffer-list))
-          (set-default symbol value)
-           )))
+          (dolist (buf (buffer-list))
+            (with-current-buffer buf
+              (when (and (boundp 'viper-insert-basic-map)
+                         (keymapp viper-insert-basic-map))
+                (when old-value
+                  (define-key viper-insert-basic-map old-value nil))
+                (define-key viper-insert-basic-map value 'viper-escape-to-vi))
+              (when (and (boundp 'viper-vi-intercept-map)
+                         (keymapp viper-vi-intercept-map))
+                (when old-value
+                  (define-key viper-vi-intercept-map old-value nil))
+                (define-key
+                  viper-vi-intercept-map value 'viper-toggle-key-action))
+              (when (and (boundp 'viper-emacs-intercept-map)
+                         (keymapp viper-emacs-intercept-map))
+                (define-key viper-emacs-intercept-map old-value nil)
+                (define-key
+                  viper-emacs-intercept-map value 'viper-change-state-to-vi))
+              ))
+          (set-default symbol value))))
 
 (defcustom viper-quoted-insert-key "\C-v"
   "The key used to quote special characters when inserting them in Insert 
state."
@@ -257,7 +254,7 @@ In insert mode, this key also functions as Meta."
 
 (let ((i ?\ ))
   (while (<= i ?~)
-    (define-key viper-insert-diehard-map (make-string 1 i) 
'self-insert-command)
+    (define-key viper-insert-diehard-map (string i) #'self-insert-command)
     (setq i (1+ i))))
 
 ;; Insert mode map when user wants emacs style
@@ -490,7 +487,7 @@ Useful in some modes, such as Gnus, MH, etc.")
 The effect is seen in the current buffer only.
 Useful for customizing  mailer buffers, gnus, etc.
 STATE is `vi-state', `insert-state', or `emacs-state'.
-ALIST is of the form ((key . func) (key . func) ...)
+ALIST is of the form ((KEY . FUNC) (KEY . FUNC) ...)
 Normally, this would be called from a hook to a major mode or
 on a per buffer basis.
 Usage:
@@ -548,14 +545,11 @@ The above needs not to be done for major modes that come 
up in Vi or Insert
 state by default.
 
 Arguments: (major-mode viper-state keymap)"
-  (let ((alist
-        (cond ((eq state 'vi-state) 'viper-vi-state-modifier-alist)
-              ((eq state 'insert-state) 'viper-insert-state-modifier-alist)
-              ((eq state 'emacs-state) 'viper-emacs-state-modifier-alist)))
-       elt)
-    (if (setq elt (assoc mode (eval alist)))
-       (set alist (delq elt (eval alist))))
-    (set alist (cons (cons mode keymap) (eval alist)))
+  (let* ((alist
+         (cond ((eq state 'vi-state) 'viper-vi-state-modifier-alist)
+               ((eq state 'insert-state) 'viper-insert-state-modifier-alist)
+               ((eq state 'emacs-state) 'viper-emacs-state-modifier-alist))))
+    (setf (alist-get mode (symbol-value alist)) keymap)
 
     ;; Normalization usually doesn't help here, since one needs to
     ;; normalize in the actual buffer where changes to the keymap are
@@ -646,9 +640,9 @@ Arguments: (major-mode viper-state keymap)"
        (cdr mapsrc)))
 
 (defun viper-modify-keymap (map alist)
-   "Modifies MAP with bindings specified in the ALIST.  The alist has the
-form ((key . function) (key . function) ... )."
-   (mapcar (lambda (p) (define-key map (eval (car p)) (cdr p)))
+   "Modifies MAP with bindings specified in the ALIST.
+The ALIST has the form ((KEY . FUNCTION) (KEY . FUNCTION) ... )."
+   (mapcar (lambda (p) (define-key map (eval (car p) t) (cdr p)))
           alist))
 
 
diff --git a/lisp/emulation/viper-macs.el b/lisp/emulation/viper-macs.el
index 039ddab..94ab817 100644
--- a/lisp/emulation/viper-macs.el
+++ b/lisp/emulation/viper-macs.el
@@ -24,8 +24,6 @@
 
 ;;; Code:
 
-(provide 'viper-macs)
-
 ;; compiler pacifier
 (defvar viper-ex-work-buf)
 (defvar viper-custom-file-name)
@@ -37,7 +35,7 @@
 
 (require 'viper-util)
 (require 'viper-keym)
-
+(require 'seq)
 
 ;;; Variables
 
@@ -102,9 +100,11 @@ a key is a symbol, e.g., `a', `\\1', `f2', etc., or a 
list, e.g.,
       ;; if defining macro for insert, switch there for authentic WYSIWYG
       (if ins (viper-change-state-to-insert))
       (start-kbd-macro nil)
-      (define-key viper-vi-intercept-map "\C-x)" 'viper-end-mapping-kbd-macro)
-      (define-key viper-insert-intercept-map "\C-x)" 
'viper-end-mapping-kbd-macro)
-      (define-key viper-emacs-intercept-map "\C-x)" 
'viper-end-mapping-kbd-macro)
+      (define-key viper-vi-intercept-map "\C-x)" #'viper-end-mapping-kbd-macro)
+      (define-key viper-insert-intercept-map "\C-x)"
+        #'viper-end-mapping-kbd-macro)
+      (define-key viper-emacs-intercept-map "\C-x)"
+        #'viper-end-mapping-kbd-macro)
       (message "Mapping %S in %s state.  Type macro definition followed by 
`C-x )'"
               (viper-display-macro macro-name)
               (if ins "Insert" "Vi")))
@@ -442,7 +442,7 @@ If SCOPE is nil, the user is asked to specify the scope."
                       (list nil (list (cons scope nil)) (cons t nil)))
                      ((stringp scope)
                       (list (list (cons scope nil)) nil (cons t nil))))))
-    (setq old-elt (assoc macro-name (eval macro-alist-var)))
+    (setq old-elt (assoc macro-name (symbol-value macro-alist-var)))
 
     (if (null old-elt)
        (progn
@@ -450,8 +450,8 @@ If SCOPE is nil, the user is asked to specify the scope."
          (define-key
            keymap
            (vector (viper-key-to-emacs-key (aref macro-name 0)))
-           'viper-exec-mapped-kbd-macro)
-         (setq lis (eval macro-alist-var))
+           #'viper-exec-mapped-kbd-macro)
+         (setq lis (symbol-value macro-alist-var))
          (while (and lis (string< (viper-array-to-string (car (car lis)))
                                   (viper-array-to-string macro-name)))
            (setq lis2 (cons (car lis) lis2))
@@ -514,7 +514,7 @@ mistakes in macro names to be passed to this function is to 
use
     (if (viper-char-array-p macro-name)
        (setq macro-name (viper-char-array-to-macro macro-name)))
 
-    (setq macro-entry (assoc macro-name (eval macro-alist-var)))
+    (setq macro-entry (assoc macro-name (symbol-value macro-alist-var)))
     (if (= (length macro-name) 0)
        (error "Can't unmap an empty macro name"))
     (if (null macro-entry)
@@ -557,9 +557,10 @@ mistakes in macro names to be passed to this function is 
to use
        (cdr mode-mapping)
        (cdr global-mapping)
        (progn
-         (set macro-alist-var (delq macro-entry (eval macro-alist-var)))
+         (set macro-alist-var (delq macro-entry
+                                    (symbol-value macro-alist-var)))
          (if (viper-can-release-key (aref macro-name 0)
-                                    (eval macro-alist-var))
+                                    (symbol-value macro-alist-var))
              (define-key
                keymap
                (vector (viper-key-to-emacs-key (aref macro-name 0)))
@@ -649,11 +650,11 @@ mistakes in macro names to be passed to this function is 
to use
   (interactive)
   (with-output-to-temp-buffer " *viper-info*"
     (princ "Macros in Vi state:\n===================\n")
-    (mapc 'viper-describe-one-macro viper-vi-kbd-macro-alist)
+    (mapc #'viper-describe-one-macro viper-vi-kbd-macro-alist)
     (princ "\n\nMacros in Insert and Replace 
states:\n====================================\n")
-    (mapc 'viper-describe-one-macro viper-insert-kbd-macro-alist)
+    (mapc #'viper-describe-one-macro viper-insert-kbd-macro-alist)
     (princ "\n\nMacros in Emacs state:\n======================\n")
-    (mapcar 'viper-describe-one-macro viper-emacs-kbd-macro-alist)
+    (mapc #'viper-describe-one-macro viper-emacs-kbd-macro-alist)
     ))
 
 (defun viper-describe-one-macro (macro)
@@ -661,11 +662,11 @@ mistakes in macro names to be passed to this function is 
to use
                 (viper-display-macro (car macro))))
   (princ "   ** Buffer-specific:")
   (if (viper-kbd-buf-alist macro)
-      (mapc 'viper-describe-one-macro-elt (viper-kbd-buf-alist macro))
+      (mapc #'viper-describe-one-macro-elt (viper-kbd-buf-alist macro))
     (princ "  none\n"))
   (princ "\n   ** Mode-specific:")
   (if (viper-kbd-mode-alist macro)
-      (mapc 'viper-describe-one-macro-elt (viper-kbd-mode-alist macro))
+      (mapc #'viper-describe-one-macro-elt (viper-kbd-mode-alist macro))
     (princ "  none\n"))
   (princ "\n   ** Global:")
   (if (viper-kbd-global-definition macro)
@@ -683,10 +684,9 @@ mistakes in macro names to be passed to this function is 
to use
 ;; check if SEQ is a prefix of some car of an element in ALIST
 (defun viper-keyseq-is-a-possible-macro (seq alist)
   (let ((converted-seq (viper-events-to-macro seq)))
-    (eval (cons 'or
-               (mapcar
-                (lambda (elt) (viper-prefix-subseq-p converted-seq elt))
-                (viper-this-buffer-macros alist))))))
+    (seq-some
+     (lambda (elt) (viper-prefix-subseq-p converted-seq elt))
+     (viper-this-buffer-macros alist))))
 
 ;; whether SEQ1 is a prefix of SEQ2
 (defun viper-prefix-subseq-p (seq1 seq2)
@@ -704,11 +704,10 @@ mistakes in macro names to be passed to this function is 
to use
         len)
     (if (= (length seqs) 0)
        (setq len 0)
-      (setq len (apply 'min (mapcar 'length seqs))))
+      (setq len (apply #'min (mapcar #'length seqs))))
     (while (< idx len)
-      (if (eval (cons 'and
-                     (mapcar (lambda (s) (equal (elt first idx) (elt s idx)))
-                             rest)))
+      (if (seq-every-p (lambda (s) (equal (elt first idx) (elt s idx)))
+                      rest)
          (setq pref (vconcat pref (vector (elt first idx)))))
       (setq idx (1+ idx)))
     pref))
@@ -720,7 +719,7 @@ mistakes in macro names to be passed to this function is to 
use
 
 (defun viper-do-sequence-completion (seq alist compl-message)
   (let* ((matches (viper-extract-matching-alist-members seq alist))
-        (new-seq (apply 'viper-common-seq-prefix matches))
+        (new-seq (apply #'viper-common-seq-prefix matches))
         )
     (cond ((and (equal seq new-seq) (= (length matches) 1))
           (message "%s (Sole completion)" compl-message)
@@ -741,8 +740,8 @@ mistakes in macro names to be passed to this function is to 
use
 (defun viper-display-vector-completions (list)
   (with-output-to-temp-buffer "*Completions*"
     (display-completion-list
-     (mapcar 'prin1-to-string
-            (mapcar 'viper-display-macro list)))))
+     (mapcar #'prin1-to-string
+            (mapcar #'viper-display-macro list)))))
 
 
 
@@ -793,9 +792,9 @@ mistakes in macro names to be passed to this function is to 
use
 ;; string--do so.  Otherwise, do nothing.
 (defun viper-display-macro (macro-name-or-body)
   (cond ((viper-char-symbol-sequence-p macro-name-or-body)
-        (mapconcat 'symbol-name macro-name-or-body ""))
+        (mapconcat #'symbol-name macro-name-or-body ""))
        ((viper-char-array-p macro-name-or-body)
-        (mapconcat 'char-to-string macro-name-or-body ""))
+        (mapconcat #'char-to-string macro-name-or-body ""))
        (t macro-name-or-body)))
 
 ;; convert sequence of events (that came presumably from emacs kbd macro) into
@@ -815,7 +814,7 @@ mistakes in macro names to be passed to this function is to 
use
 
 ;; convert strings or arrays of characters to Viper macro form
 (defun viper-char-array-to-macro (array)
-  (vconcat (mapcar 'viper-event-key (vconcat array))))
+  (vconcat (mapcar #'viper-event-key (vconcat array))))
 
 ;; For macros bodies and names, goes over MACRO and checks if all members are
 ;; names of keys (actually, it only checks if they are symbols or lists
@@ -850,7 +849,7 @@ mistakes in macro names to be passed to this function is to 
use
        macro)))
 
 (defun viper-macro-to-events (macro-body)
-  (vconcat (mapcar 'viper-key-to-emacs-key macro-body)))
+  (vconcat (mapcar #'viper-key-to-emacs-key macro-body)))
 
 
 
@@ -929,5 +928,5 @@ mistakes in macro names to be passed to this function is to 
use
     (beginning-of-line)
     (call-last-kbd-macro)))
 
-
+(provide 'viper-macs)
 ;;; viper-macs.el ends here
diff --git a/lisp/emulation/viper-mous.el b/lisp/emulation/viper-mous.el
index 71e40ee..83fc5af 100644
--- a/lisp/emulation/viper-mous.el
+++ b/lisp/emulation/viper-mous.el
@@ -1,4 +1,4 @@
-;;; viper-mous.el --- mouse support for Viper
+;;; viper-mous.el --- mouse support for Viper  -*- lexical-binding: t; -*-
 
 ;; Copyright (C) 1994-1997, 2001-2021 Free Software Foundation, Inc.
 
@@ -24,8 +24,6 @@
 
 ;;; Code:
 
-(provide 'viper-mous)
-
 ;; compiler pacifier
 (defvar double-click-time)
 (defvar mouse-track-multi-click-time)
@@ -60,8 +58,7 @@
 Takes two parameters: a COUNT, indicating how many words to return,
 and CLICK-COUNT, telling whether this is the first click, a double-click,
 or a triple-click."
-  :type 'symbol
-  :group 'viper-mouse)
+  :type 'symbol)
 
 ;; time interval in millisecond within which successive clicks are
 ;; considered related
@@ -70,8 +67,7 @@ or a triple-click."
                                    500)
   "Time interval in millisecond within which successive mouse clicks are
 considered related."
-  :type 'integer
-  :group 'viper-mouse)
+  :type 'integer)
 
 ;; Local variable used to toggle wraparound search on click.
 (defvar-local viper-mouse-click-search-noerror t)
@@ -292,7 +288,7 @@ See `viper-surrounding-word' for the definition of a word 
in this case."
                    (prin1-to-string (viper-event-key event)))))
 
 (define-obsolete-function-alias 'viper-event-click-count
-  'event-click-count "28.1")
+  #'event-click-count "28.1")
 
 (declare-function viper-forward-word "viper-cmd" (arg))
 (declare-function viper-adjust-window "viper-cmd" ())
@@ -407,7 +403,7 @@ this command.
          (setq arg (1- arg)))
        ))))
 
-(defun viper-mouse-catch-frame-switch (event arg)
+(defun viper-mouse-catch-frame-switch (_event arg)
   "Catch the event of switching frame.
 Usually is bound to a `down-mouse' event to work properly.  See sample
 bindings in the Viper manual."
@@ -436,8 +432,9 @@ bindings in the Viper manual."
 ;; until you do something other than viper-mouse-click-* command.
 ;; In XEmacs, you have to manually select frame B (with the mouse click) in
 ;; order to shift focus to frame B.
-(defsubst viper-remember-current-frame (frame)
-  (setq last-command 'handle-switch-frame
+(defun viper-remember-current-frame (&rest _)
+  "Remember the selected frame before the switch-frame event."
+  (setq last-command #'handle-switch-frame
        viper-current-frame-saved (selected-frame)))
 
 
@@ -446,8 +443,8 @@ bindings in the Viper manual."
 ;; Emacs.  EVENT-TYPE is either `up' or `down'.  Up returns button-up key; down
 ;; returns button-down key.
 (defun viper-parse-mouse-key (key-var event-type)
-  (let ((key (eval key-var))
-       button-spec meta-spec shift-spec control-spec key-spec)
+  (let ((key (symbol-value key-var))
+       button-spec meta-spec shift-spec control-spec)
     (if (null key)
        ;; just return nil
        ()
@@ -470,10 +467,9 @@ bindings in the Viper manual."
            control-spec
            (if (memq 'control key) "C-" ""))
 
-      (setq key-spec
-           (vector
-            (intern (concat control-spec meta-spec
-                             shift-spec button-spec)))))))
+      (vector
+       (intern (concat control-spec meta-spec
+                       shift-spec button-spec))))))
 
 (defun viper-unbind-mouse-search-key ()
   (if viper-mouse-up-search-key-parsed
@@ -497,8 +493,8 @@ bindings in the Viper manual."
        (viper-parse-mouse-key 'viper-mouse-search-key 'up)
        viper-mouse-down-search-key-parsed
        (viper-parse-mouse-key 'viper-mouse-search-key 'down))
-  (cond ((or (null viper-mouse-up-search-key-parsed)
-            (null viper-mouse-down-search-key-parsed))
+  (cond ((not (and viper-mouse-up-search-key-parsed
+                  viper-mouse-down-search-key-parsed))
         nil) ; just quit
        ((and (null force)
              (key-binding viper-mouse-up-search-key-parsed)
@@ -516,9 +512,9 @@ bindings in the Viper manual."
          viper-mouse-down-search-key-parsed))
        (t
         (global-set-key viper-mouse-up-search-key-parsed
-                        'viper-mouse-click-search-word)
+                        #'viper-mouse-click-search-word)
         (global-set-key viper-mouse-down-search-key-parsed
-                        'viper-mouse-catch-frame-switch))))
+                        #'viper-mouse-catch-frame-switch))))
 
 ;; If FORCE, bind even if this mouse action is already bound to something else
 (defun viper-bind-mouse-insert-key (&optional force)
@@ -526,8 +522,8 @@ bindings in the Viper manual."
        (viper-parse-mouse-key 'viper-mouse-insert-key 'up)
        viper-mouse-down-insert-key-parsed
        (viper-parse-mouse-key 'viper-mouse-insert-key 'down))
-  (cond ((or (null viper-mouse-up-insert-key-parsed)
-            (null viper-mouse-down-insert-key-parsed))
+  (cond ((not (and viper-mouse-up-insert-key-parsed
+                  viper-mouse-down-insert-key-parsed))
         nil) ; just quit
        ((and (null force)
              (key-binding viper-mouse-up-insert-key-parsed)
@@ -545,9 +541,9 @@ bindings in the Viper manual."
          viper-mouse-down-insert-key-parsed))
        (t
         (global-set-key viper-mouse-up-insert-key-parsed
-                        'viper-mouse-click-insert-word)
+                        #'viper-mouse-click-insert-word)
         (global-set-key viper-mouse-down-insert-key-parsed
-                        'viper-mouse-catch-frame-switch))))
+                        #'viper-mouse-catch-frame-switch))))
 
 (defun viper-reset-mouse-search-key (symb val)
   (viper-unbind-mouse-search-key)
@@ -573,8 +569,7 @@ This buffer may be different from the one where the click 
occurred."
                     (const :format "%v " shift)
                     (const control))
               (integer :tag "Button"))
-  :set 'viper-reset-mouse-search-key
-  :group 'viper-mouse)
+  :set #'viper-reset-mouse-search-key)
 
 (defcustom viper-mouse-insert-key '(meta shift 2)
   "Key used to click-insert in Viper.
@@ -589,7 +584,7 @@ This buffer may be different from the one where the click 
occurred."
                     (const :format "%v " shift)
                     (const control))
               (integer :tag "Button"))
-  :set 'viper-reset-mouse-insert-key
-  :group 'viper-mouse)
+  :set #'viper-reset-mouse-insert-key)
 
+(provide 'viper-mous)
 ;;; viper-mous.el ends here
diff --git a/lisp/emulation/viper-util.el b/lisp/emulation/viper-util.el
index 1bdb155..51f7406 100644
--- a/lisp/emulation/viper-util.el
+++ b/lisp/emulation/viper-util.el
@@ -24,8 +24,7 @@
 
 ;;; Code:
 
-(provide 'viper-util)
-
+(require 'seq)
 
 ;; Compiler pacifier
 (defvar viper-minibuffer-current-face)
@@ -47,22 +46,22 @@
 
 
 
-(define-obsolete-function-alias 'viper-overlay-p 'overlayp "27.1")
-(define-obsolete-function-alias 'viper-make-overlay 'make-overlay "27.1")
-(define-obsolete-function-alias 'viper-overlay-live-p 'overlayp "27.1")
-(define-obsolete-function-alias 'viper-move-overlay 'move-overlay "27.1")
-(define-obsolete-function-alias 'viper-overlay-start 'overlay-start "27.1")
-(define-obsolete-function-alias 'viper-overlay-end 'overlay-end "27.1")
-(define-obsolete-function-alias 'viper-overlay-get 'overlay-get "27.1")
-(define-obsolete-function-alias 'viper-overlay-put 'overlay-put "27.1")
-(define-obsolete-function-alias 'viper-read-event 'read-event "27.1")
-(define-obsolete-function-alias 'viper-characterp 'integerp "27.1")
-(define-obsolete-function-alias 'viper-int-to-char 'identity "27.1")
-(define-obsolete-function-alias 'viper-get-face 'facep "27.1")
+(define-obsolete-function-alias 'viper-overlay-p #'overlayp "27.1")
+(define-obsolete-function-alias 'viper-make-overlay #'make-overlay "27.1")
+(define-obsolete-function-alias 'viper-overlay-live-p #'overlayp "27.1")
+(define-obsolete-function-alias 'viper-move-overlay #'move-overlay "27.1")
+(define-obsolete-function-alias 'viper-overlay-start #'overlay-start "27.1")
+(define-obsolete-function-alias 'viper-overlay-end #'overlay-end "27.1")
+(define-obsolete-function-alias 'viper-overlay-get #'overlay-get "27.1")
+(define-obsolete-function-alias 'viper-overlay-put #'overlay-put "27.1")
+(define-obsolete-function-alias 'viper-read-event #'read-event "27.1")
+(define-obsolete-function-alias 'viper-characterp #'integerp "27.1")
+(define-obsolete-function-alias 'viper-int-to-char #'identity "27.1")
+(define-obsolete-function-alias 'viper-get-face #'facep "27.1")
 (define-obsolete-function-alias 'viper-color-defined-p
-  'x-color-defined-p "27.1")
+  #'x-color-defined-p "27.1")
 (define-obsolete-function-alias 'viper-iconify
-  'iconify-or-deiconify-frame "27.1")
+  #'iconify-or-deiconify-frame "27.1")
 
 
 ;; CHAR is supposed to be a char or an integer (positive or negative)
@@ -269,10 +268,10 @@ Otherwise return the normal value."
 ;; Then, each time this var is used in `viper-move-marker-locally' in a new
 ;; buffer, a new marker will be created.
 (defun viper-move-marker-locally (var pos &optional buffer)
-  (if (markerp (eval var))
+  (if (markerp (symbol-value var))
       ()
     (set var (make-marker)))
-  (move-marker (eval var) pos buffer))
+  (move-marker (symbol-value var) pos buffer))
 
 
 ;; Print CONDITIONS as a message.
@@ -280,7 +279,7 @@ Otherwise return the normal value."
   (let ((case (car conditions)) (msg (cdr conditions)))
     (if (null msg)
        (message "%s" case)
-      (message "%s: %s" case (mapconcat 'prin1-to-string msg " ")))
+      (message "%s: %s" case (mapconcat #'prin1-to-string msg " ")))
     (beep 1)))
 
 
@@ -453,7 +452,7 @@ Otherwise return the normal value."
                                  "$"))
                         tmp2))
        (setq tmp (cdr tmp)))
-      (reverse (apply 'append tmp2)))))
+      (reverse (apply #'append tmp2)))))
 
 
 ;;; Insertion ring
@@ -488,11 +487,11 @@ Otherwise return the normal value."
 
 ;; Push item onto ring.  The second argument is a ring-variable, not value.
 (defun viper-push-onto-ring (item ring-var)
-  (or (ring-p (eval ring-var))
-      (set ring-var (make-ring (eval (intern (format "%S-size" ring-var))))))
+  (or (ring-p (symbol-value ring-var))
+      (set ring-var (make-ring (symbol-value (intern (format "%S-size" 
ring-var))))))
   (or (null item) ; don't push nil
       (and (stringp item) (string= item "")) ; or empty strings
-      (equal item (viper-current-ring-item (eval ring-var))) ; or old stuff
+      (equal item (viper-current-ring-item (symbol-value ring-var))) ; or old 
stuff
       ;; Since viper-set-destructive-command checks if we are inside
       ;; viper-repeat, we don't check whether this-command-keys is a `.'.  The
       ;; cmd viper-repeat makes a call to the current function only if `.' is
@@ -505,7 +504,7 @@ Otherwise return the normal value."
       (and (eq ring-var 'viper-command-ring)
           (string-match "\\([0-9]*\e\\|^[ \t]*$\\|escape\\)"
                         (viper-array-to-string (this-command-keys))))
-      (viper-ring-insert (eval ring-var) item))
+      (viper-ring-insert (symbol-value ring-var) item))
   )
 
 
@@ -595,7 +594,7 @@ Otherwise return the normal value."
 ;; Arguments: var message file &optional erase-message
 (defun viper-save-setting (var message file &optional erase-msg)
   (let* ((var-name (symbol-name var))
-        (var-val (if (boundp var) (eval var)))
+        (var-val (if (boundp var) (symbol-value var)))
         (regexp (format "^[^;]*%s[ \t\n]*[a-zA-Z0-9---_']*[ \t\n)]" var-name))
         (buf (find-file-noselect (substitute-in-file-name file)))
        )
@@ -795,7 +794,7 @@ Otherwise return the normal value."
 ;;; XEmacs compatibility
 
 (define-obsolete-function-alias 'viper-abbreviate-file-name
-  'abbreviate-file-name "27.1")
+  #'abbreviate-file-name "27.1")
 
 (defsubst viper-sit-for-short (val &optional nodisp)
   (declare (obsolete nil "28.1"))
@@ -815,7 +814,7 @@ Otherwise return the normal value."
        (with-current-buffer buf
          (and (<= pos (point-max)) (<= (point-min) pos))))))
 
-(define-obsolete-function-alias 'viper-mark-marker 'mark-marker "27.1")
+(define-obsolete-function-alias 'viper-mark-marker #'mark-marker "27.1")
 
 (defvar viper-saved-mark nil
   "Where viper saves mark.  This mark is resurrected by m^.")
@@ -831,9 +830,9 @@ Otherwise return the normal value."
 ;; highlighted due to Viper's pushing marks.  So, we deactivate marks,
 ;; unless the user explicitly wants highlighting, e.g., by hitting ''
 ;; or ``
-(define-obsolete-function-alias 'viper-deactivate-mark 'deactivate-mark "27.1")
+(define-obsolete-function-alias 'viper-deactivate-mark #'deactivate-mark 
"27.1")
 
-(define-obsolete-function-alias 'viper-leave-region-active 'ignore "27.1")
+(define-obsolete-function-alias 'viper-leave-region-active #'ignore "27.1")
 
 ;; Check if arg is a valid character for register
 ;; TYPE is a list that can contain `letter', `Letter', and `digit'.
@@ -852,7 +851,7 @@ Otherwise return the normal value."
 
 
 
-(define-obsolete-function-alias 'viper-copy-event 'identity "27.1")
+(define-obsolete-function-alias 'viper-copy-event #'identity "27.1")
 
 ;; Uses different timeouts for ESC-sequences and others
 (defun viper-fast-keysequence-p ()
@@ -862,7 +861,7 @@ Otherwise return the normal value."
                t)))
 
 (define-obsolete-function-alias 'viper-read-event-convert-to-char
-  'read-event "27.1")
+  #'read-event "27.1")
 
 
 ;; Emacs has a bug in eventp, which causes (eventp nil) to return (nil)
@@ -941,20 +940,20 @@ Otherwise return the normal value."
                     (car (read-from-string
                           (concat
                            "?\\"
-                           (mapconcat 'identity mod-char-list "-\\")
+                           (mapconcat #'identity mod-char-list "-\\")
                            "-"
                            base-key-name))))
             (setq key-name
                   (intern
                    (concat
-                    (mapconcat 'identity mod-char-list "-")
+                    (mapconcat #'identity mod-char-list "-")
                     "-"
                     base-key-name))))))
     ))
 
 
 ;; LIS is assumed to be a list of events of characters
-(define-obsolete-function-alias 'viper-eventify-list-xemacs 'ignore "27.1")
+(define-obsolete-function-alias 'viper-eventify-list-xemacs #'ignore "27.1")
 
 
 ;; Arg is a character, an event, a list of events or a sequence of
@@ -985,22 +984,20 @@ Otherwise return the normal value."
 ;; XEmacs only
 (defun viper-event-vector-p (vec)
   (and (vectorp vec)
-       (eval (cons 'and (mapcar (lambda (elt) (if (eventp elt) t)) vec)))))
+       (seq-every-p (lambda (elt) (if (eventp elt) t)) vec)))
 
 
 ;; check if vec is a vector of character symbols
 (defun viper-char-symbol-sequence-p (vec)
   (and
    (sequencep vec)
-   (eval
-    (cons 'and
-         (mapcar (lambda (elt)
-                   (and (symbolp elt) (= (length (symbol-name elt)) 1)))
-                 vec)))))
+   (seq-every-p (lambda (elt)
+                 (and (symbolp elt) (= (length (symbol-name elt)) 1)))
+               vec)))
 
 
 (defun viper-char-array-p (array)
-  (eval (cons 'and (mapcar 'characterp array))))
+  (seq-every-p #'characterp array))
 
 
 ;; Args can be a sequence of events, a string, or a Viper macro.  Will try to
@@ -1012,19 +1009,19 @@ Otherwise return the normal value."
   (let (temp temp2)
     (cond ((stringp event-seq) event-seq)
          ((viper-event-vector-p event-seq)
-           (setq temp (mapcar 'viper-event-key event-seq))
+           (setq temp (mapcar #'viper-event-key event-seq))
            (cond ((viper-char-symbol-sequence-p temp)
-                  (mapconcat 'symbol-name temp ""))
+                  (mapconcat #'symbol-name temp ""))
                  ((and (viper-char-array-p
-                        (setq temp2 (mapcar 'viper-key-to-character temp))))
-                  (mapconcat 'char-to-string temp2 ""))
+                        (setq temp2 (mapcar #'viper-key-to-character temp))))
+                  (mapconcat #'char-to-string temp2 ""))
                  (t (prin1-to-string (vconcat temp)))))
          ((viper-char-symbol-sequence-p event-seq)
-          (mapconcat 'symbol-name event-seq ""))
+          (mapconcat #'symbol-name event-seq ""))
          ((and (vectorp event-seq)
                (viper-char-array-p
-                (setq temp (mapcar 'viper-key-to-character event-seq))))
-          (mapconcat 'char-to-string temp ""))
+                (setq temp (mapcar #'viper-key-to-character event-seq))))
+          (mapconcat #'char-to-string temp ""))
          (t (prin1-to-string event-seq)))))
 
 (defun viper-key-press-events-to-chars (events)
@@ -1172,7 +1169,7 @@ syntax tables.
 This option is appropriate if you like Emacs-style words."
   :type '(radio (const strict-vi) (const reformed-vi)
                 (const extended) (const emacs))
-  :set 'viper-set-syntax-preference
+  :set #'viper-set-syntax-preference
   :group 'viper)
 (make-variable-buffer-local 'viper-syntax-preference)
 
@@ -1375,4 +1372,5 @@ This option is appropriate if you like Emacs-style words."
                 (setq i (1+ i) start (1+ start)))
               res))))))
 
+(provide 'viper-util)
 ;;; viper-util.el ends here
diff --git a/lisp/emulation/viper.el b/lisp/emulation/viper.el
index df5a083..cce5117 100644
--- a/lisp/emulation/viper.el
+++ b/lisp/emulation/viper.el
@@ -1061,9 +1061,7 @@ This may be needed if the previous `:map' command 
terminated abnormally."
   (if (viper-window-display-p)
       (viper--advice-add
        'handle-switch-frame :before
-       (lambda (&rest _)
-        "Remember the selected frame before the switch-frame event."
-        (viper-remember-current-frame (selected-frame)))))
+       #'viper-remember-current-frame))
 
   ) ; end viper-non-hook-settings
 
@@ -1191,7 +1189,7 @@ These two lines must come in the order given."))
 
 ;; The default viper-toggle-key is \C-z; for the novice, it suspends or
 ;; iconifies Emacs
-(define-key viper-vi-intercept-map viper-toggle-key 'viper-toggle-key-action)
+(define-key viper-vi-intercept-map viper-toggle-key #'viper-toggle-key-action)
 (define-key
   viper-emacs-intercept-map viper-toggle-key #'viper-change-state-to-vi)
 



reply via email to

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