##// END OF EJS Templates
%alias shows interesting last, %unalias removes %stored
vivainio -
Show More
@@ -1,7 +1,7 b''
1 1 # -*- coding: utf-8 -*-
2 2 """Magic functions for InteractiveShell.
3 3
4 $Id: Magic.py 1823 2006-10-13 15:09:08Z vivainio $"""
4 $Id: Magic.py 1824 2006-10-13 21:07:59Z vivainio $"""
5 5
6 6 #*****************************************************************************
7 7 # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and
@@ -2365,17 +2365,24 b' Defaulting color scheme to \'NoColor\'"""'
2365 2365
2366 2366 par = parameter_s.strip()
2367 2367 if not par:
2368 if self.shell.rc.automagic:
2369 prechar = ''
2370 else:
2371 prechar = self.shell.ESC_MAGIC
2372 #print 'Alias\t\tSystem Command\n'+'-'*30
2368 stored = self.db['stored_aliases']
2373 2369 atab = self.shell.alias_table
2374 2370 aliases = atab.keys()
2375 2371 aliases.sort()
2376 2372 res = []
2373 showlast = []
2377 2374 for alias in aliases:
2378 res.append((alias, atab[alias][1]))
2375 tgt = atab[alias][1]
2376 # 'interesting' aliases
2377 if (alias in stored or
2378 alias != os.path.splitext(tgt)[0] or
2379 ' ' in tgt):
2380 showlast.append((alias, tgt))
2381 else:
2382 res.append((alias, tgt ))
2383
2384 # show most interesting aliases last
2385 res.extend(showlast)
2379 2386 print "Total number of aliases:",len(aliases)
2380 2387 return res
2381 2388 try:
@@ -2398,6 +2405,11 b' Defaulting color scheme to \'NoColor\'"""'
2398 2405 aname = parameter_s.strip()
2399 2406 if aname in self.shell.alias_table:
2400 2407 del self.shell.alias_table[aname]
2408 stored = self.db['stored_aliases']
2409 if aname in stored:
2410 print "Removing %stored alias",aname
2411 del stored[aname]
2412 self.db['stored_aliases'] = stored
2401 2413
2402 2414 def magic_rehash(self, parameter_s = ''):
2403 2415 """Update the alias table with all entries in $PATH.
@@ -1,7 +1,12 b''
1 1 2006-10-14 Ville Vainio <vivainio@gmail.com>
2 2
3 * Magic.py, ipython.el: applied first part of Rocky Bernstein's
4 patch set for pydb integration.
3 * Magic.py, ipython.el: applied first "safe" part of Rocky
4 Bernstein's patch set for pydb integration.
5
6 * Magic.py (%unalias, %alias): %store'd aliases can now be
7 removed with '%unalias'. %alias w/o args now shows most
8 interesting (stored / manually defined) aliases last
9 where they catch the eye w/o scrolling.
5 10
6 11 2006-10-12 Ville Vainio <vivainio@gmail.com>
7 12
General Comments 0
You need to be logged in to leave comments. Login now