From: ueno Date: Sun, 14 Apr 2002 21:18:20 +0000 (+0000) Subject: Remove unused local variable from all of the files. X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5e3555235d4a750d9c213fb7d9af74f63ed94531;p=elisp%2Fliece.git Remove unused local variable from all of the files. * liece-compat.el (liece-region-active-p): New function. (liece-truncate-string-to-width): New function. * liece-misc.el: Sort macrodefs. (liece-maybe-poll): Abolish. * liece-channel.el (liece-channel-last): Simplified. (liece-channel-switch-to-last): Define as function. * liece-commands.el (liece-command-ping): Send system-name until liece-server-name is determined. * liece-ctcp.el: Load `liece-q-*' even when compiling. * liece-hilit.el (liece-highlight-turn-on-font-lock): Don't set font-lock-support-mode if it isn't bound. --- diff --git a/lisp/bitmap-stipple.el b/lisp/bitmap-stipple.el index c946ed0..5b3d5ee 100644 --- a/lisp/bitmap-stipple.el +++ b/lisp/bitmap-stipple.el @@ -32,13 +32,16 @@ "Convert xbm FILE into icon format and return the list of spec and buffers." (with-temp-buffer (erase-buffer) - (let ((case-fold-search t) width height xbytes right margin) + (let ((case-fold-search t) width height + ;;xbytes right margin + ) (insert-file-contents file) (goto-char (point-min)) (or (re-search-forward "_width[\t ]+\\([0-9]+\\)" nil t) (error "!! Illegal xbm file format" (current-buffer))) (setq width (string-to-int (match-string 1)) - xbytes (/ (+ width 7) 8)) + ;;xbytes (/ (+ width 7) 8) + ) (goto-char (point-min)) (or (re-search-forward "_height[\t ]+\\([0-9]+\\)" nil t) (error "!! Illegal xbm file format" (current-buffer))) diff --git a/lisp/liece-300.el b/lisp/liece-300.el index 93fe292..88bc79a 100644 --- a/lisp/liece-300.el +++ b/lisp/liece-300.el @@ -129,7 +129,7 @@ (or (string-equal liece-away-indicator "A") (return-from liece-handle-305-message)) (setq liece-away-indicator "-") - (liece-maybe-poll) + (liece-command-ping) (when (string-match "[^:]:\\(.*\\)" rest) (setq rest (match-string 1 rest)) (liece-insert-info liece-300-buffer diff --git a/lisp/liece-400.el b/lisp/liece-400.el index 2bce593..9cfac01 100644 --- a/lisp/liece-400.el +++ b/lisp/liece-400.el @@ -114,8 +114,9 @@ (defun liece-handle-442-message (prefix rest) "ERR_NOTONCHANNEL \" :You're not on that channel\"." (if (string-match "[^ ]+ \\([^ ]+\\) +:\\(.*\\)" rest) - (let* ((chnl (liece-channel-virtual (match-string 1 rest))) - (rest (match-string 2 rest))) + (let ((chnl (liece-channel-virtual (match-string 1 rest))) + ;;(rest (match-string 2 rest)) + ) (if (liece-channel-member chnl liece-current-channels) (liece-channel-part chnl) (liece-message (_ "You're not on channel %s") chnl))))) @@ -124,7 +125,8 @@ "ERR_USERONCHANNEL \" :is already on channel\"." (if (string-match "[^ ]+ \\([^ ]+\\) \\([^ ]+\\)" rest) (let ((chnl (match-string 1 rest)) - (rest (match-string 2 rest))) + ;;(rest (match-string 2 rest)) + ) (when (prog1 (liece-channel-p chnl) (setq chnl (liece-channel-virtual chnl))) (or (liece-channel-member chnl liece-current-channels) diff --git a/lisp/liece-channel.el b/lisp/liece-channel.el index e2fd430..b202fc4 100644 --- a/lisp/liece-channel.el +++ b/lisp/liece-channel.el @@ -50,7 +50,6 @@ (y-or-n-p (format "Do you really join %s? " chnl))) (liece-command-join chnl)))) -;;; Reader conventions (defun liece-channel-p (chnl) (string-match (eval-when-compile @@ -354,13 +353,13 @@ If NOSW is non-nil do not switch to newly created channel." (liece-channel-switch-to-last liece-current-channels))))) (defun liece-channel-last (chnls) - (car (last (delq nil (copy-sequence chnls))))) + (car (last chnls))) -(defmacro liece-channel-switch-to-last (chnls) - `(let ((chnl (liece-channel-last ,chnls))) - (if chnl - (liece-switch-to-channel chnl)) - (liece-channel-change))) +(defun liece-channel-switch-to-last (chnls) + (let ((chnl (liece-channel-last chnls))) + (if chnl + (liece-switch-to-channel chnl)) + (liece-channel-change))) (defun liece-channel-change () (let ((chnls (if (eq liece-command-buffer-mode 'chat) diff --git a/lisp/liece-commands.el b/lisp/liece-commands.el index c7817fb..d96065e 100644 --- a/lisp/liece-commands.el +++ b/lisp/liece-commands.el @@ -132,10 +132,7 @@ Optional argument NO-CONS specifies timestamp format is cons cell." "Send MESSAGE to current chat partner of current channel." (if (string-equal message "") (progn (liece-message (_ "No text to send")) nil) - (let ((addr (if (eq liece-command-buffer-mode 'chat) - liece-current-chat-partner - liece-current-channel)) - repr method name target) + (let (repr method target) (cond ((eq liece-command-buffer-mode 'chat) (or liece-current-chat-partner @@ -145,7 +142,7 @@ Optional argument NO-CONS specifies timestamp format is cons cell." (setq repr (liece-channel-parse-representation liece-current-chat-partner) method (aref repr 0) - name (aref repr 1) + ;; name (aref repr 1) target (aref repr 2)) (cond ((eq method 'dcc) (liece-dcc-chat-send target message)) @@ -600,7 +597,7 @@ With - as argument, list all channels." (defun liece-command-nickname (nick) "Set your nickname to NICK." (interactive "sEnter your nickname: ") - (let ((nickname (truncate-string nick liece-nick-max-length))) + (let ((nickname (liece-truncate-string-to-width nick liece-nick-max-length))) (if (zerop (length nickname)) (liece-message (_ "illegal nickname \"%s\"; not changed") nickname) (liece-send "NICK %s" nick)))) @@ -1073,8 +1070,10 @@ Argument ARG is prefix argument of toggle status." (defun liece-command-ping () "Send PING to server." (interactive) - (if (stringp liece-server-name) - (liece-send "PING %s" liece-server-name))) + (liece-send "PING %s" + (if (stringp liece-server-name) + liece-server-name + (system-name)))) (defun liece-command-ison (nicks) "IsON users NICKS." @@ -1128,7 +1127,7 @@ Argument ARG is prefix argument of toggle status." (defun liece-command-tag-region (start end) "Move current region between START and END to `kill-ring'." (interactive - (if (region-active-p) + (if (liece-region-active-p) (list (region-beginning)(region-end)) (list (line-beginning-position)(line-end-position)))) (static-if (fboundp 'extent-property) diff --git a/lisp/liece-compat.el b/lisp/liece-compat.el index 7ed1a87..848921a 100644 --- a/lisp/liece-compat.el +++ b/lisp/liece-compat.el @@ -37,13 +37,14 @@ (defalias 'liece-widget-convert-button 'widget-convert-button) (defalias 'liece-widget-button-click 'widget-button-click) -(defun-maybe region-active-p () - "Return non-nil if the region is active. +(static-if (fboundp 'region-active-p) + (defalias 'liece-region-active-p 'region-active-p) + (defun liece-region-active-p () + "Return non-nil if the region is active. If `zmacs-regions' is true, this is equivalent to `region-exists-p'. Otherwise, this function always returns false. \[XEmacs emulating function]" - (static-if (and (boundp 'transient-mark-mode) (boundp 'mark-active)) - (and transient-mark-mode mark-active))) + (and transient-mark-mode mark-active))) (defun liece-map-overlays (function) "Map FUNCTION over the extents which overlap the current buffer." @@ -98,6 +99,10 @@ Otherwise, this function always returns false. (setq dir-list (cdr dir-list)))) dir)) +(static-if (fboundp 'truncate-string-to-width) + (defalias 'liece-truncate-string-to-width 'truncate-string-to-width) + (defalias 'liece-truncate-string-to-width 'truncate-string)) + (defvar-maybe completion-display-completion-list-function 'display-completion-list) diff --git a/lisp/liece-ctcp.el b/lisp/liece-ctcp.el index 88a85a8..63db6ab 100644 --- a/lisp/liece-ctcp.el +++ b/lisp/liece-ctcp.el @@ -35,8 +35,9 @@ (require 'pccl) -(or (broken-p 'ccl-usable) (require 'liece-q-ccl nil 'noerror) - (require 'liece-q-el)) +(eval-and-compile + (or (broken-p 'ccl-usable) (require 'liece-q-ccl nil 'noerror) + (require 'liece-q-el))) (require 'liece-x-face) diff --git a/lisp/liece-handle.el b/lisp/liece-handle.el index b0238eb..520dd72 100644 --- a/lisp/liece-handle.el +++ b/lisp/liece-handle.el @@ -197,7 +197,7 @@ (defun liece-handle-ping-message (prefix rest) (liece-send "PONG :%s" rest) (liece-command-timestamp-if-interval-expired t) - (liece-maybe-poll)) + (liece-command-ping)) (defun liece-handle-wall-message (prefix rest) (liece-insert-broadcast (append liece-D-buffer liece-O-buffer) diff --git a/lisp/liece-handler.el b/lisp/liece-handler.el index b085fe9..4ba6e1c 100644 --- a/lisp/liece-handler.el +++ b/lisp/liece-handler.el @@ -53,8 +53,7 @@ (defun liece-handler-unify-argument-list-function (args unifiers) (let ((index 0) (unfs (copy-alist unifiers)) - (len (length args)) - type) + (len (length args))) (setq unfs (remove-if (lambda (unf) (/= (length (cdr unf)) len)) unfs)) (dolist (arg args) diff --git a/lisp/liece-hilit.el b/lisp/liece-hilit.el index b29e892..fa1b534 100644 --- a/lisp/liece-hilit.el +++ b/lisp/liece-hilit.el @@ -378,8 +378,9 @@ (setq font-lock-defaults '(liece-highlight-font-lock-keywords t)) (make-local-variable 'font-lock-verbose) (setq font-lock-verbose nil) - (make-local-variable 'font-lock-support-mode) - (setq font-lock-support-mode nil) + (static-when (boundp 'font-lock-support-mode) + (make-local-variable 'font-lock-support-mode) + (setq font-lock-support-mode nil)) (make-local-hook 'font-lock-mode-hook) (setq font-lock-mode-hook nil) (turn-on-font-lock) @@ -423,7 +424,7 @@ (defun liece-highlight-colorize-quote (st nd len) (save-excursion (goto-char st) - (let (num face faces vender name ovl) + (let (num face faces vender ovl) (while (re-search-forward "\\([\003\013][0-9:;<=]+\\)\\([^\002\026\037\003\013]*\\)" nd t) (setq ovl (make-overlay (match-beginning 2) (match-end 2)) num (match-string 1) diff --git a/lisp/liece-minibuf.el b/lisp/liece-minibuf.el index d5063af..e5b0250 100644 --- a/lisp/liece-minibuf.el +++ b/lisp/liece-minibuf.el @@ -103,11 +103,11 @@ (or (car-safe y) y)))))))))) (defun liece-minibuffer-complete-channel-modes () - (let* ((preceding-char (char-before)) completion candidate all - (modes (mapconcat + (let* ((modes (mapconcat (function car) liece-supported-channel-mode-alist "")) (nicks (liece-channel-get-nicks)) + completion candidate all uahs (context (liece-minibuffer-parse-modes)) (state (car context)) (type (cdr context))) diff --git a/lisp/liece-misc.el b/lisp/liece-misc.el index e479e43..fcf8d6b 100644 --- a/lisp/liece-misc.el +++ b/lisp/liece-misc.el @@ -39,6 +39,53 @@ (eval-when-compile (autoload '_ "liece-intl" nil nil 'macro)) +(defmacro liece-insert-change (buffer msg) + `(liece-insert ,buffer (concat liece-change-prefix ,msg))) + +(defmacro liece-insert-notice (buffer msg) + `(liece-insert ,buffer (concat liece-notice-prefix ,msg))) + +(defmacro liece-insert-broadcast (buffer msg) + `(liece-insert ,buffer (concat liece-broadcast-prefix ,msg))) + +(defmacro liece-insert-wallops (buffer msg) + `(liece-insert ,buffer (concat liece-wallops-prefix ,msg))) + +(defmacro liece-insert-error (buffer msg) + `(liece-insert ,buffer (concat liece-error-prefix ,msg))) + +(defmacro liece-insert-info (buffer msg) + `(liece-insert ,buffer (concat liece-info-prefix ,msg))) + +(defmacro liece-insert-timestamp (buffer msg) + `(liece-insert ,buffer (concat liece-timestamp-prefix ,msg))) + +(defmacro liece-insert-dcc (buffer msg) + `(liece-insert ,buffer (concat liece-dcc-prefix ,msg))) + +(defmacro liece-insert-client (buffer msg) + `(liece-insert ,buffer (concat liece-client-prefix ,msg))) + +(defmacro liece-current-nickname () + "Our current nickname." + 'liece-real-nickname) + +(defmacro liece-current-channel () + "Our current channel." + 'liece-current-channel) + +(defmacro liece-current-channels () + "Our current channels." + 'liece-current-channels) + +(defmacro liece-current-chat-partner () + "Our current chat partner." + 'liece-current-chat-partner) + +(defmacro liece-current-chat-partners () + "Our current chat partners." + 'liece-current-chat-partners) + (defun liece-toggle-command-buffer-mode (&optional mode) "Toggle command buffer MODE." (let ((mode @@ -184,38 +231,6 @@ (product-name (product-find 'liece-version)) (format ,@message))) -(defmacro liece-insert-change (buffer msg) - `(liece-insert ,buffer (concat liece-change-prefix ,msg))) - -(defmacro liece-insert-notice (buffer msg) - `(liece-insert ,buffer (concat liece-notice-prefix ,msg))) - -(defmacro liece-insert-broadcast (buffer msg) - `(liece-insert ,buffer (concat liece-broadcast-prefix ,msg))) - -(defmacro liece-insert-wallops (buffer msg) - `(liece-insert ,buffer (concat liece-wallops-prefix ,msg))) - -(defmacro liece-insert-error (buffer msg) - `(liece-insert ,buffer (concat liece-error-prefix ,msg))) - -(defmacro liece-insert-info (buffer msg) - `(liece-insert ,buffer (concat liece-info-prefix ,msg))) - -(defmacro liece-insert-timestamp (buffer msg) - `(liece-insert ,buffer (concat liece-timestamp-prefix ,msg))) - -(defmacro liece-insert-dcc (buffer msg) - `(liece-insert ,buffer (concat liece-dcc-prefix ,msg))) - -(defmacro liece-insert-client (buffer msg) - `(liece-insert ,buffer (concat liece-client-prefix ,msg))) - -(defmacro liece-own-message (message) - `(if (eq liece-command-buffer-mode 'channel) - (liece-own-channel-message ,message) - (liece-own-channel-message ,message))) - (defmacro liece-own-channel-message (message &optional chnl) `(let* ((chnl (or ,chnl (liece-current-channel))) (liece-message-target chnl) @@ -230,6 +245,29 @@ (liece-message-direction 'outgoing)) (liece-display-message ,message))) +(defmacro liece-own-message (message) + `(if (eq liece-command-buffer-mode 'channel) + (liece-own-channel-message ,message) + (liece-own-channel-message ,message))) + +(defvar liece-idle-point nil "Timestamp of last idle reset.") + +(defmacro liece-reset-idle () + "Reset idle counter and return last idle." + '(prog1 (liece-idle) (setq liece-idle-point (current-time)))) + +(defmacro liece-idle () + "How long has liece been idle." + '(if liece-idle-point + (liece-time-difference liece-idle-point (current-time)) + 9999999)) + +(defmacro liece-ping-if-idle (&optional limit) + `(if (<= (liece-idle) (or ,limit 120)) + nil + (liece-command-ping) + t)) + (defmacro liece-convert-received-input (input) "Convert input before it is processed" `(let ((conv-list liece-receive-convert-list) @@ -292,26 +330,6 @@ (concat "[" ,hostname "]") ,hostname))) -(defmacro liece-current-nickname () - "Our current nickname." - 'liece-real-nickname) - -(defmacro liece-current-channel () - "Out current channel." - 'liece-current-channel) - -(defmacro liece-current-channels () - "Out current channels." - 'liece-current-channels) - -(defmacro liece-current-chat-partner () - "Out current chat partner." - 'liece-current-chat-partner) - -(defmacro liece-current-chat-partners () - "Out current chat partners." - 'liece-current-chat-partners) - (defmacro liece-scroll-if-visible (window) `(if ,window (set-window-point ,window (point-max)))) @@ -357,27 +375,6 @@ (defmacro liece-insert-time-string () '(insert (substring (current-time-string) 11 16) " ")) -(defvar liece-idle-point nil "Timestamp of last idle reset.") - -(defmacro liece-reset-idle () - "Reset idle counter and return last idle." - '(prog1 (liece-idle) (setq liece-idle-point (current-time)))) - -(defmacro liece-idle () - "How long has liece been idle." - '(if liece-idle-point - (liece-time-difference liece-idle-point (current-time)) - 9999999)) - -(defmacro liece-ping-if-idle (&optional limit) - `(if (<= (liece-idle) (or ,limit 120)) - nil - (liece-command-ping) - t)) - -(defmacro liece-maybe-poll () - '(liece-send "PING %s" (system-name))) - (defun liece-get-buffer-create (name) "Get or create buffer, keep track on its NAME so we can kill it." (let ((buffer (get-buffer-create name))) @@ -463,20 +460,6 @@ If optional argument TIME is nil, calculate timestamp using current time." (setq time (current-time))) (format "%04x%04x" (car time) (cadr time))) -(defmacro liece-hex-timestamp-valid (timestamp limit) - "Is TIMESTAMP valid within LIMIT?" - `(let (t1 t2 diff (timestamp ,timestamp)) - (if (not (and (stringp timestamp) - (string-match - "^[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]$" timestamp))) - nil - (setq t1 (liece-hex-string-to-integer (substring timestamp 0 4)) - t2 (liece-hex-string-to-integer (substring timestamp 4 8)) - diff (liece-time-difference - (list t1 t2 0) (current-time))) - (or (>= ,limit 0) - (and (< diff ,limit) (> diff (- 0 ,limit))))))) - (defmacro liece-hex-char-to-integer (character) "Convert single hex digit CHARACTER to integer." `(if (and (>= ,character ?0) (<= ,character ?9)) @@ -496,6 +479,20 @@ If optional argument TIME is nil, calculate timestamp using current time." (setq hex-string (substring hex-string 1))) hex-num)) +(defmacro liece-hex-timestamp-valid (timestamp limit) + "Is TIMESTAMP valid within LIMIT?" + `(let (t1 t2 diff (timestamp ,timestamp)) + (if (not (and (stringp timestamp) + (string-match + "^[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]$" timestamp))) + nil + (setq t1 (liece-hex-string-to-integer (substring timestamp 0 4)) + t2 (liece-hex-string-to-integer (substring timestamp 4 8)) + diff (liece-time-difference + (list t1 t2 0) (current-time))) + (or (>= ,limit 0) + (and (< diff ,limit) (> diff (- 0 ,limit))))))) + (defmacro liece-remove-properties-region (start end) (unless (fboundp 'make-extent) `(save-excursion diff --git a/lisp/liece-nick.el b/lisp/liece-nick.el index 93dfe51..86e0c8a 100644 --- a/lisp/liece-nick.el +++ b/lisp/liece-nick.el @@ -123,7 +123,7 @@ (cond ((and (eq liece-nick-sort-nicks t) (liece-functionp liece-nick-sort-predicate)) - (let (nicks found) + (let (found) (goto-char (point-min)) (while (and (not (eobp)) (not found)) (if (condition-case nil @@ -269,7 +269,7 @@ ;;;###liece-autoload (defun liece-nick-change (old new) (let* ((old (liece-nick-strip old)) (new (liece-nick-strip new)) - (chnls (get (intern old liece-obarray) 'chnl)) chnl nbuf) + (chnls (get (intern old liece-obarray) 'chnl)) nbuf) (liece-change-nick-of old new) (if new (put (intern new liece-obarray) 'chnl chnls)) @@ -311,7 +311,7 @@ (setq liece-nick-region-nicks nil) (save-excursion (let (region nick) - (if (not (region-active-p)) + (if (not (liece-region-active-p)) (setq region (cons (line-beginning-position) (line-beginning-position 2))) (setq region (cons (region-beginning) (region-end))) diff --git a/lisp/liece.el b/lisp/liece.el index c65c7b3..edff59c 100644 --- a/lisp/liece.el +++ b/lisp/liece.el @@ -220,6 +220,7 @@ If optional argument SAFE is nil, overwrite previous definitions." "q" liece-command-quit "r" liece-command-reconfigure-windows "x" liece-command-tag-region + "\C-s" liece-command-open-server "t" liece-command-topic ;;"T" liece-command-timestamp ;;"\C-t" liece-command-find-timestamp @@ -321,7 +322,8 @@ is running on." (when (or confirm (null (or liece-server (setq liece-server (getenv "IRCSERVER"))))) - (setq liece-server (completing-read (_ "IRC server: ") liece-server-alist))) + (setq liece-server (completing-read (_ "IRC server: ") + liece-server-alist))) (unless (listp liece-server) (let ((entry (assoc liece-server liece-server-alist))) (if entry @@ -334,7 +336,8 @@ is running on." (setq liece-server plist))))) (when (or (and confirm liece-ask-for-nickname) (null liece-nickname)) - (setq liece-nickname (read-string (_ "Enter your nickname: ") liece-nickname))) + (setq liece-nickname (read-string (_ "Enter your nickname: ") + liece-nickname))) (let ((host (liece-server-host))) (liece-message (_ "Connecting to IRC server on %s...") host) @@ -432,7 +435,7 @@ If optional argument SERVICE is non-nil, open by the service name." (setq liece-tmp-server-name host) (setq liece-server-process (liece-open-server-internal host service type)) (setq liece-after-registration nil) - (liece-maybe-poll) + (liece-command-ping) (if (null (liece-wait-for-response "^:[^ ]+ [4P][5O][1N][ G]")) (progn ;; We have to close connection here, since the function @@ -459,7 +462,8 @@ If optional argument SERVICE is non-nil, open by the service name." ;; notify the real nickname to the user. (or liece-real-nickname (setq liece-real-nickname - (truncate-string liece-nickname liece-nick-max-length))) + (liece-truncate-string-to-width liece-nickname + liece-nick-max-length))) (setq liece-nickname-last liece-real-nickname liece-nick-accepted 'sent liece-after-registration t))))