]> code.delx.au - gnu-emacs/blobdiff - lisp/erc/erc-match.el
Aidan Gauland <aidalgol@no8wireless.co.nz>
[gnu-emacs] / lisp / erc / erc-match.el
index 259eb201fe0b3f34842bd4dca3f6575f3b820205..1da838557f7ab790c79bcf0c781bdca34aa3ba30 100644 (file)
@@ -1,8 +1,9 @@
 ;;; erc-match.el --- Highlight messages matching certain regexps
 
-;; Copyright (C) 2002-2012 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2013 Free Software Foundation, Inc.
 
 ;; Author: Andreas Fuchs <asf@void.at>
+;; Maintainer: FSF
 ;; Keywords: comm, faces
 ;; URL: http://www.emacswiki.org/cgi-bin/wiki.pl?ErcMatch
 
 ;; customizable variables.
 
 ;; Usage:
-;; Put (erc-match-mode 1) into your ~/.emacs file.
+;; Put (erc-match-mode 1) into your init file.
 
 ;;; Code:
 
 (require 'erc)
-(eval-when-compile (require 'cl))
 
 ;; Customization:
 
@@ -237,7 +237,7 @@ current-nick, keyword, pal, dangerous-host, fool"
 useful for excluding all the things like MOTDs from the server
 and other miscellaneous functions."
   :group 'erc-match
-  :version "24.2"
+  :version "24.3"
   :type 'boolean)
 
 ;; Internal variables:
@@ -447,18 +447,26 @@ Use this defun with `erc-insert-modify-hook'."
                        (nth 0 (erc-parse-user nickuserhost))))
         (old-pt (point))
         (nick-beg (and nickname
-                       (re-search-forward (regexp-quote nickname)
+                       (re-search-forward "\\(\\* \\)?"(regexp-quote nickname)
                                           (point-max) t)
                        (match-beginning 0)))
         (nick-end (when nick-beg
                     (match-end 0)))
-        (message (buffer-substring (if (and nick-end
-                                            (<= (+ 2 nick-end) (point-max)))
-                                       (+ 2 nick-end)
-                                     (point-min))
-                                   (point-max))))
+        (message (buffer-substring
+                  (if (and nick-end
+                           (<= (+ 2 nick-end) (point-max)))
+                      (+ nick-end
+                         ;; Message starts 2 characters after the nick except
+                         ;; for CTCP ACTION messages.
+                         (if (string= "* "
+                                      (buffer-substring (- nick-beg 2)
+                                                        nick-beg))
+                             1
+                           2))
+                    (point-min))
+                  (point-max))))
     (when (and vector
-              (not (and erc-track-exclude-server-buffer
+              (not (and erc-match-exclude-server-buffer
                         (erc-server-buffer-p))))
       (mapc
        (lambda (match-type)