projects
/
elisp
/
riece.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
* riece-rdcc.el (riece-rdcc-server-port): New user option.
[elisp/riece.git]
/
lisp
/
riece-keyword.el
diff --git
a/lisp/riece-keyword.el
b/lisp/riece-keyword.el
index
37056e2
..
85251b7
100644
(file)
--- a/
lisp/riece-keyword.el
+++ b/
lisp/riece-keyword.el
@@
-1,4
+1,4
@@
-;;; riece-keyword.el --- highlight keywords in channel buffers
+;;; riece-keyword.el --- detect keywords in IRC buffers
;; Copyright (C) 1998-2003 Daiki Ueno
;; Author: Daiki Ueno <ueno@unixuser.org>
;; Copyright (C) 1998-2003 Daiki Ueno
;; Author: Daiki Ueno <ueno@unixuser.org>
@@
-19,21
+19,21
@@
;; 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
;; 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.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
;;; Commentary:
;;; Commentary:
-;; To use, add the following line to your ~/.riece/init.el:
-;; (add-to-list 'riece-addons 'riece-keyword)
+;; NOTE: This is an add-on module for Riece.
;;; Code:
(require 'riece-message)
(defgroup riece-keyword nil
;;; Code:
(require 'riece-message)
(defgroup riece-keyword nil
- "Highlight keyword in IRC buffer."
- :group 'riece-vars)
+ "Detect keywords in IRC buffers."
+ :prefix "riece-"
+ :group 'riece)
(defcustom riece-keywords nil
"Keywords to be highlightened."
(defcustom riece-keywords nil
"Keywords to be highlightened."
@@
-61,15
+61,19
@@
and the matched message object."
'((((class color))
(:foreground "red" :underline t))
(t
'((((class color))
(:foreground "red" :underline t))
(t
- ()))
+ (:underline t)))
"Face used for highlightening matching keyword."
:group 'riece-highlight-faces)
(defvar riece-keyword-face 'riece-keyword-face)
"Face used for highlightening matching keyword."
:group 'riece-highlight-faces)
(defvar riece-keyword-face 'riece-keyword-face)
+(defconst riece-keyword-description
+ "Detect keywords in IRC buffers.")
+
;;; The old XEmacs package doesn't have autoload setting for regexp-opt.
(autoload 'regexp-opt "regexp-opt")
(defun riece-keyword-message-filter (message)
;;; The old XEmacs package doesn't have autoload setting for regexp-opt.
(autoload 'regexp-opt "regexp-opt")
(defun riece-keyword-message-filter (message)
- (if (and riece-keywords
+ (if (and (get 'riece-keyword 'riece-addon-enabled)
+ riece-keywords
;; Ignore messages which belongs to myself.
(not (riece-message-own-p message)))
(let* (keywords
;; Ignore messages which belongs to myself.
(not (riece-message-own-p message)))
(let* (keywords
@@
-88,11
+92,10
@@
and the matched message object."
(setq index 0)
(while (string-match (car (car alist))
(riece-message-text message) index)
(setq index 0)
(while (string-match (car (car alist))
(riece-message-text message) index)
- (if (memq 'riece-highlight riece-addons)
- (put-text-property (match-beginning (cdr (car alist)))
- (match-end (cdr (car alist)))
- 'riece-keyword t
- (riece-message-text message)))
+ (put-text-property (match-beginning (cdr (car alist)))
+ (match-end (cdr (car alist)))
+ 'riece-overlay-face riece-keyword-face
+ (riece-message-text message))
(run-hook-with-args 'riece-notify-keyword-functions
(match-string (cdr (car alist))
(riece-message-text message)))
(run-hook-with-args 'riece-notify-keyword-functions
(match-string (cdr (car alist))
(riece-message-text message)))
@@
-103,21
+106,15
@@
and the matched message object."
(setq alist (cdr alist)))))
message)
(setq alist (cdr alist)))))
message)
-(defun riece-keyword-scan-region (start end)
- (riece-scan-property-region
- 'riece-keyword
- start end
- (lambda (start end)
- (riece-overlay-put (riece-make-overlay start end)
- 'face riece-keyword-face))))
-
(defun riece-keyword-requires ()
(if (memq 'riece-highlight riece-addons)
'(riece-highlight)))
(defun riece-keyword-insinuate ()
(defun riece-keyword-requires ()
(if (memq 'riece-highlight riece-addons)
'(riece-highlight)))
(defun riece-keyword-insinuate ()
- (add-hook 'riece-message-filter-functions 'riece-keyword-message-filter)
- (add-hook 'riece-after-insert-functions 'riece-keyword-scan-region))
+ (add-hook 'riece-message-filter-functions 'riece-keyword-message-filter))
+
+(defun riece-keyword-uninstall ()
+ (remove-hook 'riece-message-filter-functions 'riece-keyword-message-filter))
(provide 'riece-keyword)
(provide 'riece-keyword)