pajato0
pajato0

Reputation: 3676

How would I go about developing a file handler for Chrome and/or Chromium?

I would like to develop a browser plugin/extension (I'm not sure how they differ) for a particular (possibly new) file type. To be very explicit, I would like to visit a file, "foo.org", using my browser in something like Drop Box or Google Drive and have the browser treat the file as Emacs would treat an org-mode file. Eventually I would like to develop a full Emacs plugin/extension and be able to configure the browser to handle files with this plugin/extension based on the file extension or a file grokking heuristic.

Any solution that I develop will allow the editing to take place directly in the browser's tab area, i.e. a seamless solution (as opposed the useful but seamy Edit with Emacs solution referenced below). In the same way that Chrome recognizes a spreadsheet or word document and invokes the appropriate Google Docs tool, I would like to get an Emacs-lite editor handle the foo.org file. Another way to ask the question is: how do Google Docs tools get invoked within Chrome and perform the associated editing task. And are these tools open source?

Upvotes: 1

Views: 276

Answers (2)

Tikhon Jelvis
Tikhon Jelvis

Reputation: 68172

You should consider building on Ymacs which is an Emacs-like editor in the browser.

For browser extensions, there is an experimental downloads api. However, it doesn't let you monitor downloads at the moment. This is planned for the future:

In the future, you will also be able to monitor and manipulate downloads.

However, you can probably just use some JavaScript and replace all links to *.org files with links that open in a tab running Ymacs. This should have the same effect--clicking a *.org link will open it in a new tab.

Take a look at content scripts and the tab api for documentation on how to inject a script into every page and how to open new tabs.

Upvotes: 1

jdd
jdd

Reputation: 4336

Take a look at Edit with Emacs , it should help you get (at least) part of the way there.

Upvotes: 0

Related Questions