Talespin_Kit
Talespin_Kit

Reputation: 21877

How to view history of various commands in Emacs

Commands entered after pressing M-x can be viewed using the up/down arrow keys.

How can I get a list of all the commands including menu bar invocation, commands triggered using mouse clicks, etc. in Emacs?

Upvotes: 22

Views: 9365

Answers (5)

Gangula
Gangula

Reputation: 7304

You can also use the keycast package which comes with a handy keycast-mode-line-mode which displays the last executed keybinding along with its command in the modeline.

It also has a keycast-log-mode which

displays a list of recent bindings in a dedicated frame.

But this only keeps track of the commands after enabling the mode


In my opinion M-x view-lossage OR C-h l (lowercase "L") as mentioned by others here is the best option and additionally, it is also an in-built tool, so no additional packages..

Upvotes: 0

agarttha
agarttha

Reputation: 11

M-x view-lossage

From emacs documentation

(view-lossage)

Display last few input keystrokes and the commands run. For convenience this uses the same format as edit-last-kbd-macro. See lossage-size to update the number of recorded keystrokes.

To record all your input, use open-dribble-file.

(open-dribble-file FILE)

Start writing input events to a dribble file called FILE. Any previously open dribble file will be closed first. If FILE is nil, just close the dribble file, if any. If the file is still open when Emacs exits, it will be closed then.

The events written to the file include keyboard and mouse input events, but not events from executing keyboard macros. The events are written to the dribble file immediately without line buffering.

Be aware that this records all characters you type! This may include sensitive information such as passwords.

Upvotes: 0

bos
bos

Reputation: 6555

For a complete list of history, type C-h l (lowercase "L").

Note: this list is complete in the sense that it keeps all events and commands that happened recently, but it's not complete in the sense that it only keeps track of the last 300 or so events (and corresponding commands).

Upvotes: 31

event_jr
event_jr

Reputation: 17707

I've used mwe-log-commands to make screencasts. It shows events and the commands they trigger as you work in Emacs.


command-log-mode

screen shot

I've just forked it and made it into a proper minor-mode and global-minor-mode along with some other improvements as command-log-mode.

Give it a shot and file issues against me if the documentation is unclear or if you find any bugs.

Upvotes: 15

Tom
Tom

Reputation: 7586

So you want the history of of all commands, regardless of where they are executed? I don't know if emacs provides this by default, but you can add your own function to post-command-hook which is executed after every command, so you can use it to collect all the executed commands.

Upvotes: 2

Related Questions