emacs with perl auto completion

I have to admit that I am programming again. Yes, again, after five or six years. Again, I am still programming perl, still under emacs. Fortunately, the language doesn’t change a lot, so do emacs.

Ok, of course emacs, but we need do some modification to make it as a good IDE. There are two auto completion modes I can find on the net, let’s talk about the details.

  1. autocomplete
    This is a Japanese designed model which has popup menu to complete the keywords. Even the project was stop 3 years ago, but the mode is still useful.
    After reading hundreds documents through the Google and put around thirty some lines into the .emacs file, I still can’t make it work. Eventually I had to get back to read the official manual and just got a hint. It was only a hint instead of a solution, but it helped. The solution is easy, just extract the zip file into site-lisp folder, normally it’s under .emacs.d folder. Then put the following lisp into the .emacs:
     (add-to-list 'load-path "~/.emacs.d/site-lisp/auto-complete-1.3.1")
     (require 'auto-complete-config)
     (add-to-list 'ac-dictionary-directories "~/.emacs.d/site-lisp/auto-complete-1.3.1/dict/")

    Until now, it won’t work. You still need a perl dictionary which is a plain text reserved keywords list. The key point is how to name the file. The package already has several dictionaries under its own dict folder and named as css-mode, ruby-mode, and etc. NONE of them will work! You have to make a copy of the dictionary files into relative extension names. For example, python-mode file has to be a file named as "py". Perl dictionary isn’t the default and has to follow the file naming rule, I prepared a pl file for you, just save as it to dict folder.

  2. perl-completion

    This one isn’t as fancy as the above, but it’s much more useful for a programmer. It also lists the keywords but is at the bottom message area. It can do some sort of syntax analyst that’s why I prefer it. This one need three modes:




    and need the following to the .emacs:

    (add-hook 'cperl-mode-hook
                (require 'perl-completion)
                (perl-completion-mode t)))

    It won’t automatically load up, so you have to ‘M-x cperl-mode’ to active it.

  3. When use those together, autocomplete doesn’t require the dictionary file. Instead, the keywords list, aka the autocomplete source, will be provided by perl-completion. And following to the .emacs, the code in 1 and 2 has to be in consequence and 3 also.

    (add-hook  'cperl-mode-hook
               (lambda ()
                 (when (require 'auto-complete nil t) ; no error whatever auto-complete.el is not installed.
                   (auto-complete-mode t)
                   (make-variable-buffer-local 'ac-sources)
                   (setq ac-sources

Nepali Tea

这张纸是我的好友Catherine Houghton手写给我的,是尼泊尔茶的方子,现在故人仙去,特地找了出来,扫描录入,以兹纪念。

To make the tea spice mixture, combine these ingredients:

2 cardamom pod, seeded (remove + use the seeds, not the shell) – crush + grind

or ground cardamom powder

30 black pepper corns – grind

or ground black pepper powder

1 cinnamon stick 5 cm long

Or ground cinnamon powder

½ tsp. (el löffel) of ginger, ground

½ tsp. of nutmeg, ground

¼ tsp. of cloves, ground

Crush and grind these spices together.


1 cup milk

2 cups water

3 tablespoons (soupspoons) sugar

3 full tsps. dried mint leaves

1/8 tsp. tea spice mixture (or more, according to taste), from India or Nepal



Put milk, water, mint, sugar, tea spices, and tea leaves in a pan.

Bring to a slow boil, remove from heat, and strain through a sieve.

Put in a pre-wormed pot.


(or) – heat water to a boil, pour over tea leaves, and let them steep (soak) until water becomes tea.

Then heat milk, sugar, mint, and spices, but to not boil.

Pour milk mixture into tea, and allow to sit a few minutes.

Then strain out tea leaves and whole spices.