From 80a77181a6d052524422dbc7e72771317b31176d Mon Sep 17 00:00:00 2001 From: ueno Date: Mon, 26 Aug 2002 07:50:27 +0000 Subject: [PATCH] Synch up with liece-1_4. --- lisp/ChangeLog | 36 ++++++++++++++++++++++ lisp/Makefile.lisp | 2 +- lisp/liece-commands.el | 2 +- lisp/liece-compat.el | 4 --- lisp/liece-config.el | 2 +- lisp/liece-handle.el | 77 ++++++++++++++++++++++++++---------------------- lisp/liece-inlines.el | 24 ++++++--------- lisp/liece-make.el | 4 +-- lisp/liece-menu.el | 7 +++-- lisp/liece-xemacs.el | 9 ------ lisp/liece.el | 3 +- 11 files changed, 96 insertions(+), 74 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 2ea63d6..5ccde7a 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,13 @@ +2002-08-26 Daiki Ueno + + * liece-handle.el (liece-handle-mode-message): Care + liece-channel-set-* are defined as macros. + * liece-inlines.el (string-equal-ignore-case): Don't use + compare-strings. + (string-list-member-ignore-case): Don't use member-ignore-case. + Suggested by "Akinori MUSHA" . + [cf. ] + 2002-08-11 OHASHI Akira * liece-window.el (liece-configure-windows): Set @@ -17,10 +27,36 @@ function is the slightly modified version of the implementation by akira yamada . [cf. ] +2002-07-13 Daiki Ueno + + * liece-menu.el (liece-menu-add-url): Always switch to *Commands* + buffer. + * liece-xemacs.el (liece-fix-menu-path-switch-buffer): Removed old + defadvice to easy-menu-add-item. + +2002-06-08 Adrian Aichner + + * liece-commands.el (liece-command-nickname): Use + truncate-string-to-width instead of non-existent truncate-string. + * liece.el (liece-open-server): Ditto. + +2002-06-05 Steve Youngs + + * liece-inlines.el (string-equal-ignore-case): Don't try to use + 'compare-strings'. + 2002-05-19 Daiki Ueno * liece-xemacs.el (liece-xemacs-modeline-glyph): Check 'xbm. +2002-05-04 Stephen J. Turnbull + + * liece-make.el (config-liece-package-directory): + * liece-config.el (PACKAGEDIR): + Handle case when dirs is nil. + + * Makefile.lisp (package): Preload advice. + 2002-05-12 Daiki Ueno * gettext.el (gettext-default-locale): New variable. diff --git a/lisp/Makefile.lisp b/lisp/Makefile.lisp index cffea34..5372840 100644 --- a/lisp/Makefile.lisp +++ b/lisp/Makefile.lisp @@ -27,7 +27,7 @@ install: elc package: $(XEMACS) $(FLAGS) -l ./liece-make.el -f autoload-liece \ $(PREFIX) $(LISPDIR) - $(XEMACS) $(FLAGS) -l ./liece-make.el -f compile-liece-package \ + $(XEMACS) $(FLAGS) -l ./liece-make.el -l advice -f compile-liece-package \ $(PACKAGEDIR) install-package: package diff --git a/lisp/liece-commands.el b/lisp/liece-commands.el index d96065e..d85c11f 100644 --- a/lisp/liece-commands.el +++ b/lisp/liece-commands.el @@ -597,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 (liece-truncate-string-to-width nick liece-nick-max-length))) + (let ((nickname (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)))) diff --git a/lisp/liece-compat.el b/lisp/liece-compat.el index 848921a..3ee1199 100644 --- a/lisp/liece-compat.el +++ b/lisp/liece-compat.el @@ -99,10 +99,6 @@ 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-config.el b/lisp/liece-config.el index 336a2e3..13f1995 100644 --- a/lisp/liece-config.el +++ b/lisp/liece-config.el @@ -85,7 +85,7 @@ (if last-package-load-path last-packages))) dir) - (while (not (file-exists-p (setq dir (car dirs)))) + (while (and dirs (not (file-exists-p (setq dir (car dirs))))) (setq dirs (cdr dirs)) ) dir ))) diff --git a/lisp/liece-handle.el b/lisp/liece-handle.el index 520dd72..0befca6 100644 --- a/lisp/liece-handle.el +++ b/lisp/liece-handle.el @@ -265,38 +265,43 @@ (defun* liece-handle-mode-message (prefix rest) (if (liece-handle-check-changes-ignored) (return-from liece-handle-mode-message)) - (let ((chnl " ") (str "") mflag mflags marg margs val md chnlp) - (or (and (string-match "\\([^ ]*\\) +:?" rest) - (setq chnl (match-string 1 rest) - str (substring rest (match-end 0)) - chnlp (liece-channel-p chnl) - str (if (= (aref str (1- (length str))) ? ) - (substring str 0 -1) str) - chnl (liece-channel-virtual chnl))) - (and (string-match " +:" rest) - (setq str (substring rest (match-end 0)))) - (return-from liece-handle-mode-message)) - + (let (mflgs margs val chnl mode chnlp) + (if (string-match "\\([^ ]*\\) *:?" rest) + (progn + (setq chnl (match-string 1 rest) + mode (substring rest (match-end 0))) + (if (liece-channel-p chnl) + (setq chnl (liece-channel-virtual chnl) chnlp t)) + (if (string-match " *$" mode) + (setq mode (substring mode 0 (match-beginning 0))))) + (return-from liece-handle-mode-message)) ;; parse modes - (when (string-match "\\([^ ]*\\) +" str) - (setq mflag (match-string 1 str) - marg (substring str (match-end 0)) - mflags (liece-string-to-list mflag)) - (while (string-match "^\\([^ ]*\\) +" marg) - (setq margs (cons (match-string 1 marg) margs) - marg (substring marg (match-end 0)))) - (or (string= marg "") (setq margs (cons marg margs))) - (while (setq md (pop mflags)) - (cond ((eq ?- md) (setq val nil)) - ((eq ?+ md) (setq val t)) - ((eq ?o md) (liece-channel-set-operator chnl (pop margs) val)) - ((eq ?v md) (liece-channel-set-voice chnl (pop margs) val)) - ((eq ?b md) (liece-channel-set-ban chnl (pop margs) val)) - ((eq ?e md) (liece-channel-set-exception chnl (pop margs) val)) - ((eq ?I md) (liece-channel-set-invite chnl (pop margs) val)) - (chnlp (liece-channel-set-mode val md chnl)) - (t (liece-nick-set-mode val md chnl))))) - + (when (string-match "\\([^ ]*\\) *" mode) + (setq mflgs (liece-string-to-list (match-string 1 mode)) + margs (delete "" (split-string + (substring mode (match-end 0)) + "[ ]+"))) + (while mflgs + (cond ((eq ?- (car mflgs)) (setq val nil)) + ((eq ?+ (car mflgs)) (setq val t)) + ((eq ?o (car mflgs)) + (liece-channel-set-operator chnl (car margs) val) + (setq margs (cdr margs))) + ((eq ?v (car mflgs)) + (liece-channel-set-voice chnl (car margs) val) + (setq margs (cdr margs))) + ((eq ?b (car mflgs)) + (liece-channel-set-ban chnl (car margs) val) + (setq margs (cdr margs))) + ((eq ?e (car mflgs)) + (liece-channel-set-exception chnl (car margs) val) + (setq margs (cdr margs))) + ((eq ?I (car mflgs)) + (liece-channel-set-invite chnl (car margs) val) + (setq margs (cdr margs))) + (chnlp (liece-channel-set-mode val (car mflgs) chnl)) + (t (liece-nick-set-mode val (car mflgs) chnl))) + (setq mflgs (cdr mflgs)))) (liece-set-channel-indicator) (cond (liece-compress-changes @@ -307,26 +312,26 @@ (regexp-quote liece-change-prefix) (regexp-quote chnl) (regexp-quote prefix))) (default (format (_ "%sNew mode for %s set by %s: %s\n") - liece-change-prefix chnl prefix str))) + liece-change-prefix chnl prefix mode))) (liece-replace (liece-pick-buffer chnl) - match default text (concat ", " str "\n")) + match default text (concat ", " mode "\n")) (liece-replace (if (and liece-current-channel (liece-channel-equal chnl liece-current-channel)) liece-D-buffer (append liece-D-buffer liece-O-buffer)) - match default text (concat ", " str "\n")))) + match default text (concat ", " mode "\n")))) (t (liece-insert-change (liece-pick-buffer chnl) (format (_ "New mode for %s set by %s: %s\n") - chnl prefix str)) + chnl prefix mode)) (liece-insert-change (if (and liece-current-channel (liece-channel-equal chnl liece-current-channel)) liece-D-buffer (append liece-D-buffer liece-O-buffer)) (format (_ "New mode for %s set by %s: %s\n") - chnl prefix str)))))) + chnl prefix mode)))))) (defun* liece-handle-kick-message (prefix rest) (if (/= 3 (length (setq rest (liece-split-line rest)))) diff --git a/lisp/liece-inlines.el b/lisp/liece-inlines.el index e8a283e..416d24c 100644 --- a/lisp/liece-inlines.el +++ b/lisp/liece-inlines.el @@ -44,21 +44,15 @@ (defmacro string-join (strlst &optional del) `(mapconcat #'identity ,strlst ,del)) -(static-if (subr-fboundp 'compare-strings) - (defmacro string-equal-ignore-case (s1 s2) - `(eq t (compare-strings ,s1 0 nil ,s2 0 nil 'ignore-case))) - (defmacro string-equal-ignore-case (s1 s2) - `(string-equal (upcase ,s1) (upcase ,s2)))) - -(static-if (fboundp 'member-ignore-case) - (defalias 'string-list-member-ignore-case - 'member-ignore-case) - (defsubst string-list-member-ignore-case (thing list) - "Returns t if thing is member of list, not funcallable" - (member-if - (lambda (item) - (and (stringp item) (string-equal-ignore-case thing item))) - list))) +(defmacro string-equal-ignore-case (s1 s2) + `(string-equal (upcase ,s1) (upcase ,s2))) + +(defsubst string-list-member-ignore-case (thing list) + "Returns t if thing is member of list, not funcallable" + (member-if + (lambda (item) + (and (stringp item) (string-equal-ignore-case thing item))) + list)) (defsubst string-list-remove-ignore-case (thing list) (let ((element (string-list-member-ignore-case thing list))) diff --git a/lisp/liece-make.el b/lisp/liece-make.el index b96100c..2b56ef3 100644 --- a/lisp/liece-make.el +++ b/lisp/liece-make.el @@ -145,8 +145,8 @@ (if last-package-load-path last-packages))) dir) - (while (not (file-exists-p - (setq dir (car dirs)))) + (while (and dirs (not (file-exists-p + (setq dir (car dirs))))) (setq dirs (cdr dirs))) (defvar PACKAGEDIR dir) (princ (format "PACKAGEDIR=%s\n" PACKAGEDIR))))) diff --git a/lisp/liece-menu.el b/lisp/liece-menu.el index 20e769d..99a6128 100644 --- a/lisp/liece-menu.el +++ b/lisp/liece-menu.el @@ -246,9 +246,10 @@ (defun liece-menu-add-url (url) (when (boundp 'liece-menu-url-menu-map) - (easy-menu-add-item - liece-menu-url-menu-map nil - (vector url (list 'liece-command-browse-url url) t)))) + (with-current-buffer liece-command-buffer + (easy-menu-add-item + nil (list (car liece-menu-url-menu)) + (vector url (list 'liece-command-browse-url url) t))))) ;;; @ menu callbacks ;;; diff --git a/lisp/liece-xemacs.el b/lisp/liece-xemacs.el index e041e01..8e840d3 100644 --- a/lisp/liece-xemacs.el +++ b/lisp/liece-xemacs.el @@ -423,15 +423,6 @@ Always two arguments are passed, OBJECT and NICK." (let ((filename (match-string 1 (cdr object)))) (liece-command-dcc-send filename nick)))) -(defadvice easy-menu-add-item - (around liece-fix-menu-path-switch-buffer activate) - "Advice for XEmacs 20.4 or earlier." - (save-excursion - (set-buffer liece-command-buffer) - (add-menu-button - (cons (car (ad-get-arg 0)) (ad-get-arg 1)) - (ad-get-arg 2) (ad-get-arg 3)))) - (eval-and-compile (setq liece-x-face-insert-function (function liece-x-face-insert-with-xemacs)) diff --git a/lisp/liece.el b/lisp/liece.el index edff59c..e7f1818 100644 --- a/lisp/liece.el +++ b/lisp/liece.el @@ -462,8 +462,7 @@ 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 - (liece-truncate-string-to-width liece-nickname - liece-nick-max-length))) + (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)))) -- 1.7.10.4