Next: , Previous: , Up: Hacking and Tweaking   [Contents][Index]

4.5 Defining a new command

Here’s a simple new command, /sv. With it, you can boast about your IRC client. It shows how you can use defun-rcirc-command to define new commands.

We’re waiting for the definition of this command until rcirc is loaded because defun-rcirc-command is not yet available, and without rcirc loaded, the command wouldn’t do us much good anyway.

(with-eval-after-load 'rcirc
  (defun-rcirc-command sv (arg)
    "Boast about rcirc."
    (interactive "i")
    (rcirc-send-message process target
                         (concat "I use " rcirc-id-string))))