* Don't use pop and push.
2003-05-30 Daiki Ueno <ueno@unixuser.org>
+ * Makefile.am (elc): Renamed from "compile".
+
* riece.el (riece-dialogue-mode-map): Bind
riece-command-toggle-channel-list-buffer-mode.
CLEANFILES = auto-autoloads.el custom-load.el *.elc
FLAGS ?= -batch -q -no-site-file
-all: compile
+all: elc
-compile:
+elc:
$(EMACS) $(FLAGS) -l COMPILE -f riece-compile
-install: compile
+install: elc
$(EMACS) $(FLAGS) -l COMPILE -f riece-install $(lispdir) # $(MAKE)
package:
(let* ((channel (match-string 1 string))
(mode-string (substring string (match-beginning 2)))
(modes (string-to-list (match-string 2 string)))
- (toggle (pop modes)))
+ (toggle (car modes)))
+ (setq modes (cdr modes))
(while modes
(riece-channel-toggle-mode channel (car modes) (eq toggle ?+))
(setq modes (cdr modes)))
(list users current-prefix-arg)))
(let (group)
(while users
- (push (pop users) group)
+ (setq group (cons (car users) group)
+ users (cdr users))
(if (or (= (length group) 3)
(null users))
(riece-send-string
(list users current-prefix-arg)))
(let (group)
(while users
- (push (pop users) group)
+ (setq group (cons (car users) group)
+ users (cdr users))
(if (or (= (length group) 3)
(null users))
(riece-send-string
server-name)))
(with-current-buffer (process-buffer process)
(setq riece-server-name server-name))
- (push (cons server-name process) riece-server-process-alist)))
+ (setq riece-server-process-alist
+ (cons (cons server-name process)
+ riece-server-process-alist))))
(defun riece-command-close-server (server-name &optional message)
(interactive
(unless (riece-identity-assoc-no-server
identity riece-channel-buffer-alist)
(let ((buffer (riece-channel-buffer-create identity)))
- (push (cons identity buffer) riece-channel-buffer-alist)))
+ (setq riece-channel-buffer-alist
+ (cons (cons identity buffer)
+ riece-channel-buffer-alist))))
(unless (riece-identity-assoc-no-server
identity riece-user-list-buffer-alist)
(let ((buffer (riece-user-list-buffer-create identity)))
- (push (cons identity buffer) riece-user-list-buffer-alist)))))
+ (setq riece-user-list-buffer-alist
+ (cons (cons identity buffer)
+ riece-user-list-buffer-alist))))))
(defun riece-switch-to-nearest-channel (pointer)
(let ((start riece-current-channels)
(if (riece-identity-equal-no-server (riece-make-identity old)
riece-current-channel)
(riece-switch-to-channel (riece-make-identity new)))
- (push (riece-make-identity new) channels)))
+ (setq channels (cons (riece-make-identity new) channels))))
(riece-insert-change (mapcar
(lambda (channel)
(cdr (riece-identity-assoc-no-server
(defun riece-handle-privmsg-message (prefix string)
(let* ((user (riece-prefix-nickname prefix))
(parameters (riece-split-parameters string))
- (targets (split-string (pop parameters) ","))
- (message (pop parameters)))
- (unless (equal message "")
- (while targets
- (riece-display-message
- (riece-make-message user (riece-make-identity (pop targets))
- message))))))
+ (targets (split-string (car parameters) ","))
+ (message (nth 1 parameters)))
+ (unless (equal message "") ;not ignored by server?
+ (riece-display-message
+ (riece-make-message user (riece-make-identity (car targets))
+ message)))))
(defun riece-handle-notice-message (prefix string)
(let* ((user (if prefix
(riece-prefix-nickname prefix)))
(parameters (riece-split-parameters string))
- (targets (split-string (pop parameters) ","))
- (message (pop parameters)))
- (unless (equal message "")
+ (targets (split-string (car parameters) ","))
+ (message (nth 1 parameters)))
+ (unless (equal message "") ;not ignored by server?
(if user
- (while targets
- (riece-display-message
- (riece-make-message user (riece-make-identity (pop targets))
- message 'notice)))
+ (riece-display-message
+ (riece-make-message user (riece-make-identity (car targets))
+ message 'notice))
;; message from server
(riece-insert-notice
(list riece-dialogue-buffer riece-others-buffer)
(defun riece-handle-part-message (prefix string)
(let* ((user (riece-prefix-nickname prefix))
(parameters (riece-split-parameters string))
- (channels (split-string (pop parameters) ","))
- (message (pop parameters)))
+ (channels (split-string (car parameters) ","))
+ (message (nth 1 parameters)))
(while channels
(riece-naming-assert-part user (car channels))
(let ((buffer (cdr (riece-identity-assoc-no-server
(defun riece-handle-kick-message (prefix string)
(let* ((kicker (riece-prefix-nickname prefix))
(parameters (riece-split-parameters string))
- (channel (pop parameters))
- (user (pop parameters))
- (message (pop parameters)))
+ (channel (car parameters))
+ (user (nth 1 parameters))
+ (message (nth 2 parameters)))
(riece-naming-assert-part user channel)
(let ((buffer (cdr (riece-identity-assoc-no-server
(riece-make-identity channel)
(defun riece-handle-kill-message (prefix string)
(let* ((killer (riece-prefix-nickname prefix))
(parameters (riece-split-parameters string))
- (user (pop parameters))
- (message (pop parameters))
+ (user (car parameters))
+ (message (nth 1 parameters))
(channels (copy-sequence (riece-user-get-channels user)))
pointer)
;; You were talking with the user.
(defun riece-handle-invite-message (prefix string)
(let* ((user (riece-prefix-nickname prefix))
(parameters (riece-split-parameters string))
- (channel (pop parameters)))
+ (channel (car parameters)))
(riece-insert-info
(list riece-dialogue-buffer riece-others-buffer)
(concat
(defun riece-handle-topic-message (prefix string)
(let* ((user (riece-prefix-nickname prefix))
(parameters (riece-split-parameters string))
- (channel (pop parameters))
- (topic (pop parameters)))
+ (channel (car parameters))
+ (topic (nth 1 parameters)))
(riece-channel-set-topic (riece-get-channel channel) topic)
(let ((buffer (cdr (riece-identity-assoc-no-server
(riece-make-identity channel)
(defun riece-get-buffer-create (name)
(let ((buffer (get-buffer-create name)))
- (or (memq buffer riece-buffer-list)
- (push buffer riece-buffer-list))
+ (unless (memq buffer riece-buffer-list)
+ (setq riece-buffer-list (cons buffer riece-buffer-list)))
buffer))
(defun riece-insert (buffers string)
(mapatoms
(lambda (atom)
(unless (riece-channel-p (symbol-name atom))
- (push (symbol-name atom) users)))
+ (setq users (cons (symbol-name atom) users))))
riece-obarray)
(if (member riece-real-nickname users)
users
(service (match-string 2 string))
(password (substring string (match-end 0)))
plist)
- (push `(:host ,host) plist)
+ (setq plist (cons `(:host ,host) plist))
(unless (equal service "")
- (push `(:service ,(string-to-int service)) plist))
+ (setq plist (cons `(:service ,(string-to-int service)) plist)))
(unless (equal password "")
- (push `(:password ,(substring password 1)) plist))
+ (setq plist (cons `(:password ,(substring password 1)) plist)))
(apply #'nconc plist))))
(defun riece-server-name-to-server (server-name)
(if entry
(unless (listp (cdr entry))
(setcdr entry (riece-server-parse-string (cdr entry))))
- (setq entry (cons server-name (riece-server-parse-string server-name)))
- (push entry riece-server-alist)
- (setq riece-save-variables-are-dirty t))
+ (setq entry (cons server-name (riece-server-parse-string server-name))
+ riece-server-alist (cons entry riece-server-alist)
+ riece-save-variables-are-dirty t))
(cdr entry)))
(defun riece-open-server (server server-name)
(setq keymap (symbol-value (car keymap)))))
(let (key)
(while plist
- (when (symbolp (setq key (pop plist)))
- (setq key (symbol-value key)))
+ (if (symbolp (setq key (car plist)))
+ (setq key (symbol-value key)))
+ (setq plist (cdr plist))
(if (or (not safe)
(eq (lookup-key keymap key) 'undefined))
- (define-key keymap key (pop plist))
- (pop plist)))))
+ (define-key keymap key (car plist))
+ (car plist))
+ (setq plist (cdr plist)))))
(when t
(riece-define-keys riece-dialogue-mode-map
(while pointer
(if (setq entry (assq (car pointer) dependencies))
(setcar (cdr entry) (1+ (nth 1 entry)))
- (push (list (car pointer) 1 nil) dependencies))
+ (setq dependencies (cons (list (car pointer) 1 nil)
+ dependencies)))
(setq pointer (cdr pointer)))
(if (setq entry (assq (car addons) dependencies))
(setcar (nthcdr 2 entry) requires)
- (push (list (car addons) 0 requires) dependencies)))
+ (setq dependencies (cons (list (car addons) 0 requires)
+ dependencies))))
(setq addons (cdr addons)))
dependencies))
(pointer dependencies)
queue)
(while pointer
- (when (zerop (nth 1 (car pointer)))
- (setq dependencies (delq (car pointer) dependencies))
- (push (car pointer) queue))
+ (if (zerop (nth 1 (car pointer)))
+ (setq dependencies (delq (car pointer) dependencies)
+ queue (cons (car pointer) queue)))
(setq pointer (cdr pointer)))
(setq addons nil)
(while queue
- (push (car (car queue)) addons)
- (setq pointer (nth 2 (car queue)))
+ (setq addons (cons (car (car queue)) addons)
+ pointer (nth 2 (car queue)))
(while pointer
(let* ((entry (assq (car pointer) dependencies))
(count (1- (nth 1 entry))))