basic: improve config file handling

- add `add-resource-path(string)` to add a new resource directory
- bind `load-file-from-path` on C-c C-f
This commit is contained in:
Charlie Gordon 2016-12-31 18:45:08 +00:00
commit 0f1d2244e7
3 changed files with 13 additions and 1 deletions

7
qe.c
View file

@ -8105,6 +8105,13 @@ static int parse_command_line(int argc, char **argv)
return _optind;
}
void do_add_resource_path(EditState *s, const char *path)
{
QEmacsState *qs = s->qe_state;
pstrcat(qs->res_path, sizeof(qs->res_path), ":");
pstrcat(qs->res_path, sizeof(qs->res_path), path);
}
void set_user_option(const char *user)
{
QEmacsState *qs = &qe_state;

1
qe.h
View file

@ -1831,6 +1831,7 @@ int qe_load_file(EditState *s, const char *filename1,
/* config file support */
void do_load_config_file(EditState *e, const char *file);
void do_load_qerc(EditState *e, const char *file);
void do_add_resource_path(EditState *s, const char *path);
/* popup / low level window handling */
EditState *show_popup(EditBuffer *b);

View file

@ -428,7 +428,7 @@ static CmdDef basic_commands[] = {
"ui{Fill column: }")
/* other stuff */
CMD3( KEY_NONE, KEY_NONE,
CMD3( KEY_CTRLC(KEY_CTRL('f')), KEY_NONE,
"load-file-from-path", do_load_file_from_path, ESsi, 0,
"s{Load file from path: }|file|"
"v")
@ -438,6 +438,10 @@ static CmdDef basic_commands[] = {
CMD2( KEY_NONE, KEY_NONE,
"load-qerc", do_load_qerc, ESs,
"s{path: }[file]|file|")
CMD2( KEY_NONE, KEY_NONE,
"add-resource-path", do_add_resource_path, ESs,
"s{resource path: }[file]|file|")
CMD_DEF_END,
};