From 8fa702447df025aa9b4d98da9082f0764ba40cc5 Mon Sep 17 00:00:00 2001 From: ueno Date: Sat, 6 Mar 2004 12:59:27 +0000 Subject: [PATCH] * riece-xface.el (riece-xface-insinuate): Set 'riece-update-buffer-functions local to the user-list buffer. * riece-unread.el: Require 'riece-signal instead of 'riece-display. (riece-unread-after-display-message-function): Emit 'riece-update-buffer signal instead of 'riece-unread-channel-list-update signal. * riece-ndcc.el: Don't require 'riece-display. * riece-naming.el: Require 'riece-signal instead of 'riece-display. (riece-naming-assert-rename): Don't rename buffer. * riece-history.el (riece-history-format-channel-list-line): Don't append "\n". * riece-handle.el: Require 'riece-signal instead of 'riece-display. (riece-parse-modes): Rename from riece-parse-channel-modes; don't update channel modes. (riece-handle-channel-modes): New function which processes the result of riece-parse-modes. (riece-handle-mode-message): Use it. * riece-filter.el: Don't require 'riece-display. * riece-display.el: Require 'riece-signal; connect 'riece-update-buffer signal. * riece-ctcp.el: Don't require 'riece-display. * riece-signal.el: New module splitted from riece-display.el. * Makefile.am (EXTRA_DIST): Add riece-signal. * COMPILE (riece-modules): Add riece-signal. --- lisp/COMPILE | 2 + lisp/Makefile.am | 4 +- lisp/riece-ctcp.el | 1 - lisp/riece-display.el | 145 +++++++++++++------------------------------------ lisp/riece-filter.el | 1 - lisp/riece-handle.el | 92 ++++++++++++++++--------------- lisp/riece-history.el | 3 +- lisp/riece-naming.el | 20 ++----- lisp/riece-ndcc.el | 1 - lisp/riece-signal.el | 109 +++++++++++++++++++++++++++++++++++++ lisp/riece-unread.el | 13 ++--- lisp/riece-xface.el | 43 ++++++++------- 12 files changed, 229 insertions(+), 205 deletions(-) create mode 100644 lisp/riece-signal.el diff --git a/lisp/COMPILE b/lisp/COMPILE index f9abd24..de49d00 100644 --- a/lisp/COMPILE +++ b/lisp/COMPILE @@ -18,6 +18,8 @@ riece-user riece-misc + riece-signal + ;; riece-layout ---> riece-display riece-layout riece-display diff --git a/lisp/Makefile.am b/lisp/Makefile.am index b0ced27..108ec38 100644 --- a/lisp/Makefile.am +++ b/lisp/Makefile.am @@ -4,8 +4,8 @@ EXTRA_DIST = COMPILE ChangeLog ChangeLog.Liece \ riece-complete.el riece-display.el riece-emacs.el riece-filter.el \ riece-globals.el riece-handle.el riece-highlight.el riece-identity.el \ riece-message.el riece-misc.el riece-naming.el \ - riece-options.el riece-server.el riece-user.el riece-version.el \ - riece-xemacs.el riece.el \ + riece-options.el riece-server.el riece-signal.el riece-user.el \ + riece-version.el riece-xemacs.el riece.el \ riece-ctcp.el riece-url.el riece-unread.el \ riece-ndcc.el riece-rdcc.el riece-log.el riece-mini.el \ riece-doctor.el riece-alias.el riece-layout.el riece-skk-kakutei.el \ diff --git a/lisp/riece-ctcp.el b/lisp/riece-ctcp.el index 8baad1d..37061bc 100644 --- a/lisp/riece-ctcp.el +++ b/lisp/riece-ctcp.el @@ -26,7 +26,6 @@ (require 'riece-version) (require 'riece-misc) -(require 'riece-display) (require 'riece-highlight) (defface riece-ctcp-action-face diff --git a/lisp/riece-display.el b/lisp/riece-display.el index f07e405..b4f2ecf 100644 --- a/lisp/riece-display.el +++ b/lisp/riece-display.el @@ -28,6 +28,7 @@ (require 'riece-channel) (require 'riece-misc) (require 'riece-layout) +(require 'riece-signal) (defvar riece-channel-buffer-format "*Channel:%s*" "Format of channel message buffer.") @@ -45,110 +46,33 @@ Local to the buffer in `riece-buffer-list'.") riece-update-channel-list-indicator) "Functions to update modeline indicators.") -;;; Qt like "signal-slot" abstraction for routing display events. -(defvar riece-signal-slot-obarray - (make-vector 31 0)) - -(defun riece-make-slot (function &optional filter handback) - "Make an instance of slot object. -Arguments are corresponding to callback function, filter function, and -a handback object, respectively. -This function is for internal use only." - (vector function filter handback)) - -(defun riece-slot-function (slot) - "Return the callback function of SLOT. -This function is for internal use only." - (aref slot 0)) - -(defun riece-slot-filter (slot) - "Return the filter function of SLOT. -This function is for internal use only." - (aref slot 1)) - -(defun riece-slot-handback (slot) - "Return the handback object of SLOT. -This function is for internal use only." - (aref slot 2)) - -(defun riece-make-signal (name args) - "Make an instance of signal object. -The 1st arguments is the name of the signal and the rest of arguments -are the data of the signal. -This function is for internal use only." - (vector name args)) - -(defun riece-signal-name (signal) - "Return the name of SIGNAL." - (aref signal 0)) - -(defun riece-signal-args (signal) - "Return the data of SIGNAL." - (aref signal 1)) - -(defun riece-connect-signal (signal-name function &optional filter handback) - "Add SLOT as a listener of a signal identified by SIGNAL-NAME." - (let ((symbol (intern (symbol-name signal-name) riece-signal-slot-obarray))) - (set symbol (cons (riece-make-slot function filter handback) - (if (boundp symbol) - (symbol-value symbol)))))) - -(defun riece-emit-signal (signal-name &rest args) - "Emit SIGNAL." - (let ((symbol (intern-soft (symbol-name signal-name) - riece-signal-slot-obarray)) - signal - slots) - (when symbol - (setq signal (riece-make-signal signal-name args) - slots (symbol-value symbol)) - (while slots - (condition-case error - (if (or (null (riece-slot-filter (car slots))) - (condition-case error - (funcall (riece-slot-filter (car slots)) signal) - (error - (if riece-debug - (message - "Error occurred in signal filter for \"%S\": %S" - signal-name error))) - nil)) - (funcall (riece-slot-function (car slots)) - signal (riece-slot-handback (car slots)))) - (error - (if riece-debug - (message "Error occurred in slot function for \"%S\": %S" - signal-name error)))) - (setq slots (cdr slots)))))) - (defun riece-display-connect-signals () (riece-connect-signal + 'riece-update-buffer + (lambda (signal handback) + (save-excursion + (set-buffer (car (riece-signal-args signal))) + (run-hooks 'riece-update-buffer-functions)))) + (riece-connect-signal 'riece-switch-to-channel (lambda (signal handback) (riece-update-status-indicators) (riece-update-channel-indicator) (riece-update-long-channel-indicator) + (riece-update-channel-list-indicator) (force-mode-line-update t) - (save-excursion - (set-buffer riece-user-list-buffer) - (run-hooks 'riece-update-buffer-functions)) - (save-excursion - (set-buffer riece-channel-list-buffer) - (run-hooks 'riece-update-buffer-functions)) + (riece-emit-signal 'riece-update-buffer riece-user-list-buffer) + (riece-emit-signal 'riece-update-buffer riece-channel-list-buffer) (save-excursion (riece-redraw-layout)))) (riece-connect-signal 'riece-naming-assert-channel-users (lambda (signal handback) - (save-excursion - (set-buffer riece-user-list-buffer) - (run-hooks 'riece-update-buffer-functions)))) + (riece-emit-signal 'riece-update-buffer riece-user-list-buffer))) (riece-connect-signal 'riece-naming-assert-join (lambda (signal handback) - (save-excursion - (set-buffer riece-user-list-buffer) - (run-hooks 'riece-update-buffer-functions))) + (riece-emit-signal 'riece-update-buffer riece-user-list-buffer)) (lambda (signal) (and riece-current-channel (riece-identity-equal (nth 1 (riece-signal-args signal)) @@ -167,9 +91,7 @@ This function is for internal use only." (riece-connect-signal 'riece-naming-assert-part (lambda (signal handback) - (save-excursion - (set-buffer riece-user-list-buffer) - (run-hooks 'riece-update-buffer-functions))) + (riece-emit-signal 'riece-update-buffer riece-user-list-buffer)) (lambda (signal) (and riece-current-channel (riece-identity-equal (nth 1 (riece-signal-args signal)) @@ -186,9 +108,7 @@ This function is for internal use only." (riece-connect-signal 'riece-naming-assert-rename (lambda (signal handback) - (save-excursion - (set-buffer riece-user-list-buffer) - (run-hooks 'riece-update-buffer-functions))) + (riece-emit-signal 'riece-update-buffer riece-user-list-buffer)) (lambda (signal) (and riece-current-channel (equal (riece-identity-server (nth 1 (riece-signal-args signal))) @@ -218,6 +138,23 @@ This function is for internal use only." (riece-identity-equal (car (riece-signal-args signal)) riece-current-channel)))) (riece-connect-signal + 'riece-naming-assert-rename + (lambda (signal handback) + (let* ((old-identity (car (riece-signal-args signal))) + (new-identity (nth 1 (riece-signal-args signal))) + (pointer (riece-identity-member old-identity + riece-current-channels))) + ;; Rename the channel buffer. + (when pointer + (setcar pointer new-identity) + (with-current-buffer (riece-channel-buffer old-identity) + (rename-buffer (riece-channel-buffer-name new-identity) t) + (setq riece-channel-buffer-alist + (cons (cons new-identity (current-buffer)) + (delq (riece-identity-assoc old-identity + riece-channel-buffer-alist) + riece-channel-buffer-alist)))))))) + (riece-connect-signal 'riece-user-toggle-away (lambda (signal handback) (riece-update-status-indicators) @@ -243,7 +180,7 @@ This function is for internal use only." (riece-identity-equal (car (riece-signal-args signal)) riece-current-channel)))) (riece-connect-signal - 'riece-channel-toggle-modes + 'riece-channel-set-modes (lambda (signal handback) (riece-update-status-indicators) (force-mode-line-update t)) @@ -254,9 +191,7 @@ This function is for internal use only." (riece-connect-signal 'riece-channel-toggle-operator (lambda (signal handback) - (save-excursion - (set-buffer riece-user-list-buffer) - (run-hooks 'riece-update-buffer-functions))) + (riece-emit-signal 'riece-update-buffer riece-user-list-buffer)) (lambda (signal) (and riece-current-channel (riece-identity-equal (car (riece-signal-args signal)) @@ -264,9 +199,7 @@ This function is for internal use only." (riece-connect-signal 'riece-channel-toggle-speaker (lambda (signal handback) - (save-excursion - (set-buffer riece-user-list-buffer) - (run-hooks 'riece-update-buffer-functions))) + (riece-emit-signal 'riece-update-buffer riece-user-list-buffer)) (lambda (signal) (and riece-current-channel (riece-identity-equal (car (riece-signal-args signal)) @@ -314,8 +247,8 @@ This function is for internal use only." (riece-kill-all-overlays) (while channels (if (car channels) - (insert (riece-format-channel-list-line - index (car channels)))) + (insert (riece-format-channel-list-line index (car channels)) + "\n")) (setq index (1+ index) channels (cdr channels)))))) @@ -326,8 +259,7 @@ This function is for internal use only." (if (riece-identity-equal channel riece-current-channel) ?* ? )) - (riece-format-identity channel) - "\n"))) + (riece-format-identity channel)))) (defun riece-update-channel-indicator () (setq riece-channel-indicator @@ -360,8 +292,7 @@ This function is for internal use only." (lambda (channel) (prog1 (if channel - (format "%d:%s" index - (riece-format-identity channel))) + (riece-format-channel-list-line index channel)) (setq index (1+ index)))) riece-current-channels)) ","))) diff --git a/lisp/riece-filter.el b/lisp/riece-filter.el index f522c48..f888921 100644 --- a/lisp/riece-filter.el +++ b/lisp/riece-filter.el @@ -28,7 +28,6 @@ (require 'riece-misc) (require 'riece-server) ;riece-close-server (require 'riece-identity) -(require 'riece-display) (defun riece-handle-numeric-reply (prefix number name string) (let ((base-number (* (/ number 100) 100)) diff --git a/lisp/riece-handle.el b/lisp/riece-handle.el index 386e491..bee461f 100644 --- a/lisp/riece-handle.el +++ b/lisp/riece-handle.el @@ -28,7 +28,7 @@ (require 'riece-message) (require 'riece-channel) (require 'riece-naming) -(require 'riece-display) +(require 'riece-signal) (defun riece-handle-nick-message (prefix string) (let* ((old (riece-prefix-nickname prefix)) @@ -344,51 +344,53 @@ topic)) "\n"))))) -(defsubst riece-parse-channel-modes (string channel) - (while (string-match "^[-+]\\([^ ]*\\) *" string) - (let ((toggle (aref string 0)) - (modes (string-to-list (match-string 1 string)))) - (setq string (substring string (match-end 0))) - (while modes - (if (and (memq (car modes) '(?O ?o ?v ?k ?l ?b ?e ?I)) - (string-match "\\([^-+][^ ]*\\) *" string)) - (let ((parameter (match-string 1 string))) - (setq string (substring string (match-end 0))) - (cond - ((eq (car modes) ?o) - (riece-channel-toggle-operator channel parameter - (eq toggle ?+)) - (riece-emit-signal 'riece-channel-toggle-operator - (riece-make-identity channel - riece-server-name) - (riece-make-identity parameter - riece-server-name) - (eq toggle ?+))) - ((eq (car modes) ?v) - (riece-channel-toggle-speaker channel parameter - (eq toggle ?+)) - (riece-emit-signal 'riece-channel-toggle-speaker - (riece-make-identity channel - riece-server-name) - (riece-make-identity parameter - riece-server-name) - (eq toggle ?+))) - ((eq (car modes) ?b) - (riece-channel-toggle-banned channel parameter - (eq toggle ?+))) - ((eq (car modes) ?e) - (riece-channel-toggle-uninvited channel parameter - (eq toggle ?+))) - ((eq (car modes) ?I) - (riece-channel-toggle-invited channel parameter - (eq toggle ?+))))) - (riece-channel-toggle-mode channel (car modes) - (eq toggle ?+))) - (setq modes (cdr modes))) - (riece-emit-signal 'riece-channel-toggle-modes +(defun riece-parse-modes (string) + (let (result) + (while (string-match "^[-+]\\([^ ]*\\) *" string) + (let ((toggle (eq (aref string 0) ?+)) + (modes (string-to-list (match-string 1 string)))) + (setq string (substring string (match-end 0))) + (while modes + (if (string-match "\\([^-+][^ ]*\\) *" string) + (setq result (cons (list (car modes) toggle + (match-string 1 string)) + result)) + (setq result (cons (list (car modes) toggle) + result))) + (setq modes (cdr modes))))) + (nreverse result))) + +(defun riece-handle-channel-modes (channel modes) + (while modes + (cond + ((eq (car (car modes)) ?o) + (apply #'riece-channel-toggle-operator channel (cdr (car modes))) + (riece-emit-signal 'riece-channel-toggle-operator (riece-make-identity channel riece-server-name) - modes toggle)))) + (riece-make-identity (nth 2 (car modes)) + riece-server-name) + (nth 1 (car modes)))) + ((eq (car (car modes)) ?v) + (apply #'riece-channel-toggle-speaker channel (cdr (car modes))) + (riece-emit-signal 'riece-channel-toggle-speaker + (riece-make-identity channel + riece-server-name) + (riece-make-identity (nth 2 (car modes)) + riece-server-name) + (nth 1 (car modes)))) + ((eq (car (car modes)) ?b) + (apply #'riece-channel-toggle-banned channel (cdr (car modes)))) + ((eq (car (car modes)) ?e) + (apply #'riece-channel-toggle-uninvited channel (cdr (car modes)))) + ((eq (car (car modes)) ?I) + (apply #'riece-channel-toggle-invited channel (cdr (car modes)))) + (t + (apply #'riece-channel-toggle-mode channel (cdr (car modes))))) + (setq modes (cdr modes))) + (riece-emit-signal 'riece-channel-set-modes + (riece-make-identity channel + riece-server-name))) (defun riece-handle-mode-message (prefix string) (let* ((user (riece-prefix-nickname prefix)) @@ -398,7 +400,7 @@ (setq channel (match-string 1 string) string (substring string (match-end 0))) (if (string-match (concat "^" riece-channel-regexp "$") channel) - (riece-parse-channel-modes string channel)) + (riece-handle-channel-modes channel (riece-parse-modes string))) (let* ((channel-identity (riece-make-identity channel riece-server-name)) (buffer (riece-channel-buffer channel-identity))) (riece-insert-change diff --git a/lisp/riece-history.el b/lisp/riece-history.el index aece829..4398410 100644 --- a/lisp/riece-history.el +++ b/lisp/riece-history.el @@ -76,8 +76,7 @@ (if (and (not (ring-empty-p riece-channel-history)) (riece-identity-equal channel (ring-ref riece-channel-history 0))) (concat (format "%2d:+" index) - (riece-format-identity channel) - "\n"))) + (riece-format-identity channel)))) ;;; (defun riece-history-requires () ;;; (if (memq 'riece-guess riece-addons) diff --git a/lisp/riece-naming.el b/lisp/riece-naming.el index 7093938..ab5a357 100644 --- a/lisp/riece-naming.el +++ b/lisp/riece-naming.el @@ -27,7 +27,7 @@ (require 'riece-globals) (require 'riece-channel) (require 'riece-user) -(require 'riece-display) +(require 'riece-signal) (defun riece-naming-assert-join (user-name channel-name) (riece-user-toggle-channel user-name channel-name t) @@ -63,21 +63,9 @@ (setcar user new-name)) (setq channels (cdr channels))) (riece-rename-user old-name new-name)) - ;; Rename the channel buffer. - (let* ((old-identity (riece-make-identity old-name riece-server-name)) - (new-identity (riece-make-identity new-name riece-server-name)) - (pointer (riece-identity-member old-identity riece-current-channels))) - (when pointer - (setcar pointer new-identity) - (with-current-buffer (riece-channel-buffer old-identity) - (rename-buffer (riece-channel-buffer-name new-identity) t) - (setq riece-channel-buffer-alist - (cons (cons new-identity (current-buffer)) - (delq (riece-identity-assoc old-identity - riece-channel-buffer-alist) - riece-channel-buffer-alist))))) - (riece-emit-signal 'riece-naming-assert-rename - old-identity new-identity))) + (riece-emit-signal 'riece-naming-assert-rename + (riece-make-identity old-name riece-server-name) + (riece-make-identity new-name riece-server-name))) (defun riece-naming-assert-channel-users (users channel-name) (let ((channel-identity (riece-make-identity channel-name diff --git a/lisp/riece-ndcc.el b/lisp/riece-ndcc.el index 0466040..10efdc4 100644 --- a/lisp/riece-ndcc.el +++ b/lisp/riece-ndcc.el @@ -25,7 +25,6 @@ (require 'riece-globals) (require 'riece-options) -(require 'riece-display) (require 'calc) diff --git a/lisp/riece-signal.el b/lisp/riece-signal.el new file mode 100644 index 0000000..7fedd2f --- /dev/null +++ b/lisp/riece-signal.el @@ -0,0 +1,109 @@ +;;; riece-signal.el --- "signal-slot" abstraction for routing display events +;; Copyright (C) 1998-2003 Daiki Ueno + +;; Author: Daiki Ueno +;; Created: 1998-09-28 +;; Keywords: IRC, riece + +;; This file is part of Riece. + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 2, or (at your option) +;; any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +;;; Commentary: + +;;; This module implements Qt like "signal-slot" abstraction for +;;; routing display events. + +;;; Code: + +(defvar riece-signal-slot-obarray + (make-vector 31 0)) + +(defun riece-make-slot (function &optional filter handback) + "Make an instance of slot object. +Arguments are corresponding to callback function, filter function, and +a handback object, respectively. +This function is for internal use only." + (vector function filter handback)) + +(defun riece-slot-function (slot) + "Return the callback function of SLOT. +This function is for internal use only." + (aref slot 0)) + +(defun riece-slot-filter (slot) + "Return the filter function of SLOT. +This function is for internal use only." + (aref slot 1)) + +(defun riece-slot-handback (slot) + "Return the handback object of SLOT. +This function is for internal use only." + (aref slot 2)) + +(defun riece-make-signal (name args) + "Make an instance of signal object. +The 1st arguments is the name of the signal and the rest of arguments +are the data of the signal. +This function is for internal use only." + (vector name args)) + +(defun riece-signal-name (signal) + "Return the name of SIGNAL." + (aref signal 0)) + +(defun riece-signal-args (signal) + "Return the data of SIGNAL." + (aref signal 1)) + +(defun riece-connect-signal (signal-name function &optional filter handback) + "Add SLOT as a listener of a signal identified by SIGNAL-NAME." + (let ((symbol (intern (symbol-name signal-name) riece-signal-slot-obarray))) + (set symbol (cons (riece-make-slot function filter handback) + (if (boundp symbol) + (symbol-value symbol)))))) + +(defun riece-emit-signal (signal-name &rest args) + "Emit SIGNAL." + (let ((symbol (intern-soft (symbol-name signal-name) + riece-signal-slot-obarray)) + signal + slots) + (when symbol + (setq signal (riece-make-signal signal-name args) + slots (symbol-value symbol)) + (while slots + (condition-case error + (if (or (null (riece-slot-filter (car slots))) + (condition-case error + (funcall (riece-slot-filter (car slots)) signal) + (error + (if riece-debug + (message + "Error occurred in signal filter for \"%S\": %S" + signal-name error))) + nil)) + (funcall (riece-slot-function (car slots)) + signal (riece-slot-handback (car slots)))) + (error + (if riece-debug + (message "Error occurred in slot function for \"%S\": %S" + signal-name error)))) + (setq slots (cdr slots)))))) + +(provide 'riece-signal) + +;;; riece-signal.el ends here diff --git a/lisp/riece-unread.el b/lisp/riece-unread.el index e8c826a..764bb63 100644 --- a/lisp/riece-unread.el +++ b/lisp/riece-unread.el @@ -35,6 +35,7 @@ (require 'riece-message) (require 'riece-commands) +(require 'riece-signal) (eval-when-compile (require 'riece-highlight)) @@ -68,7 +69,7 @@ riece-unread-channels)) (setq riece-unread-channels (cons (riece-message-target message) riece-unread-channels)) - (riece-emit-signal 'riece-unread-channel-list-update))) + (riece-emit-signal 'riece-update-buffer riece-channel-list-buffer))) (defun riece-unread-after-switch-to-channel-function (last) (setq riece-unread-channels @@ -78,8 +79,7 @@ (defun riece-unread-format-channel-list-line (index channel) (if (riece-identity-member channel riece-unread-channels) (concat (format "%2d:!" index) - (riece-format-identity channel) - "\n"))) + (riece-format-identity channel)))) (defun riece-unread-switch-to-channel () (interactive) @@ -127,12 +127,7 @@ ;;; (if (memq 'riece-guess riece-addons) ;;; (add-hook 'riece-guess-channel-try-functions ;;; 'riece-guess-channel-from-unread)) - (riece-connect-signal - 'riece-unread-channel-list-update - (lambda (signal handback) - (save-excursion - (set-buffer riece-channel-list-buffer) - (run-hooks 'riece-update-buffer-functions))))) + ) (provide 'riece-unread) diff --git a/lisp/riece-xface.el b/lisp/riece-xface.el index 8663214..dbb8a27 100644 --- a/lisp/riece-xface.el +++ b/lisp/riece-xface.el @@ -37,32 +37,33 @@ (defvar lsdb-insert-x-face-function) (defun riece-xface-update-user-list-buffer () - (save-excursion - (set-buffer riece-user-list-buffer) - (riece-scan-property-region - 'riece-identity (point-min)(point-max) - (lambda (start end) - (let ((records (riece-lsdb-lookup-records (get-text-property - start 'riece-identity))) - xface) - (while (and records - (null xface)) - (setq xface (nth 1 (assq 'x-face (car records))) - records (cdr records))) - (if (and xface - (not (eq (char-after end) ? ))) - (let ((inhibit-read-only t) - buffer-read-only) - (goto-char end) - (insert " ") - (funcall lsdb-insert-x-face-function xface)))))))) + (riece-scan-property-region + 'riece-identity (point-min)(point-max) + (lambda (start end) + (let ((records (riece-lsdb-lookup-records (get-text-property + start 'riece-identity))) + xface) + (while (and records + (null xface)) + (setq xface (nth 1 (assq 'x-face (car records))) + records (cdr records))) + (if (and xface + (not (eq (char-after end) ? ))) + (let ((inhibit-read-only t) + buffer-read-only) + (goto-char end) + (insert " ") + (funcall lsdb-insert-x-face-function xface))))))) (defun riece-xface-requires () '(riece-lsdb)) (defun riece-xface-insinuate () - (add-hook 'riece-update-buffer-functions - 'riece-xface-update-user-list-buffer t)) + (add-hook 'riece-startup-hook + (lambda () + (with-current-buffer riece-user-list-buffer + (add-hook 'riece-update-buffer-functions + 'riece-xface-update-user-list-buffer t))))) (provide 'riece-xface) -- 1.7.10.4