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

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

Re: Improving xface insertion


From: Ted Zlatanov
Subject: Re: Improving xface insertion
Date: Tue, 04 Aug 2009 13:29:54 -0500
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.1.50 (gnu/linux)

On Tue, 04 Aug 2009 15:17:42 +0200 giglio robbo' d'acciaio <dgiglio@iol.it> 
wrote: 

grd> Hi, I use the following lisp function to insert a random face header pic 
in my
grd> posts.

grd> ,----
grd> | (defun random-face-header-insert ()
grd> |   (let* ((faces (directory-files "~/News/xfaces" t "\\.png\\(\\.0\\)?$"))
grd> |   (face (nth (random (length faces)) faces)))
grd> |     (save-excursion  
grd> |       (goto-char (point-min))    
grd> |       (insert "Face: "  (gnus-convert-png-to-face face) "\n")    
grd> |       (when (string-match "0$" face)
grd> |  (insert "Face: "
grd> |          (gnus-convert-png-to-face (replace-match face "0$" "1"))
grd> |          "\n")))))
grd> | 
grd> | (add-hook 'message-send-hook 'random-face-header-insert)
grd> `----

grd> Though it doesn't check if a such header is already inserted in case it
grd> prevents to insert it again. How can I do it?

I think you want `message-replace-header' instead of the excursion, it
will simplify the code.

Ted


reply via email to

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