diff options
author | Dave Love <fx@gnu.org> | 2000-09-21 16:28:06 +0000 |
---|---|---|
committer | Dave Love <fx@gnu.org> | 2000-09-21 16:28:06 +0000 |
commit | 5768681d58479ef65f2bfb7b0311db675a06c183 (patch) | |
tree | aca10bd62620449306430737da4f369635342b14 /lisp/gnus | |
parent | 370d860cb1af276062164836329d210f55e41128 (diff) | |
download | emacs-5768681d58479ef65f2bfb7b0311db675a06c183.tar.gz |
(smiley-region): Test if display-graphic-p bound
(for Emacs 20). Tidy somewhat.
Diffstat (limited to 'lisp/gnus')
-rw-r--r-- | lisp/gnus/smiley-ems.el | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lisp/gnus/smiley-ems.el b/lisp/gnus/smiley-ems.el index 3ccb8b155c3..1d2a9045871 100644 --- a/lisp/gnus/smiley-ems.el +++ b/lisp/gnus/smiley-ems.el @@ -48,6 +48,7 @@ ;; The XEmacs version has a baroque, if not rococo, set of these. (defcustom smiley-regexp-alist + ;; Perhaps :-) should be distinct -- it does appear in the Jargon File. '(("\\([:;]-?)\\)\\W" 1 "smile.xbm") ("\\(:-[/\\]\\)\\W" 1 "wry.xbm") ("\\(:-[({]\\)\\W" 1 "frown.xbm")) @@ -91,7 +92,8 @@ rgexp to replace with IMAGE. IMAGE is the name of an XBM file in (defun smiley-region (start end) "Replace in the region `smiley-regexp-alist' matches with corresponding images." (interactive "r") - (when (display-graphic-p) + (when (and (fboundp 'display-graphic-p) + (display-graphic-p)) (mapc (lambda (o) (if (eq 'smiley (overlay-get o 'smiley)) (delete-overlay o))) @@ -100,16 +102,17 @@ rgexp to replace with IMAGE. IMAGE is the name of an XBM file in (smiley-update-cache)) (save-excursion (let ((beg (or start (point-min))) - buffer-read-only entry beg group overlay image) + group overlay image) (dolist (entry smiley-cached-regexp-alist) - (setq group (nth 1 entry)) + (setq group (nth 1 entry) + image (nth 2 entry)) (goto-char beg) (while (re-search-forward (car entry) end t) (when image (setq overlay (make-overlay (match-beginning group) (match-end group))) (overlay-put overlay - 'display `(when smiley-active ,@(nth 2 entry))) + 'display `(when smiley-active ,@image)) (overlay-put overlay 'mouse-face 'highlight) (overlay-put overlay 'smiley t) (overlay-put overlay |