From b522060cef3a5cd00ef35688e58cc397e4cc806b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Fri, 19 May 2017 07:39:23 +0200 Subject: [PATCH] buflist: add variable ${current_buffer} in bar item evaluation --- ChangeLog.adoc | 4 ++++ doc/de/autogen/user/buflist_commands.adoc | 1 + doc/en/autogen/user/buflist_commands.adoc | 1 + doc/fr/autogen/user/buflist_commands.adoc | 1 + doc/it/autogen/user/buflist_commands.adoc | 1 + doc/ja/autogen/user/buflist_commands.adoc | 1 + doc/pl/autogen/user/buflist_commands.adoc | 1 + po/cs.po | 5 ++++- po/de.po | 5 ++++- po/es.po | 5 ++++- po/fr.po | 10 ++++++++-- po/hu.po | 5 ++++- po/it.po | 5 ++++- po/ja.po | 5 ++++- po/pl.po | 5 ++++- po/pt.po | 5 ++++- po/pt_BR.po | 5 ++++- po/ru.po | 5 ++++- po/tr.po | 5 ++++- po/weechat.pot | 5 ++++- src/plugins/buflist/buflist-bar-item.c | 5 +++++ src/plugins/buflist/buflist-command.c | 3 +++ 22 files changed, 74 insertions(+), 14 deletions(-) diff --git a/ChangeLog.adoc b/ChangeLog.adoc index 1fed26e89..141843450 100644 --- a/ChangeLog.adoc +++ b/ChangeLog.adoc @@ -18,6 +18,10 @@ https://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes] [[v1.9]] == Version 1.9 (under dev) +Improvements:: + + * buflist: add variable `${current_buffer}` (boolean "0" / "1") in bar item evaluation + Bug fixes:: * buflist: add option "bar" in command /buflist, do not automatically add the "buflist" bar when the option buflist.look.enabled is off (issue #994) diff --git a/doc/de/autogen/user/buflist_commands.adoc b/doc/de/autogen/user/buflist_commands.adoc index 045ec4a33..1f73eefda 100644 --- a/doc/de/autogen/user/buflist_commands.adoc +++ b/doc/de/autogen/user/buflist_commands.adoc @@ -28,6 +28,7 @@ The following variables can be used in these options: - irc_channel: IRC channel data, defined only on an IRC channel buffer (see hdata "irc_channel" in API doc) - extra variables added by buflist for convenience: - ${format_buffer}: the evaluated value of option buflist.format.buffer; this can be used in option buflist.format.buffer_current to just change the background color for example + - ${current_buffer}: a boolean ("0" or "1"), "1" if this is the current buffer; it can be used in a condition: ${if:${current_buffer}?...:...} - ${format_number}: indented number with separator (evaluation of option buflist.format.number) - ${number}: indented number, for example " 1" if there are between 10 and 99 buffers - ${indent}: indentation for name (channel and private buffers are indented) (evaluation of option buflist.format.indent) diff --git a/doc/en/autogen/user/buflist_commands.adoc b/doc/en/autogen/user/buflist_commands.adoc index 59ea83eac..cd3519d00 100644 --- a/doc/en/autogen/user/buflist_commands.adoc +++ b/doc/en/autogen/user/buflist_commands.adoc @@ -28,6 +28,7 @@ The following variables can be used in these options: - irc_channel: IRC channel data, defined only on an IRC channel buffer (see hdata "irc_channel" in API doc) - extra variables added by buflist for convenience: - ${format_buffer}: the evaluated value of option buflist.format.buffer; this can be used in option buflist.format.buffer_current to just change the background color for example + - ${current_buffer}: a boolean ("0" or "1"), "1" if this is the current buffer; it can be used in a condition: ${if:${current_buffer}?...:...} - ${format_number}: indented number with separator (evaluation of option buflist.format.number) - ${number}: indented number, for example " 1" if there are between 10 and 99 buffers - ${indent}: indentation for name (channel and private buffers are indented) (evaluation of option buflist.format.indent) diff --git a/doc/fr/autogen/user/buflist_commands.adoc b/doc/fr/autogen/user/buflist_commands.adoc index b8e9ae38f..4ec76fc2f 100644 --- a/doc/fr/autogen/user/buflist_commands.adoc +++ b/doc/fr/autogen/user/buflist_commands.adoc @@ -28,6 +28,7 @@ Les variables suivantes peuvent être utilisées dans ces options : - irc_channel: données du canal IRC, défini seulement sur un tampon de canal IRC (voir le hdata "irc_channel" dans la doc API) - variables additionnelles ajoutées par buflist pour des raisons pratiques : - ${format_buffer} : la valeur évaluée de l'option buflist.format.buffer ; peut être utilisée dans l'option buflist.format.buffer_current pour juste changer la couleur de fond par exemple + - ${current_buffer} : un booléen ("0" ou "1"), "1" s'il s'agit du tampon courant ; cela peut être utilisé dans une condition : ${if:${current_buffer}?...:...} - ${format_number} : numéro indenté avec un séparateur (évaluation de l'option buflist.format.number) - ${number} : numéro indenté, par exemple " 1" s'il y a entre 10 et 99 tampons - ${indent} : indentation pour le nom (les tampons de canaux ou privés sont indentés) (évaluation de l'option buflist.format.indent) diff --git a/doc/it/autogen/user/buflist_commands.adoc b/doc/it/autogen/user/buflist_commands.adoc index 59ea83eac..cd3519d00 100644 --- a/doc/it/autogen/user/buflist_commands.adoc +++ b/doc/it/autogen/user/buflist_commands.adoc @@ -28,6 +28,7 @@ The following variables can be used in these options: - irc_channel: IRC channel data, defined only on an IRC channel buffer (see hdata "irc_channel" in API doc) - extra variables added by buflist for convenience: - ${format_buffer}: the evaluated value of option buflist.format.buffer; this can be used in option buflist.format.buffer_current to just change the background color for example + - ${current_buffer}: a boolean ("0" or "1"), "1" if this is the current buffer; it can be used in a condition: ${if:${current_buffer}?...:...} - ${format_number}: indented number with separator (evaluation of option buflist.format.number) - ${number}: indented number, for example " 1" if there are between 10 and 99 buffers - ${indent}: indentation for name (channel and private buffers are indented) (evaluation of option buflist.format.indent) diff --git a/doc/ja/autogen/user/buflist_commands.adoc b/doc/ja/autogen/user/buflist_commands.adoc index 415ce21b1..1d04b70a1 100644 --- a/doc/ja/autogen/user/buflist_commands.adoc +++ b/doc/ja/autogen/user/buflist_commands.adoc @@ -28,6 +28,7 @@ The following variables can be used in these options: - irc_channel: IRC channel data, defined only on an IRC channel buffer (see hdata "irc_channel" in API doc) - extra variables added by buflist for convenience: - ${format_buffer}: the evaluated value of option buflist.format.buffer; this can be used in option buflist.format.buffer_current to just change the background color for example + - ${current_buffer}: a boolean ("0" or "1"), "1" if this is the current buffer; it can be used in a condition: ${if:${current_buffer}?...:...} - ${format_number}: indented number with separator (evaluation of option buflist.format.number) - ${number}: indented number, for example " 1" if there are between 10 and 99 buffers - ${indent}: indentation for name (channel and private buffers are indented) (evaluation of option buflist.format.indent) diff --git a/doc/pl/autogen/user/buflist_commands.adoc b/doc/pl/autogen/user/buflist_commands.adoc index 64c67ddf2..b32dce5fb 100644 --- a/doc/pl/autogen/user/buflist_commands.adoc +++ b/doc/pl/autogen/user/buflist_commands.adoc @@ -28,6 +28,7 @@ The following variables can be used in these options: - irc_channel: IRC channel data, defined only on an IRC channel buffer (see hdata "irc_channel" in API doc) - extra variables added by buflist for convenience: - ${format_buffer}: the evaluated value of option buflist.format.buffer; this can be used in option buflist.format.buffer_current to just change the background color for example + - ${current_buffer}: a boolean ("0" or "1"), "1" if this is the current buffer; it can be used in a condition: ${if:${current_buffer}?...:...} - ${format_number}: indented number with separator (evaluation of option buflist.format.number) - ${number}: indented number, for example " 1" if there are between 10 and 99 buffers - ${indent}: indentation for name (channel and private buffers are indented) (evaluation of option buflist.format.indent) diff --git a/po/cs.po b/po/cs.po index 150b18c44..3662d23d1 100644 --- a/po/cs.po +++ b/po/cs.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2017-05-18 21:59+0200\n" +"POT-Creation-Date: 2017-05-19 07:35+0200\n" "PO-Revision-Date: 2017-05-13 22:06+0200\n" "Last-Translator: Ondřej Súkup \n" "Language-Team: weechat-dev \n" @@ -4935,6 +4935,9 @@ msgid "" " - ${format_buffer}: the evaluated value of option buflist.format.buffer; " "this can be used in option buflist.format.buffer_current to just change the " "background color for example\n" +" - ${current_buffer}: a boolean (\"0\" or \"1\"), \"1\" if this is the " +"current buffer; it can be used in a condition: ${if:" +"${current_buffer}?...:...}\n" " - ${format_number}: indented number with separator (evaluation of option " "buflist.format.number)\n" " - ${number}: indented number, for example \" 1\" if there are between 10 " diff --git a/po/de.po b/po/de.po index 2118c5ef2..1b5ca2efb 100644 --- a/po/de.po +++ b/po/de.po @@ -19,7 +19,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2017-05-18 21:59+0200\n" +"POT-Creation-Date: 2017-05-19 07:35+0200\n" "PO-Revision-Date: 2017-05-06 21:10+0200\n" "Last-Translator: Nils Görs \n" "Language-Team: German \n" @@ -5826,6 +5826,9 @@ msgid "" " - ${format_buffer}: the evaluated value of option buflist.format.buffer; " "this can be used in option buflist.format.buffer_current to just change the " "background color for example\n" +" - ${current_buffer}: a boolean (\"0\" or \"1\"), \"1\" if this is the " +"current buffer; it can be used in a condition: ${if:" +"${current_buffer}?...:...}\n" " - ${format_number}: indented number with separator (evaluation of option " "buflist.format.number)\n" " - ${number}: indented number, for example \" 1\" if there are between 10 " diff --git a/po/es.po b/po/es.po index 4a3865c82..06d652ef1 100644 --- a/po/es.po +++ b/po/es.po @@ -22,7 +22,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2017-05-18 21:59+0200\n" +"POT-Creation-Date: 2017-05-19 07:35+0200\n" "PO-Revision-Date: 2017-01-06 22:01+0100\n" "Last-Translator: Elián Hanisch \n" "Language-Team: weechat-dev \n" @@ -5149,6 +5149,9 @@ msgid "" " - ${format_buffer}: the evaluated value of option buflist.format.buffer; " "this can be used in option buflist.format.buffer_current to just change the " "background color for example\n" +" - ${current_buffer}: a boolean (\"0\" or \"1\"), \"1\" if this is the " +"current buffer; it can be used in a condition: ${if:" +"${current_buffer}?...:...}\n" " - ${format_number}: indented number with separator (evaluation of option " "buflist.format.number)\n" " - ${number}: indented number, for example \" 1\" if there are between 10 " diff --git a/po/fr.po b/po/fr.po index 0b92b4bdc..e4a753ea1 100644 --- a/po/fr.po +++ b/po/fr.po @@ -21,8 +21,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2017-05-18 21:59+0200\n" -"PO-Revision-Date: 2017-05-18 21:59+0200\n" +"POT-Creation-Date: 2017-05-19 07:35+0200\n" +"PO-Revision-Date: 2017-05-19 07:36+0200\n" "Last-Translator: Sébastien Helleu \n" "Language-Team: weechat-dev \n" "Language: fr\n" @@ -5696,6 +5696,9 @@ msgid "" " - ${format_buffer}: the evaluated value of option buflist.format.buffer; " "this can be used in option buflist.format.buffer_current to just change the " "background color for example\n" +" - ${current_buffer}: a boolean (\"0\" or \"1\"), \"1\" if this is the " +"current buffer; it can be used in a condition: ${if:" +"${current_buffer}?...:...}\n" " - ${format_number}: indented number with separator (evaluation of option " "buflist.format.number)\n" " - ${number}: indented number, for example \" 1\" if there are between 10 " @@ -5746,6 +5749,9 @@ msgstr "" " - ${format_buffer} : la valeur évaluée de l'option buflist.format." "buffer ; peut être utilisée dans l'option buflist.format.buffer_current pour " "juste changer la couleur de fond par exemple\n" +" - ${current_buffer} : un booléen (\"0\" ou \"1\"), \"1\" s'il s'agit du " +"tampon courant ; cela peut être utilisé dans une condition : ${if:" +"${current_buffer}?...:...}\n" " - ${format_number} : numéro indenté avec un séparateur (évaluation de " "l'option buflist.format.number)\n" " - ${number} : numéro indenté, par exemple \" 1\" s'il y a entre 10 et 99 " diff --git a/po/hu.po b/po/hu.po index e62c0e091..c4c9c03c2 100644 --- a/po/hu.po +++ b/po/hu.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2017-05-18 21:59+0200\n" +"POT-Creation-Date: 2017-05-19 07:35+0200\n" "PO-Revision-Date: 2017-01-06 22:03+0100\n" "Last-Translator: Andras Voroskoi \n" "Language-Team: weechat-dev \n" @@ -4473,6 +4473,9 @@ msgid "" " - ${format_buffer}: the evaluated value of option buflist.format.buffer; " "this can be used in option buflist.format.buffer_current to just change the " "background color for example\n" +" - ${current_buffer}: a boolean (\"0\" or \"1\"), \"1\" if this is the " +"current buffer; it can be used in a condition: ${if:" +"${current_buffer}?...:...}\n" " - ${format_number}: indented number with separator (evaluation of option " "buflist.format.number)\n" " - ${number}: indented number, for example \" 1\" if there are between 10 " diff --git a/po/it.po b/po/it.po index 14b375260..c86ddb9f7 100644 --- a/po/it.po +++ b/po/it.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2017-05-18 21:59+0200\n" +"POT-Creation-Date: 2017-05-19 07:35+0200\n" "PO-Revision-Date: 2017-01-06 22:04+0100\n" "Last-Translator: Esteban I. Ruiz Moreno \n" "Language-Team: weechat-dev \n" @@ -5287,6 +5287,9 @@ msgid "" " - ${format_buffer}: the evaluated value of option buflist.format.buffer; " "this can be used in option buflist.format.buffer_current to just change the " "background color for example\n" +" - ${current_buffer}: a boolean (\"0\" or \"1\"), \"1\" if this is the " +"current buffer; it can be used in a condition: ${if:" +"${current_buffer}?...:...}\n" " - ${format_number}: indented number with separator (evaluation of option " "buflist.format.number)\n" " - ${number}: indented number, for example \" 1\" if there are between 10 " diff --git a/po/ja.po b/po/ja.po index 3803aa845..51d55254b 100644 --- a/po/ja.po +++ b/po/ja.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2017-05-18 21:59+0200\n" +"POT-Creation-Date: 2017-05-19 07:35+0200\n" "PO-Revision-Date: 2017-05-06 09:00+0900\n" "Last-Translator: AYANOKOUZI, Ryuunosuke \n" "Language-Team: Japanese \n" "Language-Team: weechat-dev \n" @@ -5567,6 +5567,9 @@ msgid "" " - ${format_buffer}: the evaluated value of option buflist.format.buffer; " "this can be used in option buflist.format.buffer_current to just change the " "background color for example\n" +" - ${current_buffer}: a boolean (\"0\" or \"1\"), \"1\" if this is the " +"current buffer; it can be used in a condition: ${if:" +"${current_buffer}?...:...}\n" " - ${format_number}: indented number with separator (evaluation of option " "buflist.format.number)\n" " - ${number}: indented number, for example \" 1\" if there are between 10 " diff --git a/po/pt.po b/po/pt.po index 0cd1a5265..9908f05c9 100644 --- a/po/pt.po +++ b/po/pt.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2017-05-18 21:59+0200\n" +"POT-Creation-Date: 2017-05-19 07:35+0200\n" "PO-Revision-Date: 2017-04-08 14:50+0200\n" "Last-Translator: Vasco Almeida \n" "Language-Team: Portuguese <>\n" @@ -5543,6 +5543,9 @@ msgid "" " - ${format_buffer}: the evaluated value of option buflist.format.buffer; " "this can be used in option buflist.format.buffer_current to just change the " "background color for example\n" +" - ${current_buffer}: a boolean (\"0\" or \"1\"), \"1\" if this is the " +"current buffer; it can be used in a condition: ${if:" +"${current_buffer}?...:...}\n" " - ${format_number}: indented number with separator (evaluation of option " "buflist.format.number)\n" " - ${number}: indented number, for example \" 1\" if there are between 10 " diff --git a/po/pt_BR.po b/po/pt_BR.po index a22f93f35..7c4c803bc 100644 --- a/po/pt_BR.po +++ b/po/pt_BR.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2017-05-18 21:59+0200\n" +"POT-Creation-Date: 2017-05-19 07:35+0200\n" "PO-Revision-Date: 2016-09-03 08:24+0200\n" "Last-Translator: Eduardo Elias \n" "Language-Team: weechat-dev \n" @@ -5089,6 +5089,9 @@ msgid "" " - ${format_buffer}: the evaluated value of option buflist.format.buffer; " "this can be used in option buflist.format.buffer_current to just change the " "background color for example\n" +" - ${current_buffer}: a boolean (\"0\" or \"1\"), \"1\" if this is the " +"current buffer; it can be used in a condition: ${if:" +"${current_buffer}?...:...}\n" " - ${format_number}: indented number with separator (evaluation of option " "buflist.format.number)\n" " - ${number}: indented number, for example \" 1\" if there are between 10 " diff --git a/po/ru.po b/po/ru.po index 772fabb10..51344fa93 100644 --- a/po/ru.po +++ b/po/ru.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2017-05-18 21:59+0200\n" +"POT-Creation-Date: 2017-05-19 07:35+0200\n" "PO-Revision-Date: 2017-01-06 22:06+0100\n" "Last-Translator: Aleksey V Zapparov AKA ixti \n" "Language-Team: weechat-dev \n" @@ -4511,6 +4511,9 @@ msgid "" " - ${format_buffer}: the evaluated value of option buflist.format.buffer; " "this can be used in option buflist.format.buffer_current to just change the " "background color for example\n" +" - ${current_buffer}: a boolean (\"0\" or \"1\"), \"1\" if this is the " +"current buffer; it can be used in a condition: ${if:" +"${current_buffer}?...:...}\n" " - ${format_number}: indented number with separator (evaluation of option " "buflist.format.number)\n" " - ${number}: indented number, for example \" 1\" if there are between 10 " diff --git a/po/tr.po b/po/tr.po index de8f42085..23569d3b9 100644 --- a/po/tr.po +++ b/po/tr.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2017-05-18 21:59+0200\n" +"POT-Creation-Date: 2017-05-19 07:35+0200\n" "PO-Revision-Date: 2017-01-06 22:07+0100\n" "Last-Translator: Hasan Kiran \n" "Language-Team: weechat-dev \n" @@ -4076,6 +4076,9 @@ msgid "" " - ${format_buffer}: the evaluated value of option buflist.format.buffer; " "this can be used in option buflist.format.buffer_current to just change the " "background color for example\n" +" - ${current_buffer}: a boolean (\"0\" or \"1\"), \"1\" if this is the " +"current buffer; it can be used in a condition: ${if:" +"${current_buffer}?...:...}\n" " - ${format_number}: indented number with separator (evaluation of option " "buflist.format.number)\n" " - ${number}: indented number, for example \" 1\" if there are between 10 " diff --git a/po/weechat.pot b/po/weechat.pot index 3e8637c33..5539fed8e 100644 --- a/po/weechat.pot +++ b/po/weechat.pot @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2017-05-18 21:59+0200\n" +"POT-Creation-Date: 2017-05-19 07:35+0200\n" "PO-Revision-Date: 2014-08-16 10:27+0200\n" "Last-Translator: Sébastien Helleu \n" "Language-Team: weechat-dev \n" @@ -4061,6 +4061,9 @@ msgid "" " - ${format_buffer}: the evaluated value of option buflist.format.buffer; " "this can be used in option buflist.format.buffer_current to just change the " "background color for example\n" +" - ${current_buffer}: a boolean (\"0\" or \"1\"), \"1\" if this is the " +"current buffer; it can be used in a condition: ${if:" +"${current_buffer}?...:...}\n" " - ${format_number}: indented number with separator (evaluation of option " "buflist.format.number)\n" " - ${number}: indented number, for example \" 1\" if there are between 10 " diff --git a/src/plugins/buflist/buflist-bar-item.c b/src/plugins/buflist/buflist-bar-item.c index 4f45592de..38c0a21e7 100644 --- a/src/plugins/buflist/buflist-bar-item.c +++ b/src/plugins/buflist/buflist-bar-item.c @@ -168,6 +168,11 @@ buflist_bar_item_buflist_cb (const void *pointer, void *data, goto error; } + /* current buffer */ + weechat_hashtable_set (buflist_hashtable_extra_vars, + "current_buffer", + (current_buffer) ? "1" : "0"); + /* buffer number */ number = weechat_hdata_integer (buflist_hdata_buffer, ptr_buffer, "number"); diff --git a/src/plugins/buflist/buflist-command.c b/src/plugins/buflist/buflist-command.c index 6bfef160b..4a599499e 100644 --- a/src/plugins/buflist/buflist-command.c +++ b/src/plugins/buflist/buflist-command.c @@ -99,6 +99,9 @@ buflist_command_init () "buflist.format.buffer; this can be used in option " "buflist.format.buffer_current to just change the background color " "for example\n" + " - ${current_buffer}: a boolean (\"0\" or \"1\"), \"1\" if " + "this is the current buffer; it can be used in a condition: " + "${if:${current_buffer}?...:...}\n" " - ${format_number}: indented number with separator " "(evaluation of option buflist.format.number)\n" " - ${number}: indented number, for example \" 1\" if there "