This was a great little ergonomic improvement, and thanks for taking us on that journey!
My final version is in my config now. The only improvements are skipping the most recent command when scrolling back through history (a nice improvement IMO) and some probably unnecessary refactoring.
Thanks for finding that advice solution, which is like 98% of my version. : )
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 tocompleting-read
(and therefore by extensionread-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.