Another little emacs tip. The tip is about how to edit files that requires admin privilege.

Often, you want to edit a file that requires admin privilege. So, either you start another emacs instance as root, or, modify the file's permission first with sudo then edit then modify it back. Both solutions are painful.

Starting another emacs instance is slower, and you also need to navigate to the dir path. Edit permission bits is error prone and dangerous. You have to carefully remember what was the original perm bits.

When i was a full time unix sys admin, i usually always keep a instance of emacs as root, with different colored background. But this is also not a optimal solution. Often i need to login to several remote machines. Starting another instance as root is too much manual overhead, and may ends up too many terminal windows.

PS the above works in unixes only (including Linuxes and Mac OS X). How does one do on Windows? If you know, please post! Concrete solution that you actually use is preferred.

2010-04-17

Little tips about calculating dates.

I needed to find the date of 2010-04-17 minus 200 days. How do you do it in emacs?

Start calendar mode by tying 【Alt+x cale Enter】. In calendar mode, the left arrow moves you back. But it also takes a universal argument of n to go back n days. So, type 【Ctrl+u 200 ←】 will put you 200 days back.

When your cursor is in the calender pane, there are these new menus: Scroll, Goto, Holidays, Diary, Sun/Moon. Check them out! I've been using emacs for 12 years, but never realized this!

A new version of AutoHotkey Mode For Emacs is out. This version fixes a defect where if the source code contains “"C:\"”, then everything after is badly syntax colored.

2010-02-13

A new report: Emacs's Command Frequency. This report is a major update from the one in 2007, with data size that's 20 times larger. It took some 16+ hours to do this report, most time is spent on thinking and re-writing the Python script that generates the report. (i thought it was just gonna be some 2 hours)

If your are running Microsoft Vista, and you use emacs to edit files in the C:\Program Files\ or c:\Program Files (x86)\ dir, and without admin privilege, Windows will automatically create them in $HOME\AppData\Local\VirtualStore\. This may be very confusing, because dired will show a certain file you have in the program dir, but it doesn't exist when you use shell to look for it. For detail, see: Windows Vista VirtualStore Problem.

I very like the default style of PHP lanuage on Notepad++, hope I can use them on GNU Emacs.

Yes.

i don't recommend it because emacs's font style for programing lang
keyword types are used across all langs. For example, function is
blue, strings is a bit orange, coments are red, etc., for all
langs. Also, emacs's font face coloring are designed so it's also
usable when in 8-color terminal.

anyway, to do what you want, do Alt+x customize-group, then give “font-lock-faces”. There, you can use the mouse to select and change.

When you use a hook, it is best to define it as a function, then add that to hook, instead of using a lambda. Let me explain… (archived at: Emacs Tips Collection.)

2009-12-31

Starting a Dedicated Emacs Blog

Am starting this emacs blog. Often, i have random tips or notes i want
to write down. Too small to be part of tutorial, but still useful even
to myself later. This blog also serve as news update for my emacs tutorial.
I have a main blog but that is not focused on emacs topic. Many people
are interested in my emacs news but not others. So, this emacs blog will
help.

What follows are emacs related stuff from my main blog in the past 4 months. I put them here to start with, and also gives some sense of the topics in this blog.