Hello, I usually run the same command with async-shell-command, however I have to navigate back to the last command history to trigger my last run command, is there any way async-shell-command (and shell-command) can autofill with last run command so that I just hit enter without extra steps?

  • abbreviatedman@fediverser.communick.devB
    link
    fedilink
    English
    arrow-up
    1
    ·
    11 months ago

    Yeah, that one took some digging! I found the relevant bit in the Elisp manual. I should have some elisp for you to access the area of the manual within Emacs but I’m not there yet. : ) Here’s the HTML version.

    That bit of a code is a cons pair, a list of the symbol shell-command-history and the number 1. The history argument to completing-read (and therefore by extension read-shell-command) can take in either a symbol for a history variable or a cons pair of a history variable symbol and an index to start with.