From 3d33459c2d4ff3174ef1fba3ead27aabf12ac96e Mon Sep 17 00:00:00 2001 From: moculus Date: Fri, 5 Dec 2008 05:38:08 +0000 Subject: [PATCH] search-n-replace --HG-- branch : pmacs2 --- default.py | 43 ++++++++++++++++++++----------------------- 1 file changed, 20 insertions(+), 23 deletions(-) diff --git a/default.py b/default.py index 5030990..f2b59b9 100644 --- a/default.py +++ b/default.py @@ -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: - return None +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):