Discussion:
gnus-posting-styles not applied when posting
(too old to reply)
Zaichuan Du
2024-02-02 18:19:01 UTC
Permalink
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
yeti
2024-02-02 19:35:39 UTC
Permalink
Post by Zaichuan Du
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 ...
Post by Zaichuan Du
(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?
Post by Zaichuan Du
(name "MYNAME")
(signature-file "casual"))))
#+end_src
--
I do not bite, I just want to play.
Zaichuan Du
2024-02-02 20:33:42 UTC
Permalink
Post by yeti
Post by Zaichuan Du
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.
Post by yeti
Post by Zaichuan Du
(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.
Post by yeti
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
Loading...