On Tue, 04 Aug 2009 15:17:42 +0200 giglio robbo' d'acciaio <[email protected]> 
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
_______________________________________________
info-gnus-english mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/info-gnus-english

Reply via email to