Übersicht Letzte Änderungen Neuigkeiten Suchen ElispSektion KurzAnleitung Impressum

rcircSmiley

This code adds smileys such as :) and :( to rcirc.

(eval-after-load 'rcirc
  '(add-to-list 'rcirc-markup-text-functions 'rcirc-smileys))

(defun rcirc-smileys (&rest ignore)
  "Run smiley-buffer on the buffer
but add a temporary space at the end to ensure matches of smiley
regular expressions."
  (goto-char (point-max))
  (insert " ")
  (smiley-buffer)
  (delete-char -1))

The smiley library is part of Gnus. Check ‘smiley-regexp-alist’ to see which smileys are supported. This is also the place where you can add more replacements.

Alternatively, if you like using Unicode:

(eval-after-load 'rcirc
  '(add-to-list 'rcirc-markup-text-functions 'rcirc-smileys))

(defvar rcirc-smileys '((":)" . "☺")
                        (":(" . "☹")
			("<3" . "♥"))
  "Alist containing string replacements for rcirc messages.")

(defvar rcirc-smiley-regexp
  (regexp-opt (mapcar 'car rcirc-smileys))
  "Regular expression matching the keys in rcirc-smileys.")

(defun rcirc-smileys (&rest ignore)
  "Use Unicode smileys in the buffer."
  (goto-char (point-min))
  (while (re-search-forward rcirc-smiley-regexp nil t)
    (replace-match (cdr (assoc (match-string 0) rcirc-smileys)))))