##// END OF EJS Templates
fix dir stack - push *current* directory, not the target directory
vivainio -
Show More
@@ -1,7 +1,7 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2 """Magic functions for InteractiveShell.
2 """Magic functions for InteractiveShell.
3
3
4 $Id: Magic.py 2728 2007-09-07 16:12:42Z vivainio $"""
4 $Id: Magic.py 2744 2007-09-08 12:58:56Z vivainio $"""
5
5
6 #*****************************************************************************
6 #*****************************************************************************
7 # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and
7 # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and
@@ -2676,9 +2676,11 b' Defaulting color scheme to \'NoColor\'"""'
2676 if len(dir_s)>0 and os.path.expanduser(parameter_s) != \
2676 if len(dir_s)>0 and os.path.expanduser(parameter_s) != \
2677 os.path.expanduser(self.shell.dir_stack[0]):
2677 os.path.expanduser(self.shell.dir_stack[0]):
2678 try:
2678 try:
2679 cwd = os.getcwd().replace(self.home_dir,'~')
2679 self.magic_cd(parameter_s)
2680 self.magic_cd(parameter_s)
2680 dir_s.insert(0,os.getcwd().replace(self.home_dir,'~'))
2681 # print "Pushed:",cwd #dbg
2681 self.magic_dirs()
2682 dir_s.insert(0,cwd)
2683 return self.magic_dirs()
2682 except:
2684 except:
2683 print 'Invalid directory'
2685 print 'Invalid directory'
2684 else:
2686 else:
@@ -2688,9 +2690,9 b' Defaulting color scheme to \'NoColor\'"""'
2688 """Change to directory popped off the top of the stack.
2690 """Change to directory popped off the top of the stack.
2689 """
2691 """
2690 if len (self.shell.dir_stack) > 1:
2692 if len (self.shell.dir_stack) > 1:
2691 self.shell.dir_stack.pop(0)
2693 top = self.shell.dir_stack.pop(0)
2692 self.magic_cd(self.shell.dir_stack[0])
2694 self.magic_cd(top)
2693 print self.shell.dir_stack[0]
2695 print "popd ->",top
2694 else:
2696 else:
2695 print "You can't remove the starting directory from the stack:",\
2697 print "You can't remove the starting directory from the stack:",\
2696 self.shell.dir_stack
2698 self.shell.dir_stack
@@ -2698,7 +2700,7 b' Defaulting color scheme to \'NoColor\'"""'
2698 def magic_dirs(self, parameter_s=''):
2700 def magic_dirs(self, parameter_s=''):
2699 """Return the current directory stack."""
2701 """Return the current directory stack."""
2700
2702
2701 return self.shell.dir_stack[:]
2703 return self.shell.dir_stack
2702
2704
2703 def magic_dhist(self, parameter_s=''):
2705 def magic_dhist(self, parameter_s=''):
2704 """Print your history of visited directories.
2706 """Print your history of visited directories.
@@ -1,3 +1,8 b''
1 2007-09-08 Ville Vainio <vivainio@gmail.com>
2
3 * Magic.py (%pushd, %popd, %dirs): Fix dir stack - push *current*
4 directory, not the target directory.
5
1 2007-09-07 Ville Vainio <vivainio@gmail.com>
6 2007-09-07 Ville Vainio <vivainio@gmail.com>
2
7
3 * iplib.py: do not auto-alias "dir", it screws up other dir auto
8 * iplib.py: do not auto-alias "dir", it screws up other dir auto
General Comments 0
You need to be logged in to leave comments. Login now