unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Buffer specific hide-list in ERC
@ 2009-08-03 15:17 Brian Adkins
  2009-08-03 18:40 ` Edward O'Connor
       [not found] ` <mailman.3778.1249324869.2239.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 7+ messages in thread
From: Brian Adkins @ 2009-08-03 15:17 UTC (permalink / raw)
  To: help-gnu-emacs

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.

Is there a way to accomplish this?

-- 
Brian Adkins
http://lojic.com/


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Buffer specific hide-list in ERC
  2009-08-03 15:17 Buffer specific hide-list in ERC Brian Adkins
@ 2009-08-03 18:40 ` Edward O'Connor
       [not found] ` <mailman.3778.1249324869.2239.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 7+ messages in thread
From: Edward O'Connor @ 2009-08-03 18:40 UTC (permalink / raw)
  To: Brian Adkins; +Cc: help-gnu-emacs

> 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.




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Buffer specific hide-list in ERC
       [not found] ` <mailman.3778.1249324869.2239.help-gnu-emacs@gnu.org>
@ 2009-08-03 19:54   ` Brian Adkins
  2009-08-03 21:17     ` Brian Adkins
  0 siblings, 1 reply; 7+ messages in thread
From: Brian Adkins @ 2009-08-03 19:54 UTC (permalink / raw)
  To: help-gnu-emacs

"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.

-- 
Brian Adkins
http://lojic.com/


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Buffer specific hide-list in ERC
  2009-08-03 19:54   ` Brian Adkins
@ 2009-08-03 21:17     ` Brian Adkins
  2009-08-04 22:25       ` Brian Adkins
  0 siblings, 1 reply; 7+ messages in thread
From: Brian Adkins @ 2009-08-03 21:17 UTC (permalink / raw)
  To: help-gnu-emacs

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/


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Buffer specific hide-list in ERC
  2009-08-03 21:17     ` Brian Adkins
@ 2009-08-04 22:25       ` Brian Adkins
  2009-08-04 23:06         ` Johan Bockgård
       [not found]         ` <mailman.3894.1249427215.2239.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 7+ messages in thread
From: Brian Adkins @ 2009-08-04 22:25 UTC (permalink / raw)
  To: help-gnu-emacs

Brian Adkins <lojicdotcom@gmail.com> writes:

> [...]
> 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.

It turns out this isn't working as well as I thought. It does set the
variable local to the buffer (as verified by C-h v), but some messages
that I wanted to see were still being hidden even with erc-hide-list
being nil in the buffer.

I tried flipping it so that the default was nil and I set it to the
list above for all channels other than the ones in which I wanted to
see the messages. As an example:

--- snip ---
erc-hide-list is a variable defined in `erc.el'.
Its value is 
("JOIN" "PART" "QUIT" "MODE" "NICK")

Local in buffer #foo; global value is nil
--- snip ---

But I was still seeing "quit", "nick", etc.  messages in the channel.

I suppose it has something to do with erc-hide-list being incompatible
with the buffer local mechanism.

-- 
Brian Adkins
http://lojic.com/


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Buffer specific hide-list in ERC
  2009-08-04 22:25       ` Brian Adkins
@ 2009-08-04 23:06         ` Johan Bockgård
       [not found]         ` <mailman.3894.1249427215.2239.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 7+ messages in thread
From: Johan Bockgård @ 2009-08-04 23:06 UTC (permalink / raw)
  To: help-gnu-emacs

Brian Adkins <lojicdotcom@gmail.com> writes:

> I suppose it has something to do with erc-hide-list being incompatible
> with the buffer local mechanism.

When ERC reads the value of erc-hide-list (in erc-display-message), it
has not (necessarily) made current the buffer where the message is going
to be displayed (which can actually be a list of buffers).





^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Buffer specific hide-list in ERC
       [not found]         ` <mailman.3894.1249427215.2239.help-gnu-emacs@gnu.org>
@ 2009-08-05 11:57           ` Brian Adkins
  0 siblings, 0 replies; 7+ messages in thread
From: Brian Adkins @ 2009-08-05 11:57 UTC (permalink / raw)
  To: help-gnu-emacs

bojohan+news@dd.chalmers.se (Johan Bockgård) writes:

> Brian Adkins <lojicdotcom@gmail.com> writes:
>
>> I suppose it has something to do with erc-hide-list being incompatible
>> with the buffer local mechanism.
>
> When ERC reads the value of erc-hide-list (in erc-display-message), it
> has not (necessarily) made current the buffer where the message is going
> to be displayed (which can actually be a list of buffers).

Thanks - I think that explains what I was seeing. 

It appears that erc-display-message is the *only* place that
erc-hide-list is referenced, so if I felt strongly about it I think it
would be straightforward to patch it to work the way I'd like.

-- 
Brian Adkins
http://lojic.com/


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-08-05 11:57 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-03 15:17 Buffer specific hide-list in ERC Brian Adkins
2009-08-03 18:40 ` Edward O'Connor
     [not found] ` <mailman.3778.1249324869.2239.help-gnu-emacs@gnu.org>
2009-08-03 19:54   ` Brian Adkins
2009-08-03 21:17     ` Brian Adkins
2009-08-04 22:25       ` Brian Adkins
2009-08-04 23:06         ` Johan Bockgård
     [not found]         ` <mailman.3894.1249427215.2239.help-gnu-emacs@gnu.org>
2009-08-05 11:57           ` Brian Adkins

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).