diff --git a/moo.mprj b/moo.mprj
index 7595760f..8875cbdf 100644
--- a/moo.mprj
+++ b/moo.mprj
@@ -34,7 +34,7 @@
- /home/muntyan/projects/moo/
+ /home/muntyan/projects/moo/moo/mooedit/
--g-fatal-warnings --new-app --mode=project
medit/medit
diff --git a/moo/mooedit/plugins/fileselector/moofileselector.c b/moo/mooedit/plugins/fileselector/moofileselector.c
index 293072d2..993c8b26 100644
--- a/moo/mooedit/plugins/fileselector/moofileselector.c
+++ b/moo/mooedit/plugins/fileselector/moofileselector.c
@@ -303,6 +303,22 @@ moo_file_selector_activate (MooFileView *fileview,
#ifdef MOO_USE_XDGMIME
{
const char *mime_type = xdg_mime_get_mime_type_for_file (path, &statbuf);
+
+ if (!strcmp (mime_type, "application/x-trash"))
+ {
+ guint i;
+ const char *bak_suffixes[] = {"~", "%", ".bak", ".old", ".sik"};
+
+ for (i = 0; i < G_N_ELEMENTS (bak_suffixes); ++i)
+ if (g_str_has_suffix (path, bak_suffixes[i]))
+ {
+ char *tmp = g_strndup (path, strlen (path) - strlen (bak_suffixes[i]));
+ mime_type = xdg_mime_get_mime_type_from_file_name (tmp);
+ g_free (tmp);
+ break;
+ }
+ }
+
is_text = !strcmp (mime_type, "application/octet-stream") ||
xdg_mime_mime_type_subclass (mime_type, "text/plain");
is_exe = !strcmp (mime_type, "application/x-executable");