• gnus-posting-styles not applied when posting

    From Zaichuan Du@21:1/5 to All on Fri Feb 2 19:19:01 2024
    Hi folks,

    First usenet posting ever. Excited.

    I have set the following piece for gnus in my init.el. It works as
    expected when I reply to different news groups in the gnus summary
    buffer, but fail when I do gnus-group-post-news in the group buffer.

    The "formal" signature in the first list applies, while the "casual" one
    in the second does not. Any ideas?

    #+begin_src elisp
    (setq gnus-posting-styles
    '( ;; first list
    (".*"
    (signature-file "formal"))
    ;; second list
    ((header "Newsgroups" "comp.emacs")
    (name "MYNAME")
    (signature-file "casual"))))
    #+end_src

    --
    Zaichuan

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From yeti@21:1/5 to Zaichuan Du on Fri Feb 2 20:17:39 2024
    Zaichuan Du <duzaichuan@hotmail.com> writes:

    The "formal" signature in the first list applies, while the "casual" one
    in the second does not. Any ideas?

    #+begin_src elisp
    (setq gnus-posting-styles
    '( ;; first list
    (".*"
    ^^^^^
    I only use such matches for protocols, servers and groups ...

    (signature-file "formal"))
    ;; second list
    ((header "Newsgroups" "comp.emacs")
    ^^^^^^^
    ... and assume that above ~(header ...)~ just would pre-set
    the header "Newsgroups:" to "comp.emacs" instead of matching it.

    Can you try ~(":comp\\.emacs$"~ instead?

    (name "MYNAME")
    (signature-file "casual"))))
    #+end_src

    --
    I do not bite, I just want to play.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Zaichuan Du@21:1/5 to yeti on Fri Feb 2 21:33:42 2024
    yeti <yeti@tilde.institute> writes:

    Zaichuan Du <duzaichuan@hotmail.com> writes:

    The "formal" signature in the first list applies, while the "casual" one
    in the second does not. Any ideas?

    #+begin_src elisp
    (setq gnus-posting-styles
    '( ;; first list
    (".*"
    ^^^^^
    I only use such matches for protocols, servers and groups ...

    Oh, yes, this first string in the list ".*" is indeed used to match gnus groups. I just did not notice it when first looked into the manual.


    (signature-file "formal"))
    ;; second list
    ((header "Newsgroups" "comp.emacs")
    ^^^^^^^
    ... and assume that above ~(header ...)~ just would pre-set
    the header "Newsgroups:" to "comp.emacs" instead of matching it.

    I guess I understood this. If the first element is not a string, but a
    form like (header MATCH REG), this will try to match the header of the underlying article in the summary buffer.

    Thus, the latter one only works in the summary buffer, but not the group buffer. That is why it worked when I replied to news, but failed in
    directly posting one.

    Can you try ~(":comp\\.emacs$"~ instead?

    The following works for me.

    #+begin_src elisp
    (setq gnus-posting-styles
    '((".*"
    (signature-file "formal"))
    ("comp.emacs"
    (name "NAME")
    (signature-file "casual"))))
    #+end_src

    Thanks!

    --
    Zaichuan

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)