help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Buffer specific hide-list in ERC


From: Brian Adkins
Subject: Re: Buffer specific hide-list in ERC
Date: Mon, 03 Aug 2009 17:17:44 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (darwin)

Brian Adkins <lojicdotcom@gmail.com> writes:

> "Edward O'Connor" <hober0@gmail.com> 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/


reply via email to

[Prev in Thread] Current Thread [Next in Thread]