             (error (if (smex-save-file-not-empty-p)
                        (error "Invalid data in smex-save-file (%s). Can't restore history."
                               smex-save-file)
-                     (if (not (boundp 'smex-history)) (setq smex-history))
-                     (if (not (boundp 'smex-data))    (setq smex-data))))))
+                     (unless (boundp 'smex-history) (setq smex-history nil))
+                     (unless (boundp 'smex-data)    (setq smex-data nil))))))
       (setq smex-history nil smex-data nil))))
-
-(defsubst smex-save-file-not-empty-p ()
-  (string-match-p "\[^[:space:]\]" (buffer-string)))
 
 (defun smex-save-history ()
   "Updates `smex-history'"
   (setq smex-history nil)
   (let ((cell smex-cache))
-    (dotimes (i smex-history-length)
+    (dotimes (_ smex-history-length)
       (setq smex-history (cons (caar cell) smex-history))
       (setq cell (cdr cell))))
   (setq smex-history (nreverse smex-history)))
 
+(defmacro smex-pp (list-var)
+  `(smex-pp* ,list-var ,(symbol-name list-var)))
+
 (defun smex-save-to-file ()
   (interactive)
   (smex-save-history)
   (with-temp-file (expand-file-name smex-save-file)
-    (ido-pp 'smex-history)
-    (ido-pp 'smex-data)))
+    (smex-pp smex-history)
+    (smex-pp smex-data)))
 
 ;;--------------------------------------------------------------------------------
 ;; Ranking

    commands))

(defun smex-parse-keymap (map commands)
  (map-keymap (lambda (binding element)
                (if (and (listp element) (eq 'keymap (car element)))
                    (smex-parse-keymap element commands)
                  ;; Strings are commands, too. Reject them.

          (setq smex-custom-action nil)
          (funcall action chosen-item))
      (unwind-protect
          (with-no-warnings ; Don't warn about interactive use of `execute-extended-command'
            (execute-extended-command current-prefix-arg chosen-item-name))
        (smex-rank chosen-item)))))

;;;###autoload
