From: ueno Date: Sun, 17 Sep 2000 14:05:27 +0000 (+0000) Subject: * liece-make.el (make-liece-sample-files): Abolish. X-Git-Tag: liece-1_4_4-1~8 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=f9196743e57981afb207fae1ab42b7d274f9c3ba;p=elisp%2Fliece.git * liece-make.el (make-liece-sample-files): Abolish. (make-liece-info-files): Abolish. * liece-url.el (liece-add-url-functions): Rename from `liece-url-add-hook'. * liece.el (liece-after-insert-functions): Rename from `liece-insert-hook'. (liece-before-insert-functions): Rename from `liece-before-insert-hook'. * liece-handle.el (liece-notice-cleartext-hook): Abolish. (liece-privmsg-cleartext-hook): Abolish. * liece-filter.el (liece-handle-message): Simplify. * liece-ctcp.el (liece-ctcp-message): Don't ignore errors in hooks. (liece-ctcp-notice): Ditto. (liece-ctcp-file-notice): Ditto. * liece-channel.el (liece-channel-add-mode): Don't use pushnew. (liece-channel-add-exception): Ditto. (liece-channel-add-invite): Ditto. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index fd7d285..a38c9b9 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,26 @@ +2000-09-17 Daiki Ueno + + * liece-make.el (make-liece-sample-files): Abolish. + (make-liece-info-files): Abolish. + + * liece-url.el (liece-add-url-functions): Rename from `liece-url-add-hook'. + + * liece.el (liece-after-insert-functions): Rename from `liece-insert-hook'. + (liece-before-insert-functions): Rename from `liece-before-insert-hook'. + + * liece-handle.el (liece-notice-cleartext-hook): Abolish. + (liece-privmsg-cleartext-hook): Abolish. + + * liece-filter.el (liece-handle-message): Simplify. + + * liece-ctcp.el (liece-ctcp-message): Don't ignore errors in hooks. + (liece-ctcp-notice): Ditto. + (liece-ctcp-file-notice): Ditto. + + * liece-channel.el (liece-channel-add-mode): Don't use pushnew. + (liece-channel-add-exception): Ditto. + (liece-channel-add-invite): Ditto. + 2000-09-12 Daiki Ueno * liece-vars.el (liece-inhibit-startup-message): New user option. diff --git a/lisp/liece-channel.el b/lisp/liece-channel.el index c11ca08..1bfe07b 100644 --- a/lisp/liece-channel.el +++ b/lisp/liece-channel.el @@ -139,7 +139,8 @@ "Add MODE as char to CHNL." `(let ((modes (string-to-char-list (or (liece-channel-get-modes ,chnl) "")))) - (pushnew ,mode modes) + (or (memq ,mode modes) + (push ,mode modes)) (put (intern (or ,chnl liece-current-channel) liece-obarray) 'mode (mapconcat #'char-to-string modes "")))) @@ -160,7 +161,8 @@ (defmacro liece-channel-add-ban (pattern &optional chnl) "Add ban PATTERN as char to CHNL." `(let ((patterns (liece-channel-get-bans ,chnl))) - (add-to-list 'patterns ,pattern) + (or (string-list-member-ignore-case ,pattern patterns) + (push ,pattern patterns)) (put (intern (or ,chnl liece-current-channel) liece-obarray) 'ban patterns))) @@ -180,7 +182,8 @@ (defmacro liece-channel-add-exception (pattern &optional chnl) "Add exception PATTERN as char to CHNL." `(let ((patterns (liece-channel-get-exceptions ,chnl))) - (pushnew ,pattern patterns) + (or (string-list-member-ignore-case ,pattern patterns) + (push ,pattern patterns)) (put (intern (or ,chnl liece-current-channel) liece-obarray) 'exception patterns))) @@ -200,7 +203,8 @@ (defmacro liece-channel-add-invite (pattern &optional chnl) "Add invite PATTERN as char to CHNL." `(let ((patterns (liece-channel-get-invites ,chnl))) - (pushnew ,pattern patterns) + (or (string-list-member-ignore-case ,pattern patterns) + (push ,pattern patterns)) (put (intern (or ,chnl liece-current-channel) liece-obarray) 'invite patterns))) diff --git a/lisp/liece-ctcp.el b/lisp/liece-ctcp.el index ec97b2b..1a0b605 100644 --- a/lisp/liece-ctcp.el +++ b/lisp/liece-ctcp.el @@ -133,9 +133,7 @@ after-hook (intern-soft (concat "liece-after-ctcp-" message "-hook"))) - (if (condition-case nil - (run-hook-with-args-until-success hook from chnl data) - (error nil)) + (if (run-hook-with-args-until-success hook from chnl data) (return-from liece-ctcp-message rest)) (let ((func (liece-handler-find-function @@ -143,7 +141,7 @@ (if func (funcall func from chnl data) (liece-ctcp-messages message from chnl data)) - (ignore-errors (run-hook-with-args after-hook from chnl data))) + (run-hook-with-args after-hook from chnl data)) rest)) (defun liece-ctcp-messages (message from chnl rest) @@ -281,9 +279,7 @@ after-hook (intern-soft (concat "liece-after-ctcp-" message "-notice-hook"))) - (if (condition-case nil - (run-hook-with-args-until-success hook prefix data) - (error nil)) + (if (run-hook-with-args-until-success hook prefix data) (return-from liece-ctcp-notice rest)) (let ((func (liece-handler-find-function @@ -291,7 +287,7 @@ (if func (funcall func prefix data) (liece-ctcp-notices message prefix data))) - (ignore-errors (run-hook-with-args after-hook prefix data)) + (run-hook-with-args after-hook prefix data) rest)) (defun liece-ctcp-notices (message prefix rest) @@ -322,16 +318,14 @@ (intern-soft (concat "liece-after-file-" message "-hook"))) func) - (if (condition-case nil - (run-hook-with-args-until-success hook prefix name) - (error nil)) + (if (run-hook-with-args-until-success hook prefix name) (return-from liece-ctcp-file-notice)) (setq func (liece-handler-find-function message '(prefix name data) 'ctcp-file)) (if func (funcall func prefix name data) (liece-file-notices message prefix name data)) - (ignore-errors (run-hook-with-args after-hook prefix name)))))) + (run-hook-with-args after-hook prefix name))))) (defun liece-file-notices (message prefix name data) (liece-message diff --git a/lisp/liece-filter.el b/lisp/liece-filter.el index 0cca753..fa5ef6f 100644 --- a/lisp/liece-filter.el +++ b/lisp/liece-filter.el @@ -40,33 +40,22 @@ (let ((hook (intern (concat "liece-" message "-hook"))) (after-hook (intern (concat "liece-after-" message "-hook"))) (number (car (read-from-string message))) - func) - (if (condition-case nil - (run-hook-with-args-until-success hook prefix line) - (error nil)) + function) + (if (run-hook-with-args-until-success hook prefix line) (return-from liece-handle-message)) - - (cond - ((numberp number) - (let* ((base (/ number 100)) - (backend (format "liece-%d00" base))) - (or (eval `(featurep ',(intern backend))) - (load backend t)) - (setq func (liece-handler-find-function message '(prefix line) - (format "%d00" base))) - (if func - (funcall func prefix line) - (funcall (symbol-function (intern - (format "liece-handle-%d00-messages" - base))) - message prefix line)))) - (t - (setq func (liece-handler-find-function - message '(prefix line) "generic")) - (if func - (funcall func prefix line)))) - - (ignore-errors (run-hook-with-args after-hook prefix line)))) + (if (not (numberp number)) + (setq function (liece-handler-find-function message '(prefix line) "generic")) + (let ((base (format "%03d" (- number (mod number 100))))) + (require (intern (concat "liece-" base)) nil 'noerror) + (setq function (liece-handler-find-function message '(prefix line) base)) + (or function + (setq function + (let ((default (concat "liece-handle-" base "-messages"))) + `(lambda (prefix line) + (funcall (intern ,default) ,message prefix line))))))) + (if function + (funcall function prefix line)) + (run-hook-with-args after-hook prefix line))) (defun liece-parse-user-at-host () (let ((cookie diff --git a/lisp/liece-handle.el b/lisp/liece-handle.el index 78a2c16..06a07e5 100644 --- a/lisp/liece-handle.el +++ b/lisp/liece-handle.el @@ -116,10 +116,6 @@ (liece-insert-notice (append liece-D-buffer liece-O-buffer) (concat (substring rest (match-end 0)) "\n")) (return-from liece-handle-notice-message)) - (if (run-hook-with-args-until-success 'liece-notice-cleartext-hook - prefix rest) - (return-from liece-handle-notice-message)) - (multiple-value-bind (chnl temp) (liece-split-line rest) ;; This is a ctcp reply but contains additional messages ;; at the left or/and right side. @@ -138,10 +134,6 @@ (defun* liece-handle-privmsg-message (prefix rest) (if (liece-handle-message-check-ignored prefix rest) (return-from liece-handle-privmsg-message)) - (if (run-hook-with-args-until-success 'liece-privmsg-cleartext-hook - prefix rest) - (return-from liece-handle-privmsg-message)) - (multiple-value-bind (chnl temp) (liece-split-line rest) (setq temp (or temp "")) ;; This is a ctcp request but contains additional messages diff --git a/lisp/liece-hilit.el b/lisp/liece-hilit.el index b9ed847..b29e892 100644 --- a/lisp/liece-hilit.el +++ b/lisp/liece-hilit.el @@ -368,9 +368,9 @@ 'liece-highlight-turn-on-font-lock) (add-hook 'liece-dialogue-mode-hook 'liece-highlight-turn-on-font-lock) - (add-hook 'liece-insert-hook 'liece-url-add-buttons) - (add-hook 'liece-insert-hook 'liece-channel-add-buttons) - ;;(add-hook 'liece-insert-hook 'liece-nick-add-buttons) + (add-hook 'liece-after-insert-functions 'liece-url-add-buttons) + (add-hook 'liece-after-insert-functions 'liece-channel-add-buttons) + ;;(add-hook 'liece-after-insert-functions 'liece-nick-add-buttons) )) (defun liece-highlight-turn-on-font-lock () diff --git a/lisp/liece-make.el b/lisp/liece-make.el index 3030daa..b96100c 100644 --- a/lisp/liece-make.el +++ b/lisp/liece-make.el @@ -197,35 +197,6 @@ (file-name-sans-extension generated-autoload-file))) (save-buffer))) -;; Generate documents and startup samples. -(defun make-liece-info-files () - (let ((file (car command-line-args-left))) - (when (and file (file-exists-p file)) - (if (fboundp 'set-language-environment) - (set-language-environment "Japanese")) - (find-file file) - (texinfo-every-node-update) - (texinfo-format-buffer) - (save-buffer)))) - -(defun make-liece-sample-files () - (let* ((file (pop command-line-args-left)) - (dcc-path (pop command-line-args-left)) - (icon-directory (pop command-line-args-left)) - (catalogue-directory (pop command-line-args-left)) - (styles-directory (pop command-line-args-left))) - (when (and file (file-exists-p file)) - (find-file file) - (goto-char (point-min)) - (replace-string "@DCCPATH@" dcc-path) - (goto-char (point-min)) - (replace-string "@ICONDIR@" icon-directory) - (goto-char (point-min)) - (replace-string "@CATALOGDIR@" catalogue-directory)) - (goto-char (point-min)) - (replace-string "@STYLEDIR@" styles-directory) - (save-buffer))) - (provide 'liece-make) ;;; liece-make.el ends here diff --git a/lisp/liece-menu.el b/lisp/liece-menu.el index dc80af4..06875c5 100644 --- a/lisp/liece-menu.el +++ b/lisp/liece-menu.el @@ -211,7 +211,7 @@ (featurep 'menu-bar)) (add-hook 'liece-command-mode-hook 'liece-command-define-menus) (add-hook 'liece-command-mode-hook 'liece-command-add-menus 'append) - (add-hook 'liece-url-add-hook 'liece-menu-add-url)) + (add-hook 'liece-add-url-functions 'liece-menu-add-url)) (defun liece-menu-define (menu) (eval (list 'easy-menu-define diff --git a/lisp/liece-url.el b/lisp/liece-url.el index a0e2033..d7d3abe 100644 --- a/lisp/liece-url.el +++ b/lisp/liece-url.el @@ -63,7 +63,7 @@ (let ((browse-url-browser-function liece-url-browser-function)) (browse-url (widget-value widget)))) -(defvar liece-url-add-hook nil) +(defvar liece-add-url-functions nil) (defun liece-url-add-buttons (start end) (save-excursion @@ -75,7 +75,7 @@ 'url-link (match-beginning 0)(match-end 0) url)) (unless (assoc url liece-url-alist) (push (list url) liece-url-alist) - (run-hook-with-args 'liece-url-add-hook url)))))) + (run-hook-with-args 'liece-add-url-functions url)))))) (defun liece-command-browse-url (&optional url) (interactive diff --git a/lisp/liece.el b/lisp/liece.el index 7fc1eee..81bbe9e 100644 --- a/lisp/liece.el +++ b/lisp/liece.el @@ -930,7 +930,7 @@ If such a buffer is found, shrink it." (defun liece-check-buffers-if-interval-expired () "Timer handler for `liece-check-buffers'. -Only used from `liece-before-insert-hook'." +Only used from `liece-before-insert-functions'." (and (> liece-buffer-check-interval 0) (or (null liece-buffer-last-check-time) (> (liece-time-difference liece-buffer-last-check-time @@ -963,7 +963,7 @@ Only used from `liece-before-insert-hook'." (goto-char ,liece-save-point) (set-marker ,liece-save-point nil))))) -(defvar liece-before-insert-hook +(defvar liece-before-insert-functions '(liece-check-buffers-if-interval-expired liece-command-timestamp-if-interval-expired)) @@ -971,7 +971,7 @@ Only used from `liece-before-insert-hook'." "Helper function only used from `liece-insert'. Insert before point of BUFFER STRING with decorating." - (run-hooks 'liece-before-insert-hook) + (run-hooks 'liece-before-insert-functions) (with-current-buffer (liece-get-buffer-create buffer) (or (eq (derived-mode-class major-mode) 'liece-dialogue-mode) (liece-dialogue-mode)) @@ -983,7 +983,7 @@ Insert before point of BUFFER STRING with decorating." (and liece-display-time (not (string-equal string "")) (liece-insert-time-string)) (insert string) - (run-hook-with-args 'liece-insert-hook from (point))))) + (run-hook-with-args 'liece-after-insert-functions from (point))))) (unless (liece-frozen (current-buffer)) (liece-refresh-buffer-window (current-buffer)))))