+(defun command-history-mode ()
+ "Major mode for listing and repeating recent commands.
+
+Keybindings:
+\\{command-history-map}"
+ (interactive)
+ (Command-history-setup)
+ (setq major-mode 'command-history-mode)
+ (setq mode-name "Command History")
+ (use-local-map command-history-map)
+ (run-mode-hooks 'command-history-mode-hook))
+
+(defun Command-history-setup ()
+ (kill-all-local-variables)
+ (use-local-map command-history-map)
+ (lisp-mode-variables nil)
+ (set-syntax-table emacs-lisp-mode-syntax-table)
+ (setq buffer-read-only t))
+
+(defcustom command-history-hook nil
+ "If non-nil, its value is called on entry to `command-history-mode'."
+ :type 'hook
+ :group 'chistory)
+