From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Brian Adkins Newsgroups: gmane.emacs.help Subject: Re: Buffer specific hide-list in ERC Date: Mon, 03 Aug 2009 17:17:44 -0400 Organization: A noiseless patient Spider Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1249349624 17142 80.91.229.12 (4 Aug 2009 01:33:44 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 4 Aug 2009 01:33:44 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Aug 04 03:33:37 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MY8uG-0001ki-Bj for geh-help-gnu-emacs@m.gmane.org; Tue, 04 Aug 2009 03:33:36 +0200 Original-Received: from localhost ([127.0.0.1]:58139 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MY8uF-0003kS-QS for geh-help-gnu-emacs@m.gmane.org; Mon, 03 Aug 2009 21:33:35 -0400 Original-Path: news.stanford.edu!headwall.stanford.edu!news.glorb.com!news2.glorb.com!newsfeed.straub-nv.de!feeder.eternal-september.org!eternal-september.org!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 49 Original-X-Trace: news.eternal-september.org U2FsdGVkX1/OcL1idOf/1EWxNwWhF1fefwHMCnf/AZjtGRJXnLsFsCyVkIZ0I+pq56s9dG1yFl6D8etAC4J8K8X33Z10O/mxx3OQwOlrk89B2cPL9HosydTrRltYQZEiterjiQgUFHpzfJK4J+od4A== Original-X-Complaints-To: abuse@eternal-september.org Original-NNTP-Posting-Date: Mon, 3 Aug 2009 21:25:22 +0000 (UTC) X-Auth-Sender: U2FsdGVkX1+nQ7DCnfjsH2qXJRoKzjjr4g3iRxYYDhA= Cancel-Lock: sha1:964IkYALMEA7nkki/gV74MrSyrA= sha1:E3gK879p6pCjSHV3S7po1wNkGUQ= User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (darwin) Original-Xref: news.stanford.edu gnu.emacs.help:171532 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:66716 Archived-At: Brian Adkins writes: > "Edward O'Connor" writes: > >>> I just discovered the way to hide certain IRC messages in the Emacs >>> ERC client via erc-hide-list; however, I've been unable to find a way >>> to do this for specific channels/buffers. >>> >>> In other words, I'd like to hide 'join', 'part', 'quit', etc. in my >>> higher traffic channels, but I'm in a few low traffic channels where >>> it would be handy to see that a person has joined. >> >> You could make the variables be buffer-local, and set them to >> different values via a hook. > > Thanks. > > The help for make-variable-buffer-local recommends using > make-local-variable. The latter accepts one argument - the name of the > variable, so it appears to depend on some sort of context to determine > which buffer in which to make the variable local i.e. I can't pass in > a reference to a buffer. > > The ERC doc shows a erc-join-hook which states the function is called > w/o arguments and the current buffer is set to the buffer of the new > channel. So if I can just figure out how to determine which channel is > associated with the current buffer, the rest should be easy :) > > buffer-name might be sufficient since it looks like the buffer name > begins with the name of the channel. On the off chance that this is useful to anyone else. Here's the code I came up with to set the erc-hide-list variable for a specific channel: ; Set the global variable to hide the list of message types (setq erc-hide-list '("JOIN" "PART" "QUIT" "MODE" "NICK")) (add-hook 'erc-join-hook (lambda () (if (equal "#MyIRCChannel" (buffer-name)) (set (make-local-variable 'erc-hide-list) '())))) Thanks Edward for pointing me in the right direction. It's amazing how extensible and well thought out Emacs is. -- Brian Adkins http://lojic.com/