* liece-make.el (make-liece-sample-files): Abolish.
authorueno <ueno>
Sun, 17 Sep 2000 14:05:27 +0000 (14:05 +0000)
committerueno <ueno>
Sun, 17 Sep 2000 14:05:27 +0000 (14:05 +0000)
(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.

lisp/ChangeLog
lisp/liece-channel.el
lisp/liece-ctcp.el
lisp/liece-filter.el
lisp/liece-handle.el
lisp/liece-hilit.el
lisp/liece-make.el
lisp/liece-menu.el
lisp/liece-url.el
lisp/liece.el

index fd7d285..a38c9b9 100644 (file)
@@ -1,3 +1,26 @@
+2000-09-17   Daiki Ueno  <ueno@unixuser.org>
+
+       * 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  <ueno@unixuser.org>
 
        * liece-vars.el (liece-inhibit-startup-message): New user option.
index c11ca08..1bfe07b 100644 (file)
   "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 ""))))
 
 (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)))
 
 (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)))
 
 (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)))
 
index ec97b2b..1a0b605 100644 (file)
          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
       (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)
          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
       (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)
             (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
index 0cca753..fa5ef6f 100644 (file)
   (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
index 78a2c16..06a07e5 100644 (file)
     (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.
 (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
index b9ed847..b29e892 100644 (file)
              '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 ()
index 3030daa..b96100c 100644 (file)
             (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
index dc80af4..06875c5 100644 (file)
          (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
index a0e2033..d7d3abe 100644 (file)
@@ -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
index 7fc1eee..81bbe9e 100644 (file)
@@ -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)))))