mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-03 18:14:25 +03:00
Rename macros with editor-related file locations.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
3c38214458
commit
81b1f47e01
@ -64,18 +64,18 @@
|
||||
#define MC_SKINS_SUBDIR "skins"
|
||||
|
||||
/* editor home directory */
|
||||
#define EDIT_DIR "mcedit"
|
||||
#define EDIT_HOME_DIR "mcedit"
|
||||
|
||||
/* file names */
|
||||
#define MC_EXTMACRO_FILE EDIT_DIR PATH_SEP_STR "macros.d" PATH_SEP_STR "macro"
|
||||
#define EDIT_SYNTAX_FILE EDIT_DIR PATH_SEP_STR "Syntax"
|
||||
#define EDIT_CLIP_FILE EDIT_DIR PATH_SEP_STR "mcedit.clip"
|
||||
#define EDIT_BLOCK_FILE EDIT_DIR PATH_SEP_STR "mcedit.block"
|
||||
#define EDIT_TEMP_FILE EDIT_DIR PATH_SEP_STR "mcedit.temp"
|
||||
#define EDIT_HOME_MACRO_FILE EDIT_HOME_DIR PATH_SEP_STR "macros.d" PATH_SEP_STR "macro"
|
||||
#define EDIT_HOME_SYNTAX_FILE EDIT_HOME_DIR PATH_SEP_STR "Syntax"
|
||||
#define EDIT_HOME_CLIP_FILE EDIT_HOME_DIR PATH_SEP_STR "mcedit.clip"
|
||||
#define EDIT_HOME_BLOCK_FILE EDIT_HOME_DIR PATH_SEP_STR "mcedit.block"
|
||||
#define EDIT_HOME_TEMP_FILE EDIT_HOME_DIR PATH_SEP_STR "mcedit.temp"
|
||||
|
||||
#define EDIT_GLOBAL_MENU "mcedit.menu"
|
||||
#define EDIT_LOCAL_MENU ".cedit.menu"
|
||||
#define EDIT_HOME_MENU EDIT_DIR PATH_SEP_STR "menu"
|
||||
#define EDIT_HOME_MENU EDIT_HOME_DIR PATH_SEP_STR "menu"
|
||||
|
||||
/*** enums ***************************************************************************************/
|
||||
|
||||
|
@ -68,10 +68,10 @@ static const struct
|
||||
{ "hotlist", &mc_config_str, MC_HOTLIST_FILE},
|
||||
{ "mc.keymap", &mc_config_str, GLOBAL_KEYMAP_FILE},
|
||||
{ "menu", &mc_config_str, MC_USERMENU_FILE},
|
||||
{ "cedit" PATH_SEP_STR "Syntax", &mc_config_str, EDIT_SYNTAX_FILE},
|
||||
{ "cedit" PATH_SEP_STR "Syntax", &mc_config_str, EDIT_HOME_SYNTAX_FILE},
|
||||
{ "cedit" PATH_SEP_STR "menu", &mc_config_str, EDIT_HOME_MENU},
|
||||
{ "cedit" PATH_SEP_STR "edit.indent.rc", &mc_config_str, EDIT_DIR PATH_SEP_STR "edit.indent.rc"},
|
||||
{ "cedit" PATH_SEP_STR "edit.spell.rc", &mc_config_str, EDIT_DIR PATH_SEP_STR "edit.spell.rc"},
|
||||
{ "cedit" PATH_SEP_STR "edit.indent.rc", &mc_config_str, EDIT_HOME_DIR PATH_SEP_STR "edit.indent.rc"},
|
||||
{ "cedit" PATH_SEP_STR "edit.spell.rc", &mc_config_str, EDIT_HOME_DIR PATH_SEP_STR "edit.spell.rc"},
|
||||
{ "panels.ini", &mc_config_str, MC_PANELS_FILE},
|
||||
|
||||
/* User should move this file with applying some changes in file */
|
||||
@ -86,14 +86,14 @@ static const struct
|
||||
{ "extfs.d", &mc_data_str, MC_EXTFS_DIR},
|
||||
{ "history", &mc_data_str, MC_HISTORY_FILE},
|
||||
{ "filepos", &mc_data_str, MC_FILEPOS_FILE},
|
||||
{ "cedit" PATH_SEP_STR "cooledit.clip", &mc_data_str, EDIT_CLIP_FILE},
|
||||
{ "cedit" PATH_SEP_STR "cooledit.clip", &mc_data_str, EDIT_HOME_CLIP_FILE},
|
||||
{ "", &mc_data_str, MC_MACRO_FILE},
|
||||
|
||||
/* cache */
|
||||
{ "log", &mc_cache_str, "mc.log"},
|
||||
{ "Tree", &mc_cache_str, MC_TREESTORE_FILE},
|
||||
{ "cedit" PATH_SEP_STR "cooledit.temp", &mc_cache_str, EDIT_TEMP_FILE},
|
||||
{ "cedit" PATH_SEP_STR "cooledit.block", &mc_cache_str, EDIT_BLOCK_FILE},
|
||||
{ "cedit" PATH_SEP_STR "cooledit.temp", &mc_cache_str, EDIT_HOME_TEMP_FILE},
|
||||
{ "cedit" PATH_SEP_STR "cooledit.block", &mc_cache_str, EDIT_HOME_BLOCK_FILE},
|
||||
|
||||
{NULL, NULL, NULL}
|
||||
/* *INDENT-ON* */
|
||||
@ -110,15 +110,15 @@ static const struct
|
||||
{
|
||||
/* *INDENT-OFF* */
|
||||
{ &mc_data_str, MC_USERMENU_FILE, &mc_config_str},
|
||||
{ &mc_data_str, EDIT_SYNTAX_FILE, &mc_config_str},
|
||||
{ &mc_data_str, EDIT_HOME_SYNTAX_FILE, &mc_config_str},
|
||||
{ &mc_data_str, EDIT_HOME_MENU, &mc_config_str},
|
||||
{ &mc_data_str, EDIT_DIR PATH_SEP_STR "edit.indent.rc", &mc_config_str},
|
||||
{ &mc_data_str, EDIT_DIR PATH_SEP_STR "edit.spell.rc", &mc_config_str},
|
||||
{ &mc_data_str, EDIT_HOME_DIR PATH_SEP_STR "edit.indent.rc", &mc_config_str},
|
||||
{ &mc_data_str, EDIT_HOME_DIR PATH_SEP_STR "edit.spell.rc", &mc_config_str},
|
||||
{ &mc_data_str, MC_FILEBIND_FILE, &mc_config_str},
|
||||
|
||||
{ &mc_cache_str, MC_HISTORY_FILE, &mc_data_str},
|
||||
{ &mc_cache_str, MC_FILEPOS_FILE, &mc_data_str},
|
||||
{ &mc_cache_str, EDIT_CLIP_FILE, &mc_data_str},
|
||||
{ &mc_cache_str, EDIT_HOME_CLIP_FILE, &mc_data_str},
|
||||
|
||||
{ &mc_cache_str, MC_PANELS_FILE, &mc_config_str},
|
||||
|
||||
@ -435,10 +435,10 @@ mc_config_migrate_from_old_place (GError ** mcerror, char **msg)
|
||||
|
||||
old_dir = mc_config_get_deprecated_path ();
|
||||
|
||||
g_free (mc_config_init_one_config_path (mc_config_str, EDIT_DIR, mcerror));
|
||||
g_free (mc_config_init_one_config_path (mc_config_str, EDIT_HOME_DIR, mcerror));
|
||||
#if MC_HOMEDIR_XDG
|
||||
g_free (mc_config_init_one_config_path (mc_cache_str, EDIT_DIR, mcerror));
|
||||
g_free (mc_config_init_one_config_path (mc_data_str, EDIT_DIR, mcerror));
|
||||
g_free (mc_config_init_one_config_path (mc_cache_str, EDIT_HOME_DIR, mcerror));
|
||||
g_free (mc_config_init_one_config_path (mc_data_str, EDIT_HOME_DIR, mcerror));
|
||||
#endif /* MC_HOMEDIR_XDG */
|
||||
|
||||
mc_return_val_if_error (mcerror, FALSE);
|
||||
|
@ -81,7 +81,7 @@ clipboard_file_to_ext_clip (const gchar * event_group_name, const gchar * event_
|
||||
if (d == NULL || clipboard_store_path == NULL || clipboard_store_path[0] == '\0')
|
||||
return TRUE;
|
||||
|
||||
tmp = mc_config_get_full_path (EDIT_CLIP_FILE);
|
||||
tmp = mc_config_get_full_path (EDIT_HOME_CLIP_FILE);
|
||||
cmd = g_strconcat (clipboard_store_path, " ", tmp, " 2>/dev/null", (char *) NULL);
|
||||
|
||||
if (cmd != NULL)
|
||||
@ -146,7 +146,7 @@ clipboard_file_from_ext_clip (const gchar * event_group_name, const gchar * even
|
||||
{
|
||||
vfs_path_t *fname_vpath;
|
||||
|
||||
fname_vpath = mc_config_get_full_vpath (EDIT_CLIP_FILE);
|
||||
fname_vpath = mc_config_get_full_vpath (EDIT_HOME_CLIP_FILE);
|
||||
file = mc_open (fname_vpath, clip_open_flags, clip_open_mode);
|
||||
vfs_path_free (fname_vpath);
|
||||
|
||||
@ -186,7 +186,7 @@ clipboard_text_to_file (const gchar * event_group_name, const gchar * event_name
|
||||
if (text == NULL)
|
||||
return FALSE;
|
||||
|
||||
fname_vpath = mc_config_get_full_vpath (EDIT_CLIP_FILE);
|
||||
fname_vpath = mc_config_get_full_vpath (EDIT_HOME_CLIP_FILE);
|
||||
file = mc_open (fname_vpath, clip_open_flags, clip_open_mode);
|
||||
vfs_path_free (fname_vpath);
|
||||
|
||||
@ -221,7 +221,7 @@ clipboard_text_from_file (const gchar * event_group_name, const gchar * event_na
|
||||
(void) event_name;
|
||||
(void) init_data;
|
||||
|
||||
fname = mc_config_get_full_path (EDIT_CLIP_FILE);
|
||||
fname = mc_config_get_full_path (EDIT_HOME_CLIP_FILE);
|
||||
f = fopen (fname, "r");
|
||||
g_free (fname);
|
||||
|
||||
|
@ -49,7 +49,7 @@
|
||||
#include "lib/tty/tty.h" /* attrset() */
|
||||
#include "lib/tty/key.h" /* is_idle() */
|
||||
#include "lib/skin.h" /* EDITOR_NORMAL_COLOR */
|
||||
#include "lib/fileloc.h" /* EDIT_BLOCK_FILE */
|
||||
#include "lib/fileloc.h" /* EDIT_HOME_BLOCK_FILE */
|
||||
#include "lib/vfs/vfs.h"
|
||||
#include "lib/strutil.h" /* utf string functions */
|
||||
#include "lib/util.h" /* load_file_position(), save_file_position() */
|
||||
@ -1769,7 +1769,7 @@ user_menu (WEdit * edit, const char *menu_file, int selected_entry)
|
||||
struct stat status;
|
||||
vfs_path_t *block_file_vpath;
|
||||
|
||||
block_file = mc_config_get_full_path (EDIT_BLOCK_FILE);
|
||||
block_file = mc_config_get_full_path (EDIT_HOME_BLOCK_FILE);
|
||||
block_file_vpath = vfs_path_from_str (block_file);
|
||||
curs = edit->buffer.curs1;
|
||||
nomark = !eval_marks (edit, &start_mark, &end_mark);
|
||||
|
@ -1087,7 +1087,7 @@ edit_save_block_to_clip_file (WEdit * edit, off_t start, off_t finish)
|
||||
gboolean ret;
|
||||
gchar *tmp;
|
||||
|
||||
tmp = mc_config_get_full_path (EDIT_CLIP_FILE);
|
||||
tmp = mc_config_get_full_path (EDIT_HOME_CLIP_FILE);
|
||||
ret = edit_save_block (edit, tmp, start, finish);
|
||||
g_free (tmp);
|
||||
|
||||
@ -2145,7 +2145,7 @@ edit_load_syntax_file (WDialog * h)
|
||||
{
|
||||
vfs_path_t *user_syntax_file_vpath;
|
||||
|
||||
user_syntax_file_vpath = mc_config_get_full_vpath (EDIT_SYNTAX_FILE);
|
||||
user_syntax_file_vpath = mc_config_get_full_vpath (EDIT_HOME_SYNTAX_FILE);
|
||||
check_for_default (extdir_vpath, user_syntax_file_vpath);
|
||||
ret = edit_load_file_from_filename (h, user_syntax_file_vpath);
|
||||
vfs_path_free (user_syntax_file_vpath);
|
||||
@ -3022,7 +3022,7 @@ edit_paste_from_X_buf_cmd (WEdit * edit)
|
||||
|
||||
/* try use external clipboard utility */
|
||||
mc_event_raise (MCEVENT_GROUP_CORE, "clipboard_file_from_ext_clip", NULL);
|
||||
tmp = mc_config_get_full_vpath (EDIT_CLIP_FILE);
|
||||
tmp = mc_config_get_full_vpath (EDIT_HOME_CLIP_FILE);
|
||||
ret = (edit_insert_file (edit, tmp) >= 0);
|
||||
vfs_path_free (tmp);
|
||||
|
||||
@ -3083,7 +3083,7 @@ edit_save_block_cmd (WEdit * edit)
|
||||
if (!eval_marks (edit, &start_mark, &end_mark))
|
||||
return TRUE;
|
||||
|
||||
tmp = mc_config_get_full_path (EDIT_CLIP_FILE);
|
||||
tmp = mc_config_get_full_path (EDIT_HOME_CLIP_FILE);
|
||||
exp =
|
||||
input_expand_dialog (_("Save block"), _("Enter file name:"),
|
||||
MC_HISTORY_EDIT_SAVE_BLOCK, tmp, INPUT_COMPLETE_FILENAMES);
|
||||
@ -3115,7 +3115,7 @@ edit_insert_file_cmd (WEdit * edit)
|
||||
char *exp;
|
||||
gboolean ret = FALSE;
|
||||
|
||||
tmp = mc_config_get_full_path (EDIT_CLIP_FILE);
|
||||
tmp = mc_config_get_full_path (EDIT_HOME_CLIP_FILE);
|
||||
exp = input_expand_dialog (_("Insert file"), _("Enter file name:"),
|
||||
MC_HISTORY_EDIT_INSERT_FILE, tmp, INPUT_COMPLETE_FILENAMES);
|
||||
g_free (tmp);
|
||||
@ -3156,7 +3156,7 @@ edit_sort_cmd (WEdit * edit)
|
||||
return 0;
|
||||
}
|
||||
|
||||
tmp = mc_config_get_full_path (EDIT_BLOCK_FILE);
|
||||
tmp = mc_config_get_full_path (EDIT_HOME_BLOCK_FILE);
|
||||
edit_save_block (edit, tmp, start_mark, end_mark);
|
||||
g_free (tmp);
|
||||
|
||||
@ -3167,8 +3167,8 @@ edit_sort_cmd (WEdit * edit)
|
||||
if (exp == NULL)
|
||||
return 1;
|
||||
|
||||
tmp_edit_block_name = mc_config_get_full_path (EDIT_BLOCK_FILE);
|
||||
tmp_edit_temp_name = mc_config_get_full_path (EDIT_TEMP_FILE);
|
||||
tmp_edit_block_name = mc_config_get_full_path (EDIT_HOME_BLOCK_FILE);
|
||||
tmp_edit_temp_name = mc_config_get_full_path (EDIT_HOME_TEMP_FILE);
|
||||
tmp =
|
||||
g_strconcat (" sort ", exp, " ", tmp_edit_block_name,
|
||||
" > ", tmp_edit_temp_name, (char *) NULL);
|
||||
@ -3203,7 +3203,7 @@ edit_sort_cmd (WEdit * edit)
|
||||
{
|
||||
vfs_path_t *tmp_vpath;
|
||||
|
||||
tmp_vpath = mc_config_get_full_vpath (EDIT_TEMP_FILE);
|
||||
tmp_vpath = mc_config_get_full_vpath (EDIT_HOME_TEMP_FILE);
|
||||
edit_insert_file (edit, tmp_vpath);
|
||||
vfs_path_free (tmp_vpath);
|
||||
}
|
||||
@ -3233,7 +3233,7 @@ edit_ext_cmd (WEdit * edit)
|
||||
if (!exp)
|
||||
return 1;
|
||||
|
||||
tmp_edit_temp_file = mc_config_get_full_path (EDIT_TEMP_FILE);
|
||||
tmp_edit_temp_file = mc_config_get_full_path (EDIT_HOME_TEMP_FILE);
|
||||
tmp = g_strconcat (exp, " > ", tmp_edit_temp_file, (char *) NULL);
|
||||
g_free (tmp_edit_temp_file);
|
||||
e = system (tmp);
|
||||
@ -3251,7 +3251,7 @@ edit_ext_cmd (WEdit * edit)
|
||||
{
|
||||
vfs_path_t *tmp_vpath;
|
||||
|
||||
tmp_vpath = mc_config_get_full_vpath (EDIT_TEMP_FILE);
|
||||
tmp_vpath = mc_config_get_full_vpath (EDIT_HOME_TEMP_FILE);
|
||||
edit_insert_file (edit, tmp_vpath);
|
||||
vfs_path_free (tmp_vpath);
|
||||
}
|
||||
@ -3270,7 +3270,7 @@ edit_block_process_cmd (WEdit * edit, int macro_number)
|
||||
char *fname;
|
||||
char *macros_fname = NULL;
|
||||
|
||||
fname = g_strdup_printf ("%s.%i.sh", MC_EXTMACRO_FILE, macro_number);
|
||||
fname = g_strdup_printf ("%s.%i.sh", EDIT_HOME_MACRO_FILE, macro_number);
|
||||
macros_fname = g_build_filename (mc_config_get_data_path (), fname, (char *) NULL);
|
||||
user_menu (edit, macros_fname, 0);
|
||||
g_free (fname);
|
||||
|
@ -45,7 +45,7 @@
|
||||
#include "lib/tty/key.h" /* is_idle() */
|
||||
#include "lib/tty/color.h" /* tty_setcolor() */
|
||||
#include "lib/skin.h"
|
||||
#include "lib/fileloc.h" /* EDIT_DIR */
|
||||
#include "lib/fileloc.h" /* EDIT_HOME_DIR */
|
||||
#include "lib/strutil.h" /* str_term_trim() */
|
||||
#include "lib/util.h" /* mc_build_filename() */
|
||||
#include "lib/widget.h"
|
||||
@ -1217,15 +1217,15 @@ edit_files (const GList * files)
|
||||
{
|
||||
char *dir;
|
||||
|
||||
dir = mc_build_filename (mc_config_get_cache_path (), EDIT_DIR, (char *) NULL);
|
||||
dir = mc_build_filename (mc_config_get_cache_path (), EDIT_HOME_DIR, (char *) NULL);
|
||||
made_directory = (mkdir (dir, 0700) != -1 || errno == EEXIST);
|
||||
g_free (dir);
|
||||
|
||||
dir = mc_build_filename (mc_config_get_path (), EDIT_DIR, (char *) NULL);
|
||||
dir = mc_build_filename (mc_config_get_path (), EDIT_HOME_DIR, (char *) NULL);
|
||||
made_directory = (mkdir (dir, 0700) != -1 || errno == EEXIST);
|
||||
g_free (dir);
|
||||
|
||||
dir = mc_build_filename (mc_config_get_data_path (), EDIT_DIR, (char *) NULL);
|
||||
dir = mc_build_filename (mc_config_get_data_path (), EDIT_HOME_DIR, (char *) NULL);
|
||||
made_directory = (mkdir (dir, 0700) != -1 || errno == EEXIST);
|
||||
g_free (dir);
|
||||
}
|
||||
|
@ -56,7 +56,7 @@
|
||||
#include "lib/global.h"
|
||||
#include "lib/search.h" /* search engine */
|
||||
#include "lib/skin.h"
|
||||
#include "lib/fileloc.h" /* EDIT_DIR, EDIT_SYNTAX_FILE */
|
||||
#include "lib/fileloc.h" /* EDIT_HOME_DIR, EDIT_HOME_SYNTAX_FILE */
|
||||
#include "lib/strutil.h" /* utf string functions */
|
||||
#include "lib/util.h"
|
||||
#include "lib/widget.h" /* message() */
|
||||
@ -883,7 +883,7 @@ open_include_file (const char *filename)
|
||||
|
||||
g_free (error_file_name);
|
||||
error_file_name =
|
||||
g_build_filename (mc_config_get_data_path (), EDIT_DIR, filename, (char *) NULL);
|
||||
g_build_filename (mc_config_get_data_path (), EDIT_HOME_DIR, filename, (char *) NULL);
|
||||
f = fopen (error_file_name, "r");
|
||||
if (f != NULL)
|
||||
return f;
|
||||
@ -1486,7 +1486,7 @@ edit_load_syntax (WEdit * edit, GPtrArray * pnames, const char *type)
|
||||
if (edit != NULL && edit->filename_vpath == NULL)
|
||||
return;
|
||||
|
||||
f = mc_config_get_full_path (EDIT_SYNTAX_FILE);
|
||||
f = mc_config_get_full_path (EDIT_HOME_SYNTAX_FILE);
|
||||
if (edit != NULL)
|
||||
r = edit_read_syntax_file (edit, pnames, f, vfs_path_as_str (edit->filename_vpath),
|
||||
get_first_editor_line (edit),
|
||||
|
@ -234,7 +234,7 @@ show_datadirs_extended (void)
|
||||
#endif
|
||||
#ifdef USE_INTERNAL_EDIT
|
||||
PRINTF ("mcedit macros:", mc_config_get_data_path (), MC_MACRO_FILE);
|
||||
PRINTF ("mcedit external macros:", mc_config_get_data_path (), MC_EXTMACRO_FILE ".*");
|
||||
PRINTF ("mcedit external macros:", mc_config_get_data_path (), EDIT_HOME_MACRO_FILE ".*");
|
||||
#endif
|
||||
PRINTF_SECTION2 (_("Cache directory:"), mc_config_get_cache_path ());
|
||||
}
|
||||
|
@ -843,7 +843,7 @@ expand_format (const WEdit * edit_widget, char c, gboolean do_quote)
|
||||
{
|
||||
char *file;
|
||||
|
||||
file = mc_config_get_full_path (EDIT_BLOCK_FILE);
|
||||
file = mc_config_get_full_path (EDIT_HOME_BLOCK_FILE);
|
||||
result = quote_func (file, FALSE);
|
||||
g_free (file);
|
||||
goto ret;
|
||||
|
@ -108,7 +108,7 @@ static const struct test_user_config_paths_ds
|
||||
},
|
||||
{ /* 5. */
|
||||
CONF_MAIN,
|
||||
EDIT_SYNTAX_FILE
|
||||
EDIT_HOME_SYNTAX_FILE
|
||||
},
|
||||
{ /* 6. */
|
||||
CONF_MAIN,
|
||||
@ -116,11 +116,11 @@ static const struct test_user_config_paths_ds
|
||||
},
|
||||
{ /* 7. */
|
||||
CONF_MAIN,
|
||||
EDIT_DIR PATH_SEP_STR "edit.indent.rc"
|
||||
EDIT_HOME_DIR PATH_SEP_STR "edit.indent.rc"
|
||||
},
|
||||
{ /* 8. */
|
||||
CONF_MAIN,
|
||||
EDIT_DIR PATH_SEP_STR "edit.spell.rc"
|
||||
EDIT_HOME_DIR PATH_SEP_STR "edit.spell.rc"
|
||||
},
|
||||
{ /* 9. */
|
||||
CONF_MAIN,
|
||||
@ -164,7 +164,7 @@ static const struct test_user_config_paths_ds
|
||||
},
|
||||
{ /* 19. */
|
||||
CONF_DATA,
|
||||
EDIT_CLIP_FILE
|
||||
EDIT_HOME_CLIP_FILE
|
||||
},
|
||||
{ /* 20. */
|
||||
CONF_DATA,
|
||||
@ -180,11 +180,11 @@ static const struct test_user_config_paths_ds
|
||||
},
|
||||
{ /* 23. */
|
||||
CONF_CACHE,
|
||||
EDIT_TEMP_FILE
|
||||
EDIT_HOME_TEMP_FILE
|
||||
},
|
||||
{ /* 24. */
|
||||
CONF_CACHE,
|
||||
EDIT_BLOCK_FILE
|
||||
EDIT_HOME_BLOCK_FILE
|
||||
},
|
||||
};
|
||||
/* *INDENT-ON* */
|
||||
|
Loading…
Reference in New Issue
Block a user