I often find myself doing things like installations or debugging where I would like to be able to work in shell mode but be able to insert annotations as I go. BBEdit has something like this but suffers badly from being not EMACS.
Ideally, such a mode would have some simple syntax for blocks of text that aren't sent to the shell subprocess at all. One possibility is something like Python's triple-quoted strings, inserted ahead if the current command. For example:
$ echo "Here is one command"
$ echo "Here is a second command"
$ _
This would be the vanilla shell session, cursor at the underscore. CTRL-P a few times, CTRL-O, and you open a line in the previous command text.
$ echo "Here is one command"
_
$ echo "Here is a second command"
$
Now enter text.
$ echo "Here is one command"
""" This is a longish comment I'm inserting into the text that
won't be seen as a command, and thus won't be sent to the bottom
as a shell command.
The block ends at the matching triple-quote, like this:
"""
$ echo "Here is a second command"
$
I'm sure it's not an excessively difficult hack, but it seems like other people may have wanted this in the past, and I'd rather find an existing package than build my own.
alias rem='cat >/dev/null'
in your shell (which does run a shell command, but otherwise more or less matches your needs).C-d
to exit from thecat
command when you've finished typing your comment.cat >/dev/null
as suggested by phils), or do you also want to go back and annotate old commands (in which case you can just edit the buffer)?