help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: command-history for commands bound to keys.


From: esabof
Subject: Re: command-history for commands bound to keys.
Date: Sun, 2 Feb 2014 07:46:28 -0800 (PST)
User-agent: G2/1.0

> 
>   http://www.emacswiki.org/emacs/CommandLogMode
> 
> or
>
>   http://www.emacswiki.org/emacs/InteractionLogMode
>

And also:

(defvar es-full-command-history (make-ring 100))

(defun es-full-command-history-register ()
  (unless (or (memq this-command
                    '(self-insert-command
                      handle-select-window))
              (and (symbolp this-command)
                   (get this-command 'scroll-command)))
    (ring-insert es-full-command-history
                 (cons (key-description (this-command-keys))
                       this-command))))

(defun es-full-command-history (&rest ignore)
  (interactive)
  (with-current-buffer
      (get-buffer-create "*all-commands-history*")
    (let ((inhibit-read-only t))
      (erase-buffer)
      (cl-dolist (elem (ring-elements es-full-command-history))
        (pp elem (current-buffer)))
      (goto-char (point-min))
      (switch-to-buffer (current-buffer))
      (special-mode)
      (setq-local revert-buffer-function 'es-full-command-history))))

(add-hook 'post-command-hook 'es-full-command-history-register)

Evgeni


reply via email to

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