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

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

Re: capturing commands


From: Michael Slass
Subject: Re: capturing commands
Date: Thu, 17 Oct 2002 01:43:46 GMT
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

merik <merik@cc.gatech.edu> writes:

>Have a Pan Galactic Gargleblaster and read Michael Slass's shiznit
>
>> Barry Margolin <barmar@genuity.net> writes:
><snip, some stuff that i'm thankful for>
>
>I'm a n00b here so I wanted to know how I can could actually implement 
>this becuase i've seen the view-lossage and was hoping to use the 
>open-dribble-file but I don't know how.

M-x open-dribble-file RET
then type the file name when prompted.

That will save all your keystrokes to your file.



If you want to save the names of all your commands to a file, try
adding this to your .emacs

(defvar emacs-command-log
        (find-file "~/my-emacs-commands"))

(defun log-last-command ()
  (save-excursion
    (let ((com (prin1-to-string last-command))
          (deactivate-mark nil))
      (set-buffer emacs-command-log)
      (goto-char (point-max))
      (insert "\n" com))))

(add-hook 'post-command-hook 'log-last-command)


This will fill a file in your home directory called
"my-emacs-commands" with a list of all the commands you run.  You can
look at the list by switching to the my-emacs-commands buffer.  Emacs
will ask you if you want to save the file each time you quit.

You will find the vast majority of these will be self-insert-command,
which is what's ordinarily run when you hit a key which produces a
printing character.

NB -

0) This is very lightly tested, so use at your own risk

1) The my-emacs-commands file will grow WITHOUT BOUNDS, so truncate it
   now and again.

2) this will degrade your emacs performance since all the code in
   log-last-command must run each time you do anything.  When you've
   got the info you want, delete (or comment out) the above code.


-- 
Mike Slass


reply via email to

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