From d286f6889cf7877d79bbc2604d18819b72e9c97b Mon Sep 17 00:00:00 2001 From: Po Lu Date: Sat, 2 Sep 2023 10:05:23 +0800 Subject: [PATCH] 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'. --- doc/emacs/android.texi | 8 ++- java/AndroidManifest.xml.in | 75 +++-------------------- java/org/gnu/emacs/EmacsOpenActivity.java | 4 ++ 3 files changed, 20 insertions(+), 67 deletions(-) diff --git a/doc/emacs/android.texi b/doc/emacs/android.texi index 383555a87c9..d831a7a1884 100644 --- a/doc/emacs/android.texi +++ b/doc/emacs/android.texi @@ -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 diff --git a/java/AndroidManifest.xml.in b/java/AndroidManifest.xml.in index 2cbcdbc3e5b..21bb2af2530 100644 --- a/java/AndroidManifest.xml.in +++ b/java/AndroidManifest.xml.in @@ -107,73 +107,18 @@ along with GNU Emacs. If not, see . --> - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + diff --git a/java/org/gnu/emacs/EmacsOpenActivity.java b/java/org/gnu/emacs/EmacsOpenActivity.java index ea503ebd120..ca6d99e20b7 100644 --- a/java/org/gnu/emacs/EmacsOpenActivity.java +++ b/java/org/gnu/emacs/EmacsOpenActivity.java @@ -477,6 +477,10 @@ public final class EmacsOpenActivity extends Activity } } } + 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) { -- 2.39.2