diff --git a/doc/emacs/android.texi b/doc/emacs/android.texi
index d7fadd69e4b..d94b91c7ab7 100644
--- a/doc/emacs/android.texi
+++ b/doc/emacs/android.texi
@@ -608,16 +608,20 @@ to provide that style.
@cindex troubleshooting, android
@cindex emacs -Q, android
+@cindex emacs --debug-init, android
Since Android has no command line, there is normally no way to
specify command-line arguments when starting Emacs. This is very
nasty when you make a mistake in your Emacs initialization files that
prevents Emacs from starting up at all, as the system normally
prevents other programs from accessing Emacs's home directory.
+@xref{Initial Options}.
- However, Emacs can be started with the equivalent of the
-@code{--quick} option (@pxref{Initial Options}) through a special
-preferences screen, which can be accessed through the Emacs ``app
-info'' page in the system settings application.
+ However, Emacs can be started with the equivalent of either the
+option @code{--quick}, or @code{--debug-init}, through a special
+preferences screen. Under Android 7.0 and later, this can be accessed
+through the Emacs ``app info'' page in the system settings program; on
+older systems, this is displayed as a separate icon on the desktop
+labeled ``Emacs options''.
Consult the manufacturer of your device for more details, as how to
do this varies by device.
diff --git a/java/AndroidManifest.xml.in b/java/AndroidManifest.xml.in
index f7f834e7582..082c4c9373e 100644
--- a/java/AndroidManifest.xml.in
+++ b/java/AndroidManifest.xml.in
@@ -180,6 +180,23 @@ along with GNU Emacs. If not, see . -->
+
+
+
+
+
+
+
+
+
+
. */
+
+package org.gnu.emacs;
+
+/* This class only exists because EmacsPreferencesActivity is already
+ defined as an activity, the system wants a new class in order to
+ define a new activity, and only activities can be enabled or
+ disabled per the API level of the host. */
+
+public final class EmacsLauncherPreferencesActivity
+ extends EmacsPreferencesActivity
+{
+
+}
diff --git a/java/org/gnu/emacs/EmacsPreferencesActivity.java b/java/org/gnu/emacs/EmacsPreferencesActivity.java
index 70934fa4bd4..7e67cc3679b 100644
--- a/java/org/gnu/emacs/EmacsPreferencesActivity.java
+++ b/java/org/gnu/emacs/EmacsPreferencesActivity.java
@@ -42,10 +42,11 @@ import android.preference.*;
Unfortunately, there is no alternative that looks the same way. */
@SuppressWarnings ("deprecation")
-public final class EmacsPreferencesActivity extends PreferenceActivity
+public class EmacsPreferencesActivity extends PreferenceActivity
{
- /* Restart Emacs with -Q. Call EmacsThread.exit to kill Emacs now, and
- tell the system to EmacsActivity with some parameters later. */
+ /* Restart Emacs with -Q. Call EmacsThread.exit to kill Emacs now,
+ and tell the system to start EmacsActivity with some parameters
+ later. */
private void
startEmacsQ ()
@@ -55,7 +56,24 @@ public final class EmacsPreferencesActivity extends PreferenceActivity
intent = new Intent (this, EmacsActivity.class);
intent.addFlags (Intent.FLAG_ACTIVITY_NEW_TASK
| Intent.FLAG_ACTIVITY_CLEAR_TASK);
- intent.putExtra ("org.gnu.emacs.START_DASH_Q", true);
+ intent.putExtra ("org.gnu.emacs.STARTUP_ARGUMENT", "--quick");
+ startActivity (intent);
+ System.exit (0);
+ }
+
+ /* Restart Emacs with `--debug-init'. Call EmacsThread.exit to kill
+ Emacs now, and tell the system to EmacsActivity with some
+ parameters later. */
+
+ private void
+ startEmacsDebugInit ()
+ {
+ Intent intent;
+
+ intent = new Intent (this, EmacsActivity.class);
+ intent.addFlags (Intent.FLAG_ACTIVITY_NEW_TASK
+ | Intent.FLAG_ACTIVITY_CLEAR_TASK);
+ intent.putExtra ("org.gnu.emacs.STARTUP_ARGUMENT", "--debug-init");
startActivity (intent);
System.exit (0);
}
@@ -89,7 +107,7 @@ public final class EmacsPreferencesActivity extends PreferenceActivity
}
@Override
- public void
+ public final void
onCreate (Bundle savedInstanceState)
{
Preference tem;
@@ -111,7 +129,6 @@ public final class EmacsPreferencesActivity extends PreferenceActivity
items. */
tem = findPreference ("start_quick");
-
listener = new Preference.OnPreferenceClickListener () {
@Override
public boolean
@@ -123,9 +140,19 @@ public final class EmacsPreferencesActivity extends PreferenceActivity
};
tem.setOnPreferenceClickListener (listener);
+ tem = findPreference ("start_debug_init");
+ listener = new Preference.OnPreferenceClickListener () {
+ @Override
+ public boolean
+ onPreferenceClick (Preference preference)
+ {
+ startEmacsDebugInit ();
+ return true;
+ }
+ };
+ tem.setOnPreferenceClickListener (listener);
tem = findPreference ("erase_dump");
-
listener = new Preference.OnPreferenceClickListener () {
@Override
public boolean
diff --git a/java/org/gnu/emacs/EmacsService.java b/java/org/gnu/emacs/EmacsService.java
index 30ef71540a9..bb17d27bcf8 100644
--- a/java/org/gnu/emacs/EmacsService.java
+++ b/java/org/gnu/emacs/EmacsService.java
@@ -79,7 +79,10 @@ public final class EmacsService extends Service
{
public static final String TAG = "EmacsService";
public static volatile EmacsService SERVICE;
- public static boolean needDashQ;
+
+ /* If non-NULL, an extra argument to pass to
+ `android_emacs_init'. */
+ public static String extraStartupArgument;
private EmacsThread thread;
private Handler handler;
@@ -231,7 +234,7 @@ public final class EmacsService extends Service
(float) pixelDensityY,
classPath, EmacsService.this);
}
- }, needDashQ,
+ }, extraStartupArgument,
/* If any file needs to be opened, open it now. */
EmacsOpenActivity.fileToOpen);
thread.start ();
diff --git a/java/org/gnu/emacs/EmacsThread.java b/java/org/gnu/emacs/EmacsThread.java
index d175fe332b5..468c6530af0 100644
--- a/java/org/gnu/emacs/EmacsThread.java
+++ b/java/org/gnu/emacs/EmacsThread.java
@@ -29,8 +29,9 @@ public class EmacsThread extends Thread
{
private static final String TAG = "EmacsThread";
- /* Whether or not Emacs should be started -Q. */
- private boolean startDashQ;
+ /* Whether or not Emacs should be started with an additional
+ argument, and that additional argument if non-NULL. */
+ private String extraStartupArgument;
/* Runnable run to initialize Emacs. */
private Runnable paramsClosure;
@@ -40,10 +41,10 @@ public class EmacsThread extends Thread
public
EmacsThread (EmacsService service, Runnable paramsClosure,
- boolean startDashQ, String fileToOpen)
+ String extraStartupArgument, String fileToOpen)
{
super ("Emacs main thread");
- this.startDashQ = startDashQ;
+ this.extraStartupArgument = extraStartupArgument;
this.paramsClosure = paramsClosure;
this.fileToOpen = fileToOpen;
}
@@ -56,18 +57,20 @@ public class EmacsThread extends Thread
if (fileToOpen == null)
{
- if (!startDashQ)
+ if (extraStartupArgument == null)
args = new String[] { "libandroid-emacs.so", };
else
- args = new String[] { "libandroid-emacs.so", "-Q", };
+ args = new String[] { "libandroid-emacs.so",
+ extraStartupArgument, };
}
else
{
- if (!startDashQ)
+ if (extraStartupArgument != null)
args = new String[] { "libandroid-emacs.so",
fileToOpen, };
else
- args = new String[] { "libandroid-emacs.so", "-Q",
+ args = new String[] { "libandroid-emacs.so",
+ extraStartupArgument,
fileToOpen, };
}
diff --git a/java/res/drawable/emacs_wrench.png b/java/res/drawable/emacs_wrench.png
new file mode 100644
index 00000000000..50572d3bed1
Binary files /dev/null and b/java/res/drawable/emacs_wrench.png differ
diff --git a/java/res/values-v24/bool.xml b/java/res/values-v24/bool.xml
new file mode 100644
index 00000000000..37f07992995
--- /dev/null
+++ b/java/res/values-v24/bool.xml
@@ -0,0 +1,22 @@
+
+
+
+ false
+
diff --git a/java/res/values/bool.xml b/java/res/values/bool.xml
index d37eab745c0..2b253824e29 100644
--- a/java/res/values/bool.xml
+++ b/java/res/values/bool.xml
@@ -19,4 +19,5 @@ along with GNU Emacs. If not, see . -->
false
+ true
diff --git a/java/res/values/strings.xml b/java/res/values/strings.xml
new file mode 100644
index 00000000000..36a47be6c84
--- /dev/null
+++ b/java/res/values/strings.xml
@@ -0,0 +1,39 @@
+
+
+
+
+ Restart Emacs with -Q
+
+
+ Restart Emacs, but do not load site lisp or init files.
+
+
+ Restart Emacs with --debug-init
+
+
+ Restart Emacs, and display the debugger should an error occur while loading initialization files.
+
+
+ Delete dump file
+
+
+ Remove the dumped state created when Emacs was installed.
+
+
diff --git a/java/res/xml/preferences.xml b/java/res/xml/preferences.xml
index f0c3abb52e7..d52d28816e5 100644
--- a/java/res/xml/preferences.xml
+++ b/java/res/xml/preferences.xml
@@ -19,10 +19,12 @@ along with GNU Emacs. If not, see . -->
-
+ android:title="@string/start_quick_title"
+ android:summary="@string/start_quick_caption"/>
+
+ android:title="@string/erase_dump_title"
+ android:summary="@string/erase_dump_caption"/>