* reply hook?
@ 2012-11-30 15:03 Uwe Brauer
2012-12-01 11:48 ` Oleksandr Gavenko
2012-12-01 19:23 ` Dave Goldberg
0 siblings, 2 replies; 4+ messages in thread
From: Uwe Brauer @ 2012-11-30 15:03 UTC (permalink / raw)
To: ding
Hello
I would like to execute a couple of function when replying.
I have not found a relevant hook so I am using defadvice
which is not good for debugging.
Example
(defadvice gnus-summary-reply (after mycheckispell activate)
"Runs ispell dict checks and other stuff after
the gnus-summary-reply-with-original function."
(my-checks-spell))
(defun my-checks-spell ()
(interactive)
(bbdbciteadpt-insert-bbdbcite)
(bbdbispelladpt-try-bbdbispell)
(bbdbscadapt-try-bbdbsc)
(tool-check-from-and-change-ispell-dic)
(message-goto-subject)
(bbdb-inform-dict-and-abbrev))
Any suggestions?
Thanks
Uwe Brauer
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: reply hook?
2012-11-30 15:03 reply hook? Uwe Brauer
@ 2012-12-01 11:48 ` Oleksandr Gavenko
2012-12-01 19:23 ` Dave Goldberg
1 sibling, 0 replies; 4+ messages in thread
From: Oleksandr Gavenko @ 2012-12-01 11:48 UTC (permalink / raw)
To: ding
On 2012-11-30, Uwe Brauer wrote:
> I would like to execute a couple of function when replying.
> I have not found a relevant hook so I am using defadvice
> which is not good for debugging.
>
> (defadvice gnus-summary-reply (after mycheckispell activate)
> "Runs ispell dict checks and other stuff after
> the gnus-summary-reply-with-original function."
> (my-checks-spell))
>
>
> (defun my-checks-spell ()
> (interactive)
> (bbdbciteadpt-insert-bbdbcite)
> (bbdbispelladpt-try-bbdbispell)
> (bbdbscadapt-try-bbdbsc)
> (tool-check-from-and-change-ispell-dic)
> (message-goto-subject)
> (bbdb-inform-dict-and-abbrev))
>
> Any suggestions?
>
Just type "M-x apropos-variable RET message-.*hook RET". I hope this help you.
In such way I found useful hooks for my '.emacs' customisations:
(defun my-message-mode-hook ()
(setq fill-column 78)
(turn-on-auto-fill)
(flyspell-mode 1))
(add-hook 'message-mode-hook 'my-message-mode-hook)
(defun my-message-save ()
"Store message in `gnus-article-save-directory' after
successful sending. It is possible that mail rejected and I lost
it completely, this func save it for me."
(unless (eq major-mode 'message-mode)
(error "Attempt to call my-message-save in non message-mode buffer"))
(make-directory gnus-article-save-directory t)
(let ( (buf (current-buffer))
(field-to (my-clean-filename (or (message-fetch-field "Newsgroups") (message-fetch-field "To"))))
(field-subject (my-clean-filename (message-fetch-field "Subject")))
file )
(setq file (concat gnus-article-save-directory "/" (format-time-string "%F_%T") "_" field-to "_" field-subject))
(with-temp-file file
(insert-buffer buf)
)) )
(add-hook 'message-sent-hook 'my-message-save)
--
Best regards!
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: reply hook?
2012-11-30 15:03 reply hook? Uwe Brauer
2012-12-01 11:48 ` Oleksandr Gavenko
@ 2012-12-01 19:23 ` Dave Goldberg
2012-12-02 18:59 ` Uwe Brauer
1 sibling, 1 reply; 4+ messages in thread
From: Dave Goldberg @ 2012-12-01 19:23 UTC (permalink / raw)
To: ding
> Hello
> I would like to execute a couple of function when replying.
> I have not found a relevant hook so I am using defadvice
> which is not good for debugging.
In gnus-message-setup-hook you can check for the variable gnus-article-reply. I use this to ensure I am sending encrypted replies to encrypted messages:
(add-hook 'gnus-message-setup-hook
(lambda ()
(cond ((and gnus-article-reply
(message-with-reply-buffer
(re-search-forward
"^Content-Type.*application/\\(x-\\)?pkcs7-mime"
nil t)))
(condition-case nil
(mml-secure-message-encrypt-smime)
(error
(message "One or more recipients do not have certs")))))))
--
Dave Goldberg
david.goldberg6@verizon.net
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: reply hook?
2012-12-01 19:23 ` Dave Goldberg
@ 2012-12-02 18:59 ` Uwe Brauer
0 siblings, 0 replies; 4+ messages in thread
From: Uwe Brauer @ 2012-12-02 18:59 UTC (permalink / raw)
To: ding
>> On Sat, 01 Dec 2012 14:23:11 -0500, david.goldberg6@verizon.net (Dave Goldberg) wrote:
>> Hello
>> I would like to execute a couple of function when replying.
>> I have not found a relevant hook so I am using defadvice
>> which is not good for debugging.
> In gnus-message-setup-hook you can check for the variable gnus-article-reply. I use this to ensure I am sending encrypted replies to encrypted messages:
> (add-hook 'gnus-message-setup-hook
> (lambda ()
> (cond ((and gnus-article-reply
> (message-with-reply-buffer
> (re-search-forward
> "^Content-Type.*application/\\(x-\\)?pkcs7-mime"
> nil t)))
> (condition-case nil
> (mml-secure-message-encrypt-smime)
> (error
> (message "One or more recipients do not have certs")))))))
Cool.
I prefer however
(mml-secure-message-encrypt-pgp) over
smime, :-D
> --
> Dave Goldberg
> david.goldberg6@verizon.net
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-12-02 18:59 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-30 15:03 reply hook? Uwe Brauer
2012-12-01 11:48 ` Oleksandr Gavenko
2012-12-01 19:23 ` Dave Goldberg
2012-12-02 18:59 ` Uwe Brauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).