[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Solution of sorts]
From: |
Uwe Brauer |
Subject: |
Re: [Solution of sorts] |
Date: |
Tue, 11 Feb 2025 08:26:18 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
>>> "AadfGtGEUn(E" == Announcements and discussions for GNUS, the GNU Emacs
>>> Usenet newsreader (in English) <Michael> writes:
Moin Michael
> Moin Uwe,
> Nice idea, thx for sharing. Some comments below:
Thanks for comments, this is work in progress. One problem that I have
to solve later are newsgroups and mailing list, because right now the
function complains in those circumstances, but I prefer to have false
positives than false negatives, for the moment.
>> Adding (gnus-summary-select-article-buffer)
>>
>> Solves the problem somehow:
>> (defun check-my-to-field ()
>> "This function will be run before you execute followup. And it
>> warns you if your email address is not in the To field. That
>> warning is a safty message if you had been only on the BCC
>> field!!"
>> (interactive)
>> (gnus-summary-select-article-buffer)
> Hmm, but you don't want to select that buffer, right? I would at least
> wrap the whole thing in an appropriate excursion
> (`save-window-excursion'?) But maybe we find a better suited function.
> Doesn't (with-current-buffer gnus-article-buffer ...) suffice?
Right that was a desperate measure, since in the summary buffer itself
to analyse the from field is very tricky.
>> (unless
>> (string-match user-mail-address (message-fetch-field "To"))
> Slightly better:
> (string-match-p (regexp-quote user-mail-address)
> (message-fetch-field "To"))
Ok
>> (error
>> (progn
>> (message "Aborted, you are not in the To: field!!!"))))))
> Either `error', then with string + arg, or a message. We don't have a
> condition-case handler here, right? I'd use `user-error'.
Ok thanks
>>
>> (defadvice gnus-summary-followup-with-original (before mychecktofield
>> activate)
>> "This function will be run before you execute followup. It warns you if your
>> email address is not in the To field. That
>> warning is a safty message if you had been only on the BCC field!!"
>> (check-my-to-field))
> Is there some hook one could alternatively use for this functionality?
> We could check `this-command' to include only commands we want to
> influence.
Right, defadvice is old and I copied that lines from some old code, so I
will look into that later today.
Uwe
> Michael.
--
I strongly condemn Hamas heinous despicable pogroms/atrocities on Israel
I strongly condemn Putin's war of aggression against Ukraine.
I support to deliver weapons to Ukraine's military.
I support the EU and NATO membership of Ukraine.
smime.p7s
Description: S/MIME cryptographic signature
- Checking if user-mail-address is in To or CC (to avoid an embarrassing social situation) BCC, Uwe Brauer, 2025/02/10
- [Solution of sorts] (was: Checking if user-mail-address is in To or CC (to avoid an embarrassing social situation) BCC), Uwe Brauer, 2025/02/10
- Re: [Solution of sorts], Michael Heerdegen, 2025/02/10
- Re: [Solution of sorts],
Uwe Brauer <=
- [defadvice, advice-add ] (was: [Solution of sorts]), Uwe Brauer, 2025/02/11
- Re: [defadvice, advice-add ], Michael Heerdegen, 2025/02/11
- [which hook?] (was: [defadvice, advice-add ]), Uwe Brauer, 2025/02/12
- Re: [defadvice, advice-add ], Uwe Brauer, 2025/02/12
- Re: [defadvice, advice-add ], Christoph Groth, 2025/02/12
- Re: [defadvice, advice-add ], Uwe Brauer, 2025/02/13
- Re: [defadvice, advice-add ], Uwe Brauer, 2025/02/15
- [a better solution without using advice] (was: [defadvice, advice-add ]), Uwe Brauer, 2025/02/22
Re: Checking if user-mail-address is in To or CC (to avoid an embarrassing social situation) BCC, James Thomas, 2025/02/11