info-gnus-english
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Solution of sorts]


From: Michael Heerdegen
Subject: Re: [Solution of sorts]
Date: Tue, 11 Feb 2025 03:37:41 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

Moin Uwe,

Nice idea, thx for sharing.  Some comments below:


> 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?

>   (unless
>       (string-match user-mail-address (message-fetch-field "To"))

Slightly better:

  (string-match-p (regexp-quote user-mail-address)
                  (message-fetch-field "To"))

>       (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'.


> (defadvice gnus-article-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))
>
> (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.


Michael.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]