search-n-replace

--HG--
branch : pmacs2
This commit is contained in:
moculus 2008-12-05 05:38:08 +00:00
parent 6fccb54b16
commit 3d33459c2d
1 changed files with 20 additions and 23 deletions

View File

@ -2,42 +2,39 @@ import os
import util
# default callbacks
def none(window):
def none(w):
return None
def last_buffer(window):
bl = window.application.bufferlist
def last_buffer(w):
bl = w.application.bufferlist
if bl.hidden_buffers:
return bl.hidden_buffers[0].name()
else:
return ''
def current_buffer(window):
return window.buffer.name()
def current_buffer(w):
return w.buffer.name()
def last_replace_before(window):
return None #XYZ
if window.application.last_replace_before:
return window.application.last_replace_before
else:
def last_replace_before(w):
a = w.application
if a.config.get('use_last_replace') and a.last_replace_before:
return a.last_replace_before
return None
def last_replace_after(w):
a = w.application
if a.config.get('use_last_replace') and a.last_replace_after:
return w.application.last_replace_after
return None
def last_replace_after(window):
return None #XYZ
if window.application.last_replace_after:
return window.application.last_replace_after
else:
return None
def current_working_dir(window):
def current_working_dir(w):
return util.normal_path(os.getcwd())
def path_dirname(window):
if hasattr(window.buffer, 'path'):
path = os.path.dirname(window.buffer.path)
def path_dirname(w):
if hasattr(w.buffer, 'path'):
path = os.path.dirname(w.buffer.path)
return util.normal_path(path) + '/'
else:
return current_working_dir(window)
return current_working_dir(w)
# default callback builders
def build_constant(c):