diff --git a/doc/de/autogen/user/weechat_commands.txt b/doc/de/autogen/user/weechat_commands.txt index f1dffb0ec..e803fc15a 100644 --- a/doc/de/autogen/user/weechat_commands.txt +++ b/doc/de/autogen/user/weechat_commands.txt @@ -230,7 +230,8 @@ To force a string comparison, add double quotes around each expression, for exam Some variables are replaced in expression, using the format ${variable}, variable can be, by order of prioity : 1. the name of an option (file.section.option) - 2. a hdata name/variable (the value is automatically converted to string), by default "window" and "buffer" point to current window/buffer. + 2. the name of a local variable in buffer + 3. a hdata name/variable (the value is automatically converted to string), by default "window" and "buffer" point to current window/buffer. Format for hdata can be one of following: hdata.var1.var2...: start with a hdata (pointer must be known), and ask variables one after one (other hdata can be followed) hdata(list).var1.var2...: start with a hdata using a list, for example: diff --git a/doc/en/autogen/user/weechat_commands.txt b/doc/en/autogen/user/weechat_commands.txt index 7438d2805..0db618cde 100644 --- a/doc/en/autogen/user/weechat_commands.txt +++ b/doc/en/autogen/user/weechat_commands.txt @@ -230,7 +230,8 @@ To force a string comparison, add double quotes around each expression, for exam Some variables are replaced in expression, using the format ${variable}, variable can be, by order of prioity : 1. the name of an option (file.section.option) - 2. a hdata name/variable (the value is automatically converted to string), by default "window" and "buffer" point to current window/buffer. + 2. the name of a local variable in buffer + 3. a hdata name/variable (the value is automatically converted to string), by default "window" and "buffer" point to current window/buffer. Format for hdata can be one of following: hdata.var1.var2...: start with a hdata (pointer must be known), and ask variables one after one (other hdata can be followed) hdata(list).var1.var2...: start with a hdata using a list, for example: diff --git a/doc/fr/autogen/user/weechat_commands.txt b/doc/fr/autogen/user/weechat_commands.txt index 9af2d263b..94fed7bdf 100644 --- a/doc/fr/autogen/user/weechat_commands.txt +++ b/doc/fr/autogen/user/weechat_commands.txt @@ -230,7 +230,8 @@ Pour forcer une comparaison de chaînes, ajoutez des guillemets autour de chaque Des variables sont remplacées dans l'expression, en utilisant le format ${variable}, la variable pouvant être, par ordre de priorité : 1. le nom d'une option (fichier.section.option) - 2. le nom d'un hdata/variable (la valeur est automatiquement convertie en chaîne), par défaut "window" et "buffer" pointent vers la fenêtre et le tampon courants. + 2. le nom d'une variable locale du tampon + 3. le nom d'un hdata/variable (la valeur est automatiquement convertie en chaîne), par défaut "window" et "buffer" pointent vers la fenêtre et le tampon courants. Le format du hdata peut être le suivant : hdata.var1.var2...: démarrer avec un hdata (le pointeur doit être connu), et demander les variables l'une après l'autre (d'autres hdata peuvent être suivis) hdata(list).var1.var2...: démarrer avec un hdata en utlisant une liste, par exemple : diff --git a/doc/it/autogen/user/weechat_commands.txt b/doc/it/autogen/user/weechat_commands.txt index ba77936b3..1bd978ad3 100644 --- a/doc/it/autogen/user/weechat_commands.txt +++ b/doc/it/autogen/user/weechat_commands.txt @@ -230,7 +230,8 @@ To force a string comparison, add double quotes around each expression, for exam Some variables are replaced in expression, using the format ${variable}, variable can be, by order of prioity : 1. the name of an option (file.section.option) - 2. a hdata name/variable (the value is automatically converted to string), by default "window" and "buffer" point to current window/buffer. + 2. the name of a local variable in buffer + 3. a hdata name/variable (the value is automatically converted to string), by default "window" and "buffer" point to current window/buffer. Format for hdata can be one of following: hdata.var1.var2...: start with a hdata (pointer must be known), and ask variables one after one (other hdata can be followed) hdata(list).var1.var2...: start with a hdata using a list, for example: diff --git a/doc/ja/autogen/user/weechat_commands.txt b/doc/ja/autogen/user/weechat_commands.txt index 9bf0c3a08..adffe54d0 100644 --- a/doc/ja/autogen/user/weechat_commands.txt +++ b/doc/ja/autogen/user/weechat_commands.txt @@ -230,7 +230,8 @@ To force a string comparison, add double quotes around each expression, for exam Some variables are replaced in expression, using the format ${variable}, variable can be, by order of prioity : 1. the name of an option (file.section.option) - 2. a hdata name/variable (the value is automatically converted to string), by default "window" and "buffer" point to current window/buffer. + 2. the name of a local variable in buffer + 3. a hdata name/variable (the value is automatically converted to string), by default "window" and "buffer" point to current window/buffer. Format for hdata can be one of following: hdata.var1.var2...: start with a hdata (pointer must be known), and ask variables one after one (other hdata can be followed) hdata(list).var1.var2...: start with a hdata using a list, for example: diff --git a/po/cs.po b/po/cs.po index 5e3a25aa8..205a77e79 100644 --- a/po/cs.po +++ b/po/cs.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.0-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2012-11-02 08:59+0100\n" +"POT-Creation-Date: 2012-11-02 15:35+0100\n" "PO-Revision-Date: 2012-09-29 11:42+0200\n" "Last-Translator: Jiri Golembiovsky \n" "Language-Team: weechat-dev \n" @@ -1227,7 +1227,8 @@ msgid "" "Some variables are replaced in expression, using the format ${variable}, " "variable can be, by order of prioity :\n" " 1. the name of an option (file.section.option)\n" -" 2. a hdata name/variable (the value is automatically converted to string), " +" 2. the name of a local variable in buffer\n" +" 3. a hdata name/variable (the value is automatically converted to string), " "by default \"window\" and \"buffer\" point to current window/buffer.\n" "Format for hdata can be one of following:\n" " hdata.var1.var2...: start with a hdata (pointer must be known), and ask " diff --git a/po/de.po b/po/de.po index 23db423a6..4e100761f 100644 --- a/po/de.po +++ b/po/de.po @@ -23,7 +23,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.7-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2012-11-02 08:59+0100\n" +"POT-Creation-Date: 2012-11-02 15:35+0100\n" "PO-Revision-Date: 2012-10-19 17:57+0100\n" "Last-Translator: Nils Görs \n" "Language-Team: German \n" @@ -1286,7 +1286,8 @@ msgid "" "Some variables are replaced in expression, using the format ${variable}, " "variable can be, by order of prioity :\n" " 1. the name of an option (file.section.option)\n" -" 2. a hdata name/variable (the value is automatically converted to string), " +" 2. the name of a local variable in buffer\n" +" 3. a hdata name/variable (the value is automatically converted to string), " "by default \"window\" and \"buffer\" point to current window/buffer.\n" "Format for hdata can be one of following:\n" " hdata.var1.var2...: start with a hdata (pointer must be known), and ask " diff --git a/po/es.po b/po/es.po index 005918e54..d4e5317e1 100644 --- a/po/es.po +++ b/po/es.po @@ -22,7 +22,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.0-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2012-11-02 08:59+0100\n" +"POT-Creation-Date: 2012-11-02 15:35+0100\n" "PO-Revision-Date: 2012-09-29 11:42+0200\n" "Last-Translator: Elián Hanisch \n" "Language-Team: weechat-dev \n" @@ -1263,7 +1263,8 @@ msgid "" "Some variables are replaced in expression, using the format ${variable}, " "variable can be, by order of prioity :\n" " 1. the name of an option (file.section.option)\n" -" 2. a hdata name/variable (the value is automatically converted to string), " +" 2. the name of a local variable in buffer\n" +" 3. a hdata name/variable (the value is automatically converted to string), " "by default \"window\" and \"buffer\" point to current window/buffer.\n" "Format for hdata can be one of following:\n" " hdata.var1.var2...: start with a hdata (pointer must be known), and ask " diff --git a/po/fr.po b/po/fr.po index dbdbd5e00..4d85f5d13 100644 --- a/po/fr.po +++ b/po/fr.po @@ -21,8 +21,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.0-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2012-11-02 08:59+0100\n" -"PO-Revision-Date: 2012-10-27 12:51+0200\n" +"POT-Creation-Date: 2012-11-02 15:35+0100\n" +"PO-Revision-Date: 2012-11-02 15:35+0100\n" "Last-Translator: Sebastien Helleu \n" "Language-Team: weechat-dev \n" "Language: French\n" @@ -1263,7 +1263,8 @@ msgid "" "Some variables are replaced in expression, using the format ${variable}, " "variable can be, by order of prioity :\n" " 1. the name of an option (file.section.option)\n" -" 2. a hdata name/variable (the value is automatically converted to string), " +" 2. the name of a local variable in buffer\n" +" 3. a hdata name/variable (the value is automatically converted to string), " "by default \"window\" and \"buffer\" point to current window/buffer.\n" "Format for hdata can be one of following:\n" " hdata.var1.var2...: start with a hdata (pointer must be known), and ask " @@ -1320,7 +1321,8 @@ msgstr "" "Des variables sont remplacées dans l'expression, en utilisant le format " "${variable}, la variable pouvant être, par ordre de priorité :\n" " 1. le nom d'une option (fichier.section.option)\n" -" 2. le nom d'un hdata/variable (la valeur est automatiquement convertie en " +" 2. le nom d'une variable locale du tampon\n" +" 3. le nom d'un hdata/variable (la valeur est automatiquement convertie en " "chaîne), par défaut \"window\" et \"buffer\" pointent vers la fenêtre et le " "tampon courants.\n" "Le format du hdata peut être le suivant :\n" diff --git a/po/hu.po b/po/hu.po index 20a95a5ce..c31803900 100644 --- a/po/hu.po +++ b/po/hu.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.0-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2012-11-02 08:59+0100\n" +"POT-Creation-Date: 2012-11-02 15:35+0100\n" "PO-Revision-Date: 2012-09-29 11:42+0200\n" "Last-Translator: Andras Voroskoi \n" "Language-Team: weechat-dev \n" @@ -1165,7 +1165,8 @@ msgid "" "Some variables are replaced in expression, using the format ${variable}, " "variable can be, by order of prioity :\n" " 1. the name of an option (file.section.option)\n" -" 2. a hdata name/variable (the value is automatically converted to string), " +" 2. the name of a local variable in buffer\n" +" 3. a hdata name/variable (the value is automatically converted to string), " "by default \"window\" and \"buffer\" point to current window/buffer.\n" "Format for hdata can be one of following:\n" " hdata.var1.var2...: start with a hdata (pointer must be known), and ask " diff --git a/po/it.po b/po/it.po index bc3556fa3..093d6f201 100644 --- a/po/it.po +++ b/po/it.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.0-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2012-11-02 08:59+0100\n" +"POT-Creation-Date: 2012-11-02 15:35+0100\n" "PO-Revision-Date: 2012-09-29 11:42+0200\n" "Last-Translator: Marco Paolone \n" "Language-Team: weechat-dev \n" @@ -1252,7 +1252,8 @@ msgid "" "Some variables are replaced in expression, using the format ${variable}, " "variable can be, by order of prioity :\n" " 1. the name of an option (file.section.option)\n" -" 2. a hdata name/variable (the value is automatically converted to string), " +" 2. the name of a local variable in buffer\n" +" 3. a hdata name/variable (the value is automatically converted to string), " "by default \"window\" and \"buffer\" point to current window/buffer.\n" "Format for hdata can be one of following:\n" " hdata.var1.var2...: start with a hdata (pointer must be known), and ask " diff --git a/po/ja.po b/po/ja.po index d13a6f67c..fea7cd3b0 100644 --- a/po/ja.po +++ b/po/ja.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.0-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2012-11-02 08:59+0100\n" +"POT-Creation-Date: 2012-11-02 15:35+0100\n" "PO-Revision-Date: 2012-09-29 11:42+0200\n" "Last-Translator: AYANOKOUZI, Ryuunosuke \n" "Language-Team: Japanese \n" @@ -1238,7 +1238,8 @@ msgid "" "Some variables are replaced in expression, using the format ${variable}, " "variable can be, by order of prioity :\n" " 1. the name of an option (file.section.option)\n" -" 2. a hdata name/variable (the value is automatically converted to string), " +" 2. the name of a local variable in buffer\n" +" 3. a hdata name/variable (the value is automatically converted to string), " "by default \"window\" and \"buffer\" point to current window/buffer.\n" "Format for hdata can be one of following:\n" " hdata.var1.var2...: start with a hdata (pointer must be known), and ask " diff --git a/po/pl.po b/po/pl.po index df21e7917..08628f387 100644 --- a/po/pl.po +++ b/po/pl.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.0-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2012-11-02 08:59+0100\n" +"POT-Creation-Date: 2012-11-02 15:35+0100\n" "PO-Revision-Date: 2012-09-29 11:42+0200\n" "Last-Translator: Krzysztof Korościk \n" "Language-Team: weechat-dev \n" @@ -1259,7 +1259,8 @@ msgid "" "Some variables are replaced in expression, using the format ${variable}, " "variable can be, by order of prioity :\n" " 1. the name of an option (file.section.option)\n" -" 2. a hdata name/variable (the value is automatically converted to string), " +" 2. the name of a local variable in buffer\n" +" 3. a hdata name/variable (the value is automatically converted to string), " "by default \"window\" and \"buffer\" point to current window/buffer.\n" "Format for hdata can be one of following:\n" " hdata.var1.var2...: start with a hdata (pointer must be known), and ask " diff --git a/po/pt_BR.po b/po/pt_BR.po index 1c66c5ef6..83b5483e9 100644 --- a/po/pt_BR.po +++ b/po/pt_BR.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.0-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2012-11-02 08:59+0100\n" +"POT-Creation-Date: 2012-11-02 15:35+0100\n" "PO-Revision-Date: 2012-09-29 11:43+0200\n" "Last-Translator: Sergio Durigan Junior \n" "Language-Team: weechat-dev \n" @@ -1294,7 +1294,8 @@ msgid "" "Some variables are replaced in expression, using the format ${variable}, " "variable can be, by order of prioity :\n" " 1. the name of an option (file.section.option)\n" -" 2. a hdata name/variable (the value is automatically converted to string), " +" 2. the name of a local variable in buffer\n" +" 3. a hdata name/variable (the value is automatically converted to string), " "by default \"window\" and \"buffer\" point to current window/buffer.\n" "Format for hdata can be one of following:\n" " hdata.var1.var2...: start with a hdata (pointer must be known), and ask " diff --git a/po/ru.po b/po/ru.po index eaa57a380..d393e7805 100644 --- a/po/ru.po +++ b/po/ru.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.0-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2012-11-02 08:59+0100\n" +"POT-Creation-Date: 2012-11-02 15:35+0100\n" "PO-Revision-Date: 2012-09-29 11:43+0200\n" "Last-Translator: Aleksey V Zapparov AKA ixti \n" "Language-Team: weechat-dev \n" @@ -1183,7 +1183,8 @@ msgid "" "Some variables are replaced in expression, using the format ${variable}, " "variable can be, by order of prioity :\n" " 1. the name of an option (file.section.option)\n" -" 2. a hdata name/variable (the value is automatically converted to string), " +" 2. the name of a local variable in buffer\n" +" 3. a hdata name/variable (the value is automatically converted to string), " "by default \"window\" and \"buffer\" point to current window/buffer.\n" "Format for hdata can be one of following:\n" " hdata.var1.var2...: start with a hdata (pointer must be known), and ask " diff --git a/po/weechat.pot b/po/weechat.pot index 6e129f57a..28b401eef 100644 --- a/po/weechat.pot +++ b/po/weechat.pot @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2012-11-02 08:59+0100\n" +"POT-Creation-Date: 2012-11-02 15:35+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -1025,7 +1025,8 @@ msgid "" "Some variables are replaced in expression, using the format ${variable}, " "variable can be, by order of prioity :\n" " 1. the name of an option (file.section.option)\n" -" 2. a hdata name/variable (the value is automatically converted to string), " +" 2. the name of a local variable in buffer\n" +" 3. a hdata name/variable (the value is automatically converted to string), " "by default \"window\" and \"buffer\" point to current window/buffer.\n" "Format for hdata can be one of following:\n" " hdata.var1.var2...: start with a hdata (pointer must be known), and ask " diff --git a/src/core/wee-command.c b/src/core/wee-command.c index 5ab73624a..830b40bae 100644 --- a/src/core/wee-command.c +++ b/src/core/wee-command.c @@ -5796,7 +5796,8 @@ command_init () "Some variables are replaced in expression, using the " "format ${variable}, variable can be, by order of prioity :\n" " 1. the name of an option (file.section.option)\n" - " 2. a hdata name/variable (the value is automatically " + " 2. the name of a local variable in buffer\n" + " 3. a hdata name/variable (the value is automatically " "converted to string), by default \"window\" and \"buffer\" " "point to current window/buffer.\n" "Format for hdata can be one of following:\n" diff --git a/src/core/wee-eval.c b/src/core/wee-eval.c index 45b2e1f01..f52e359e4 100644 --- a/src/core/wee-eval.c +++ b/src/core/wee-eval.c @@ -36,6 +36,7 @@ #include "wee-hdata.h" #include "wee-hook.h" #include "wee-string.h" +#include "../gui/gui-buffer.h" #include "../gui/gui-color.h" #include "../gui/gui-window.h" #include "../plugins/plugin.h" @@ -212,7 +213,8 @@ end: * by order of priority: * 1. an extra variable (from hashtable "extra_vars") * 2. an name of option (file.section.option) - * 3. a hdata name/variable + * 3. a buffer local variable + * 4. a hdata name/variable * Examples: * option: ${weechat.look.scroll_amount} * hdata : ${window.buffer.full_name} @@ -224,6 +226,7 @@ eval_replace_vars_cb (void *data, const char *text) { struct t_hashtable *pointers, *extra_vars; struct t_config_option *ptr_option; + struct t_gui_buffer *ptr_buffer; char str_value[64], *value, *pos, *pos1, *pos2, *hdata_name, *list_name; char *tmp; const char *ptr_value; @@ -233,12 +236,12 @@ eval_replace_vars_cb (void *data, const char *text) pointers = (struct t_hashtable *)(((void **)data)[0]); extra_vars = (struct t_hashtable *)(((void **)data)[1]); - /* first look for var in hashtable "extra_vars" */ + /* 1. look for var in hashtable "extra_vars" */ ptr_value = hashtable_get (extra_vars, text); if (ptr_value) return strdup (ptr_value); - /* look for name of option: if found, return this value */ + /* 2. look for name of option: if found, return this value */ config_file_search_with_string (text, NULL, NULL, &ptr_option, NULL); if (ptr_option) { @@ -261,7 +264,16 @@ eval_replace_vars_cb (void *data, const char *text) } } - /* look for hdata */ + /* 3. look for local variable in buffer */ + ptr_buffer = hashtable_get (pointers, "buffer"); + if (ptr_buffer) + { + ptr_value = hashtable_get (ptr_buffer->local_variables, text); + if (ptr_value) + return strdup (ptr_value); + } + + /* 4. look for hdata */ value = NULL; hdata_name = NULL; list_name = NULL;