From: Jonathan Neuschäfer Date: Sat, 17 Dec 2011 16:08:36 +0000 (+0100) Subject: Add option "text-editor" X-Git-Tag: release-0.20~45 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=549fcb39eb7d3d229550af78b03b53cfcad299b8;p=ncmpc.git Add option "text-editor" The lyrics screen is going to spawn a text editor to edit lyrics. Put the infrastructure in place to make it configurable. --- diff --git a/doc/config.sample b/doc/config.sample index 75ab0f1..6ad6809 100644 --- a/doc/config.sample +++ b/doc/config.sample @@ -101,6 +101,9 @@ ## Automatically save the lyrics after receiving them. #lyrics-autosave = no +## The text editor used for editing lyrics. +#text-editor = emacs + ## Display song length in second column #second-column = yes diff --git a/doc/ncmpc.1 b/doc/ncmpc.1 index fc191f1..6f48734 100644 --- a/doc/ncmpc.1 +++ b/doc/ncmpc.1 @@ -130,6 +130,9 @@ Automatically save lyrics after receiving them. .B lyrics\-show\-plugin = yes|no Show the name of the plugin used to receive lyrics on the lyrics screen. .TP +.B text\-editor = EDITOR +The text editor used for editing lyrics. +.TP .B second-column = yes|no Display song length in a second column. .SS Display diff --git a/src/conf.c b/src/conf.c index cce0b94..9d1f882 100644 --- a/src/conf.c +++ b/src/conf.c @@ -77,6 +77,7 @@ #define CONF_JUMP_PREFIX_ONLY "jump-prefix-only" #define CONF_LYRICS_AUTOSAVE "lyrics-autosave" #define CONF_LYRICS_SHOW_PLUGIN "lyrics-show-plugin" +#define CONF_TEXT_EDITOR "text-editor" #define CONF_SECOND_COLUMN "second-column" static bool @@ -522,6 +523,15 @@ parse_line(char *line) options.lyrics_show_plugin = str2bool(value); #else {} +#endif + else if (!strcasecmp(name, CONF_TEXT_EDITOR)) +#ifdef ENABLE_LYRICS_SCREEN + { + g_free(options.text_editor); + options.text_editor = get_format(value); + } +#else + {} #endif else if (!strcasecmp(CONF_SECOND_COLUMN, name)) #ifdef NCMPC_MINI diff --git a/src/defaults.h b/src/defaults.h index 9bb934d..fac784d 100644 --- a/src/defaults.h +++ b/src/defaults.h @@ -34,6 +34,8 @@ #define DEFAULT_LYRICS_TIMEOUT 100 +#define DEFAULT_TEXT_EDITOR "editor" + #define DEFAULT_SCROLL TRUE #define DEFAULT_SCROLL_SEP " *** " diff --git a/src/options.c b/src/options.c index f7044cc..47fc3b9 100644 --- a/src/options.c +++ b/src/options.c @@ -368,6 +368,9 @@ options_init(void) options.list_format = g_strdup(DEFAULT_LIST_FORMAT); options.status_format = g_strdup(DEFAULT_STATUS_FORMAT); options.screen_list = g_strsplit_set(DEFAULT_SCREEN_LIST, " ", 0); +#ifdef ENABLE_LYRICS_SCREEN + options.text_editor = g_strdup(DEFAULT_TEXT_EDITOR); +#endif #ifndef NCMPC_MINI options.scroll_sep = g_strdup(DEFAULT_SCROLL_SEP); #endif diff --git a/src/options.h b/src/options.h index a8ad1ff..fc9f7a1 100644 --- a/src/options.h +++ b/src/options.h @@ -48,6 +48,7 @@ typedef struct { int lyrics_timeout; bool lyrics_autosave; bool lyrics_show_plugin; + char *text_editor; #endif bool find_wrap; bool find_show_last_pattern;