Skip to content

Add support for txmt scheme #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ build/*
*.xcodeproj/*.pbxuser
*.xcodeproj/*.perspectivev3
*.xcodeproj/TemplateIcon.icns
*.xcodeproj/project.xcworkspace
*.xcodeproj/xcuserdata
4 changes: 3 additions & 1 deletion Classes/App.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ -(void)handleGetURLEvent:(NSAppleEventDescriptor *)event withReplyEvent:(NSApple
if (nil == path) return;

// emacs://open/?url=file://~/.bash_profile&line=11&column=2
// or
// txmt://open/?url=file://~/.bash_profile&line=11&column=2
NSURL *url = [NSURL URLWithString:[[event paramDescriptorForKeyword:keyDirectObject] stringValue]];

if (url && [[url host] isEqualToString:@"open"]) {
Expand All @@ -30,7 +32,7 @@ -(void)handleGetURLEvent:(NSAppleEventDescriptor *)event withReplyEvent:(NSApple
if (file) {
NSTask *task = [[NSTask alloc] init];
[task setLaunchPath:path];
[task setArguments:[NSArray arrayWithObjects:@"-n", [NSString stringWithFormat:@"+%d:%d", [line integerValue], [column integerValue]], file, nil]];
[task setArguments:[NSArray arrayWithObjects:@"-n", [NSString stringWithFormat:@"+%ld:%ld", [line integerValue], [column integerValue]], file, nil]];
[task launch];
[task release];
}
Expand Down
1 change: 1 addition & 0 deletions Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<key>CFBundleURLSchemes</key>
<array>
<string>emacs</string>
<string>txmt</string>
</array>
<key>CFBundleURLName</key>
<string>org.unknownplace.emacshandler</string>
Expand Down
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
EmacsURLHandler for OSX
=======================

This application enables your emacs to open files via hyperlinks starts with `emacs://` something like:
This application enables your emacs to open files via hyperlinks starts with `emacs://` or `txmt://` something like:

emacs://open/?url=file:///etc/passwd&line=10&column=2
txmt://open/?url=file:///etc/passwd&line=10&column=2

This URL format is same as TextMate's `txmt:` scheme described [here](http://manual.macromates.com/en/using_textmate_from_terminal#url_scheme_html)

Expand All @@ -16,12 +17,12 @@ Requirements
Download
--------

[EmacsHandler-1.0.zip](http://cloud.github.com/downloads/typester/emacs-handler/EmacsHandler-1.0.zip) (Universal Binary)
[EmacsHandler-1.0.zip](http://zgroupsoft.com/EmacsHandler-1.0.zip) (Universal Binary)

Installation
------------

Download [latest release](http://cloud.github.com/downloads/typester/emacs-handler/EmacsHandler-1.0.zip).
Download [latest release](http://zgroupsoft.com/EmacsHandler-1.0.zip).

Unzip it, and install it in your Applications directory.

Expand All @@ -37,8 +38,9 @@ Test it
Open terminal and type:

open 'emacs://open/?url=file:///etc/hosts'
open 'txmt://open/?url=file:///etc/hosts'

or just click [this link](emacs://open/?url=file:///etc/hosts)
or just click [this link](emacs://open/?url=file:///etc/hosts) or [this](txmt://open/?url=file:///etc/hosts)


Uninstalling
Expand Down
26 changes: 17 additions & 9 deletions emacs-handler.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 45;
objectVersion = 46;
objects = {

/* Begin PBXBuildFile section */
Expand Down Expand Up @@ -143,9 +143,16 @@
/* Begin PBXProject section */
29B97313FDCFA39411CA2CEA /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0450;
};
buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "emacs-handler" */;
compatibilityVersion = "Xcode 3.1";
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 1;
knownRegions = (
en,
);
mainGroup = 29B97314FDCFA39411CA2CEA /* emacs-handler */;
projectDirPath = "";
projectRoot = "";
Expand Down Expand Up @@ -204,9 +211,9 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = NO;
GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_FIX_AND_CONTINUE = YES;
GCC_MODEL_TUNING = G5;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PRECOMPILE_PREFIX_HEADER = NO;
Expand All @@ -220,6 +227,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
COMBINE_HIDPI_IMAGES = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_MODEL_TUNING = G5;
GCC_PRECOMPILE_PREFIX_HEADER = NO;
Expand All @@ -232,26 +240,26 @@
C01FCF4F08A954540054247B /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
ARCHS = "$(NATIVE_ARCH_ACTUAL)";
GCC_C_LANGUAGE_STANDARD = c99;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.7;
ONLY_ACTIVE_ARCH = YES;
PREBINDING = NO;
SDKROOT = macosx10.5;
SDKROOT = "";
};
name = Debug;
};
C01FCF5008A954540054247B /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
ARCHS = "$(NATIVE_ARCH_ACTUAL)";
GCC_C_LANGUAGE_STANDARD = c99;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
PREBINDING = NO;
SDKROOT = macosx10.5;
MACOSX_DEPLOYMENT_TARGET = 10.7;
SDKROOT = "";
};
name = Release;
};
Expand Down