Powered by SmartDoc
ENGLISHJAPANESE

Preparing your working environment

Overview: If you have worked longer with Unix than with Windows, you probably want to build some similar environment to Unix on your machine. This chapter explains how to build a Unix-like environment on you Windows9X. You will install the following products:

  1. Cygwin tools and utilities to build a Unix-like environmenton on Windows9X
  2. Meadow 1.1 (an Emacs-20 ported to Windows9X/NT)

Cygnus

Cygnus project provides us with GNU development tools and utilities on Windows9X, allowing us to work on Windows9X as if we were on Unix. We will install the latest version, Cygwin-1.1.X. (as is on the 15rh June, 2000)

Making a directory for downloading

To download the package, you need an empty directry to which the setup program imports all the files (mostly, a gzipped tar file) necessary to install Cygnus. We assume that you make a directry, C:\tmp\cygnus, on your PC for installation using DOS-Window as shown below. (You can of course open 'my computer' window to create the new directories under C drive.)

Making c:\tmp\cygnus directory under C drive
Microsoft(R) Windows 98
	(C)Copyright Microsoft Corp 1981-1999

C:\WINDOWS>cd ..

C:\>mkdir tmp

C:\>cd tmp

C:\tmp>mkdir cygnus

Downloading and installation

  1. Visit Cygnus page for a link to the list of mirror sites.
  2. Choose the nearest site to you. You are brought into the site, e.g., University of Aizu, upon clicking.
  3. Open the folder called latest, e.g., latest at University of Aizu, to download setup.exe to the directory, C:\tmp\cygnus, on your PC.
  4. Click or execute setup.exe you have downloaded. You are then prompted to type in your Root directory. The default is, C:\cygnus. Type Return key if you are fine with the default setting. (You have to type in the directory name by yourself if the directory proposed by the installer is different from C:\cygnus.)
    Setting the root
    This is the Cygwin setup utility (v1.45.2.3),
    built on Jun  8 2000 12:08:45.
    
    Use this program to install the latest version of the Cygwin Utilities
    from the Internet.
    
    Alternatively, if you already have already downloaded the appropriate files
    to the current directory (and subdirectories below it), this program can use
    those as the basis for your installation.
    
    If you are installing from the Internet, please run this program in an empty
    temporary directory.
    
    Press <enter> to accept the default value.
    Root directory? [C:\CYGNUS] 
    
  5. You are subsequently asked if you download all the files through net or you have already those files on your PC. Choose to download them through net by typing [i] if you have not downloaded the files beforehands. You are prompted to choose a site for downloading. Type [d] if the installation is second or more time and you keep those files on your PC.
  6. Cygnus is installed automatically after downloading those files. Check if the followings appear under C:\cygnus to confirm your installation:

Settings

You can proceed to setting values to variables. You might however want to use Emacs to edit files. If you prefer using Emacs to other editors available on Windows9X, install Meadow now (See below).

Meadow

Meadow is the emacs-20 ported to Windows9X/NT by Hisashi Miyashita.

Making your HOME directory

You have to set your home to some directory to install Meadow. We assume that you use C:\cygnus\home as your home directory. Create the directory as below if you use DOS-Window.

Making c:\cygnus\home directory using DOS-Window
Microsoft(R) Windows 98
	(C)Copyright Microsoft Corp 1981-1999

C:\WINDOWS>cd ..

C:\>cd cygnus

C:\cygnus> mkdir home

You can alternatively make C:\cygnus\home using BASH. Invoke BASH to type 'mkdir /home' if you choose this way. Beaware that you do not need to specify your home as 'C:/cygnus/home' because the ROOT directory is already set to 'C:\cygnus' within BASH when you downloaded those files from net. (1) That is, '/' in BASH corresponds to 'C:\cygnus' on Windows9X.

Making c:\cygnus\home directory using BASH
C:\cygnus\bin>
BASH.EXE-2.04$ mkdir /home

A shortcut to cygwin.bat

You will need to invoke BASH frequently. It is thus better to put a short cut to C:\cygnus\bin\cygwin.bat on your desktop. Click the icon of cygwin.bat with the right button to choose the item to make a shortcut to the batch file. Drug the shortcut to your desktop.

Downloading

A gzipped tar file, Meadow-1.10-i386.tar.gz, for Meadow Win32-Intel binary package is available from Vector . The current version is 1.10. Click the link at right bottom to open a window for download. Then, click the button, [Ftp Download] to import the gzipped file. Be patient as the file size is about 17MB.

Installation

  1. We need to use Cygwin tools to install Meadow on our PC. Double-click the shortcut to cygwin.bat if you have already created it on your desktop. Execute otherwise 'C:\cygnus\bin\cygwin.bat' to invoke BASH. You can either double-click the file in window or execute it directly from the [start] buttom by specifying the file name in the dialogue window. Upon execution, you will see a window named BASH appearing on the screen.
  2. Try pwd in the window. The current directory must be shown as /usr/bin. You are actually looking at C:\cygnus\usr\bin.
  3. Move to /usr/local/lib by typing 'cd /usr/local/lib' and the return key. We are going to install Meadow in this directory.(2)
  4. Place Meadow-1.10-i386.tar.gz under C:\cygnus\usr\local\lib. You can use cp or mv command on BASH to place the file there. You can alternatively drag the icon to the folder on Windows9X.
  5. Type 'tar xvfz Meadow-1.10-i386.tar.gz' under '/usr/local/lib'. The files are then extracted and installed under the directory.
  6. Check if the directory, Meadow, is successfully created under /usr/local/lib. You can remove the archive file, Meadow-1.10-i386.tar.gz, if you like to clean up.
  7. Move to /usr/local/lib/Meadow/1.10 to execute 'install.exe'. A window is opend upon clicking, asking you to specify your HOME directory. Type in C:\cygnus\home to tell the installer that your HOME directory is set to the directory. Note that you MUST specify your HOME. (Beaware also that 'cygnus' and 'home' are case-sensitive.) The installation will otherwise fail.
  8. The binaries are installed and a window is opened titled C:\Windows\StartMenu\Program\Meadow. Click the icon, Meadow.lnk, to see if Meadow works.
  9. Finally, we link the executable, '/usr/local/lib/Meadow/1.10/Meadow95.exe', to our bin directory, i.e., '/usr/local/bin', as 'emacs.exe'. Once we set our path to the directory, we can invoke emacs from anywhere by typing 'emacs'.
    Link Meadow95.exe to /usr/local/bin/emacs.exe
    BASH.EXE-2.04$ cd /usr/local/bin
    BASH.EXE-2.04$ ln /usr/local/lib/Meadow/1.10/Meadow95.exe emacs.exe
    
  1. We have been recommended to create our HOME as C:\home, but I believe it is easier to move to HOME if you set it to C:\cygnus\home because you can specify your home just as /home in BASH. You only need, for example, to type 'cd /home' to move to your HOME on BASH. It is also good for us to enclose our UNIX-like environment to C:\cygnus, separate it from other directories.
  2. It is of course up to you in which directory you will install the package. Other directories such as '/usr/local/share' as is employed on Solaris or '/usr/share' as is employed on Linux, are as well acceptable. I like to install tools for my own into a directory that Cygnus does not keep any file, say, the directories under '/usr/local'.

Settings

To use Meadow, you have to set your HOME among others. We are going to edit AUTOEXEC.BAT to edit environment variables. Some parameters may be easily set within $HOME/.bashrc. We conclude this chapter with a note on $HOME/.emacs. I found most settings presented in this section at various sites. (Thank you guys, and I am sorry that I cannot list up all your names here. Too many to name, even to recall.).

Editing AUTOEXEC.BAT

You need to set your HOME to c:\cygnus\home. Time zone should also be set to yours. You can optionally set your your path to the bin directories of cygnus if you would like to invoke the shell within DOS-Windows or Emacs, too. (You do not need to do so if you only use the shell within Cygnus window because the path is specified in /bin/cygwin.bat.)

Variables to be added to AUTOEXEC.BAT
REM ---
REM --- Time Zone is set to that of Japan
REM ---
set TZ=JST-9

REM ---
REM --- your home directory
REM ---
set HOME=c:\cygnus\home

REM ---
REM --- Below is optional
REM ---
set PATH=.;c:\cygnus\bin;c:\cygnus\usr\local\bin;%PATH%

Memo: We had to set the variables, TMP, SHELL, and MAKE_MODE, by ourselves in beta version, but it seems that we no longer need to set those variables because the values are set by Cygnus.

Editing .bashrc

You can tune your BASH by editing .bashrc in your HOME directory. Following is my recommendtation. After editing AUTOEXEC.BAT and $HOME/.bash, you restart your PC so that the change takes effect.

A mininal definitions for .bashrc
# --- set prompt
PS1='\w> '

# --- set EDITOR
EDITOR="c:/cygnus/usr/local/lib/Meadow/1.10/bin/Meadow95.exe"
export EDITOR

# --- as you like
alias ls='ls -F'
alias cp='cp -i'
alias rm='rm -i'
alias mv='mv -i'
alias del='/bin/rm -f \!*'
alias h='history 20'
alias more=less
alias clear='COMMAND.COM /c cls'

How to close BASH window when you exit?

Would you like the BASH window to close when you exit? Click the shortcut icon on your desk top to cygwin.bat with Right button and select [property] from the popup menu. A window listing up the properties of shortcut is displayed. Select the tub, [program]. There is an option in the menu to close the window when exit. Check it and select [ok] to finish the setting. Open a BASH window and exit by typing c-d. The window is now closed when you exit.

Editing .emacs

We can control the behaviour of Meadow by editing $HOME/.emacs. We go through some useful definitions.

Set the load-path to site-lisp and TMP in .emacs

Some emacs-lisp programs are under /usr/local/lib/Meadow/site-lisp.

Set load-path
;
; Set load-path to site-lisp and TMP
;
(setq load-path
      (cons (expand-file-name
	    (concat exec-directory "/cygnus/usr/local/lib/Meadow/site-lisp"))
	    load-path))

(setenv "TMP" "/tmp")

Set your shell to bash

To envoke BASH within Meadow by typing [M-x shell], you must include the following lines into your .emacs file.

Set your shell to bash in .emacs
;;;
(setq shell-command-option "-c") 
;
;--- from FAQ u-tokyo
;
(setq explicit-shell-file-name "/cygnus/bin/bash.exe")
(setq shell-file-name "bash.exe")

Other useful definitions

To go to Home when you start Meadow
;
; To start mule from the home directory
;
(cd "~")

To change the color of cursor in IME-mode (from FAQ u-tokyo)
(add-hook 'mw32-ime-on-hook 
		  (function (lambda () (set-cursor-color "red"))))
(add-hook 'mw32-ime-off-hook 
		  (function (lambda () (set-cursor-color "black"))))

Key bindings
; my favourite
(global-set-key "\C-h" 'backward-delete-char)
(global-set-key "\M-?" 'help-for-help)

My favourite settings
; variables
(setq inhibit-startup-message t)

;
; some settings to my taste
;
(setq-default fill-column 68)
(global-set-key "\C-cg" 'goto-line)
(setq visible-bell t)
(setq display-time-day-and-date t)
(setq default-tab-width 4)
(setq search-highlight t)
(setq query-replace-highlight t)

To hilite characters
;;;
;;; hilit: change colours to improve visibility of characters
;;;
(cond (window-system
       (setq hilit-mode-enable-list  '(not text-mode)
             hilit-background-mode   'light
             hilit-inhibit-hooks     nil
	     hilit-inhibit-rebinding nil)
       (require 'hilit19)))
;
; to hilite regions (from FAQ u-tokyo)
;
(transient-mark-mode 1)

To use ange-ftp
(setq ange-ftp-ftp-program-name "/cygnus/usr/local/lib/Meadow/1.10/bin/ftp.exe")
; (setq ange-ftp-generate-anonymous-password "yourID@Domain")

To fix the problem when you access to Solaris using ange-ftp
(setq dired-move-to-filename-regexp
      (let* ((l "[A-Za-z\xa0-\xff]")
	     (k "[^\x00-\xff]")
	     (s " ")
	     (yyyy "[0-9][0-9][0-9][0-9]")
	     (mm "[ 0-1][0-9]")
	     (dd "[ 0-3][0-9]")
	     (HH:MM "[ 0-2][0-9]:[0-5][0-9]")
	     (western (concat l l l s dd s "\\(" HH:MM "\\|" s yyyy "\\)"))
	     (japanese (concat mm k " " dd k s
			       "\\(" s HH:MM "\\|" yyyy k "\\)")))
	(concat s "\\(" western "\\|" japanese "\\)" s)))
(eval-after-load 
 "ange-ftp"
 '(progn
    (setq ange-ftp-date-regexp
	 (let* ((l "[A-Za-z\xa0-\xff]")
		(k "[^\x00-\xff]")
		(s " ")
		(mm "[ 0-1][0-9]")
		(dd "[ 0-3][0-9]")
		(western (concat l l l s dd))
		(japanese (concat mm k s dd k)))
 	    (concat s "\\(" western "\\|" japanese "\\)" s)))))