Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 03-16-2009, 09:55 AM   #1
Senior Member
Registered: Dec 2005
Location: Finland
Distribution: Slackware, CentOS, RHEL, OpenBSD
Posts: 1,006

Rep: Reputation: 37
Erc+bitlbee encoding problem (Lisp coding help needed)

I want to use bitlbee within emacs erc irc-client.
Problem is that erc uses ctext as default and bitlbee expects iso-8859-15 input so my umlauts show all wrong on others.
Manually setting the encoding isn't a good option as its window specific and all msn contacts open their own buffer so the encoding should apply to each of my buddies.

I didn't find any simple solution to it but thought that something like following would work.

Make a function that is called when connecting to bitlbee server to identify with server and to change encoding of each of my buddy to more appropriate one.

I don't know lisp so here's where I need the help. I got the basics of the function defined below but I don't know how to parse command output and assign it to a list.

Sample output of 'blist all' command:
<root> buddyName msn(  Offline
<root> buddyName2 msn(  Offline
;; add to erc-insert-pre-hook

;; call from hook when connecting to bitlbee
(defun set-bitlbee-encoding ()
  "Set encoding for each member in bitlbee buddylist"

  ;; list to hold buddies, for now just command window
  (setq buddies '("&bitlbee"))

  ;; how to make the commands run on bitlbee command window?
  ;; activate bitlbee account; run "identify <password>"
  (eval (read-from-string "(format t \"identify <password>\")"))

  ;; run 'blist all' and parse buddy names from it to buddies list
  (setq tempbuddies '(eval (read-from-string "(format t \"blist all\")")))
  (while tempbuddies
    (add-to-list 'buddies (nth 2 (split-string (car tempbuddies))))
    (setq tempbuddies (cdr tempbuddies)))

  ;; iterate through buddies and apply encoding to them
  (while buddies
    (add-to-list 'erc-encoding-coding-alist '((car buddies) . iso-8859-15))
    (setq buddies (cdr buddies))))

Last edited by Zmyrgel; 03-16-2009 at 10:52 AM. Reason: updated lisp code


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Some insight on whats going wrong [Not a coding problem, but concept problem] imoracle Linux - Newbie 5 11-13-2008 11:49 PM
Help: Problem writing simple LISP-function! raskol Programming 3 03-28-2008 06:20 PM
emacs lisp problem, how to force to add " to path parv Linux - Software 8 03-07-2007 05:22 PM
LISP or COMON LISP Compiler for Debian carspidey Programming 3 04-19-2006 07:46 AM
Lisp, emacs-lisp aizkorri Programming 1 09-04-2002 06:16 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:25 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration