How can you repeat last shell command with a single shortcut (and no y/n prompts)? How to replace this sequence:
- C-u C-x s (or equivalent) to save all buffers
- M-! for
(shell-command COMMAND &optional ...)
- M-p for
Basically, how can you get this working:
(global-set-key (kbd "M-`") (lambda () (interactive) (save-some-buffers) ;; 1. (shell-command nil) ;; 2. (previous-history-element 1) ;; 3. (<press RET>))) ;; 4.
As is, it returns an error:
shell-command: Wrong type argument: stringp, nil. What should a
COMMAND be when calling
(shell-command COMMAND ...) from ELISP?
Somewhat related question: Is there a (repeat-last-command) in Emacs?