From 549fcb39eb7d3d229550af78b03b53cfcad299b8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jonathan=20Neusch=C3=A4fer?= Date: Sat, 17 Dec 2011 17:08:36 +0100 Subject: [PATCH] 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. --- doc/config.sample | 3 +++ doc/ncmpc.1 | 3 +++ src/conf.c | 10 ++++++++++ src/defaults.h | 2 ++ src/options.c | 3 +++ src/options.h | 1 + 6 files changed, 22 insertions(+) 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; -- 2.30.2