Hello, developers!
GMC has a separate file for bindings (a.k.a. associations), mc-gnome.ext.
It's clear from that code that an attempt was made to get rid of
mc-gnome.ext and switch to GNOME-specific bindings.
The bindings are processed by regex_command(), which was only used by
edit_cmd() in the GNOME edition.
However, edit_cmd() didn't work quite well with GMC. Notably, if $EDITOR
was set to a console-based editor, it won't be run in a separate window.
On the other hand, the GNOME edition provides gmc_edit(), which can handle
such editors. It also supports GNOME metadata, which makes it consistent
with the rest of the GMC code.
Given all the above, I'm replacing regex_command() with the appropriate
call to gmc_edit() in edit_cmd() for GMC.
regex_command() and ext_cmd() are now disabled for GMC. MC_USER_EXT and
MC_LIB_EXT will not be defined. Any traces of mc-gnome.ext are eliminated.
I'm applying this patch. A subsequent patch will remove mc-gnome.ext.in
from the MC source tree. Good thing - one file less to maintain.
Any comments will be appreciated.
Regards,
Pavel Roskin
__________________________
--- ChangeLog
+++ ChangeLog
@@ -1,5 +1,11 @@
2001-02-26 Pavel Roskin <[EMAIL PROTECTED]>
+ * cmd.c (edit_cmd) [HAVE_GNOME]: Use gmc_edit(). Don't use
+ regex_command().
+ (ext_cmd) [HAVE_GNOME]: Don't compile for GNOME.
+ * ext.c (regex_command) [HAVE_GNOME]: Likewise.
+ * ext.h [HAVE_GNOME]: Don't define MC_USER_EXT and MC_LIB_EXT.
+
* main.c (main): Don't call edit_init_file() - the editor should
care about its files itself.
--- cmd.c
+++ cmd.c
@@ -342,9 +342,13 @@
void edit_cmd (WPanel *panel)
{
+#ifndef HAVE_GNOME
panel = get_a_panel(panel);
if (!regex_command (selection (panel)->fname, "Edit", NULL, 0))
do_edit (selection (panel)->fname);
+#else
+ gmc_edit (selection (panel)->fname);
+#endif
}
void edit_cmd_new (WPanel *panel)
@@ -629,6 +633,7 @@
return 0;
}
+#ifndef HAVE_GNOME
void ext_cmd (void)
{
char *buffer;
@@ -654,6 +659,7 @@
g_free (extdir);
flush_extension_file ();
}
+#endif /* !HAVE_GNOME */
/* where = 0 - do edit a file menu for mc */
/* where = 1 - do edit a file menu for cool edit */
--- ext.c
+++ ext.c
@@ -351,6 +351,7 @@
* If action == "View" then a parameter is checked in the form of "View:%d",
* if the value for %d exists, then the viewer is started up at that line number.
*/
+#ifndef HAVE_GNOME
char *regex_command_title = NULL;
char *regex_command (char *filename, char *action, char **drops, int *move_dir)
{
@@ -692,3 +693,4 @@
easy_patterns = old_patterns;
return to_return;
}
+#endif /* !HAVE_GNOME */
--- ext.h
+++ ext.h
@@ -13,10 +13,7 @@
# define MC_USER_EXT "mc.ext"
# define MC_LIB_EXT "mc.ext"
#else
-# ifdef HAVE_GNOME
-# define MC_USER_EXT ".mc/gnome.ext"
-# define MC_LIB_EXT "mc-gnome.ext"
-# else
+# ifndef HAVE_GNOME
# define MC_USER_EXT ".mc/bindings"
# define MC_LIB_EXT "mc.ext"
# endif
__________________________