diff --git a/ChangeLog.adoc b/ChangeLog.adoc index 03cff7f67..f996c3feb 100644 --- a/ChangeLog.adoc +++ b/ChangeLog.adoc @@ -16,7 +16,7 @@ For a list of important changes that require manual actions, please look at rele New features:: * core: add option type "enum" (issue #1973) - * core: add options weechat.buffer.* to save buffer properties set by user (issue #352) + * core: add options weechat.buffer.* to save buffer properties set by user, add option `setauto` in command `/buffer` (issue #352) * core: add parameters and key bindings to move to edges of current area with commands `/cursor go` and `/cursor move` (issue #1282) * core: add variables "_chat_focused_line_bol" and "_chat_focused_line_eol" in focus data (issue #1955) * api: add info "buffer" (issue #1962) diff --git a/doc/de/weechat_faq.de.adoc b/doc/de/weechat_faq.de.adoc index fe3797c39..feb024039 100644 --- a/doc/de/weechat_faq.de.adoc +++ b/doc/de/weechat_faq.de.adoc @@ -993,35 +993,22 @@ die Buffer-Eigenschaft genutzt werden, um das maximale Hotlist-Level für einige oder pro Gruppe von Buffern (wie IRC-Server). Um nun Highlights (Hervorhebungen) für bestimmte Nicks zu deaktivieren, muss -man die entsprechende Eigenschaft auf 2 setzen: +man die entsprechende Eigenschaft auf 2 setzen. + +// TRANSLATION MISSING +For the current buffer: ---- -/buffer set hotlist_max_level_nicks_add joe:2,mike:2 +/buffer setauto hotlist_max_level_nicks_add joe:2,mike:2 ---- -Diese Buffereigenschaft wird aber nicht permanent in der Konfiguration -gespeichert. Um diese Eigenschaften permanent zu verwenden, muss man -das Skript _buffer_autoset.py_ nutzen: +// TRANSLATION MISSING +For all channels on server "libera": ---- -/script install buffer_autoset.py +/set weechat.buffer.irc.libera.*.hotlist_max_level_nicks_add joe:2,mike:2 ---- -Um zum Beispiel Highlights (Hervorhebungen) von Nick "mike" im Kanal -#weechat auf dem IRC Server libera zu deaktivieren: - ----- -/buffer_autoset add irc.libera.#weechat hotlist_max_level_nicks_add mike:2 ----- - -Um dies auf den kompletten libera Server anzuwenden: - ----- -/buffer_autoset add irc.libera hotlist_max_level_nicks_add mike:2 ----- - -Für weitere Beispiele, siehe `+/help buffer_autoset+`. - [[irc_target_buffer]] === Wie kann ich bei zusammengefügten Buffern den Zielbuffer ändern (z.B. bei einem Server-Buffer)? diff --git a/doc/de/weechat_user.de.adoc b/doc/de/weechat_user.de.adoc index 909edcb80..6adeb3603 100644 --- a/doc/de/weechat_user.de.adoc +++ b/doc/de/weechat_user.de.adoc @@ -2246,15 +2246,9 @@ und für jeden einzelen Nick kann ein maximler Hotlist-Level eingestellt wertden Um zum Beispiel Highlights von "joe" und "mike" im aktuellen Buffer zu deaktivieren: ---- -/buffer set hotlist_max_level_nicks_add joe:2,mike:2 +/buffer setauto hotlist_max_level_nicks_add joe:2,mike:2 ---- -[NOTE] -Die Buffer-Eigenschaft "hotlist_max_level_nicks" ist keine permanente Einstellung und wird nicht -in der Konfigurationsdatei gesichert. + Um diese Einstellung persistent zu machen benötigt man -das Skript _buffer_autoset.py_: Um das Skript zu installieren `+/script install buffer_autoset.py+` -und um eine Hilfe zu erhalten wie man es nutzt: `+/help buffer_autoset+`. - [[highlights]] === Hervorhebungen @@ -2279,15 +2273,9 @@ Dies kann auch mit der Buffereigenschaft „highlight_disable_regex“ eingestel Gleiches Beispiel, spezifisch für den aktuellen Buffer: ---- -/buffer set highlight_disable_regex +/buffer setauto highlight_disable_regex ---- -[NOTE] -Die Buffer-Eigenschaft "highlight_disable_regex" ist keine permanente Einstellung und wird nicht -in der Konfigurationsdatei gesichert. + Um diese Einstellung persistent zu machen benötigt man -das Skript _buffer_autoset.py_: Um das Skript zu installieren `+/script install buffer_autoset.py+` -und um eine Hilfe zu erhalten wie man es nutzt: `+/help buffer_autoset+`. - [[highlights_words]] ==== Worte als Highlights hinzufügen @@ -2346,15 +2334,9 @@ die Eigenschaft des Buffers mittels "highlight_regex" anpasst. Um zum Beispiel jede Nachricht im aktuellen Buffer als Highlight-Nachricht einzustufen: ---- -/buffer set highlight_regex .* +/buffer setauto highlight_regex .* ---- -[NOTE] -Die Buffer-Eigenschaft "highlight_regex" ist keine permanente Einstellung und wird nicht -in der Konfigurationsdatei gesichert. + Um diese Einstellung persistent zu machen benötigt man -das Skript _buffer_autoset.py_: Um das Skript zu installieren `+/script install buffer_autoset.py+` -und um eine Hilfe zu erhalten wie man es nutzt: `+/help buffer_autoset+`. - [[buffer_logging]] === Bufferprotokollierung diff --git a/doc/en/weechat_faq.en.adoc b/doc/en/weechat_faq.en.adoc index f9f641703..cbd190239 100644 --- a/doc/en/weechat_faq.en.adoc +++ b/doc/en/weechat_faq.en.adoc @@ -925,35 +925,20 @@ link:weechat_user.en.html#max_hotlist_level_nicks[hotlist_max_level_nicks_add ^ buffer property to set the max hotlist level for some nicks, per buffer, or per group of buffers (like IRC servers). -To only disable highlights, you'd have to set it to 2: +To only disable highlights, you'd have to set it to 2. + +For the current buffer: ---- -/buffer set hotlist_max_level_nicks_add joe:2,mike:2 +/buffer setauto hotlist_max_level_nicks_add joe:2,mike:2 ---- -This buffer property isn't stored in the configuration though. -To automatically reapply these buffer properties, you would need the -_buffer_autoset.py_ script: +For all channels on server "libera": ---- -/script install buffer_autoset.py +/set weechat.buffer.irc.libera.*.hotlist_max_level_nicks_add joe:2,mike:2 ---- -For example, to permanently disable highlights from "mike" on #weechat -on the IRC server libera: - ----- -/buffer_autoset add irc.libera.#weechat hotlist_max_level_nicks_add mike:2 ----- - -To apply it to the entire libera server instead: - ----- -/buffer_autoset add irc.libera hotlist_max_level_nicks_add mike:2 ----- - -For more examples, see `+/help buffer_autoset+`. - [[irc_target_buffer]] === How can I change target buffer for commands on merged buffers (like buffer with servers)? diff --git a/doc/en/weechat_user.en.adoc b/doc/en/weechat_user.en.adoc index d0ea70be9..ad29093ab 100644 --- a/doc/en/weechat_user.en.adoc +++ b/doc/en/weechat_user.en.adoc @@ -2221,15 +2221,9 @@ and for each nick the max hotlist level to trigger, possible levels are: For example to disable highlights from "joe" and "mike" on current buffer: ---- -/buffer set hotlist_max_level_nicks_add joe:2,mike:2 +/buffer setauto hotlist_max_level_nicks_add joe:2,mike:2 ---- -[NOTE] -The buffer property "hotlist_max_level_nicks" is not saved in configuration. + -You can easily save it with the script _buffer_autoset.py_: you can install it -with `+/script install buffer_autoset.py+` and get help with -`+/help buffer_autoset+`. - [[highlights]] === Highlights @@ -2254,15 +2248,9 @@ This can also be set with the buffer property "highlight_disable_regex". Same example, specific to the current buffer: ---- -/buffer set highlight_disable_regex +/buffer setauto highlight_disable_regex ---- -[NOTE] -The buffer property "highlight_disable_regex" is not saved in configuration. + -You can easily save it with the script _buffer_autoset.py_: you can install it -with `+/script install buffer_autoset.py+` and get help with -`+/help buffer_autoset+`. - [[highlights_words]] ==== Add words to highlight @@ -2317,15 +2305,9 @@ You can force highlight using a regular expression with the buffer property For example to force the highlight on all messages in the current buffer: ---- -/buffer set highlight_regex .* +/buffer setauto highlight_regex .* ---- -[NOTE] -The buffer property "highlight_regex" is not saved in configuration. + -You can easily save it with the script _buffer_autoset.py_: you can install it -with `+/script install buffer_autoset.py+` and get help with -`+/help buffer_autoset+`. - [[buffer_logging]] === Buffer logging diff --git a/doc/es/weechat_faq.es.adoc b/doc/es/weechat_faq.es.adoc index f735fb79e..60abe1255 100644 --- a/doc/es/weechat_faq.es.adoc +++ b/doc/es/weechat_faq.es.adoc @@ -954,35 +954,22 @@ link:weechat_user.en.html#max_hotlist_level_nicks[hotlist_max_level_nicks_add ^ buffer property to set the max hotlist level for some nicks, per buffer, or per group of buffers (like IRC servers). -Para únicamente inhabilitar las notificaciones, debería establecerlo a 2: +Para únicamente inhabilitar las notificaciones, debería establecerlo a 2. + +// TRANSLATION MISSING +For the current buffer: ---- -/buffer set hotlist_max_level_nicks_add joe:2,mike:2 +/buffer setauto hotlist_max_level_nicks_add joe:2,mike:2 ---- -Esta propiedad del buffer no es almacenada en la configuración. -Para volver a aplicar automáticamente estas propiedades del buffer, necesitaría el script -_buffer_autoset.py_: +// TRANSLATION MISSING +For all channels on server "libera": ---- -/script install buffer_autoset.py +/set weechat.buffer.irc.libera.*.hotlist_max_level_nicks_add joe:2,mike:2 ---- -Por ejemplo, para inhabilitar automáticamente las menciones de "mike" en #weechat -en el servidor IRC de libera: - ----- -/buffer_autoset add irc.libera.#weechat hotlist_max_level_nicks_add mike:2 ----- - -Para aplicarlo al servidor completo de libera: - ----- -/buffer_autoset add irc.libera hotlist_max_level_nicks_add mike:2 ----- - -Para más ejemplos, vea `+/help buffer_autoset+`. - [[irc_target_buffer]] === ¿Cómo puedo cambiar el objetivo del buffer para comandos en buffers unidos (como en un buffer con servidores)? diff --git a/doc/fr/weechat_faq.fr.adoc b/doc/fr/weechat_faq.fr.adoc index 4f52ed373..5f50f681a 100644 --- a/doc/fr/weechat_faq.fr.adoc +++ b/doc/fr/weechat_faq.fr.adoc @@ -955,35 +955,20 @@ link:weechat_user.fr.html#max_hotlist_level_nicks[hotlist_max_level_nicks_add ^ pour définir le niveau maximum de hotlist pour certains pseudos, par tampon, ou groupe de tampons (comme des serveurs IRC). -Pour désactiver seulement les highlights, vous pouvez positionner la valeur à 2 : +Pour désactiver seulement les highlights, vous pouvez positionner la valeur à 2. + +Pour le tampon courant : ---- -/buffer set hotlist_max_level_nicks_add joe:2,mike:2 +/buffer setauto hotlist_max_level_nicks_add joe:2,mike:2 ---- -Cependant, cette propriété de tampon n'est pas sauvegardée dans la configuration. -Pour automatiquement réappliquer ces propriétés de tampons, vous aurez besoin -du script _buffer_autoset.py_ : +Pour tous les canaux sur le serveur "libera": ---- -/script install buffer_autoset.py +/set weechat.buffer.irc.libera.*.hotlist_max_level_nicks_add joe:2,mike:2 ---- -Par exemple, pour désactiver de manière permanente les highlights de "mike" sur -#weechat sur le serveur IRC libera : - ----- -/buffer_autoset add irc.libera.#weechat hotlist_max_level_nicks_add mike:2 ----- - -Pour l'appliquer à l'ensemble du serveur libera : - ----- -/buffer_autoset add irc.libera hotlist_max_level_nicks_add mike:2 ----- - -Pour plus d'exemples, voir `+/help buffer_autoset+`. - [[irc_target_buffer]] === Comment puis-je changer le serveur cible pour les commandes avec des tampons mélangés (comme le tampon avec les serveurs) ? diff --git a/doc/fr/weechat_user.fr.adoc b/doc/fr/weechat_user.fr.adoc index 13ec9bb41..24ed5368d 100644 --- a/doc/fr/weechat_user.fr.adoc +++ b/doc/fr/weechat_user.fr.adoc @@ -2276,16 +2276,9 @@ Par exemple pour désactiver les « highlights » de "joe" et "mike" sur le ta courant : ---- -/buffer set hotlist_max_level_nicks_add joe:2,mike:2 +/buffer setauto hotlist_max_level_nicks_add joe:2,mike:2 ---- -[NOTE] -La propriété de tampon "hotlist_max_level_nicks" n'est pas sauvegardée dans la -configuration. + -Vous pouvez facilement la sauvegarder avec le script _buffer_autoset.py_ : vous -pouvez l'installer avec `+/script install buffer_autoset.py+` et obtenir de l'aide -avec `+/help buffer_autoset+`. - [[highlights]] === Highlights @@ -2310,16 +2303,9 @@ Ceci peut aussi être défini avec la propriété de tampon "highlight_disable_r Même exemple, spécifique au tampon courant : ---- -/buffer set highlight_disable_regex +/buffer setauto highlight_disable_regex ---- -[NOTE] -La propriété de tampon "highlight_disable_regex" n'est pas sauvegardée dans la -configuration. + -Vous pouvez facilement la sauvegarder avec le script _buffer_autoset.py_ : vous -pouvez l'installer avec `+/script install buffer_autoset.py+` et obtenir de l'aide -avec `+/help buffer_autoset+`. - [[highlights_words]] ==== Ajouter des mots pour le « highlight » @@ -2377,16 +2363,9 @@ Par exemple pour forcer le highlight sur tous les messages dans le canal courant : ---- -/buffer set highlight_regex .* +/buffer setauto highlight_regex .* ---- -[NOTE] -La propriété de tampon "highlight_regex" n'est pas sauvegardée dans la -configuration. + -Vous pouvez facilement la sauvegarder avec le script _buffer_autoset.py_ : vous -pouvez l'installer avec `+/script install buffer_autoset.py+` et obtenir de l'aide -avec `+/help buffer_autoset+`. - [[buffer_logging]] === Enregistrement des tampons diff --git a/doc/it/weechat_faq.it.adoc b/doc/it/weechat_faq.it.adoc index e0234abc4..fb563fa10 100644 --- a/doc/it/weechat_faq.it.adoc +++ b/doc/it/weechat_faq.it.adoc @@ -1012,41 +1012,25 @@ Altri script correlati: [[disable_highlights_for_specific_nicks]] === How can I disable highlights for specific nicks? -// TRANSLATION MISSING You can use the link:weechat_user.it.html#max_hotlist_level_nicks[hotlist_max_level_nicks_add ^↗^^] buffer property to set the max hotlist level for some nicks, per buffer, or per group of buffers (like IRC servers). -To only disable highlights, you'd have to set it to 2: +To only disable highlights, you'd have to set it to 2. + +For the current buffer: ---- -/buffer set hotlist_max_level_nicks_add joe:2,mike:2 +/buffer setauto hotlist_max_level_nicks_add joe:2,mike:2 ---- -This buffer property isn't stored in the configuration though. -To automatically reapply these buffer properties, you would need the -_buffer_autoset.py_ script: +For all channels on server "libera": ---- -/script install buffer_autoset.py +/set weechat.buffer.irc.libera.*.hotlist_max_level_nicks_add joe:2,mike:2 ---- -For example, to permanently disable highlights from "mike" on #weechat -on the IRC server libera: - ----- -/buffer_autoset add irc.libera.#weechat hotlist_max_level_nicks_add mike:2 ----- - -To apply it to the entire libera server instead: - ----- -/buffer_autoset add irc.libera hotlist_max_level_nicks_add mike:2 ----- - -For more examples, see `+/help buffer_autoset+`. - [[irc_target_buffer]] === Come si può modificare il buffer destinazione per i comandi sui buffer uniti (come i buffer con i server)? diff --git a/doc/it/weechat_user.it.adoc b/doc/it/weechat_user.it.adoc index 108c1fb6d..e28536830 100644 --- a/doc/it/weechat_user.it.adoc +++ b/doc/it/weechat_user.it.adoc @@ -2460,14 +2460,9 @@ and for each nick the max hotlist level to trigger, possible levels are: For example to disable highlights from "joe" and "mike" on current buffer: ---- -/buffer set hotlist_max_level_nicks_add joe:2,mike:2 +/buffer setauto hotlist_max_level_nicks_add joe:2,mike:2 ---- -[NOTE] -The buffer property "hotlist_max_level_nicks" is not saved in configuration. + -You can easily save it with the script _buffer_autoset.py_: you can install it -with `+/script install buffer_autoset.py+` and get help with `+/help buffer_autoset+`. - // TRANSLATION MISSING [[highlights]] === Highlights @@ -2494,15 +2489,9 @@ This can also be set with the buffer property "highlight_disable_regex". Same example, specific to the current buffer: ---- -/buffer set highlight_disable_regex +/buffer setauto highlight_disable_regex ---- -[NOTE] -The buffer property "highlight_disable_regex" is not saved in configuration. + -You can easily save it with the script _buffer_autoset.py_: you can install it -with `+/script install buffer_autoset.py+` and get help with -`+/help buffer_autoset+`. - [[highlights_words]] ==== Add words to highlight @@ -2557,14 +2546,9 @@ You can force highlight using a regular expression with the buffer property For example to force the highlight on all messages in the current buffer: ---- -/buffer set highlight_regex .* +/buffer setauto highlight_regex .* ---- -[NOTE] -The buffer property "highlight_regex" is not saved in configuration. + -You can easily save it with the script _buffer_autoset.py_: you can install it -with `+/script install buffer_autoset.py+` and get help with `+/help buffer_autoset+`. - // TRANSLATION MISSING [[buffer_logging]] === Buffer logging diff --git a/doc/ja/weechat_faq.ja.adoc b/doc/ja/weechat_faq.ja.adoc index 205ecece6..2c8fde776 100644 --- a/doc/ja/weechat_faq.ja.adoc +++ b/doc/ja/weechat_faq.ja.adoc @@ -953,34 +953,22 @@ link:weechat_user.ja.html#max_hotlist_level_nicks[hotlist_max_level_nicks_add ^ buffer property to set the max hotlist level for some nicks, per buffer, or per group of buffers (like IRC servers). -ハイライトを無効化するだけなら、このプロパティを 2 に設定してください: +ハイライトを無効化するだけなら、このプロパティを 2 に設定してください. + +// TRANSLATION MISSING +For the current buffer: ---- -/buffer set hotlist_max_level_nicks_add joe:2,mike:2 +/buffer setauto hotlist_max_level_nicks_add joe:2,mike:2 ---- -このバッファプロパティは設定に保存されません。このバッファプロパティを自動的に適用するには、_buffer_autoset.py_ -スクリプトが必要です: +// TRANSLATION MISSING +For all channels on server "libera": ---- -/script install buffer_autoset.py +/set weechat.buffer.irc.libera.*.hotlist_max_level_nicks_add joe:2,mike:2 ---- -例えば、IRC サーバ libera のチャンネル #weechat に参加している "mike" -の発言に対してハイライトを永久的に無効化するには以下のように設定します: - ----- -/buffer_autoset add irc.libera.#weechat hotlist_max_level_nicks_add mike:2 ----- - -この設定をすべての libera サーバのバッファに対して適用するには以下のように設定します: - ----- -/buffer_autoset add irc.libera hotlist_max_level_nicks_add mike:2 ----- - -これ以外の例は `+/help buffer_autoset+` を参照してください。 - [[irc_target_buffer]] === どうすればマージされたバッファ内であるコマンドを発行するターゲットバッファを変更できますか。 diff --git a/doc/ja/weechat_user.ja.adoc b/doc/ja/weechat_user.ja.adoc index fed231d9b..d367055c9 100644 --- a/doc/ja/weechat_user.ja.adoc +++ b/doc/ja/weechat_user.ja.adoc @@ -2373,14 +2373,9 @@ irc サーバ "libera" に含まれる全てのバッファに対して設定す 例えば現在のバッファで "joe" と "mike" からのメッセージに対するハイライトを無効化するには以下のように設定します: ---- -/buffer set hotlist_max_level_nicks_add joe:2,mike:2 +/buffer setauto hotlist_max_level_nicks_add joe:2,mike:2 ---- -[NOTE] -バッファプロパティ "hotlist_max_level_nicks" は設定ファイルに保存されません。 + -これを保存するには _buffer_autoset.py_ スクリプトを使ってください: このスクリプトをインストールするには -`+/script install buffer_autoset.py+` コマンドを使い、ヘルプを見るには `+/help buffer_autoset+` コマンドを使ってください。 - [[highlights]] === ハイライト @@ -2406,14 +2401,9 @@ This can also be set with the buffer property "highlight_disable_regex". Same example, specific to the current buffer: ---- -/buffer set highlight_disable_regex +/buffer setauto highlight_disable_regex ---- -[NOTE] -バッファプロパティ "highlight_disable_regex" は設定ファイルに保存されません。 + -これを保存するには _buffer_autoset.py_ スクリプトを使ってください: このスクリプトをインストールするには -`+/script install buffer_autoset.py+` コマンドを使い、ヘルプを見るには `+/help buffer_autoset+` コマンドを使ってください。 - [[highlights_words]] ==== ハイライトする単語の追加 @@ -2468,14 +2458,9 @@ Same example, specific to the current buffer: 例えば現在のバッファ宛のすべてのメッセージをハイライトするには以下のように設定します: ---- -/buffer set highlight_regex .* +/buffer setauto highlight_regex .* ---- -[NOTE] -バッファプロパティ "highlight_regex" は設定ファイルに保存されません。 + -これを保存するには _buffer_autoset.py_ スクリプトを使ってください: このスクリプトをインストールするには -`+/script install buffer_autoset.py+` コマンドを使い、ヘルプを見るには `+/help buffer_autoset+` コマンドを使ってください。 - // TRANSLATION MISSING [[buffer_logging]] === Buffer logging diff --git a/doc/pl/weechat_faq.pl.adoc b/doc/pl/weechat_faq.pl.adoc index bbf41d369..a761b8edf 100644 --- a/doc/pl/weechat_faq.pl.adoc +++ b/doc/pl/weechat_faq.pl.adoc @@ -927,34 +927,22 @@ link:weechat_user.pl.html#max_hotlist_level_nicks[hotlist_max_level_nicks_add ^ do ustawienia maksymalnego poziomu hotlisty dla niektórych nicków, dla buforów lub grup buforów (jak serwery IRC). -W celu wyłączenia tylko podświetleń wystarczy ustawić ja na 2: +W celu wyłączenia tylko podświetleń wystarczy ustawić ja na 2. + +// TRANSLATION MISSING +For the current buffer: ---- -/buffer set hotlist_max_level_nicks_add joe:2,mike:2 +/buffer setauto hotlist_max_level_nicks_add joe:2,mike:2 ---- -To utawienie nie jest zapisywane jednak w konfiguracji. -W celu automatycznego ustawiania tej właściwości należy użyć skryptu _buffer_autoset.py_: +// TRANSLATION MISSING +For all channels on server "libera": ---- -/script install buffer_autoset.py +/set weechat.buffer.irc.libera.*.hotlist_max_level_nicks_add joe:2,mike:2 ---- -Na przykład w celu wyłączenia powiadomień od "mike" na #weechat w sieci libera: -on the IRC server libera: - ----- -/buffer_autoset add irc.libera.#weechat hotlist_max_level_nicks_add mike:2 ----- - -Dla całego serwera libera: - ----- -/buffer_autoset add irc.libera hotlist_max_level_nicks_add mike:2 ----- - -Więcej przykładów można znaleźć wykonując komende `+/help buffer_autoset+`. - [[irc_target_buffer]] === Jak mogę zmienić docelowy bufor dla komendy w połączonym buforze (jak bufor z serwerami)? diff --git a/doc/pl/weechat_user.pl.adoc b/doc/pl/weechat_user.pl.adoc index af92dca73..ce52ff1d7 100644 --- a/doc/pl/weechat_user.pl.adoc +++ b/doc/pl/weechat_user.pl.adoc @@ -2253,14 +2253,9 @@ z ustawonym dla każdego z nich maksymalnym poziomem hotlisty, możliwe poziomy Na przykład, żeby wyłączyć podświetlenia od "joe" oraz "mike" w obecnym buforze: ---- -/buffer set hotlist_max_level_nicks_add joe:2,mike:2 +/buffer setauto hotlist_max_level_nicks_add joe:2,mike:2 ---- -[NOTE] -Właściwość bufora "hotlist_max_level_nicks" nie jest zapisywana w konfiguracji. + -Można ją zapisać za pomocą skryptu _buffer_autoset.py_: można go zaintalować za pomocą -`+/script install buffer_autoset.py+`, informacje o używaniu `+/help buffer_autoset+`. - [[highlights]] === Podświetlenia @@ -2285,14 +2280,9 @@ Można to także osiągnąć za pomocą właściwości bufora "highlight_disable Ten sam przykład, tylko dla konkretnego bufora: ---- -/buffer set highlight_disable_regex +/buffer setauto highlight_disable_regex ---- -[NOTE] -Właściwość bufora "highlight_disable_regex" nie jest zapisywana w konfiguracji. + -Można ją zapisać za pomocą skryptu _buffer_autoset.py_: można go zaintalować za pomocą -`+/script install buffer_autoset.py+`, informacje o używaniu `+/help buffer_autoset+`. - [[highlights_words]] ==== Dodawanie słów do podświetleń @@ -2346,14 +2336,9 @@ Możesz wymusić podświetlenia używając wyrażenia regularnego z właściwoś Na przykład żeby wymusić podświetlenie dla wszytkich wiadomości w obecnym buforze: ---- -/buffer set highlight_regex .* +/buffer setauto highlight_regex .* ---- -[NOTE] -Właściwość bufora "highlight_regex" nie jest zapisywana w konfiguracji. + -Można ją zapisać za pomocą skryptu _buffer_autoset.py_: można go zaintalować za pomocą -`+/script install buffer_autoset.py+`, informacje o używaniu `+/help buffer_autoset+`. - [[buffer_logging]] === Bufor logera diff --git a/doc/sr/weechat_faq.sr.adoc b/doc/sr/weechat_faq.sr.adoc index 572b214c7..f8e04718c 100644 --- a/doc/sr/weechat_faq.sr.adoc +++ b/doc/sr/weechat_faq.sr.adoc @@ -821,32 +821,22 @@ link:weechat_user.sr.html#max_hotlist_level_nicks[hotlist_max_level_nicks_add ^ можете користити да за неке надимке подесите максимални ниво вруће листе, по баферу, или по групи бафера (као на пример IRC сервери). -Ако само желите да искључите истицања, треба да је поставите на 2: +Ако само желите да искључите истицања, треба да је поставите на 2. + +// TRANSLATION MISSING +For the current buffer: ---- -/buffer set hotlist_max_level_nicks_add joe:2,mike:2 +/buffer setauto hotlist_max_level_nicks_add joe:2,mike:2 ---- -Међутим, ова особина бафера се не чува у конфигурацији. Ако желите да се ове особине бафера аутоматски поново примене, биће вам потребна скрипта _buffer_autoset.py_: +// TRANSLATION MISSING +For all channels on server "libera": ---- -/script install buffer_autoset.py +/set weechat.buffer.irc.libera.*.hotlist_max_level_nicks_add joe:2,mike:2 ---- -На пример, ако за стално желите да искључите истицања од надимка „mike” са #weechat на IRC серверу libera: - ----- -/buffer_autoset add irc.libera.#weechat hotlist_max_level_nicks_add mike:2 ----- - -Ако уместо овога желите да се примени на комплетан libera сервер: - ----- -/buffer_autoset add irc.libera hotlist_max_level_nicks_add mike:2 ----- - -За још примера, погледајте `+/help buffer_autoset+`. - [[irc_target_buffer]] === Како могу да променим циљни бафер за команде над спојеним баферима (као што је бафер са серверима)? diff --git a/doc/sr/weechat_user.sr.adoc b/doc/sr/weechat_user.sr.adoc index 228f30a29..03c95a29f 100644 --- a/doc/sr/weechat_user.sr.adoc +++ b/doc/sr/weechat_user.sr.adoc @@ -2111,13 +2111,9 @@ include::{autogendir}/autogen_user_options.sr.adoc[tag=charset_options] На пример, ако желите да искључите истицања од „joe” и „mike” у текућем баферу: ---- -/buffer set hotlist_max_level_nicks_add joe:2,mike:2 +/buffer setauto hotlist_max_level_nicks_add joe:2,mike:2 ---- -[NOTE] -Особина бафера „hotlist_max_level_nicks” се не чува у конфигурацији. + -Лако можете да је сачувате скриптом _buffer_autoset.py_: инсталирате је командом `+/script install buffer_autoset.py+`, а помоћ добијате са `+/help buffer_autoset+`. - [[highlights]] === Истицања @@ -2141,13 +2137,9 @@ include::{autogendir}/autogen_user_options.sr.adoc[tag=charset_options] Исти пример, који функционише само на текућем баферу: ---- -/buffer set highlight_disable_regex +/buffer setauto highlight_disable_regex ---- -[NOTE] -Особина бафера „highlight_disable_regex” се не чува у конфигурацији. + -Лако можете да је сачувате скриптом _buffer_autoset.py_: инсталирате је командом `+/script install buffer_autoset.py+`, а помоћ добијате са `+/help buffer_autoset+`. - [[highlights_words]] ==== Додавање речи које се истичу @@ -2189,13 +2181,9 @@ include::{autogendir}/autogen_user_options.sr.adoc[tag=charset_options] На пример, да форсирате истицање свих порука у текућем баферу: ---- -/buffer set highlight_regex .* +/buffer setauto highlight_regex .* ---- -[NOTE] -Особина бафера „highlight_regex” се не чува у конфигурацији. + -Лако можете да је сачувате скриптом _buffer_autoset.py_: инсталирате је командом `+/script install buffer_autoset.py+`, а помоћ добијате са `+/help buffer_autoset+`. - [[buffer_logging]] === Логовање бафера diff --git a/src/core/wee-command.c b/src/core/wee-command.c index b9e802233..54209d505 100644 --- a/src/core/wee-command.c +++ b/src/core/wee-command.c @@ -642,7 +642,7 @@ COMMAND_CALLBACK(buffer) long number, number1, number2, numbers[3]; char *error, *value, *pos, *str_number1, *pos_number2; int i, count, prev_number, clear_number, list_size; - int buffer_found, arg_name, type_free, switch_to_buffer; + int buffer_found, arg_name, type_free, switch_to_buffer, rc; /* make C compiler happy */ (void) pointer; @@ -1328,6 +1328,41 @@ COMMAND_CALLBACK(buffer) return WEECHAT_RC_OK; } + /* + * set a property on buffer, saved in config, auto-applied when the buffer + * is opened + */ + if (string_strcmp (argv[1], "setauto") == 0) + { + COMMAND_MIN_ARGS(3, "setauto"); + if (argc == 3) + { + /* + * default to empty value for valueless buffer "properties", + * e.g. localvar_del_xxx + */ + rc = config_weechat_buffer_set (buffer, argv[2], ""); + } + else + { + value = string_remove_quotes (argv_eol[3], "'\""); + rc = config_weechat_buffer_set (buffer, + argv[2], + (value) ? value : argv_eol[3]); + if (value) + free (value); + } + if (!rc) + { + gui_chat_printf ( + NULL, + _("%sUnable to create option for buffer property \"%s\""), + gui_chat_prefix[GUI_CHAT_PREFIX_ERROR], + argv[2]); + } + return WEECHAT_RC_OK; + } + /* get a buffer property */ if (string_strcmp (argv[1], "get") == 0) { @@ -7758,6 +7793,7 @@ command_init () " || setvar []" " || delvar " " || set []" + " || setauto []" " || get " " || jump smart|last_displayed|prev_visited|next_visited" " || |-|+|"), @@ -7795,6 +7831,9 @@ command_init () " setvar: set a local variable in the current buffer\n" " delvar: delete a local variable from the current buffer\n" " set: set a property in the current buffer\n" + " setauto: like \"set\" and also define option " + "\"weechat.buffer..\" so that the property is saved " + "in configuration and applied each time this buffer is opened\n" " get: display a property of current buffer\n" " jump: jump to another buffer:\n" " smart: next buffer with activity\n" @@ -7861,6 +7900,7 @@ command_init () " || setvar %(buffer_local_variables) %(buffer_local_variable_value)" " || delvar %(buffer_local_variables)" " || set %(buffer_properties_set)" + " || setauto %(buffer_properties_setauto)" " || get %(buffer_properties_get)" " || jump smart|last_displayed|prev_visited|next_visited" " || %(buffers_plugins_names)|%(buffers_names)|%(irc_channels)|" diff --git a/src/core/wee-completion.c b/src/core/wee-completion.c index cbd068b4d..9c4674af6 100644 --- a/src/core/wee-completion.c +++ b/src/core/wee-completion.c @@ -489,6 +489,62 @@ completion_list_add_buffer_properties_set_cb (const void *pointer, void *data, return WEECHAT_RC_OK; } +/* + * Adds a buffer local variable to completions list (for `/buffer setauto`). + */ + +void +completion_list_map_buffer_local_variable_setauto_cb (void *data, + struct t_hashtable *hashtable, + const void *key, + const void *value) +{ + char str_localvar[4096]; + + /* make C compiler happy */ + (void) hashtable; + (void) value; + + snprintf (str_localvar, sizeof (str_localvar), + "localvar_set_%s", (const char *)key); + gui_completion_list_add ((struct t_gui_completion *)data, + str_localvar, + 0, WEECHAT_LIST_POS_SORT); +} + +/* + * Adds buffer properties and local variables (that can be set) to completion + * list. + */ + +int +completion_list_add_buffer_properties_setauto_cb (const void *pointer, void *data, + const char *completion_item, + struct t_gui_buffer *buffer, + struct t_gui_completion *completion) +{ + int i; + + /* make C compiler happy */ + (void) pointer; + (void) data; + (void) completion_item; + (void) buffer; + + for (i = 0; gui_buffer_properties_set[i]; i++) + { + gui_completion_list_add (completion, + gui_buffer_properties_set[i], + 0, WEECHAT_LIST_POS_SORT); + } + + hashtable_map (completion->buffer->local_variables, + &completion_list_map_buffer_local_variable_setauto_cb, + completion); + + return WEECHAT_RC_OK; +} + /* * Adds buffer properties (that can be read) to completion list. */ @@ -2026,6 +2082,9 @@ completion_init () hook_completion (NULL, "buffer_properties_set", N_("properties that can be set on a buffer"), &completion_list_add_buffer_properties_set_cb, NULL, NULL); + hook_completion (NULL, "buffer_properties_setauto", + N_("properties that can be automatically set on a buffer"), + &completion_list_add_buffer_properties_setauto_cb, NULL, NULL); hook_completion (NULL, "buffer_properties_get", N_("properties that can be read on a buffer"), &completion_list_add_buffer_properties_get_cb, NULL, NULL); diff --git a/src/core/wee-config.c b/src/core/wee-config.c index 583c6249d..1ab9a7195 100644 --- a/src/core/wee-config.c +++ b/src/core/wee-config.c @@ -36,6 +36,7 @@ #include #include "weechat.h" +#include "wee-arraylist.h" #include "wee-config.h" #include "wee-eval.h" #include "wee-hashtable.h" @@ -2468,19 +2469,54 @@ config_weechat_layout_write_cb (const void *pointer, void *data, } /* - * Callback for changes on a notify option. + * Applies a buffer option to all matching buffers. */ void -config_weechat_notify_change_cb (const void *pointer, void *data, +config_weechat_buffer_apply_option (struct t_config_option *option) +{ + struct t_arraylist *all_buffers; + struct t_gui_buffer *ptr_buffer; + int i, list_size; + + if (!option) + return; + + all_buffers = arraylist_new (gui_buffers_count, 0, 0, + NULL, NULL, NULL, NULL); + if (!all_buffers) + return; + + for (ptr_buffer = gui_buffers; ptr_buffer; + ptr_buffer = ptr_buffer->next_buffer) + { + arraylist_add (all_buffers, ptr_buffer); + } + + list_size = arraylist_size (all_buffers); + for (i = 0; i < list_size; i++) + { + ptr_buffer = (struct t_gui_buffer *)arraylist_get (all_buffers, i); + if (gui_buffer_valid (ptr_buffer)) + gui_buffer_apply_config_option_property (ptr_buffer, option); + } + + arraylist_free (all_buffers); +} + +/* + * Callback for changes on a buffer option. + */ + +void +config_weechat_buffer_change_cb (const void *pointer, void *data, struct t_config_option *option) { /* make C compiler happy */ (void) pointer; (void) data; - (void) option; - gui_buffer_notify_set_all (); + config_weechat_buffer_apply_option (option); } /* @@ -2505,50 +2541,112 @@ config_weechat_buffer_create_option_cb (const void *pointer, void *data, rc = WEECHAT_CONFIG_OPTION_SET_ERROR; - if (option_name) + if (!option_name) + return rc; + + ptr_option = config_file_search_option (config_file, section, + option_name); + if (ptr_option) { - ptr_option = config_file_search_option (config_file, section, - option_name); - if (ptr_option) + rc = config_file_option_set (ptr_option, value, 1); + } + else + { + pos = strrchr (option_name, '.'); + if (pos) { - rc = config_file_option_set (ptr_option, value, 1); - } - else - { - pos = strrchr (option_name, '.'); - if (pos) + buffer_mask = strndup (option_name, pos - option_name); + if (buffer_mask) { - buffer_mask = strndup (option_name, pos - option_name); - if (buffer_mask) - { - snprintf (description, sizeof (description), - _("set property \"%s\" on any buffer matching " - "mask \"%s\"; " - "content is evaluated, see /help eval; " - "${buffer} is a pointer to the buffer being " - "opened"), - pos + 1, - buffer_mask); - ptr_option = config_file_new_option ( - config_file, section, - option_name, "string", - description, - "", - 0, 0, "", value, 0, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL); - rc = (ptr_option) ? - WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE : WEECHAT_CONFIG_OPTION_SET_ERROR; - free (buffer_mask); - } + snprintf (description, sizeof (description), + _("set property \"%s\" on any buffer matching " + "mask \"%s\"; " + "content is evaluated, see /help eval; " + "${buffer} is a pointer to the buffer being " + "opened"), + pos + 1, + buffer_mask); + ptr_option = config_file_new_option ( + config_file, section, + option_name, "string", + description, + "", + 0, 0, "", value, 0, + NULL, NULL, NULL, + &config_weechat_buffer_change_cb, NULL, NULL, + NULL, NULL, NULL); + rc = (ptr_option) ? + WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE : WEECHAT_CONFIG_OPTION_SET_ERROR; + free (buffer_mask); } } } + if (ptr_option) + config_weechat_buffer_apply_option (ptr_option); + return rc; } +/* + * Sets a buffer property. + * + * Returns: + * 1: OK + * 0: error + */ + +int +config_weechat_buffer_set (struct t_gui_buffer *buffer, + const char *property, const char *value) +{ + char option_name[4096]; + int rc; + + if (!buffer || !property || !property[0]) + return 0; + + snprintf (option_name, sizeof (option_name), + "%s.%s", + buffer->full_name, + property); + + /* create/update option */ + rc = config_weechat_buffer_create_option_cb ( + NULL, NULL, + weechat_config_file, + weechat_config_section_buffer, + option_name, + (value) ? value : ""); + + if (rc != WEECHAT_CONFIG_OPTION_SET_ERROR) + { + gui_chat_printf ( + NULL, + _("Option \"weechat.buffer.%s\" has been set to \"%s\""), + option_name, + (value) ? value : ""); + } + + return (rc != WEECHAT_CONFIG_OPTION_SET_ERROR) ? 1 : 0; +} + +/* + * Callback for changes on a notify option. + */ + +void +config_weechat_notify_change_cb (const void *pointer, void *data, + struct t_config_option *option) +{ + /* make C compiler happy */ + (void) pointer; + (void) data; + (void) option; + + gui_buffer_notify_set_all (); +} + /* * Callback called when an option is created in section "notify". */ diff --git a/src/core/wee-config.h b/src/core/wee-config.h index 4aa511f79..286a02c8b 100644 --- a/src/core/wee-config.h +++ b/src/core/wee-config.h @@ -401,6 +401,8 @@ extern struct t_config_option *config_weechat_debug_get (const char *plugin_name extern int config_weechat_debug_set (const char *plugin_name, const char *value); extern void config_weechat_debug_set_all (); +extern int config_weechat_buffer_set (struct t_gui_buffer *buffer, + const char *property, const char *value); extern int config_weechat_notify_set (struct t_gui_buffer *buffer, const char *notify); extern void config_get_item_time (char *text_time, int max_length); diff --git a/src/gui/gui-buffer.c b/src/gui/gui-buffer.c index 76cec4ee3..a581c3359 100644 --- a/src/gui/gui-buffer.c +++ b/src/gui/gui-buffer.c @@ -648,6 +648,49 @@ gui_buffer_apply_properties_cb (void *data, (const char *)value); } +/* + * Applies a buffer property defined in a an option "weechat.buffer.xxx". + */ + +void +gui_buffer_apply_config_option_property (struct t_gui_buffer *buffer, + struct t_config_option *option) +{ + const char *pos; + char *buffer_mask, *value; + struct t_hashtable *pointers; + + pos = strrchr (option->name, '.'); + if (!pos) + return; + + buffer_mask = strndup (option->name, pos - option->name); + if (!buffer_mask) + return; + + if (string_match (buffer->full_name, buffer_mask, 1)) + { + pointers = hashtable_new ( + 32, + WEECHAT_HASHTABLE_STRING, + WEECHAT_HASHTABLE_POINTER, + NULL, NULL); + if (pointers) + { + hashtable_set (pointers, "buffer", buffer); + value = eval_expression (CONFIG_STRING(option), pointers, NULL, NULL); + if (value) + { + gui_buffer_set (buffer, pos + 1, value); + free (value); + } + hashtable_free (pointers); + } + } + + free (buffer_mask); +} + /* * Applies buffer properties defined in options "weechat.buffer.*". */ @@ -656,49 +699,12 @@ void gui_buffer_apply_config_properties (struct t_gui_buffer *buffer) { struct t_config_option *ptr_option; - struct t_hashtable *pointers; - const char *pos; - char *buffer_mask, *value; - - pointers = NULL; for (ptr_option = weechat_config_section_buffer->options; ptr_option; ptr_option = ptr_option->next_option) { - pos = strrchr (ptr_option->name, '.'); - if (!pos) - continue; - buffer_mask = strndup (ptr_option->name, pos - ptr_option->name); - if (!buffer_mask) - continue; - if (string_match (buffer->full_name, buffer_mask, 1)) - { - if (!pointers) - { - pointers = hashtable_new ( - 32, - WEECHAT_HASHTABLE_STRING, - WEECHAT_HASHTABLE_POINTER, - NULL, NULL); - } - if (pointers) - { - hashtable_set (pointers, "buffer", buffer); - value = eval_expression ( - CONFIG_STRING(ptr_option), - pointers, NULL, NULL); - if (value) - { - gui_buffer_set (buffer, pos + 1, value); - free (value); - } - } - } - free (buffer_mask); + gui_buffer_apply_config_option_property (buffer, ptr_option); } - - if (pointers) - hashtable_free (pointers); } /* diff --git a/src/gui/gui-buffer.h b/src/gui/gui-buffer.h index 47a0b355d..6b3357ab9 100644 --- a/src/gui/gui-buffer.h +++ b/src/gui/gui-buffer.h @@ -23,8 +23,9 @@ #include #include -struct t_hashtable; +struct t_config_option; struct t_gui_window; +struct t_hashtable; struct t_infolist; enum t_gui_buffer_type @@ -269,6 +270,8 @@ extern void gui_buffer_local_var_remove (struct t_gui_buffer *buffer, const char *name); extern void gui_buffer_notify_set_all (); extern int gui_buffer_is_reserved_name (const char *name); +extern void gui_buffer_apply_config_option_property (struct t_gui_buffer *buffer, + struct t_config_option *option); extern struct t_gui_buffer *gui_buffer_new_props (struct t_weechat_plugin *plugin, const char *name, struct t_hashtable *properties,