commit c37cec9427c49ea42525fd77ba3702adca69ef80 Date: Mon May 31 19:15:43 2010 +0100 Enhance IGNORE DIM BRIGHT and KEYWORD to handle multiple entries Incidentally it also fix a bug in those commands whereby if a user accidentally type a space following a nick, that space is taken as part of the nick. Modified lisp/net/rcirc.el diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el index 453ff86..258f7cb 100644 --- a/lisp/net/rcirc.el +++ b/lisp/net/rcirc.el @@ -2136,12 +2136,13 @@ With a prefix arg, prompt for new topic." (rcirc-send-string process (format "PRIVMSG %s :\C-aACTION %s\C-a" target args))) -(defun rcirc-add-or-remove (set &optional elt) - (if (and elt (not (string= "" elt))) - (if (member-ignore-case elt set) - (delete elt set) - (cons elt set)) - set)) +(defun rcirc-add-or-remove (set &rest elements) + (dolist (elt elements) + (if (and elt (not (string= "" elt))) + (setq set (if (member-ignore-case elt set) + (delete elt set) + (cons elt set))))) + set) (defun-rcirc-command ignore (nick) "Manage the ignore list. @@ -2149,7 +2150,9 @@ Ignore NICK, unignore NICK if already ignored, or list ignored nicks when no NICK is given. When listing ignored nicks, the ones added to the list automatically are marked with an asterisk." (interactive "sToggle ignoring of nick: ") - (setq rcirc-ignore-list (rcirc-add-or-remove rcirc-ignore-list nick)) + (setq rcirc-ignore-list + (apply #'rcirc-add-or-remove rcirc-ignore-list + (split-string nick nil t))) (rcirc-print process nil "IGNORE" target (mapconcat (lambda (nick) @@ -2161,14 +2164,18 @@ ones added to the list automatically are marked with an asterisk." (defun-rcirc-command bright (nick) "Manage the bright nick list." (interactive "sToggle emphasis of nick: ") - (setq rcirc-bright-nicks (rcirc-add-or-remove rcirc-bright-nicks nick)) + (setq rcirc-bright-nicks + (apply #'rcirc-add-or-remove rcirc-bright-nicks + (split-string nick nil t))) (rcirc-print process nil "BRIGHT" target (mapconcat 'identity rcirc-bright-nicks " "))) (defun-rcirc-command dim (nick) "Manage the dim nick list." (interactive "sToggle deemphasis of nick: ") - (setq rcirc-dim-nicks (rcirc-add-or-remove rcirc-dim-nicks nick)) + (setq rcirc-dim-nicks + (apply #'rcirc-add-or-remove rcirc-dim-nicks + (split-string nick nil t))) (rcirc-print process nil "DIM" target (mapconcat 'identity rcirc-dim-nicks " "))) @@ -2177,7 +2184,9 @@ ones added to the list automatically are marked with an asterisk." Mark KEYWORD, unmark KEYWORD if already marked, or list marked keywords when no KEYWORD is given." (interactive "sToggle highlighting of keyword: ") - (setq rcirc-keywords (rcirc-add-or-remove rcirc-keywords keyword)) + (setq rcirc-keywords + (apply #'rcirc-add-or-remove rcirc-keywords + (split-string keyword nil t))) (rcirc-print process nil "KEYWORD" target (mapconcat 'identity rcirc-keywords " ")))