Re: What's the best way to auto-sign some emails but not all?
Bjørn Mork <[email protected]> Tue, 03 Dec 2024 12:36:13 +0100
| Newsgroups | gmane.emacs.gnus.general |
|---|---|
| Organization | m |
| Message-ID | <[email protected]> |
Björn Bidar <[email protected]> writes: > Bjørn Mork <[email protected]> writes: > >> Most of the suggestions depend on message-setup-hook in some way, making >> them work and fail similar to my existing gnus-posting-styles setup. One >> exception is gnus-alias which AFAIU can apply a new identity to an >> existing message buffer. But that's an interactive choice, which is >> what I'm trying to avoid. > > That is not true. gnus-alias has rules which make it possible to > automatically apply an identity. Check C-h v gnus-alias-identity-rules RET. Yes, I know, and I didn't mean to say anything else. But AFAICS, the result of the gnus-alias automatic identity mapping is limited by what is possible in a message-setup-hook. That's what I tried to express. > Message-signature manual or automatically should also take into account > a yanked article AFAIU. Sorry if I've misunderstood something, but I really don't understand how that could work. Not sure where the authoritative source of gnus-alias is. Doesn't look like it is part of emacs. Google gave me a github repo, but I don't know if that's correct? Anyway, that version seems to do automatic identity mapping by adding a hook to message-setup-hook - which makes sense: https://github.com/altruizine/gnus-alias/blob/master/gnus-alias.el#L666 I understand that you can insert anything into the message buffer here. But Gnus has not yet inserted the yanked text, so you cannot position your inserts relative to that text. Anything you place at the beginning of the body will be moved around later. There's a lot of code spread over many functions, but I believe gnus-summary-reply() is the best place to start looking at the problem: https://github.com/emacs-mirror/emacs/blob/master/lisp/gnus/gnus-msg.el#L1061 It ends with: (message-reply nil wide) (when yank (gnus-inews-yank-articles yank)) (gnus-summary-handle-replysign))))) Where message-reply() will call message-setup() as its final step, which in turn will run all the message-setup-hook hooks. See https://github.com/emacs-mirror/emacs/blob/master/lisp/gnus/message.el#L7314 https://github.com/emacs-mirror/emacs/blob/master/lisp/gnus/message.el#L6823 This means that gnus-inews-yank-articles() runs after any automatic message setup by gnus-posting-styles, gnus-alias or my own personal setup hook. gnus-inews-yank-articles() can be configured to insert the quoted text above or below the message, but I can't see any obvious way to allow it to insert the text between any existing mml tag and the rest of the message body. Which is where I'd like it to end up. One could also have imagined a solution where it was possible to control gnus-summary-handle-replysign() by a buffer local variable. But it depends on the sign/encrypt status of the message being replied to, using the variables gnus-message-replyencrypt gnus-message-replysign And that is not exactly what I want either. I want to sign *all* replies from a specific address, whether the original was sined or not. Bjørn