loadup.el itself. */
public static native void initEmacs (String argv[], String dumpFile);
+ /* Call shut_down_emacs to auto-save and unlock files in the main
+ thread, then return. */
+ public static native void shutDownEmacs ();
+
/* Abort and generate a native core dump. */
public static native void emacsAbort ();
}
}
+ @Override
+ public void
+ onDestroy ()
+ {
+ /* This function is called immediately before the system kills
+ Emacs. In this respect, it is rather akin to a SIGDANGER
+ signal, so force an auto-save accordingly. */
+
+ EmacsNative.shutDownEmacs ();
+ super.onDestroy ();
+ }
+
\f
/* Functions from here on must only be called from the Emacs
kill (getpid (), SIGIO);
}
+/* Call shut_down_emacs subsequent to a call to the service's
+ onDestroy callback. CLOSURE is ignored. */
+
+static void
+android_shut_down_emacs (void *closure)
+{
+ __android_log_print (ANDROID_LOG_INFO, __func__,
+ "The Emacs service is being shut down");
+ shut_down_emacs (0, Qnil);
+}
+
+JNIEXPORT void JNICALL
+NATIVE_NAME (shutDownEmacs) (JNIEnv *env, jobject object)
+{
+ JNI_STACK_ALIGNMENT_PROLOGUE;
+
+ android_run_in_emacs_thread (android_shut_down_emacs, NULL);
+}
+
JNIEXPORT jlong JNICALL
NATIVE_NAME (sendConfigureNotify) (JNIEnv *env, jobject object,
jshort window, jlong time,