diff --git a/IPython/history.py b/IPython/history.py index 23dfe73..10bf679 100644 --- a/IPython/history.py +++ b/IPython/history.py @@ -24,13 +24,15 @@ def magic_history(self, parameter_s = ''): This feature is only available if numbered prompts are in use. - -t: print the 'translated' history, as IPython understands it. IPython - filters your input and converts it all into valid Python source before - executing it (things like magics or aliases are turned into function - calls, for example). With this option, you'll see the native history - instead of the user-entered version: '%cd /' will be seen as + -t: (default) print the 'translated' history, as IPython understands it. + IPython filters your input and converts it all into valid Python source + before executing it (things like magics or aliases are turned into + function calls, for example). With this option, you'll see the native + history instead of the user-entered version: '%cd /' will be seen as '_ip.magic("%cd /")' instead of '%cd /'. + -r: print the 'raw' history, i.e. the actual commands you typed. + -g: treat the arg as a pattern to grep for in (full) history. This includes the "shadow history" (almost all commands ever written). Use '%hist -g' to show full shadow history (may be very long). @@ -44,12 +46,15 @@ def magic_history(self, parameter_s = ''): if not shell.outputcache.do_full_cache: print 'This feature is only available if numbered prompts are in use.' return - opts,args = self.parse_options(parameter_s,'gnts',mode='list') + opts,args = self.parse_options(parameter_s,'gntsr',mode='list') - if not opts.has_key('t'): + if opts.has_key('t'): + input_hist = shell.input_hist + elif opts.has_key('r'): input_hist = shell.input_hist_raw else: input_hist = shell.input_hist + default_length = 40 pattern = None diff --git a/IPython/iplib.py b/IPython/iplib.py index d8c4d3f..896651a 100644 --- a/IPython/iplib.py +++ b/IPython/iplib.py @@ -6,7 +6,7 @@ Requires Python 2.3 or newer. This file contains all the classes and helper functions specific to IPython. -$Id: iplib.py 2646 2007-08-20 16:28:48Z vivainio $ +$Id: iplib.py 2652 2007-08-22 17:25:24Z vivainio $ """ #***************************************************************************** @@ -2046,7 +2046,7 @@ want to merge them back into the new files.""" % locals() # only entries starting at first column go to shadow history if line.lstrip() == line: self.shadowhist.add(line.strip()) - else: + elif not continue_prompt: self.input_hist_raw.append('\n') try: lineout = self.prefilter(line,continue_prompt) diff --git a/doc/ChangeLog b/doc/ChangeLog index 8cf0c3e..bddd7e2 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,27 @@ +2007-08-22 Ville Vainio + + * iplib.py: no extra empty (last) line in raw hist w/ multiline + statements + +2007-08-21 Ville Vainio + + * ipmaker.py: finding ipythonrc-PROF now skips ipy_profile_PROF. + (for backwards compatibility) + + * history.py: switch back to %hist -t from %hist -r as default. + At least until raw history is fixed for good. + +2007-08-20 Ville Vainio + + * ipapi.py, iplib.py: DebugTools accessible via _ip.dbg, to catch & + locate alias redeclarations etc. Also, avoid handling + _ip.IP.alias_table directly, prefer using _ip.defalias. + + +2007-08-15 Ville Vainio + + * prefilter.py: ! is now always served first + 2007-08-15 Fernando Perez * IPython/iplib.py (safe_execfile): fix the SystemExit