Wednesday, October 12, 2011

Finding Emacs - Installation in Windows 7

v 0.2
12 Oct 11

Way back when I started to be interested in Emacs, I posted my installation adventures.  A year has passed, and even though I use Emacs on OSX and Linux, somehow a Windows Desktop has remained in a convenient place and I've often used Emacs on that.  I updated the XP system to Windows 7, and would have to say that if you do use Windows, upgrading would be a wise move.  One thing about Windows 7 that appeals to me is that it has become more "Unix-like" and that makes it easier to have something like Emacs on the go.

The "home" directory in Windows 7 is your username, so if your account is "jane" it would be

c:\Users\jane

I'm the only person who uses the machine, so I've found it convenient to put both the program directory and initialisation files in "jane".

First stop is the Gnu website and downloading the latest Windows version of Emacs.  At the moment it is 23.3.  Then download the manual.  The latest version at the time of writing is 23.3, so you will want to download  emacs-23.3-bin-i386.zip .  In general, when new versions come out, the one to get will be between 35-40 mb in size and with the format  " emacs-XX.x-bin-i386.zip ".  The archive will unzip into an "emacs-23.3" or whatever folder.  I just put this in the home directory as so:


c\Users\jane\emacs-23.3


The program to run is "C:\Users\jane\emacs-23.3\bin\runemacs.exe" .  I made a shortcut, and then pinned it to the taskbar.  Congratulations, you now have a bare-metal Emacs installation.


But wait ... there's more.


Create a new folder in your home directory called  "   .emacs.d  "  .  Note the periods.  In unix terms, the period at the beginning makes the file or directory invisible.  I believe in Windows there are some problems with the period at the beginning, though I've not seen any, and an underscore will suffice, but I've not looked at that.  So you have a new directory as so:


C:\Users\jane\.emacs.d


Inside this directory go initialisation files etc .. notably  " init.el ".  Here is a part of my init.el file to get you going.


-----------------------8<--------------------------------
 ;==================================================
;
;        Geoff's Init.el file
;
;==================================================

(setq inhibit-startup-screen t)

;=================================
;
;         Org Mode
;
;=================================

(add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode))
(global-set-key "\C-cl" 'org-store-link)
(global-set-key "\C-ca" 'org-agenda)
(global-set-key "\C-cb" 'org-iswitchb)
(add-hook 'org-mode-hook 'turn-on-font-lock)  ; Org buffers only
;
;;(org-remember-insinuate)


;=================================
;
;         Mobileorg
;
;=================================

;; Set to the location of your Org files on your local system
(setq org-directory "~/org")
;; Set to the name of the file where new notes will be stored
;  Filename can be anything you like.
(setq org-mobile-inbox-for-pull "~/org/mobileorg.org")
;; Set to /MobileOrg.
;; Should be as below.  Windows has recently changed to just "Dropbox".
(setq org-mobile-directory "~/Dropbox/MobileOrg")
;  All "index.org" does is set the variable below.
(setq org-mobile-files (quote ("A380Notes.org")))


;=================================
;
;         Yasnippet

;  Requires yasnippet to be installed
;
;=================================

(add-to-list 'load-path
              "~/.emacs.d/plugins/yasnippet-0.6.1c")
(require 'yasnippet) ;; not yasnippet-bundle
(yas/initialize)
(yas/load-directory "~/.emacs.d/plugins/yasnippet-0.6.1c/snippets")

;; Develop and keep personal snippets under ~/emacs.d/mysnippets
(setq yas/root-directory "~/.emacs.d/plugins/mysnippets")

;; Load the snippets
(yas/load-directory yas/root-directory)



;======================================================================
;
;    Encryption - symmetric gpg
;
; this requires gpg be installed, available from  http://www.gnupg.org/
; To open a " .gpg " file, it will ask for password twice
; To close, will ask for password once.
;
;======================================================================

(require 'epa)
(epa-file-enable)

;======================================================================
;
;             Predictive
;
;         http://www.dr-qubit.org/emacs.php
;
;======================================================================

(setq load-path (cons "~/.emacs.d/plugins/predictive" load-path))
(autoload 'predictive-mode "predictive" "predictive" t)

;======================================================================
;
;;                    Aspell
;
; GNU Aspell is available from: http://aspell.net/
;
;======================================================================

(setq-default ispell-program-name "c:\\Pro\\Aspell\\bin\\aspell.exe")


;=================================
;
;    Norton Commander

; nc.el
;
;=================================

(add-to-list 'load-path "~/.emacs.d/plugins")
(autoload 'nc "nc" "Emulate MS-DOG file shell" t)

;=================================
;
;    Midnight Commander

; mc.el
;
;=================================

(add-to-list 'load-path "~/.emacs.d/plugins")
(autoload 'mc "mc" "Emulate MS-DOG file shell" t)


;=================================
;
;    longlines

;    plugins already in load path

;
;=================================
; (add-to-list 'load-path "~/.emacs.d/plugins")
   (autoload 'longlines-mode
     "longlines.el"
     "Minor mode for automatically wrapping long lines." t)

 
-----------------------------------8<-----------------------------------------

Now much of what I've loaded extra are emacs lisp files I've found, particularly on the Emacs wiki.  I would start with the top couple of customisations, (Orgmode) and go from there.  Longlines.el is readily available on the internet and I'd install that alongsside the init.el file (if you are not going to add to the load path).

Longlines

A word about wordwrap.  What people think of as word-wrap does not exist by default in Emacs.  Visual-line mode and longlines combined give what we think of as proper wordwrap.

This is what I have at the start of my orgmode emacs files:

# -*- mode:org ; mode:visual-line ; mode:longlines -*-

It is a comment with instructions to Emacs to initiate the appropriate modes.


That's it for now



Later ..............

No comments:

Post a Comment