aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorkwhite2015-05-21 14:30:18 -0500
committerkwhite2015-05-21 14:30:18 -0500
commitfdad335016c5e830f90bb8da3ed4f1365273a524 (patch)
treee58e8cfd62cd689952339e981ae71d1b63c4545b /lisp
parent96794d2f97cd064e4c2bf4f71459b42558cc8c79 (diff)
downloademacs-fdad335016c5e830f90bb8da3ed4f1365273a524.tar.gz
emacs-fdad335016c5e830f90bb8da3ed4f1365273a524.zip
* lisp/erc/erc.el: Hide network/channel messages
(erc-network-hide-list, etc-channel-hide-list): New lists to define message types per network/channel. (erc-add-targets): New function to parse list of targets (erc-hide-current-message-p): Modified to check for new targets
Diffstat (limited to 'lisp')
-rw-r--r--lisp/erc/erc.el53
1 files changed, 44 insertions, 9 deletions
diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el
index cf422f1cfc5..ad5e1a2468e 100644
--- a/lisp/erc/erc.el
+++ b/lisp/erc/erc.el
@@ -1,3 +1,4 @@
1
1;; erc.el --- An Emacs Internet Relay Chat client -*- lexical-binding:t -*- 2;; erc.el --- An Emacs Internet Relay Chat client -*- lexical-binding:t -*-
2 3
3;; Copyright (C) 1997-2015 Free Software Foundation, Inc. 4;; Copyright (C) 1997-2015 Free Software Foundation, Inc.
@@ -12,6 +13,7 @@
12;; Kelvin White (kwhite@gnu.org) 13;; Kelvin White (kwhite@gnu.org)
13;; Maintainer: emacs-devel@gnu.org 14;; Maintainer: emacs-devel@gnu.org
14;; Keywords: IRC, chat, client, Internet 15;; Keywords: IRC, chat, client, Internet
16
15;; Version: 5.3 17;; Version: 5.3
16 18
17;; This file is part of GNU Emacs. 19;; This file is part of GNU Emacs.
@@ -37,15 +39,13 @@
37;; * http://sv.gnu.org/projects/erc/ 39;; * http://sv.gnu.org/projects/erc/
38;; * http://www.emacswiki.org/cgi-bin/wiki/ERC 40;; * http://www.emacswiki.org/cgi-bin/wiki/ERC
39 41
42
43
40;; As of 2006-06-13, ERC development is now hosted on Savannah 44;; As of 2006-06-13, ERC development is now hosted on Savannah
41;; (http://sv.gnu.org/projects/erc). I invite everyone who wants to 45;; (http://sv.gnu.org/projects/erc). I invite everyone who wants to
42;; hack on it to contact me <mwolson@gnu.org> in order to get write 46;; hack on it to contact me <mwolson@gnu.org> in order to get write
43;; access to the shared Arch archive. 47;; access to the shared Arch archive.
44 48
45;; Installation:
46
47;; Put erc.el in your load-path, and put (require 'erc) in your .emacs.
48
49;; Configuration: 49;; Configuration:
50 50
51;; Use M-x customize-group RET erc RET to get an overview 51;; Use M-x customize-group RET erc RET to get an overview
@@ -258,11 +258,25 @@ If nil, only \"> \" will be shown."
258 (repeat :inline t :tag "Others" (string :tag "IRC Message Type")))) 258 (repeat :inline t :tag "Others" (string :tag "IRC Message Type"))))
259 259
260(defcustom erc-hide-list nil 260(defcustom erc-hide-list nil
261 "List of IRC type messages to hide. 261 "A global list of IRC message types to hide.
262A typical value would be '(\"JOIN\" \"PART\" \"QUIT\")." 262A typical value would be '(\"JOIN\" \"PART\" \"QUIT\")."
263 :group 'erc-ignore 263 :group 'erc-ignore
264 :type 'erc-message-type) 264 :type 'erc-message-type)
265 265
266(defcustom erc-network-hide-list nil
267 "A list of IRC networks to hide message types from.
268A typical value would be '((\"freenode\" \"MODE\")
269(\"OFTC\" \"JOIN\" \"QUIT\"))."
270 :group 'erc-ignore
271 :type 'erc-message-type)
272
273(defcustom erc-channel-hide-list nil
274 "A list of IRC channels to hide message types from.
275A typical value would be '((\"#emacs\" \"QUIT\" \JOIN\")
276(\"#erc\" \"NICK\")."
277 :group 'erc-ignore
278 :type 'erc-message-type)
279
266(defvar erc-session-password nil 280(defvar erc-session-password nil
267 "The password used for the current session.") 281 "The password used for the current session.")
268(make-variable-buffer-local 'erc-session-password) 282(make-variable-buffer-local 'erc-session-password)
@@ -2616,15 +2630,36 @@ otherwise `erc-server-announced-name'. SERVER is matched against
2616 erc-common-server-suffixes)) 2630 erc-common-server-suffixes))
2617 erc-server-announced-name))) 2631 erc-server-announced-name)))
2618 2632
2633(defun erc-add-targets (scope target-list)
2634 (let ((targets
2635 (mapcar (lambda (targets) (member scope targets)) target-list)))
2636 (cdr (apply 'append (delete nil targets)))))
2637
2619(defun erc-hide-current-message-p (parsed) 2638(defun erc-hide-current-message-p (parsed)
2620 "Predicate indicating whether the parsed ERC response PARSED should be hidden. 2639 "Predicate indicating whether the parsed ERC response PARSED should be hidden.
2621 2640
2622Messages are always hidden if the message type of PARSED appears in 2641Messages are always hidden if the message type of PARSED appears in
2623`erc-hide-list'. In addition, messages whose type is a member of 2642`erc-hide-list'. Message types that appear in `erc-network-hide-list'
2624`erc-lurker-hide-list' are hidden if `erc-lurker-p' returns true." 2643or `erc-channel-hide-list' are are only hidden if the target matches
2644the network or channel in the list. In addition, messages whose type
2645is a member of `erc-lurker-hide-list' are hidden if `erc-lurker-p'
2646returns non-nil."
2625 (let* ((command (erc-response.command parsed)) 2647 (let* ((command (erc-response.command parsed))
2626 (sender (car (erc-parse-user (erc-response.sender parsed))))) 2648 (sender (car (erc-parse-user (erc-response.sender parsed))))
2649 (channel (nth 1 (erc-response.command-args parsed)))
2650 (network (or (and (fboundp 'erc-network-name) (erc-network-name))
2651 (erc-shorten-server-name
2652 (or erc-server-announced-name
2653 erc-session-server))))
2654 (current-hide-list
2655 (when erc-network-hide-list
2656 (erc-add-targets network erc-network-hide-list)))
2657 (current-hide-list
2658 (apply 'append current-hide-list
2659 (when erc-channel-hide-list
2660 (erc-add-targets channel erc-channel-hide-list)))))
2627 (or (member command erc-hide-list) 2661 (or (member command erc-hide-list)
2662 (member command current-hide-list)
2628 (and (member command erc-lurker-hide-list) (erc-lurker-p sender))))) 2663 (and (member command erc-lurker-hide-list) (erc-lurker-p sender)))))
2629 2664
2630(defun erc-display-message (parsed type buffer msg &rest args) 2665(defun erc-display-message (parsed type buffer msg &rest args)
@@ -4150,7 +4185,7 @@ See also `erc-display-error-notice'."
4150 ;; server's setting if we haven't 4185 ;; server's setting if we haven't
4151 ;; established a connection yet 4186 ;; established a connection yet
4152 (- 9 (length erc-nick-uniquifier)))) 4187 (- 9 (length erc-nick-uniquifier))))
4153 erc-nick-uniquifier))) 4188 erc-nick-uniqifier)))
4154 (erc-cmd-NICK newnick) 4189 (erc-cmd-NICK newnick)
4155 (erc-display-error-notice 4190 (erc-display-error-notice
4156 nil 4191 nil