Created
August 28, 2010 02:20
-
-
Save stepheneb/554581 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From ba2e685d945bfb9e2077d8aafd29e01746a04791 Mon Sep 17 00:00:00 2001 | |
From: Stephen Bannasch <stephen.bannasch@gmail.com> | |
Date: Fri, 27 Aug 2010 22:14:33 -0400 | |
Subject: [PATCH 1/2] debug target creates symbolic link to plugin | |
The target "Run Script" now deletes any existing AckMate.tmplugin | |
in the TextMate PlugIn dir and then if: | |
debug target: | |
creates a symbolic link to the plugin in the debug build | |
release target: | |
copies the plugin to the TextMate PlugIn dir | |
To use this capability create a new Custom Executable referencing TextMate: | |
"Project", "New Custom Executable..." | |
Then after setting breakpoints: Clean and then | |
"Build and Debug - Breakpoints On" | |
adapted from: http://developer.apple.com/mac/library/qa/qa2006/qa1500.html | |
--- | |
AckMate.xcodeproj/project.pbxproj | 2 +- | |
1 files changed, 1 insertions(+), 1 deletions(-) | |
diff --git a/AckMate.xcodeproj/project.pbxproj b/AckMate.xcodeproj/project.pbxproj | |
index cb80328..0e5f138 100644 | |
--- a/AckMate.xcodeproj/project.pbxproj | |
+++ b/AckMate.xcodeproj/project.pbxproj | |
@@ -332,7 +332,7 @@ | |
); | |
runOnlyForDeploymentPostprocessing = 0; | |
shellPath = /bin/sh; | |
- shellScript = "mkdir -p \"$HOME/Library/Application Support/TextMate/PlugIns\"\ncp -pR \"${TARGET_BUILD_DIR}/${FULL_PRODUCT_NAME}\" \"$HOME/Library/Application Support/TextMate/PlugIns\""; | |
+ shellScript = "mkdir -p \"$HOME/Library/Application Support/TextMate/PlugIns\"\n# adapted from: http://developer.apple.com/mac/library/qa/qa2006/qa1500.html\n# Depending on the build configuration, either copy or link to the most recent product\nrm -rf \"$HOME/Library/Application Support/TextMate/PlugIns/${FULL_PRODUCT_NAME}\"\nif [ \"${CONFIGURATION}\" == \"Debug\" ]; then\n # if we're debugging, add a symbolic link to the plug-in\n ln -sf \"${TARGET_BUILD_DIR}/${FULL_PRODUCT_NAME}\" \\\n \"$HOME/Library/Application Support/TextMate/PlugIns/${FULL_PRODUCT_NAME}\"\nelif [ \"${CONFIGURATION}\" == \"Release\" ]; then\n # if we're compiling for release, just copy the plugin to the Internet Plug-ins folder\n cp -pR \"${TARGET_BUILD_DIR}/${FULL_PRODUCT_NAME}\" \"$HOME/Library/Application Support/TextMate/PlugIns\"\nfi"; | |
}; | |
/* End PBXShellScriptBuildPhase section */ | |
-- | |
1.7.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From f42801da968a1e6fe2927fe7a24ccbaf617293f3 Mon Sep 17 00:00:00 2001 | |
From: Stephen Bannasch <stephen.bannasch@gmail.com> | |
Date: Fri, 27 Aug 2010 22:18:10 -0400 | |
Subject: [PATCH 2/2] hack to open files in mate via NSTask | |
See issue: | |
Searching inside symlinked folders opens a new window | |
http://github.com/protocool/AckMate/issues/#issue/5 | |
This is an unfinished hack because it doesn't wait for | |
mate to open before trying to move to the correct line. | |
It also doesn't check to make sure the mate shell | |
executable is installed. | |
--- | |
source/controllers/JPAckWindowController.h | 1 + | |
source/controllers/JPAckWindowController.m | 16 +++++++++++++++- | |
2 files changed, 16 insertions(+), 1 deletions(-) | |
diff --git a/source/controllers/JPAckWindowController.h b/source/controllers/JPAckWindowController.h | |
index ba9e345..e290c27 100644 | |
--- a/source/controllers/JPAckWindowController.h | |
+++ b/source/controllers/JPAckWindowController.h | |
@@ -36,6 +36,7 @@ extern NSString * const kJPAckWindowPosition; | |
NSString* selectedSearchFolder; | |
BOOL selectionSearch; | |
NSString* fileName; | |
+ NSTask* mateTask; | |
NSMutableDictionary* preferences; | |
NSArray* history; | |
diff --git a/source/controllers/JPAckWindowController.m b/source/controllers/JPAckWindowController.m | |
index ddd1f20..f2fba24 100644 | |
--- a/source/controllers/JPAckWindowController.m | |
+++ b/source/controllers/JPAckWindowController.m | |
@@ -20,6 +20,7 @@ | |
@property(nonatomic, retain) NSArray* ackTypes; | |
@property(nonatomic, readwrite, copy) NSArray* history; | |
@property(nonatomic, copy) NSString* selectedSearchFolder; | |
+@property(retain) NSTask* mateTask; | |
@end | |
@implementation JPAckWindowController | |
@@ -50,6 +51,7 @@ NSString * const kJPAckWindowPosition = @"kJPAckWindowPosition"; | |
@synthesize folders; | |
@synthesize currentProcess; | |
@synthesize currentTypesProcess; | |
+@synthesize mateTask; | |
+ (NSSet*)keyPathsForValuesAffectingRunning | |
{ | |
@@ -88,6 +90,8 @@ NSString * const kJPAckWindowPosition = @"kJPAckWindowPosition"; | |
preferences = prefs; | |
pasteboardChangeCount = NSNotFound; | |
+ mateTask = nil; | |
+ | |
NSString* projectfile = [projectController filename] ? [projectController filename] : directory; | |
fileName = [[[projectfile lastPathComponent] stringByDeletingPathExtension] copy]; | |
projectDirectory = [directory copy]; | |
@@ -327,8 +331,18 @@ NSString * const kJPAckWindowPosition = @"kJPAckWindowPosition"; | |
- (void)openProjectFile:(NSString*)file atLine:(NSString*)line selectionRange:(NSRange)selectionRange | |
{ | |
NSString* absolute = [projectDirectory stringByAppendingPathComponent:file]; | |
- [[[NSApplication sharedApplication] delegate] openFiles:[NSArray arrayWithObject:absolute]]; | |
+ // [[[NSApplication sharedApplication] delegate] openFiles:[NSArray arrayWithObject:absolute]]; | |
+ | |
+ self.mateTask = [[[NSTask alloc] init] autorelease]; | |
+ | |
+ [self.mateTask setCurrentDirectoryPath:projectDirectory]; | |
+ [self.mateTask setLaunchPath:@"/usr/bin/env"]; | |
+ NSMutableArray* args = [NSMutableArray arrayWithObjects:@"mate", absolute, nil]; | |
+ [self.mateTask setArguments:args]; | |
+ | |
+ [self.mateTask launch]; | |
+ | |
for (NSWindow *w in [[NSApplication sharedApplication] orderedWindows]) | |
{ | |
id wc = [w windowController]; | |
-- | |
1.7.2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment