* capturing commands
@ 2002-10-16 22:08 merik
2002-10-16 22:22 ` Barry Margolin
2002-10-17 15:03 ` D. Goel
0 siblings, 2 replies; 11+ messages in thread
From: merik @ 2002-10-16 22:08 UTC (permalink / raw)
i would like to know if there was some way of capturing all commands
executed while running emacs whether they be M-x yank, C-x C-s or just
hitting the right arrow key
much thanks,
--
serendipity
merik
nirmal
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: capturing commands
2002-10-16 22:08 capturing commands merik
@ 2002-10-16 22:22 ` Barry Margolin
2002-10-16 23:14 ` Michael Slass
2002-10-17 15:03 ` D. Goel
1 sibling, 1 reply; 11+ messages in thread
From: Barry Margolin @ 2002-10-16 22:22 UTC (permalink / raw)
In article <aoko19$hiv$1@solaria.cc.gatech.edu>,
merik <merik@cc.gatech.edu> wrote:
>i would like to know if there was some way of capturing all commands
>executed while running emacs whether they be M-x yank, C-x C-s or just
>hitting the right arrow key
'C-h l' will show the last 100 keystrokes. I don't think there's a
standard way to record everything, though.
--
Barry Margolin, barmar@genuity.net
Genuity, Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: capturing commands
2002-10-16 22:22 ` Barry Margolin
@ 2002-10-16 23:14 ` Michael Slass
2002-10-17 0:15 ` merik
0 siblings, 1 reply; 11+ messages in thread
From: Michael Slass @ 2002-10-16 23:14 UTC (permalink / raw)
Barry Margolin <barmar@genuity.net> writes:
>In article <aoko19$hiv$1@solaria.cc.gatech.edu>,
>merik <merik@cc.gatech.edu> wrote:
>>i would like to know if there was some way of capturing all commands
>>executed while running emacs whether they be M-x yank, C-x C-s or just
>>hitting the right arrow key
>
>'C-h l' will show the last 100 keystrokes. I don't think there's a
>standard way to record everything, though.
>
C-h c C-h l
=> C-h l runs the command view-lossage
,----[ C-h f view-lossage RET ]
| view-lossage is an interactive compiled Lisp function in `help'.
| (view-lossage)
|
| Display last 100 input keystrokes.
|
| To record all your input on a file, use `open-dribble-file'.
`----
,----[ C-h f open-dribble-file RET ]
| open-dribble-file is an interactive built-in function.
| (open-dribble-file FILE)
|
| Start writing all keyboard characters to a dribble file called FILE.
| If FILE is nil, close any open dribble file.
`----
Why, exactly, do you want this?
--
Mike Slass
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: capturing commands
2002-10-16 23:14 ` Michael Slass
@ 2002-10-17 0:15 ` merik
2002-10-17 1:43 ` Michael Slass
0 siblings, 1 reply; 11+ messages in thread
From: merik @ 2002-10-17 0:15 UTC (permalink / raw)
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>
> Why, exactly, do you want this?
I'm working on a little menuing system and wanted to decide on how often
i use particular commands. I think it would be somehow wrong if I just
tried to think of them so I decided it would be best if there is someway
to just record them.
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.
--
serendipity
merik
nirmal
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: capturing commands
2002-10-17 0:15 ` merik
@ 2002-10-17 1:43 ` Michael Slass
2002-10-18 3:29 ` Artist
0 siblings, 1 reply; 11+ messages in thread
From: Michael Slass @ 2002-10-17 1:43 UTC (permalink / raw)
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
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: capturing commands
2002-10-17 1:43 ` Michael Slass
@ 2002-10-18 3:29 ` Artist
2002-10-18 7:40 ` Bernd Wolter
0 siblings, 1 reply; 11+ messages in thread
From: Artist @ 2002-10-18 3:29 UTC (permalink / raw)
Michael Slass <miknrene@drizzle.com> wrote in message news:<m3it01on17.fsf@localhost.localdomain>...
>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 works and really good for simple things
Now only if we can build automagic menu out of this stuff, for the
mostly access commands ( except self-insert-command and few others for
which I would define) and select directly from there, that would be
nice.
Thanks,
Artist
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: capturing commands
2002-10-18 3:29 ` Artist
@ 2002-10-18 7:40 ` Bernd Wolter
2002-10-18 16:28 ` Clemens Fischer
0 siblings, 1 reply; 11+ messages in thread
From: Bernd Wolter @ 2002-10-18 7:40 UTC (permalink / raw)
googleartist@yahoo.com (Artist) writes:
[...]
>
> This works and really good for simple things
> Now only if we can build automagic menu out of this stuff, for the
> mostly access commands ( except self-insert-command and few others for
> which I would define) and select directly from there, that would be
> nice.
>
>
> Thanks,
> Artist
Admittedly I didn't follow this thread closely, so I'm not really sure
if this helps you ... but there was keyolution.el posted by Volker
Franz some time in January to gnu.emacs.sources. It captures all your
(mode-specific) key presses and stores them to a file. The statistics
part you then have to do yourself (flush-lines, wc, sort, etc., there
are examples in the commentary). Perhaps this helps you for the data
gathering part of what you want. As for the automagic menu part,
that's way beyond me, sorry.
HTH
bernd
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: capturing commands
2002-10-18 7:40 ` Bernd Wolter
@ 2002-10-18 16:28 ` Clemens Fischer
0 siblings, 0 replies; 11+ messages in thread
From: Clemens Fischer @ 2002-10-18 16:28 UTC (permalink / raw)
Bernd Wolter <mathae.wolter@gmx.de>:
> The statistics
> part you then have to do yourself (flush-lines, wc, sort, etc., there
> are examples in the commentary). Perhaps this helps you for the data
> gathering part of what you want. As for the automagic menu part,
> that's way beyond me, sorry.
i'm always fascinated by markov-chains in this respect, but the only
implementation of it i know of is the "reactive keyboard". this is
very hacky code hard to cleanly install on a unix.
it works impressively well, though, in guessing what you will be
typing next. rk is slow at this, but an implementation of this
algorithm to automatically make keyboard-macros should be a nifty
add-on!
clemens
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: capturing commands
2002-10-16 22:08 capturing commands merik
2002-10-16 22:22 ` Barry Margolin
@ 2002-10-17 15:03 ` D. Goel
2002-10-18 18:03 ` kgold
1 sibling, 1 reply; 11+ messages in thread
From: D. Goel @ 2002-10-17 15:03 UTC (permalink / raw)
> i would like to know if there was some way of capturing all commands
> executed while running emacs whether they be M-x yank, C-x C-s or just
> hitting the right arrow key
I see from other posts that there seems no built-in way to do this in
general (for both keystrokes and commands).
so i wonder if anyone sees any problem with this sort of approach--
(defvar command-history-my nil)
(add-hook 'post-command-hook
'(lambda ()
(push this-command command-history-my)))
this seems to work for me for both the cases... hmm..except i guess
when a command explicitly overrides the value of this-command..
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: capturing commands
2002-10-17 15:03 ` D. Goel
@ 2002-10-18 18:03 ` kgold
2002-10-18 19:31 ` D. Goel
0 siblings, 1 reply; 11+ messages in thread
From: kgold @ 2002-10-18 18:03 UTC (permalink / raw)
D. Goel <deego@glue.umd.edu> writes:
>
> > i would like to know if there was some way of capturing all commands
> > executed while running emacs whether they be M-x yank, C-x C-s or just
> > hitting the right arrow key
>
> I see from other posts that there seems no built-in way to do this in
> general (for both keystrokes and commands).
>
I think you are looking for:
M-x view-lossage
--
Ken Goldman kgold@watson.ibm.com 914-784-7646
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: capturing commands
2002-10-18 18:03 ` kgold
@ 2002-10-18 19:31 ` D. Goel
0 siblings, 0 replies; 11+ messages in thread
From: D. Goel @ 2002-10-18 19:31 UTC (permalink / raw)
> I think you are looking for:
>
> M-x view-lossage
>
What i thought the OP was looking for, was a list of commands
executed --whether through a keystroke or through M-x calls.. the
hook i posted, did that, i think.
I guess one might be able to somehow parse the results of view-lossage
to do that (how?) --- but that could get (even more) complicated very
soon---one would have to figure out which minor mode the user was in
when they issued a particular keystroke..
DG http://deego.gnufans.org/~deego/
--
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2002-10-18 19:31 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-10-16 22:08 capturing commands merik
2002-10-16 22:22 ` Barry Margolin
2002-10-16 23:14 ` Michael Slass
2002-10-17 0:15 ` merik
2002-10-17 1:43 ` Michael Slass
2002-10-18 3:29 ` Artist
2002-10-18 7:40 ` Bernd Wolter
2002-10-18 16:28 ` Clemens Fischer
2002-10-17 15:03 ` D. Goel
2002-10-18 18:03 ` kgold
2002-10-18 19:31 ` D. Goel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).