the menu bar, so help text in the menu bar will display in the echo
area instead.
+@cindex X resources on Haiku
+ Unlike the X window system, Haiku does not have a system-wide
+resource database. Since many important options are are specified via
+X resources (@pxref{X Resources}), an emulation is provided: upon
+startup, Emacs will load a file named @file{GNU Emacs} inside the user
+configuration directory (normally @file{/boot/home/config/settings}),
+which should be a flattened system message where keys and values are
+both strings, and correspond to attributes and their values
+respectively.
+
+You can create such a file with the tool @code{xmlbmessage}, which is
+free software.
+
@subsection What to do when Emacs crashes
@cindex crashes, Haiku
@cindex haiku debugger
class Emacs : public BApplication
{
public:
+ BMessage settings;
+ bool settings_valid_p = false;
+
Emacs () : BApplication ("application/x-vnd.GNU-emacs")
{
+ BPath settings_path;
+
+ if (find_directory (B_USER_SETTINGS_DIRECTORY, &settings_path) != B_OK)
+ return;
+
+ settings_path.Append (PACKAGE_NAME);
+
+ BEntry entry (settings_path.Path ());
+ BFile settings_file (&entry, B_READ_ONLY | B_CREATE_FILE);
+
+ if (settings.Unflatten (&settings_file) != B_OK)
+ return;
+
+ settings_valid_p = true;
}
void
w->UnlockLooper ();
}
}
+
+/* Find a resource by the name NAME inside the settings file. The
+ string returned is in UTF-8 encoding, and will stay allocated as
+ long as the BApplication (a.k.a display) is alive. */
+const char *
+be_find_setting (const char *name)
+{
+ Emacs *app = (Emacs *) be_app;
+ const char *value;
+
+ /* Note that this is thread-safe since the constructor of `Emacs'
+ runs in the main thread. */
+ if (!app->settings_valid_p)
+ return NULL;
+
+ if (app->settings.FindString (name, 0, &value) != B_OK)
+ return NULL;
+
+ return value;
+}
extern void
BWindow_set_override_redirect (void *window, bool override_redirect_p);
+ extern const char *
+ be_find_setting (const char *name);
+
#ifdef __cplusplus
extern void *
find_appropriate_view_for_draw (void *vw);
static const char *
get_string_resource (void *ignored, const char *name, const char *class)
{
+ const char *native;
+
if (!name)
return NULL;
if (!NILP (lval))
return SSDATA (XCDR (lval));
+ if ((native = be_find_setting (name)))
+ return native;
+
return NULL;
}