Posted on 09-08-2012
Filed Under (Technology) by bigbang

The Emacs configure file is put under HOME path by default. So, the only thing we need to do is to put .emacs into HOME path and Emacs works. But is it the best way to do it under Windows? Let me introduce three ways to do this job and I think you can find your best way.

The first way, we can change HOME path value

But by doing this, we also change the value of $HOME environment variable, and will affect Cygwin or some other applications which also need Windows HOME path to do something.

The second way, let Emacs load the specifc .emacs file

We don’t change the HOME path of Windows, but let default .emacs file to read our own Emacs configure file and reset Emacs HOME path in this file by Emacs lisp. Let me show you how to do it.

You can use C-x C-f command and open ~/.emacs file (by default, the file is under folder C:/Documents and Settings/water/Application Data).

If there is no such file under ~/ path, we can create .emacs file in Emacs: just open ~/.emacs file, modify the file and save it! You can also use _emacs instead. Then put following sentences in .emacs file:

(load-file "E:/water/.emacs")

File E:/water/.emacs is the real .emacs for our Emacs here, and we can put the real sentences which we want to use to load our Emacs. The first thing we need to do is to set the home path:

(setenv "HOME" "E:/water") 
(setenv "PATH" "E:/water") 
;;set the default file path 
(setq default-directory "~/") 
(add-to-list 'load-path "~/emacs/site-lisp")

The advantage of this method is very simple and we can backup .emacs file easily, and will never affect any other applications.

The third way, modify Windows Registry and add Emacs directory info

We can add this item to Windows Registry to let Emacs load specific .emacs file:

HKEY_LOCAL_MACHINE\SOFTWARE\GNU\Emacs\HOME=%emacs_dir%

Conclusion

We can use above three ways to set Emacs Home path, but what’s the sequence which Emacs will use to load configure file? The normal sequence is:

  1. If you have set the environment variable HOME, then Emacs will use HOME as root folder.
  2. If you have set the Regiestry item HKCU\SOFTWARE\GNU\Emacs\HOME, then Emacs will use this as HOME path. This method is not recommended because it will make all users share the same HOME path.
  3. If file C:\.emacs exits, then Emacs will use C:\.emacs to set variables. By doing this, Emacs can be compatible with older Emacs configure file.
  4. Use user’s AppData path as HOME path (usually, in Windows XP it is something similar to C:/Documents and Settings/water/Application Data). The user AppData path changes according to Windows Edition.

The second way is my best choice, simple and convenient.

(1) Comment    Read More   
Posted on 20-09-2010
Filed Under (Technology) by bigbang

I want to change the text colors in my Org files. I tried to use

M-x customize-group RET org-faces RET

to adjust text color settings.

By using this way, I can adjust colors of headlines leve 1 & 2 &3 and something else. But I just don’t know how to change plain text in my notes. The plain text means the body of my ordinary text entries.

I want to change it into yellow or something else. So I can protect my eyes.

By searching the result on the Internet, I think I can use this command:

M-x customize-face RET default RET

If you want to find the fonts of current text line in Emacs, just put your cursor on the text that you are interested in and say

M-x describe-face

That’s the face which you’ll need to customize.

Ordinary text is in the default face: Org does not define a face for it. So if you change it, you’ll change the appearance of text all through Emacs.

(0) Comments    Read More