erc-match: add option to exclude server buffer
authorJulien Danjou <julien@danjou.info>
Mon, 6 Aug 2012 00:15:34 +0000 (02:15 +0200)
committerJulien Danjou <julien@danjou.info>
Mon, 6 Aug 2012 00:15:34 +0000 (02:15 +0200)
* erc-match.el (erc-match-exclude-server-buffer)
(erc-match-message): Add new option to exclude server buffer from
matching.

lisp/erc/ChangeLog
lisp/erc/erc-match.el

index 3775804..b87cfd4 100644 (file)
@@ -1,3 +1,9 @@
+2012-08-06  Julien Danjou  <julien@danjou.info>
+
+       * erc-match.el (erc-match-exclude-server-buffer)
+       (erc-match-message): Add new option to exclude server buffer from
+       matching.
+
 2012-07-21  Julien Danjou  <julien@danjou.info>
 
        * erc-notifications.el: New file.
index 9fbe954..259eb20 100644 (file)
@@ -232,6 +232,14 @@ current-nick, keyword, pal, dangerous-host, fool"
   :group 'erc-match
   :type 'hook)
 
+(defcustom erc-match-exclude-server-buffer nil
+  "If true, don't perform match on the server buffer; this is
+useful for excluding all the things like MOTDs from the server
+and other miscellaneous functions."
+  :group 'erc-match
+  :version "24.2"
+  :type 'boolean)
+
 ;; Internal variables:
 
 ;; This is exactly the same as erc-button-syntax-table.  Should we
@@ -449,7 +457,9 @@ Use this defun with `erc-insert-modify-hook'."
                                        (+ 2 nick-end)
                                      (point-min))
                                    (point-max))))
-    (when vector
+    (when (and vector
+              (not (and erc-track-exclude-server-buffer
+                        (erc-server-buffer-p))))
       (mapc
        (lambda (match-type)
         (goto-char (point-min))