all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Gnus: insert signature only when not replying
@ 2017-11-16 15:51 Teemu Likonen
  2017-11-16 17:52 ` Teemu Likonen
  0 siblings, 1 reply; 2+ messages in thread
From: Teemu Likonen @ 2017-11-16 15:51 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 620 bytes --]

In certain Gnus's groups I'd like to have an automatic message signature
only when composing a new message but not in replies. I have tried
gnus-parameters and posting-style like this:


    (setq gnus-parameters
          '(("\\`nnimap\\+foo:"
             (posting-style
              (signature-file (if message-reply-headers
                                  nil
                                "~/.signature"))))))


But it always adds the signature. Any other ideas?

-- 
/// Teemu Likonen   - .-..   <https://keybase.io/tlikonen> //
// PGP: 4E10 55DC 84E9 DFF6 13D7 8557 719D 69D3 2453 9450 ///

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Gnus: insert signature only when not replying
  2017-11-16 15:51 Gnus: insert signature only when not replying Teemu Likonen
@ 2017-11-16 17:52 ` Teemu Likonen
  0 siblings, 0 replies; 2+ messages in thread
From: Teemu Likonen @ 2017-11-16 17:52 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 987 bytes --]

Teemu Likonen [2017-11-16 17:51:23+02] wrote:

> In certain Gnus's groups I'd like to have an automatic message
> signature only when composing a new message but not in replies.

I got it working. It's a bit ugly but here it is:


(setq gnus-parameters
      '(("\\`nnimap\\+foo:"
         (posting-style
          (eval (setq-local message-signature
                            (lambda ()
                              (unless message-reply-headers
                                (let ((sig "~/.signature"))
                                  (when (file-exists-p sig)
                                    (with-temp-buffer
                                      (insert-file-contents sig)
                                      (buffer-substring-no-properties
                                       (point-min) (point-max)))))))))))))

-- 
/// Teemu Likonen   - .-..   <https://keybase.io/tlikonen> //
// PGP: 4E10 55DC 84E9 DFF6 13D7 8557 719D 69D3 2453 9450 ///

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-11-16 17:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-16 15:51 Gnus: insert signature only when not replying Teemu Likonen
2017-11-16 17:52 ` Teemu Likonen

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.