No more ‘J-j g J-s J-j’, just ‘g’ 

I read my e-mail with Gnus and have enabled agent mode because it’s impractical to be connected to the internet in order to compose or reply and even to read e-mail. I like an idea to get quick access to my e-mail no matter if I’m online or not.

Finally I have been tired pressing J-j g J-s J-j many times a day just to send and receive messages. Fortunately Emacs easily allows to reduce a number of key presses due to its great extensibility. What I needed is to tell Emacs which actions to run when a default keyboard shortcut g is pressed in the summary buffer.

Ok, C-h f define-key shows how to define a keyboard shortcut. But how do I figure out what functions to use? C-h c followed by a single key or its combination gives a function behind any keyboard shortcut. So the solution is simple:

  gnus-group-mode-map (kbd "g") (lambda () (interactive)
   (gnus-agent-toggle-plugged t)
   (gnus-agent-toggle-plugged nil)))

You don’t even have to know what does this lambda and interactive mean. Well, in most cases 😉

… even more work for machines ©