I started looking at magic_rep, while reworking the history. It's struck me that it's not a very intuitive behaviour - it can either bring a line to the prompt, or execute code, and it overlaps with the magic_r function. So I'd like to propose a cleaner separation - let's have one magic command to repeat or rerun a command, and another to bring a line to the prompt.<br>

<br>If we were starting with a clean slate, I would call these %repeat/%rep to run commands, and %recall/%rec to bring them to the prompt. But I think %rep is probably more often used to "recall" a line, so perhaps it would be better to leave it in this role, and call the new repeat function something like %rerun.<br>

<br>More specifically, the recall function, whatever we call it, would have the following behaviour:<br>- With no arguments, put the last output (_) at the prompt<br>- If the argument is a string variable in the user namespace, put the value of that variable at the prompt (so you could recall Out[4]). I think this should be possible using eval.<br>

- If the argument specifies one or more cells in the history, join them into a single cell and put this at the prompt. (Or should we just take the first cell instead of combining them?)<br>- Otherwise, search through the history, and recall the most recent line containing the search term.<br>

<br>The repeat/rerun function would accept similar options and arguments to %history (except those relating to output), and would retrieve lines in the same way, except that the search option (-g) would only retrieve the most recent match. Specifying no arguments would get the cell immediately before it. These lines would then be run in exec mode (single mode for single blocks?)<br>

<br>It makes sense to do this in my sqlite-history branch, because I need to modify these commands to work with the new history system anyway. Are there any thoughts or objections? If I separate the functions, what names would you like them to be under?<br>

<br>Thanks,<br>Thomas<br>