default value for open-file

--HG--
branch : pmacs2
This commit is contained in:
moculus 2008-03-16 21:36:34 +00:00
parent 1bc1b24170
commit d0a22e4909
2 changed files with 6 additions and 1 deletions

View File

@ -34,6 +34,10 @@ def current_working_dir(window):
cwd += '/'
return cwd
def path_dirname(window):
if hasattr(window.buffer, 'path'):
return os.path.dirname(window.buffer.path) + '/'
# default callback builders
def build_constant(c):
return lambda w: c

View File

@ -197,7 +197,8 @@ class RegexReplace(Method):
# navigating between buffers
class OpenFile(Method):
'''Open file in a new buffer, or go to file's open buffer'''
args = [Argument('filename', datatype="path", prompt="Open File: ")]
args = [Argument('filename', datatype="path", prompt="Open File: ",
default=default.path_dirname, load_default=True)]
def _execute(self, w, **vargs):
b = w.application.open_path(vargs['filename'])
SwitchBuffer().execute(w, buffername=b.name())