- (let ((channels (nreverse (copy-sequence riece-current-channels))))
- (setcdr (last channels) channels) ;make a circular link
- (riece-command-switch-to-channel
- (nth 1 (string-list-member-ignore-case
- riece-current-channel channels))))))
+ (let ((pointer (string-list-member-ignore-case
+ riece-current-channel
+ riece-current-channels))
+ (start riece-current-channels)
+ channel)
+ (while (and start (not (eq start pointer)))
+ (if (car start)
+ (setq channel (car start)))
+ (setq start (cdr start)))
+ (if channel
+ (riece-command-switch-to-channel channel)
+ (error "No such channel!")))))