From: ueno Date: Fri, 6 Jun 2008 04:12:03 +0000 (+0000) Subject: Suppress compiler warnings. X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1427368d25257dfe250b57a26e157a35783a8207;p=elisp%2Friece.git Suppress compiler warnings. (riece-make-local-hook): New alias. (riece-derived-mode-p): New alias. (riece-set-process-query-on-exit-flag): New alias. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 25100e1..6053dfd 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2008-06-06 Daiki Ueno + + * riece-compat.el (riece-make-local-hook): New alias. + (riece-derived-mode-p): New alias. + (riece-set-process-query-on-exit-flag): New alias. + 2008-06-05 TAKAHASHI Kaoru * riece-options.el (riece-server-alist): Fix :value for username, diff --git a/lisp/riece-async.el b/lisp/riece-async.el index b633ff5..56403f8 100644 --- a/lisp/riece-async.el +++ b/lisp/riece-async.el @@ -84,7 +84,7 @@ assumed that the file is in the same directory of this file.") (not (looking-at (format "NOTICE CONNECTED %d" (process-id process)))))) (accept-process-output process)))) - (process-kill-without-query process) + (riece-set-process-query-on-exit-flag process nil) process)) (defun riece-async-insinuate () diff --git a/lisp/riece-button.el b/lisp/riece-button.el index 27e4a73..fd6f24e 100644 --- a/lisp/riece-button.el +++ b/lisp/riece-button.el @@ -256,8 +256,7 @@ This function is used as a callback for a channel button." (let ((buffers riece-buffer-list)) (while buffers (set-buffer (car buffers)) - (if (eq (derived-mode-class major-mode) - 'riece-dialogue-mode) + (if (riece-derived-mode-p 'riece-dialogue-mode) (riece-button-dialogue-mode-hook)) (setq buffers (cdr buffers))))) (add-hook 'riece-channel-list-mode-hook @@ -292,8 +291,7 @@ This function is used as a callback for a channel button." (let ((pointer riece-buffer-list)) (while pointer (with-current-buffer (car pointer) - (if (eq (derived-mode-class major-mode) - 'riece-dialogue-mode) + (if (riece-derived-mode-p 'riece-dialogue-mode) (riece-button-update-buffer))) (setq pointer (cdr pointer))) (if riece-current-channel diff --git a/lisp/riece-commands.el b/lisp/riece-commands.el index 427fd3c..ddb353d 100644 --- a/lisp/riece-commands.el +++ b/lisp/riece-commands.el @@ -34,8 +34,6 @@ (require 'riece-message) (require 'riece-mcat) -(autoload 'derived-mode-class "derived") - ;;; Channel movement: (defun riece-command-switch-to-channel (channel) (interactive (list (riece-completing-read-identity @@ -445,8 +443,8 @@ the layout to the selected layout-name." (riece-line-beginning-position) (riece-line-end-position)) nil) - (let ((next-line-add-newlines t)) - (next-line 1))) + (if (> (forward-line) 0) + (insert "\n"))) (defun riece-command-enter-message-as-notice () "Send the current line to the current channel as NOTICE." @@ -455,8 +453,8 @@ the layout to the selected layout-name." (riece-line-beginning-position) (riece-line-end-position)) t) - (let ((next-line-add-newlines t)) - (next-line 1))) + (if (> (forward-line) 0) + (insert "\n"))) (defun riece-command-enter-message-to-user (user) "Send the current line to USER." @@ -476,8 +474,8 @@ the layout to the selected layout-name." user) (riece-display-message (riece-make-message (riece-current-nickname) user text nil t))) - (let ((next-line-add-newlines t)) - (next-line 1))) + (if (> (forward-line) 0) + (insert "\n"))) (defun riece-command-join-channel (target key) (unless (riece-server-opened (riece-identity-server target)) @@ -629,8 +627,7 @@ the layout to the selected layout-name." "Prevent automatic scrolling of the dialogue window. If prefix argument ARG is non-nil, toggle frozen status." (interactive "P") - (with-current-buffer (if (eq (derived-mode-class major-mode) - 'riece-dialogue-mode) + (with-current-buffer (if (riece-derived-mode-p 'riece-dialogue-mode) (current-buffer) (if (and riece-channel-buffer-mode riece-channel-buffer) @@ -647,8 +644,7 @@ If prefix argument ARG is non-nil, toggle frozen status." The difference from `riece-command-freeze' is that your messages are hidden. If prefix argument ARG is non-nil, toggle frozen status." (interactive "P") - (with-current-buffer (if (eq (derived-mode-class major-mode) - 'riece-dialogue-mode) + (with-current-buffer (if (riece-derived-mode-p 'riece-dialogue-mode) (current-buffer) (if (and riece-channel-buffer-mode riece-channel-buffer) diff --git a/lisp/riece-compat.el b/lisp/riece-compat.el index 3e54caf..b237d0e 100644 --- a/lisp/riece-compat.el +++ b/lisp/riece-compat.el @@ -66,6 +66,22 @@ (make-list (- max min) (concat regexp "?")))) ""))) +(if (get 'make-local-hook 'byte-obsolete-info) + (defalias 'riece-make-local-hook 'ignore) + (defalias 'riece-make-local-hook 'make-local-hook)) + +(autoload 'derived-mode-class "derived") +(if (fboundp 'derived-mode-p) + (defalias 'riece-derived-mode-p 'derived-mode-p) + (defun riece-derived-mode-p (&rest modes) + (memq (derived-mode-class major-mode) modes))) + +(if (fboundp 'set-process-query-on-exit-flag) + (defalias 'riece-set-process-query-on-exit-flag + 'set-process-query-on-exit-flag) + (defun riece-set-process-query-on-exit-flag (process flag) + (process-kill-without-query process (not flag)))) + (provide 'riece-compat) ;;; riece-compat.el ends here diff --git a/lisp/riece-ctcp.el b/lisp/riece-ctcp.el index e0e60a9..18eefdc 100644 --- a/lisp/riece-ctcp.el +++ b/lisp/riece-ctcp.el @@ -342,8 +342,8 @@ (read-string (riece-mcat "Action: ")) (prog1 (read-from-minibuffer (riece-mcat "Action: ") (cons message 0)) - (let ((next-line-add-newlines t)) - (next-line 1))))))) + (if (> (forward-line) 0) + (insert "\n"))))))) (if (equal action "") (error "No action")) (riece-send-string (format "PRIVMSG %s :\1ACTION %s\1\r\n" diff --git a/lisp/riece-display.el b/lisp/riece-display.el index 3cd8f72..5d20012 100644 --- a/lisp/riece-display.el +++ b/lisp/riece-display.el @@ -31,8 +31,6 @@ (require 'riece-signal) (require 'riece-mcat) -(autoload 'derived-mode-class "derived") - (defvar riece-channel-buffer-format "*Channel:%s*" "Format of channel message buffer.") (defvar riece-channel-buffer-alist nil @@ -358,8 +356,7 @@ Local to the buffer in `riece-buffer-list'.") (walk-windows (lambda (window) (with-current-buffer (window-buffer window) - (if (eq (derived-mode-class major-mode) - 'riece-dialogue-mode) + (if (riece-derived-mode-p 'riece-dialogue-mode) (setq riece-freeze-indicator (if (eq riece-freeze 'own) "f" diff --git a/lisp/riece-epg.el b/lisp/riece-epg.el index 63c5997..a33d8ad 100644 --- a/lisp/riece-epg.el +++ b/lisp/riece-epg.el @@ -109,8 +109,8 @@ (riece-display-message (riece-make-message (riece-current-nickname) riece-current-channel (concat "[encrypted:" string "]") nil t)) - (let ((next-line-add-newlines t)) - (next-line 1)))) + (if (> (forward-line) 0) + (insert "\n")))) (defun riece-command-set-passphrase (identity passphrase) "Set PASSPHRASE associated with IDENTITY." diff --git a/lisp/riece-highlight.el b/lisp/riece-highlight.el index 97e9af1..f40638e 100644 --- a/lisp/riece-highlight.el +++ b/lisp/riece-highlight.el @@ -214,7 +214,7 @@ ;; In XEmacs, auto-initialization of font-lock is not affective ;; when buffer-file-name is not set. (font-lock-set-defaults) - (make-local-hook 'after-change-functions) + (riece-make-local-hook 'after-change-functions) (add-hook 'after-change-functions 'riece-highlight-hide-prefix nil t) (if (get 'riece-highlight 'riece-addon-enabled) @@ -282,8 +282,7 @@ (save-excursion (while buffers (set-buffer (car buffers)) - (if (eq (derived-mode-class major-mode) - 'riece-dialogue-mode) + (if (riece-derived-mode-p 'riece-dialogue-mode) (remove-hook 'after-change-functions 'riece-highlight-hide-prefix t)) (setq buffers (cdr buffers))))) @@ -303,10 +302,9 @@ (defun riece-highlight-enable () (let ((buffers riece-buffer-list)) (while buffers - (if (memq (derived-mode-class - (with-current-buffer (car buffers) - major-mode)) - '(riece-dialogue-mode riece-channel-list-mode)) + (if (with-current-buffer (car buffers) + (riece-derived-mode-p 'riece-dialogue-mode + 'riece-channel-list-mode)) (with-current-buffer (car buffers) (font-lock-mode 1))) (setq buffers (cdr buffers))))) @@ -314,10 +312,9 @@ (defun riece-highlight-disable () (let ((buffers riece-buffer-list)) (while buffers - (if (memq (derived-mode-class - (with-current-buffer (car buffers) - major-mode)) - '(riece-dialogue-mode riece-channel-list-mode)) + (if (with-current-buffer (car buffers) + (riece-derived-mode-p 'riece-dialogue-mode + 'riece-channel-list-mode)) (with-current-buffer (car buffers) (font-lock-mode 0))) (setq buffers (cdr buffers))))) diff --git a/lisp/riece-ruby.el b/lisp/riece-ruby.el index 699ddd0..13d2611 100644 --- a/lisp/riece-ruby.el +++ b/lisp/riece-ruby.el @@ -265,7 +265,7 @@ Return a string name assigned by the server." (expand-file-name riece-ruby-server-program riece-data-directory) riece-ruby-server-program-arguments)) - (process-kill-without-query riece-ruby-process) + (riece-set-process-query-on-exit-flag riece-ruby-process nil) (set-process-filter riece-ruby-process #'riece-ruby-filter) (set-process-sentinel riece-ruby-process #'riece-ruby-sentinel))) (save-excursion diff --git a/lisp/riece-shrink-buffer.el b/lisp/riece-shrink-buffer.el index 6bc9481..38091a0 100644 --- a/lisp/riece-shrink-buffer.el +++ b/lisp/riece-shrink-buffer.el @@ -62,10 +62,8 @@ (while buffers (if (and (get 'riece-shrink-buffer 'riece-addon-enabled) (buffer-live-p (car buffers)) - (eq (derived-mode-class - (with-current-buffer (car buffers) - major-mode)) - 'riece-dialogue-mode)) + (with-current-buffer (car buffers) + (riece-derived-mode-p 'riece-dialogue-mode))) (riece-shrink-buffer (car buffers))) (setq buffers (cdr buffers))))) diff --git a/lisp/riece.el b/lisp/riece.el index 67ee557..400404d 100644 --- a/lisp/riece.el +++ b/lisp/riece.el @@ -31,8 +31,6 @@ (require 'riece-addon) (require 'riece-signal) -(autoload 'derived-mode-class "derived") - (defvar riece-channel-list-mode-map (make-sparse-keymap)) (defvar riece-user-list-mode-map (make-sparse-keymap)) @@ -399,9 +397,12 @@ For a list of the generic commands type \\[riece-command-generic] ? RET. (setq riece-command-mode-syntax-table (copy-syntax-table (syntax-table))) (set-syntax-table riece-command-mode-syntax-table) - (mapcar - (lambda (c) (modify-syntax-entry c "w")) - "^[]{}'`")) + (let* ((chars "^[]{}'`") + (length (length chars)) + (index 0)) + (while (< index length) + (modify-syntax-entry (aref chars index) "w") + (setq index (1+ index))))) (run-hooks 'riece-command-mode-hook)) @@ -491,7 +492,7 @@ All normal editing commands are turned off." riece-mode-line-buffer-identification) truncate-lines t buffer-read-only t) - (make-local-hook 'riece-update-buffer-functions) + (riece-make-local-hook 'riece-update-buffer-functions) (add-hook 'riece-update-buffer-functions 'riece-update-channel-list-buffer nil t) (use-local-map riece-channel-list-mode-map) @@ -522,7 +523,7 @@ Instead, these commands are available: buffer-read-only t) (if (boundp 'transient-mark-mode) (set (make-local-variable 'transient-mark-mode) t)) - (make-local-hook 'riece-update-buffer-functions) + (riece-make-local-hook 'riece-update-buffer-functions) (add-hook 'riece-update-buffer-functions 'riece-update-user-list-buffer nil t) (use-local-map riece-user-list-mode-map)