Commit fdad3350 authored by kwhite's avatar kwhite
Browse files

* 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
parent 96794d2f
......@@ -753,6 +753,26 @@ If non, @code{nil}, this is a list of IRC message types to hide, e.g.:
@end example
@end defopt
@defopt erc-network-hide-list
If non, @code{nil}, this is a list of IRC networks and message types
to hide, e.g.:
(setq erc-network-hide-list (("freenode" "JOIN" "PART" "QUIT")
("OFTC" "JOIN" "PART""))
@end example
@end defopt
@defopt erc-channel-hide-list
If non, @code{nil}, this is a list of IRC channels and message types
to hide, e.g.:
(setq erc-channel-hide-list (("#erc" "JOIN" "PART" "QUIT")
("#emacs" "NICK"))
@end example
@end defopt
@defopt erc-lurker-hide-list
Like @code{erc-hide-list}, but only applies to messages sent by
lurkers. The function @code{erc-lurker-p} determines whether a given
......@@ -249,6 +249,13 @@ Unicode standards.
** The `save-place' variable is replaced by a `save-place-mode'.
** ERC
*** Hide message types by network or channel. `erc-hide-list' will
hide all messages of the specified type, where `erc-network-hide-list'
and `erc-channel-hide-list' will only hide the specified message types
for the respective specified targets.
** Midnight-mode
*** `midnight-mode' is a proper minor mode.
*** clean-buffer-*-regexps can now specify buffers via predicate functions.
;; erc.el --- An Emacs Internet Relay Chat client -*- lexical-binding:t -*-
;; Copyright (C) 1997-2015 Free Software Foundation, Inc.
......@@ -12,6 +13,7 @@
;; Kelvin White (
;; Maintainer:
;; Keywords: IRC, chat, client, Internet
;; Version: 5.3
;; This file is part of GNU Emacs.
......@@ -37,15 +39,13 @@
;; *
;; *
;; As of 2006-06-13, ERC development is now hosted on Savannah
;; ( I invite everyone who wants to
;; hack on it to contact me <> in order to get write
;; access to the shared Arch archive.
;; Installation:
;; Put erc.el in your load-path, and put (require 'erc) in your .emacs.
;; Configuration:
;; Use M-x customize-group RET erc RET to get an overview
......@@ -258,11 +258,25 @@ If nil, only \"> \" will be shown."
(repeat :inline t :tag "Others" (string :tag "IRC Message Type"))))
(defcustom erc-hide-list nil
"List of IRC type messages to hide.
"A global list of IRC message types to hide.
A typical value would be '(\"JOIN\" \"PART\" \"QUIT\")."
:group 'erc-ignore
:type 'erc-message-type)
(defcustom erc-network-hide-list nil
"A list of IRC networks to hide message types from.
A typical value would be '((\"freenode\" \"MODE\")
(\"OFTC\" \"JOIN\" \"QUIT\"))."
:group 'erc-ignore
:type 'erc-message-type)
(defcustom erc-channel-hide-list nil
"A list of IRC channels to hide message types from.
A typical value would be '((\"#emacs\" \"QUIT\" \JOIN\")
(\"#erc\" \"NICK\")."
:group 'erc-ignore
:type 'erc-message-type)
(defvar erc-session-password nil
"The password used for the current session.")
(make-variable-buffer-local 'erc-session-password)
......@@ -2616,15 +2630,36 @@ otherwise `erc-server-announced-name'. SERVER is matched against
(defun erc-add-targets (scope target-list)
(let ((targets
(mapcar (lambda (targets) (member scope targets)) target-list)))
(cdr (apply 'append (delete nil targets)))))
(defun erc-hide-current-message-p (parsed)
"Predicate indicating whether the parsed ERC response PARSED should be hidden.
Messages are always hidden if the message type of PARSED appears in
`erc-hide-list'. In addition, messages whose type is a member of
`erc-lurker-hide-list' are hidden if `erc-lurker-p' returns true."
`erc-hide-list'. Message types that appear in `erc-network-hide-list'
or `erc-channel-hide-list' are are only hidden if the target matches
the network or channel in the list. In addition, messages whose type
is a member of `erc-lurker-hide-list' are hidden if `erc-lurker-p'
returns non-nil."
(let* ((command (erc-response.command parsed))
(sender (car (erc-parse-user (erc-response.sender parsed)))))
(sender (car (erc-parse-user (erc-response.sender parsed))))
(channel (nth 1 (erc-response.command-args parsed)))
(network (or (and (fboundp 'erc-network-name) (erc-network-name))
(or erc-server-announced-name
(when erc-network-hide-list
(erc-add-targets network erc-network-hide-list)))
(apply 'append current-hide-list
(when erc-channel-hide-list
(erc-add-targets channel erc-channel-hide-list)))))
(or (member command erc-hide-list)
(member command current-hide-list)
(and (member command erc-lurker-hide-list) (erc-lurker-p sender)))))
(defun erc-display-message (parsed type buffer msg &rest args)
......@@ -4150,7 +4185,7 @@ See also `erc-display-error-notice'."
;; server's setting if we haven't
;; established a connection yet
(- 9 (length erc-nick-uniquifier))))
(erc-cmd-NICK newnick)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment