One workaround would be to bind the keystroke to a macro that inserts a comment character at the beginning of the line before doing edit-and-execute-command. Then when you exit the editor the comment will be "executed" then you can press up arrow to retrieve the line and delete the comment character and do further editing then execute it.
This does all of that for you. At the command line: bind '"\C-xp": "\C-a# \C-x\C-e\C-p\C-a\C-d\C-d\C-e"' or in ~/.inputrc "\C-xp": "\C-a# \C-x\C-e\C-p\C-a\C-d\C-d\C-e" You could bind it to some other keystroke if you'd like. It relies on everything having default bindings. At a Bash prompt, with a command line showing, press Ctrl-x followed by p. Your command will be shown in your $VISUAL (or $EDITOR or emacs) where you can edit it (don't remove the # and space at the beginning of the line). When you exit the editor, The "comment" will be "executed", it will then be retrieved and the "# " removed, the cursor will be moved to the end of the line ready for you to do whatever you'd like. It might be easier On Mon, Aug 23, 2010 at 2:17 PM, Dabrien 'Dabe' Murphy <d...@dabe.com> wrote: > Is it possible to "C-xC-e" /without/ immediately executing the resulting > command? > > To my mind, "editing" the buffer and "executing" it are two different things > -- the latter having potentially dire consequences... > > I'd prefer it if, after exiting my $EDITOR, bash simply stuffed the results > back into my readline buffer. Particularly, if I decide to abandon my > changes, I find it worrisome that the shell goes ahead and executes the > previous command anyway. (I guess I've grown accustomed to SVN's behavior, > for example, where if you don't make any changes to your commit message, it > gives you the option to abort the entire transaction.) > > Cheers! > > -- > :- Dabe > >