From bc0d2ec97f2ca212c94d1e188e7478ea04d4cada Mon Sep 17 00:00:00 2001 From: ueno Date: Mon, 13 Oct 2003 22:27:05 +0000 Subject: [PATCH] * riece-button.el (riece-button-map-identity-region): Abolish. (riece-user-button-set-operators): Use riece-scan-property-region. (riece-user-button-set-speakers): Ditto. (riece-button-add-identity-button): Ditto. * riece-keyword.el: Require 'riece-message. (riece-keyword-map-region): Abolish. (riece-keyword-scan-region): Use riece-scan-property-region. * riece-misc.el (riece-scan-property-region): New function. --- lisp/ChangeLog | 13 +++++++++++++ lisp/riece-button.el | 26 ++++++-------------------- lisp/riece-display.el | 5 ++--- lisp/riece-keyword.el | 22 ++++------------------ lisp/riece-misc.el | 15 +++++++++++++++ 5 files changed, 40 insertions(+), 41 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 5868949..63f98e5 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,18 @@ 2003-10-13 Daiki Ueno + * riece-button.el (riece-button-map-identity-region): Abolish. + (riece-user-button-set-operators): Use riece-scan-property-region. + (riece-user-button-set-speakers): Ditto. + (riece-button-add-identity-button): Ditto. + + * riece-keyword.el: Require 'riece-message. + (riece-keyword-map-region): Abolish. + (riece-keyword-scan-region): Use riece-scan-property-region. + + * riece-misc.el (riece-scan-property-region): New function. + +2003-10-13 Daiki Ueno + * riece-xemacs.el (riece-make-overlay): New alias. (riece-overlay-put): New alias. (riece-overlay-start): New alias. diff --git a/lisp/riece-button.el b/lisp/riece-button.el index cba6fd3..2582772 100644 --- a/lisp/riece-button.el +++ b/lisp/riece-button.el @@ -116,7 +116,8 @@ This function is used as a callback for a channel button." (let (group) (if (riece-region-active-p) (save-excursion - (riece-button-map-identity-region + (riece-scan-property-region + 'riece-identity (region-beginning) (region-end) (lambda (start end) (setq group (cons (get-text-property start 'riece-identity) @@ -147,7 +148,8 @@ This function is used as a callback for a channel button." (let (group) (if (riece-region-active-p) (save-excursion - (riece-button-map-identity-region + (riece-scan-property-region + 'riece-identity (region-beginning) (region-end) (lambda (start end) (setq group (cons (get-text-property start 'riece-identity) @@ -189,26 +191,10 @@ This function is used as a callback for a channel button." (define-key map [down-mouse-3] 'riece-identity-button-popup-menu) map)) -(defun riece-button-map-identity-region (start end function) - (catch 'done - (while t - ;; Search for the beginning of the button region. - (unless (get-text-property start 'riece-identity) - (setq start (next-single-property-change start 'riece-identity - nil end))) - (if (= start end) - (throw 'done nil)) - ;; Search for the end of the button region. - (let ((button-end (next-single-property-change start 'riece-identity - nil end))) - (if (= button-end end) - (throw 'done nil)) - (funcall function start button-end) - (setq start button-end))))) - (defvar riece-identity-button-map) (defun riece-button-add-identity-button (start end) - (riece-button-map-identity-region + (riece-scan-property-region + 'riece-identity start end (lambda (start end) (let ((inhibit-read-only t) diff --git a/lisp/riece-display.el b/lisp/riece-display.el index b3c2e6e..33144dd 100644 --- a/lisp/riece-display.el +++ b/lisp/riece-display.el @@ -85,9 +85,8 @@ Local to the buffer in `riece-buffer-list'.") (erase-buffer) (while channels (if (car channels) - (let ((point (point))) - (insert (riece-format-channel-list-line - index (car channels))))) + (insert (riece-format-channel-list-line + index (car channels)))) (setq index (1+ index) channels (cdr channels)))))) diff --git a/lisp/riece-keyword.el b/lisp/riece-keyword.el index 37ae4af..5855d42 100644 --- a/lisp/riece-keyword.el +++ b/lisp/riece-keyword.el @@ -29,6 +29,8 @@ ;;; Code: +(require 'riece-message) + (defgroup riece-keyword nil "Highlight keyword in IRC buffer." :group 'riece-vars) @@ -69,25 +71,9 @@ (setq index (match-end 0))))) message) -(defun riece-keyword-map-region (start end function) - (catch 'done - (while t - ;; Search for the beginning of the button region. - (unless (get-text-property start 'riece-keyword) - (setq start (next-single-property-change start 'riece-keyword - nil end))) - (if (= start end) - (throw 'done nil)) - ;; Search for the end of the button region. - (let ((button-end (next-single-property-change start 'riece-keyword - nil end))) - (if (= button-end end) - (throw 'done nil)) - (funcall function start button-end) - (setq start button-end))))) - (defun riece-keyword-scan-region (start end) - (riece-keyword-map-region + (riece-scan-property-region + 'riece-keyword start end (lambda (start end) (riece-overlay-put (riece-make-overlay start end) diff --git a/lisp/riece-misc.el b/lisp/riece-misc.el index 60a02c0..d3a21d4 100644 --- a/lisp/riece-misc.el +++ b/lisp/riece-misc.el @@ -38,6 +38,21 @@ (setq riece-buffer-list (cons buffer riece-buffer-list))) buffer)) +(defun riece-scan-property-region (property start end function) + (catch 'done + (while t + ;; Search for the beginning of the property region. + (unless (get-text-property start property) + (setq start (next-single-property-change start property nil end))) + (if (= start end) + (throw 'done nil)) + ;; Search for the end of the property region. + (let ((region-end (next-single-property-change start property nil end))) + (if (= region-end end) + (throw 'done nil)) + (funcall function start region-end) + (setq start region-end))))) + (defun riece-insert (buffers string) (unless (listp buffers) (setq buffers (list buffers))) -- 1.7.10.4