From: dgiglio@iol.it (daniele.g (alias giglio robbo' d'acciaio))
To: info-gnus-english@gnu.org
Subject: check the presence of a Face before sending
Date: Thu, 05 Aug 2010 12:03:20 +0200 [thread overview]
Message-ID: <87pqxxidg7.fsf@father.nostromo.wy> (raw)
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
reply other threads:[~2010-08-05 10:03 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87pqxxidg7.fsf@father.nostromo.wy \
--to=dgiglio@iol.it \
--cc=info-gnus-english@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).