Discussion:
[PATCH 1/2] allow overriding charset with CMUS_CHARSET environment variable
Johannes Weißl
2011-04-11 11:47:09 UTC
Permalink
On small systems like OpenWrt nl_langinfo(CODESET) always returns
"ASCII". This way the user can override this choice if the terminal
emulator supports more character sets.

This is not a normal option for simplicity: The charset is needed right
at the start of cmus, and changing during runtime is not supported (or
needed?) right now.
---
ui_curses.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/ui_curses.c b/ui_curses.c
index 60f33bc..d009e77 100644
--- a/ui_curses.c
+++ b/ui_curses.c
@@ -2333,11 +2333,14 @@ int main(int argc, char *argv[])

setlocale(LC_CTYPE, "");
setlocale(LC_COLLATE, "");
+ charset = getenv("CMUS_CHARSET");
+ if (!charset || !charset[0]) {
#ifdef CODESET
- charset = nl_langinfo(CODESET);
+ charset = nl_langinfo(CODESET);
#else
- charset = "ISO-8859-1";
+ charset = "ISO-8859-1";
#endif
+ }
if (strcmp(charset, "UTF-8") == 0)
using_utf8 = 1;
--
1.7.4.1
Johannes Weißl
2011-04-11 11:47:10 UTC
Permalink
---
Doc/cmus.txt | 21 +++++++++++++++++++++
1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/Doc/cmus.txt b/Doc/cmus.txt
index 4ec3c07..3dc1ea2 100644
--- a/Doc/cmus.txt
+++ b/Doc/cmus.txt
@@ -1199,6 +1199,27 @@ Example status display script (See *status_display_program* option) can be
found in `/usr/share/doc/cmus/examples`.


+@h1 ENVIRONMENT
+
+CMUS_CHARSET
+ Override cmus character set (default: \`locale charmap\`).
+
+CMUS_HOME
+ Override cmus config directory (default: *$HOME*/.cmus).
+
+HOME
+ Full path of the user's home directory.
+
+http_proxy
+ URI of the proxy to use for HTTP requests.
+
+USER
+ Name of the user running cmus.
+
+USERNAME
+ Fallback for *USER*.
+
+
@h1 BUGS

After a crash last lines of `~/cmus-debug.txt` might
--
1.7.4.1
Gregory Petrosyan
2011-04-12 14:19:50 UTC
Permalink
Merged both to master, and backported to maint, thanks!

                Gregory
Johannes Weißl
2011-04-12 14:22:51 UTC
Permalink
Post by Gregory Petrosyan
Merged both to master, and backported to maint, thanks!
Thanks! Just curious: do you plan to release 2.3.6? Or will the maint be
reset to 2.4.0 once it is released?


Johannes
Gregory Petrosyan
2011-04-12 14:40:14 UTC
Permalink
Post by Johannes Weißl
Post by Gregory Petrosyan
Merged both to master, and backported to maint, thanks!
Thanks! Just curious: do you plan to release 2.3.6? Or will the maint be
reset to 2.4.0 once it is released?
I think I'll create maint-2.3, and will reset maint to 2.4.0, but will
update maint-2.3 only if *really* serious issues will be found — I
want everybody to move to 2.4 instead of using 2.3.x forever.

                Gregory

Loading...