(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-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.
"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)))
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
(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
(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
'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 ()
(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
(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
(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
'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
(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
(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))
"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))
(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)))))