1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-29 07:58:28 +00:00

Open org-protocol:// links on Android

* doc/emacs/android.texi (Android Startup): Revise to reflect
changes in the set of files registered for Emacsclient and
mention org-protocol support.

* java/AndroidManifest.xml.in: Open all files, not just a
particular subset of image and data files.  Register an
org-protocol scheme handler.

* java/org/gnu/emacs/EmacsOpenActivity.java (onCreate): Provide
URI to Emacs verbatim if its scheme is `org-protocol'.
This commit is contained in:
Po Lu 2023-09-02 10:05:23 +08:00
parent f735eb9628
commit d286f6889c
3 changed files with 20 additions and 67 deletions

View File

@ -129,8 +129,7 @@ buffer.
Since there is no other way to start the @command{emacsclient}
program (@pxref{Emacs Server}) from another Android program, Emacs
provides a wrapper around the @command{emacsclient} program, which is
registered with the system as an application that can open all text
files.
registered with the system as an application that can open any file.
When that wrapper is selected as the program with which to open a
file, it invokes @command{emacsclient} with the options
@ -154,6 +153,11 @@ directory, or try to open files in it yourself.
case such files are copied to a temporary directory before being
opened.
@cindex ``org-protocol'' links, android
In addition to opening ordinary text files, Emacs also registers its
@command{emacsclient} wrapper as a program capable of opening
``org-protocol'' links (@pxref{Protocols,,,org, The Org Manual}).
@node Android File System
@section What Files Emacs Can Access on Android
@cindex /assets directory, android

View File

@ -107,73 +107,18 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. -->
<action android:name="android.intent.action.VIEW"/>
<action android:name="android.intent.action.EDIT"/>
<action android:name="android.intent.action.PICK"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="*/*"/>
</intent-filter>
<data android:mimeType="image/aces"/>
<data android:mimeType="image/avci"/>
<data android:mimeType="image/avcs"/>
<data android:mimeType="image/avif"/>
<data android:mimeType="image/bmp"/>
<data android:mimeType="image/cgm"/>
<data android:mimeType="image/dicom-rle"/>
<data android:mimeType="image/dpx"/>
<data android:mimeType="image/emf"/>
<data android:mimeType="image/example"/>
<data android:mimeType="image/fits"/>
<data android:mimeType="image/g3fax"/>
<data android:mimeType="image/heic"/>
<data android:mimeType="image/heic-sequence"/>
<data android:mimeType="image/heif"/>
<data android:mimeType="image/heif-sequence"/>
<data android:mimeType="image/hej2k"/>
<data android:mimeType="image/hsj2"/>
<data android:mimeType="image/jls"/>
<data android:mimeType="image/jp2"/>
<data android:mimeType="image/jph"/>
<data android:mimeType="image/jphc"/>
<data android:mimeType="image/jpm"/>
<data android:mimeType="image/jpx"/>
<data android:mimeType="image/jxr"/>
<data android:mimeType="image/jxrA"/>
<data android:mimeType="image/jxrS"/>
<data android:mimeType="image/jxs"/>
<data android:mimeType="image/jxsc"/>
<data android:mimeType="image/jxsi"/>
<data android:mimeType="image/jxss"/>
<data android:mimeType="image/ktx"/>
<data android:mimeType="image/ktx2"/>
<data android:mimeType="image/naplps"/>
<data android:mimeType="image/png"/>
<data android:mimeType="image/prs.btif"/>
<data android:mimeType="image/prs.pti"/>
<data android:mimeType="image/pwg-raster"/>
<data android:mimeType="image/svg+xml"/>
<data android:mimeType="image/t38"/>
<data android:mimeType="image/tiff"/>
<data android:mimeType="image/tiff-fx"/>
<data android:mimeType="image/xpm"/>
<data android:mimeType="text/*"/>
<data android:mimeType="application/*xml"/>
<data android:mimeType="application/atom+xml"/>
<data android:mimeType="application/dxf"/>
<data android:mimeType="application/ecmascript"/>
<data android:mimeType="application/javascript"/>
<data android:mimeType="application/json"/>
<data android:mimeType="application/*log*"/>
<data android:mimeType="application/octet-stream"/>
<data android:mimeType="application/soap+xm"/>
<data android:mimeType="application/x-caramel"/>
<data android:mimeType="application/x-klaunch"/>
<data android:mimeType="application/x-latex"/>
<data android:mimeType="application/x-sh"/>
<data android:mimeType="application/x-tcl"/>
<data android:mimeType="application/x-tex*"/>
<data android:mimeType="application/x-troff*"/>
<data android:mimeType="application/xhtml+xml"/>
<data android:mimeType="application/xml*"/>
<data android:mimeType="application/zip"/>
<data android:mimeType="application/x-zip-compressed"/>
<!-- Facilitate opening org-protocol:// URLs as well, the same
way emacsclient.desktop does. -->
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:scheme="org-protocol"/>
</intent-filter>
</activity>

View File

@ -477,6 +477,10 @@ private class EmacsClientThread extends Thread
}
}
}
else if (uri.getScheme ().equals ("org-protocol"))
/* URL is an org-protocol:// link, which is meant to be
directly relayed to emacsclient. */
fileName = uri.toString ();
if (fileName == null)
{