2

I can refresh my dired buffer using M-x revert-buffer

and I've seen multiple places that I can do this more easily using g but don't understand how that would be run. Does it mean M-x g or running g <RET> somehow?

Searched around but haven't figured out what basic trick I'm missing so thanks for the help.

  • 1
    It very literally means type g. Which presumably you have already tried, but do not think it's working? What are you expecting to see, which you are not seeing from typing g ? – phils Apr 15 at 12:18
  • yeah I thought I created a subdirectory, that i wasn't seeing but I'll go back and check the whole thing again. Thanks for confirming, just thought commands had to be either C- or M- but clearly not – Hugh_Kelley Apr 15 at 13:11
  • It's common for modes that don't involve directly editing text, like dired, magit, info etc., to bind 'naked' keys to commands. This should be clear from the documentation: if you need to press Meta/Alt, or Control, the documentation will specify that explicitly: M-g and C-g, for example. If the documentation refers to a single key (i.e., g) for a command, you should just press that key. – Tyler Apr 15 at 17:32
  • thanks both. tried g again and yeah of course it works. – Hugh_Kelley Apr 15 at 17:46
  • "just thought commands had to be either C- or M- but clearly not" -- Indeed. FYI even when you are entering text, each letter you insert is the result of a command bound to the associated key (generally self-insert-command). – phils Apr 15 at 23:11
3

You can see what command a key sequence is bound to by using 'M-x describe-key' (normally bound to 'C-h k').

Switching to a dired buffer and running C-h k gives an extensive help text. The start is:

g runs the command revert-buffer (found in dired-mode-map), which is                                                                                                                                               
an interactive compiled Lisp function in ‘files.el’.                                                                                                                                                               

It is bound to g, <menu-bar> <immediate> <revert-buffer>, <menu-bar>                                                                                                                                               
<file> <revert-buffer>. 

From this we learn that g is bound to 'revert-buffer' and the binding is in 'dired-mode-map'.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.