* check the presence of a Face before sending
@ 2010-08-05 10:03 daniele.g (alias giglio robbo' d'acciaio)
0 siblings, 0 replies; only message in thread
From: daniele.g (alias giglio robbo' d'acciaio) @ 2010-08-05 10:03 UTC (permalink / raw)
To: info-gnus-english
I use
(add-hook 'message-send-hook 'random-face-header-insert)
to insert a Face header before sending my posts.
But this function doesn't check if such header is already present among
others.
This is my code:
--8<---------------cut here---------------start------------->8---
(defun random-face-header-insert ()
(let* ((faces (directory-files "~/News/xfaces" t "\\.png\\(\\.0\\)?$"))
(face (nth (random (length faces)) faces)))
(save-excursion
(goto-char (point-min))
(insert "Face: " (gnus-convert-png-to-face face) "\n")
(when (string-match "0$" face)
(insert "Face: "
(gnus-convert-png-to-face (replace-match face "0$" "1"))
"\n")))))
--8<---------------cut here---------------end--------------->8---
How can I improve it?
--
La prima prova di buon senso e' nel non pretendere di risolvere tutto
col buon senso.
-- Ugo Bernasconi
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2010-08-05 10:03 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-05 10:03 check the presence of a Face before sending daniele.g (alias giglio robbo' d'acciaio)
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).