From: ueno Date: Thu, 22 May 2003 08:42:50 +0000 (+0000) Subject: Merge XEmacs changes. X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=HEAD;p=elisp%2Fliece.git Merge XEmacs changes. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 4901fdf..319c23d 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -3,6 +3,38 @@ * liece-handle.el (liece-handle-privmsg-message): Don't compare when `item' and `liece-current-chat-partner' are nil. +2003-04-17 Daiki Ueno + + * liece-channel.el: Require 'liece-misc when compiling. + (liece-channel-equal): Define as function. + (liece-channel-buffer-create): Define as function. + (liece-channel-switch-to-last): Define before it is used. + * liece-ctcp.el: Require 'liece-misc when compiling. + * liece-message.el: Require 'liece-misc when compiling. + * liece-misc.el: Move some macros to the beginning of the file. + * liece-nick.el: Require 'liece-inlines when compiling. + (liece-nick-equal): Define as function. + (liece-nick-buffer-create): Define as function. + +2003-03-26 Steve Youngs + + * liece-channel.el (liece-channel-p): Don't wrap the string-match + in a 'eval-when-compile' to avoid a void variable error. + (liece-channel-modeless-p): Ditto. + +2003-03-09 Ben Wing + + * Makefile.lisp: + * Makefile.lisp (autoload): New. + Separate autoload building from elc building. + + * liece-make.el (install-update-package-files): + Use new `batch-update-directory-autoloads' if available. + +2002-12-08 Ville Skyttä + + * Makefile.lisp (all): Not a double-colon any more. + 2002-10-15 Daiki Ueno * liece-emacs.el: Don't use insert-file-contents-as-binary to read diff --git a/lisp/Makefile.lisp b/lisp/Makefile.lisp index 93af425..14f9894 100644 --- a/lisp/Makefile.lisp +++ b/lisp/Makefile.lisp @@ -12,7 +12,7 @@ VERSION_SPECIFIC_LISPDIR ?= NONE GOMI = liece-setup.el *.elc -all:: elc +all: elc elc: $(EMACS) $(FLAGS) -l ./liece-make.el -f autoload-liece \ diff --git a/lisp/liece-channel.el b/lisp/liece-channel.el index ed545e4..80377a6 100644 --- a/lisp/liece-channel.el +++ b/lisp/liece-channel.el @@ -30,6 +30,7 @@ ;;; Code: (eval-when-compile (require 'liece-inlines)) +(eval-when-compile (require 'liece-misc)) (eval-when-compile (require 'liece-clfns)) @@ -52,18 +53,13 @@ ;;; Reader conventions (defun liece-channel-p (chnl) - (string-match - (eval-when-compile - (concat "^" liece-channel-regexp)) - chnl)) + (string-match (concat "^" liece-channel-regexp) chnl)) (defun liece-channel-modeless-p (chnl) - (string-match - (eval-when-compile - (concat "^" liece-channel-modeless-regexp)) - chnl)) + (string-match (concat "^" liece-channel-modeless-regexp) chnl)) -(defalias 'liece-channel-equal 'string-equal-ignore-case) +(defun liece-channel-equal (c1 c2) + (string-equal-ignore-case c1 c2)) (defun liece-channel-member (chnl chnls) "Return non-nil if CHNL is member of CHNLS." @@ -289,10 +285,10 @@ Otherwise they are removed from the channel." (setq liece-channel-buffer-mode (not liece-channel-buffer-mode))) (liece-configure-windows)) -(defmacro liece-channel-buffer-create (chnl) +(defun liece-channel-buffer-create (chnl) "Create channel buffer of CHNL." - `(with-current-buffer - (liece-get-buffer-create (format liece-channel-buffer-format ,chnl)) + (with-current-buffer + (liece-get-buffer-create (format liece-channel-buffer-format chnl)) (let (buffer-read-only) (liece-insert-info (current-buffer) (concat (funcall liece-format-time-function @@ -300,7 +296,7 @@ Otherwise they are removed from the channel." " Created.\n"))) (unless (eq major-mode 'liece-channel-mode) (liece-channel-mode)) - (set-alist 'liece-channel-buffer-alist ,chnl (current-buffer)) + (set-alist 'liece-channel-buffer-alist chnl (current-buffer)) (current-buffer))) (defun liece-channel-join-internal (item chnls &optional hints) @@ -345,6 +341,12 @@ If NOSW is non-nil do not switch to newly created channel." liece-nick-buffer nbuf)) (liece-channel-change))) +(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-part-internal (item chnls &optional hints) (if hints (mapcar @@ -373,12 +375,6 @@ If NOSW is non-nil do not switch to newly created channel." (defun liece-channel-last (chnls) (car (last (delq nil (copy-sequence 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-change () (let ((chnls (if (eq liece-command-buffer-mode 'chat) liece-current-chat-partners diff --git a/lisp/liece-ctcp.el b/lisp/liece-ctcp.el index b8da665..01c7770 100644 --- a/lisp/liece-ctcp.el +++ b/lisp/liece-ctcp.el @@ -30,6 +30,7 @@ ;;; Code: (eval-when-compile (require 'liece-inlines)) +(eval-when-compile (require 'liece-misc)) (require 'liece-handler) diff --git a/lisp/liece-dcc.el b/lisp/liece-dcc.el index ff384ba..b259462 100644 --- a/lisp/liece-dcc.el +++ b/lisp/liece-dcc.el @@ -32,7 +32,8 @@ (eval-when-compile (require 'liece-intl) (require 'liece-inlines) - (require 'liece-channel)) + (require 'liece-channel) + (require 'liece-misc)) (eval-when-compile (require 'queue-m)) diff --git a/lisp/liece-emacs.el b/lisp/liece-emacs.el index b6951a3..e883650 100644 --- a/lisp/liece-emacs.el +++ b/lisp/liece-emacs.el @@ -30,7 +30,8 @@ (eval-when-compile (require 'liece-compat) - (require 'liece-vars)) + (require 'liece-vars) + (require 'liece-misc)) (eval-when-compile (require 'cl)) (eval-when-compile (ignore-errors (require 'image))) diff --git a/lisp/liece-make.el b/lisp/liece-make.el index 2b56ef3..2a69ced 100644 --- a/lisp/liece-make.el +++ b/lisp/liece-make.el @@ -126,9 +126,14 @@ (princ (format "Wrote %s\n" (expand-file-name "custom-load.elc" dir)))) (t - (setq autoload-package-name package) - (add-to-list 'command-line-args-left dir) - (batch-update-directory) + (if (fboundp 'batch-update-directory-autoloads) + (progn + (setq command-line-args-left + (cons package (cons dir command-line-args-left))) + (batch-update-directory-autoloads)) + (setq autoload-package-name package) + (add-to-list 'command-line-args-left dir) + (batch-update-directory)) (add-to-list 'command-line-args-left dir) (Custom-make-dependencies) diff --git a/lisp/liece-message.el b/lisp/liece-message.el index de35c33..88501a9 100644 --- a/lisp/liece-message.el +++ b/lisp/liece-message.el @@ -28,6 +28,8 @@ ;;; Code: +(eval-when-compile (require 'liece-misc)) + (defgroup liece-message nil "Messages" :tag "Message" diff --git a/lisp/liece-misc.el b/lisp/liece-misc.el index d69f011..2acdd6e 100644 --- a/lisp/liece-misc.el +++ b/lisp/liece-misc.el @@ -37,6 +37,33 @@ (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))) + (defun liece-toggle-command-buffer-mode (&optional mode) "Toggle command buffer MODE." (let ((mode @@ -117,8 +144,8 @@ liece-freeze-indicator (if liece-freeze "F" "-")) (force-mode-line-update))) -(defmacro liece-frozen (buffer) - (list 'with-current-buffer buffer 'liece-freeze)) +(defun liece-frozen (buffer) + (with-current-buffer buffer liece-freeze)) (defun liece-own-freeze (buffer &optional arg) (with-current-buffer buffer @@ -126,8 +153,8 @@ liece-own-freeze-indicator (if liece-own-freeze "M" "-")) (force-mode-line-update))) -(defmacro liece-own-frozen (buffer) - (list 'with-current-buffer buffer 'liece-own-freeze)) +(defun liece-own-frozen (buffer) + (with-current-buffer buffer liece-own-freeze)) (defun liece-ignore-this-p (nick user-at-host) ;; Remove entries which are expired. @@ -182,38 +209,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) @@ -228,6 +223,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) @@ -355,24 +373,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))) @@ -461,20 +461,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)) @@ -494,6 +480,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 bcf82c3..538dc77 100644 --- a/lisp/liece-nick.el +++ b/lisp/liece-nick.el @@ -29,11 +29,14 @@ ;;; Code: +(eval-when-compile (require 'liece-inlines)) + (require 'liece-hilit) (defalias 'liece-nick-set-operator 'liece-channel-set-operator) (defalias 'liece-nick-set-voice 'liece-channel-set-voice) -(defalias 'liece-nick-equal 'string-equal-ignore-case) +(defun liece-nick-equal (n1 n2) + (string-equal-ignore-case n1 n2)) (defun liece-nick-member (nick nicks) "Return non-nil if NICK is member of NICKS." @@ -185,12 +188,12 @@ Otherwise they are removed from the user." (setq liece-nick-buffer-mode (not liece-nick-buffer-mode))) (liece-configure-windows)) -(defmacro liece-nick-buffer-create (chnl) - `(with-current-buffer - (liece-get-buffer-create (format liece-nick-buffer-format ,chnl)) +(defun liece-nick-buffer-create (chnl) + (with-current-buffer + (liece-get-buffer-create (format liece-nick-buffer-format chnl)) (unless (eq major-mode 'liece-nick-mode) (liece-nick-mode)) - (set-alist 'liece-nick-buffer-alist ,chnl (current-buffer)) + (set-alist 'liece-nick-buffer-alist chnl (current-buffer)) (current-buffer))) (defun liece-change-nick-of-1 (old new nicks)