the-kenny / weechat.el

Chat via weechat's relay protocol in Emacs
177 stars 42 forks source link

Add nick completion prefix functionality (alist version) #43

Closed myrjola closed 8 years ago

myrjola commented 9 years ago

One common case is that a messaging service provides an IRC server (e.g. Flowdock and Gitter), but the mentions have to be prefixed with '@' to be highlighted in the other clients.

This is an alternative to PR #42. The nick prefix functionality is only meant for specific buffers, so it makes it natural to be able to attach prefixes only to certain buffers with regexp matching.

myrjola commented 9 years ago

One thing I noticed is that I would like the nick postfix functionality to be buffer specific as well. By using the nick prefix I now get "@nickname:" in certain buffers, while I would like to have "@nickname". Would it be better to define both the prefix and postfix in the same alist? Each element would be (BUFFER-NAME-REGEXP . (PREFIX POSTFIX)).

'((".*" . (nil ":"))
  ("gitter.*" . ("@" nil)))

This means that the default would be no prefix and ":" as postfix as is the current default. Or maybe the default values could still be in variables and the alist would only override those. What do you think?

myrjola commented 9 years ago

I also made the postfix buffer specific. weechat-complete-nick-postfix is the default, that can be overridden by including a postfix in the weechat-complete-nick-prefix-and-postfix-alist. The alist is now of the format (BUFFER-NAME-REGEXP . (NICK-PREFIX . NICK-POSTFIX)).

This introduces more complexity to the completion code for a minor use-case. PR #42 is simpler, but needs more configuration on the user's side to achieve the same thing. I'm fine either way.

the-kenny commented 8 years ago

I'm prefering this solution over #42. Merged as 910cb7!