this post was submitted on 18 Oct 2023
1 points (100.0% liked)
Emacs
313 readers
3 users here now
A community for the timeless and infinitely powerful editor. Want to see what Emacs is capable of?!
Get Emacs
Rules
- Posts should be emacs related
- Be kind please
- Yes, we already know: Google results for "emacs" and "vi" link to each other. We good.
Emacs Resources
Emacs Tutorials
- Beginner’s Guide to Emacs
- Absolute Beginner's Guide to Emacs
- How to Learn Emacs: A Hand-drawn One-pager for Beginners
Useful Emacs configuration files and distributions
Quick pain-saver tip
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
I like your thinking!
Here's a solution for automatically running the last command:
It has two drawbacks:
shell-command-history
doesn't differentiate between asynchronous and synchronous shell commands, so you may accidentally repeat an async command synchronously (if you differentiate at all)—there are ways to look through the history for the one you want, howeverHonestly probably not worth solving that second issue, as you could bind a function like the one above and then just use that binding instead of the usual when you want to repeat. (Actually, now that I've thought this through, I think that's exactly what I'm gonna do.)
If you want the auto fill behavior and not the repeat behavior, you could advise the shell-command functions to grab
(car shell-command-history)
and insert it into the minibuffer.Thanks for the thought-provoking question! I think I'm gonna go add this function now. : )