Function: smiley-region

smiley-region is an autoloaded, interactive and byte-compiled function defined in smiley.el.gz.

Signature

(smiley-region START END)

Documentation

Replace in the region smiley-regexp-alist matches with corresponding images.

A list of images is returned.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/smiley.el.gz
;; Not implemented:
;; (defvar-keymap smiley-mouse-map
;;   "<down-mouse-2>" #'ignore ; override widget
;;   "<mouse-2>"      #'smiley-mouse-toggle-buffer)

;;;###autoload
(defun smiley-region (start end)
  "Replace in the region `smiley-regexp-alist' matches with corresponding images.
A list of images is returned."
  (interactive "r")
  (when (display-graphic-p)
    (unless smiley-cached-regexp-alist
      (smiley-update-cache))
    (save-excursion
      (let ((beg (or start (point-min)))
	    group image images string)
	(dolist (entry smiley-cached-regexp-alist)
	  (setq group (nth 1 entry)
		image (nth 2 entry))
	  (goto-char beg)
	  (while (re-search-forward (car entry) end t)
	    (setq string (match-string group))
	    (goto-char (match-end group))
	    (delete-region (match-beginning group) (match-end group))
	    (when image
	      (push image images)
	      (gnus-add-wash-type 'smiley)
              (if (symbolp image)
                  (progn
                    (gnus-add-image 'smiley image)
                    (gnus-put-image image string 'smiley))
		;; This is a string, but mark the property for
		;; deletion if the washing method is switched off.
                (insert (propertize string
				    'display image
				    'gnus-image-category 'smiley))))))
	images))))