weblog d’un abbe


256 colors xterm

Filed under: Fun, Research — Tags: , , , , , , , , — abbe @ 1259

I’m using xterm in 256-color mode since a month. And I noticed that whenever I log in to any of the remote boxen (via ssh) from my xterm, I started getting WARNING: terminal is not fully functional, whenever I use less, screen, etc. curses applications. So this means xterm-256color (xterm in 256 color) terminfo is not available in the remote box. Now in most of the remote boxen, I don’t have superuser access, which means I can’t install this terminfo systemwide. So after going through terminfo(5) I figured out that I need to install this terminfo in my $HOME (at remote end) to get desired functionality. For that I did:

% ssh server mkdir -p .terminfo/x
% scp /usr/share/terminfo/x/xterm-256color server:.terminfo/x/

Thats it. Now I don’t get that warning anymore and I can use Emacs/vim in 256-colors :) . What more do you want from 256-colors life…:)


Ready to assassinate spam

Filed under: Experiments, Fun, Hacking — Tags: , , , , , — abbe @ 2136

Since a week or two, I noticed I suddenly started to get many spams (at the rate of around 10/day) delivered to my gmail inbox. I reported them every time, but that is of not much use. So tired of reporting spams, I started to create filters (in gmail) based on From address, ‘Subject’ etc. to delete them as soon they arrive, and I noticed that some of the ham mails also got deleted due to my filters. So, to get rid of this problem yesternight I installed SpamAssassin (which I’m afraid of installing earlier because I heard of its complex configuration) on my box integrated with postfix instance on my Gentoo GNU/Linux. The installation (thanks to portage) is very easy and integration with postfix is also quite easy and well documented on its wiki. And now, the best part, my SpamAssassin today recognized those mails as spam, which gmail‘s spam filters delivered into my inbox :).

Following is a Gnus hack to report spam as ham and ham as spam :

(defun my-gnus-mark-spam()
  (gnus-summary-save-in-pipe "spamc -L spam")
  ;; substitute "nnmaildir:spam" with the name of group holding "spam"
  (gnus-summary-move-article nil "nnmaildir:spam"))

(defun my-gnus-mark-ham()
  (gnus-summary-save-in-pipe "spamc -L ham")
  (gnus-summary-respool-article nil))

;; in summary mode use "B s" and "B h" keys to mark a mail as spam and ham
;; respectively for SpamAssassin to learn, and to also move to "spam" maildir
;; or respool mail accordingly
(define-key gnus-summary-mode-map (kbd "B s") 'my-gnus-mark-spam)
(define-key gnus-summary-mode-map (kbd "B h") 'my-gnus-mark-ham)

I could have used Gnus built-in spam filtering, but Gnus is not the only MUA I use ;) . Anyways, happy assassinating spam…;)



Filed under: Fun, Hacking, Yippee!! — Tags: , , , , — abbe @ 1035

/me has pasted "blog.el -- the blog client for posting to wordpress blogs" at http://paste.lisp.org/display/69993
/me has pasted "metaweblog.el -- an emacs lisp library to access metaweblog capable blogs" at http://paste.lisp.org/display/69994

Happy blogging…;)


Emacs OS capable of rendering PDFs

Filed under: Yippee!! — Tags: , , , — abbe @ 1201

Emacs OS capable of rendering PDFs


A Gnus Hack

Filed under: Hacking — Tags: , , , , — abbe @ 1317
;; Add to ~/.gnus
(defcustom my-inline-pgp-mails-list
  "List of email address which only accept inline-PGP signed mails"
  :type '(repeat string))

(defun my-list-all-recipients()
  "Lists all recipients in the current buffer"
  (let ((list-of-recipients)
        (list-of-emails '()))
    (setq list-of-recipients (split-string (concat (message-fetch-field "to") ","
                                     (message-fetch-field "bcc") ","
                                     (message-fetch-field "cc")) ","))
    (dolist (recipient list-of-recipients)
      (when (string-match "\\([[:alnum:].-]+@[[:alnum:].-]*\\)" recipient)
        (add-to-list 'list-of-emails (match-string 1 recipient))))

(defun my-sign-mail()
  "Sends a PGP signed mail depending on whether recipient allows PGP/MIME signed mails"
  (let ((recipients (my-list-all-recipients))
        (message-signed nil))
    (dolist (email my-inline-pgp-mails-list)
      (when (member email recipients)
        (message "Recipient found as %s" email)
        (setq message-signed t)
        (return t)))
    (unless message-signed

(add-hook 'message-send-hook 'my-sign-mail)

Above Emacs Lisp code allows one to send PGP signed messages, in the way preferred by recipient. e.g. There are some lists which don’t allow multipart/signed message, so in order to post to those lists, one needs to send inline PGP signed messages. This piece of code takes care of all that. All you need to do is to specify email addresses which don’t acceptmultipart/signed messages using M-x customize-variable my-inline-pgp-mails-list. Happy Gnusing… ;)

P.S. The code is also pasted at paste.lisp.org.


Devanagari script rendering in GNU Emacs

Filed under: Hacking — Tags: , , , , — abbe @ 0101

In one of my posting, I mentioned how, Emacs is able to render Devanagari script text flawlessly without any issue. But few days ago, I noticed that this is not true anymore. Rendering is not proper, probably something is broken between the builds, as I emerge emacs-cvs every two-three days. Following is the thumbnail of screenshot (click to enlarge) of issue I was facing.

Emacs 23 not rendering Devanagari text properly

I reported this issue on Emacs bugtracker. Anyways, I found a workaround against this issue after being pointed out by Kenichi Handa on how to view what font is used for rendering a particular character. C-u C-x = is the keybinding, just move your point to the desired character and do C-u C-x =. On my box, Emacs was using FreeSans (from GNU freefont) font to render the text. Probably, the appropriate font determination algorithm needs to be fixed in Emacs. Anyways, I hacked the following Emacs Lisp code for a workaround, which hints Emacs to use Lohit Hindi-11 Xft font:

(defun my-setup-hindi-rendering()
  "Setup Hindi rendering"
  (set-fontset-font "fontset-default"
		    (cons (decode-char 'ucs ?\x0900)
			  (decode-char 'ucs ?\x097f))
		    "Lohit Hindi-11"))

I’ve wrapped the code in defun, because I’m looking for a proper fix. So whenever I need to fix that Devanagari script rendering issue, I do M-x my-setup-hindi-rendering. Anyone who is experiencing similar issue, can try this and report any bugs. Happy operating Emacs system… ;)

UPDATE: As of now, this bug is fixed in Emacs CVS. I’m running GNU Emacs (x86_64-pc-linux-gnu, GTK+ Version 2.12.8) of 2008-05-29 on chateau .


ERC + ctrlproxy

Filed under: Hacking — Tags: , , , — abbe @ 1721

Following is the Emacs LISP code, I hacked for ERC to use ctrlproxy:

(defun setup-ctrlproxy()
  "Setup Emacs for using ctrlproxy"

  ;; socks.el is part of GNU Emacs 23
  (require 'socks)
  (setq socks-noproxy '("localhost"))
  (setq socks-override-functions 1)
  (setq erc-server-connect-function 'socks-open-network-stream)

  (setq socks-password "password")
  ;; ctrlproxy exposes itself a SOCKS 5 proxy
  (setq socks-server '("ctrlproxy" "localhost" "6680" 5)))

Now, whenever I want to connect to IRC (using ERC) via ctrlproxy, I simply do M-x setup-ctrlproxy which make ERC aware of ctrlproxy, then M-x erc to start ERC and at the IRC Server prompt I enter the name of the ctrlproxy network I want to connect to. Thats it. Happy, Emacsing… :)

Create a free website or blog at WordPress.com.