Gnus development mailing list
 help / color / mirror / Atom feed
From: hardaker@ece.ucdavis.edu (Wes Hardaker)
Subject: gnus-smiley.el -- new version
Date: Fri, 14 Jun 1996 10:23:32 -0700	[thread overview]
Message-ID: <199606141723.AA017493012@teal.ece.ucdavis.edu> (raw)


Did things slightly more correctly this time:

  -- cached last glyph for faster loading (of frequent smilies :-)
  -- Used "invisible extents" rather than deleting the original region
  -- more reg-exp -> smily matching

Additionally, I made the smily faces yellow with a trasparent edge, so
they look like they really should now!  Get a new copy at
ftp.ece.ucdavis.edu:/pub/hardaker/smilies.tar.gz

:-)

Wes Hardaker
Professional Time Waster

;;
;; comments go here.
;;

;; To use:
;; (load "gnus-smiley.el")
;; (add-hook 'gnus-article-display-hook 'gnus-smiley-display t)

(defvar gnus-smiley-db-dir "/home/hardaker/lib/smilies"
  "Location of the smiley xpm faces files.")

(defvar gnus-smiley-regexp-alist '((":-*\\]" "FaceGrinning.xpm")
				 (":-*[oO]" "FaceStartled.xpm")
				 (":-*[)>]" "FaceHappy.xpm")
				 (";-*[>)]" "FaceWinking.xpm")
				 (":-[/\\]" "FaceIronic.xpm")
				 (":-*|" "FaceStraight.xpm")
				 (":-*<" "FaceAngry.xpm")
				 (":-*d" "FaceTasty.xpm")
				 (":-*[pP]" "FaceYukky.xpm")
				 ("8-*|" "FaceKOed.xpm")
				 (":-*(" "FaceAngry.xpm"))
"A list of regexps to map smilies to real images.")

(defvar gnus-smiley-glyph nil)

(defvar gnus-smiley-last-file nil)

(defun gnus-smiley-display ()
  (interactive)
  (if (and (featurep 'xpm) 
           (or (not (fboundp 'device-type)) (equal (device-type) 'x)))
      (save-excursion
	(set-buffer gnus-article-buffer)
	;; search and replace
	(let ((buffer-read-only nil)
	      (alist gnus-smiley-regexp-alist)
	      bug entry regexp)
	  (goto-char (point-min))
	  ;; We skip the headers.
	  (unless (search-forward "\n\n" nil t)
	    (goto-char (point-max)))
	  (setq beg (point))
	  ;; loop through alist
	  (while (setq entry (pop alist))
	    (setq regexp (car entry))
	    (goto-char beg)
	    (while (re-search-forward regexp nil t)
	      (let ((start (match-beginning 0))
		    (end (match-end 0))
		    (file (concat (file-name-as-directory gnus-smiley-db-dir) 
				 (nth 1 entry))))
		(if (not (equal file gnus-smiley-last-file))
		    (setq gnus-smiley-glyph (make-glyph file)))
		(if gnus-smiley-glyph
		    (progn 
		      (set-glyph-face gnus-smiley-glyph 'default)
		      (let ((ext (make-extent start end)))
			(set-extent-property ext 'invisible t)
			(set-extent-property ext 'end-open t))
		      (make-annotation gnus-smiley-glyph end 'text)
		      (goto-char end))
		  ))))))))


             reply	other threads:[~1996-06-14 17:23 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-06-14 17:23 Wes Hardaker [this message]
1996-06-14 18:42 ` smiley.el (was Re: gnus-smiley.el -- new version) William Perry
1996-06-14 21:11   ` Colin Rafferty
1996-06-14 21:55     ` William Perry
1996-06-14 21:57   ` Wes Hardaker
1996-06-14 22:52     ` William Perry
1996-06-14 22:07   ` Steven L Baur
1996-06-14 22:53     ` William Perry
1996-06-14 23:14       ` Steven L Baur
1996-06-15  1:22         ` Wes Hardaker
1996-06-15  7:54           ` Lars Magne Ingebrigtsen
1996-06-15  7:59     ` Lars Magne Ingebrigtsen
1996-06-15  8:53       ` Lars Magne Ingebrigtsen
1996-06-17 13:49         ` Jan Vroonhof
1996-06-17 16:16           ` Lars Magne Ingebrigtsen
1996-06-18 16:32             ` Wes Hardaker
1996-06-18 16:54               ` Lars Magne Ingebrigtsen
1996-06-18 17:49                 ` Wes Hardaker
1996-06-19  6:07                   ` Lars Magne Ingebrigtsen
1996-06-18 19:23                 ` Sten Drescher
1996-06-18 20:12                   ` Wes Hardaker
1996-06-19  6:10                     ` Lars Magne Ingebrigtsen
1996-06-19 16:36                       ` Wes Hardaker
1996-06-17 16:27         ` Jan Vroonhof
1996-06-17 17:43         ` Wes Hardaker

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=199606141723.AA017493012@teal.ece.ucdavis.edu \
    --to=hardaker@ece.ucdavis.edu \
    /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).