Skip to content
Chris Freeman edited this page Oct 21, 2015 · 1 revision

Installing Emacs on Windows

Getting Emacs

Got to Emacs FTP page, select latest version. "i686" for 64-bit, "i386" for 32-bit.

Download: ftp://ftp.gnu.org/gnu/emacs/windows/emacs-24.5-bin-i686-mingw32.zip

Create Emacs Directory

  • Make new emacs directory, if needed, to match version: C:\emacs\emacs-24.5
  • Move downloaded zip file to this directory
  • Explore new directory
  • Using favorite unzip utility, unzip to this directory
    • Using Windows Unzip:
      • Right-click select "Extract All...""
      • Set extract to this directory: "C:\emacs\emacs-24.5"
    • Using 7-zip:
      • Right-click select "7-zip -> "Extract Here"

That's it. You can run emacs directly using "C:\emacs\emacs-24.5\bin\runemacs.exe"

See below for more setup.

Adding Emacs to Start Programs Menu

To find emacs using START -> All Programs, execute emacs addpm utility:

  • C:\emacs\emacs-24.5\bin\addpm.exe
  • Path defined should match bin parent directory: "C:\emacs\emacs-24.5"

Setting HOME directory

Emacs uses the HOME environment variable to find startup files. HOME is referenced in emacs using "~". To change HOME on Windows:

  • Select Start Button --> ThisPC --> Properties
  • In popup window, select "Advanced Properties" link
  • In 2nd popup window, select "Advanced" tab, "Environment Variables" button
  • In User Variables section:
    • select "HOME", then "Edit..." button,
    • if not present, select "New..." button
  • In 3rd popup window,
    • Enter Variable name: HOME
    • Enter Variable value: %USERPROFILE%
    • OK, OK, OK to save and exit
  • Restart Emacs

"~" now points to your C:\User<user> directory, instead of the "C:\User<user>\AppData\Roaming" directory

Emacs customization

Emacs customization can be placed in your home directory .emacs file

  • Edit the file ~/.emacs

  • Add these lines, to prevent accidental exit on C-x C-c

     ;; Make sure I don't accidentally leave Dodge
     (setq confirm-kill-emacs 'y-or-n-p)
    
  • Other useful settings:

     ;; Set column number mode by default
     (column-number-mode t)
     ;; Turn OFF tool-bar (-1 off; t on)
     (tool-bar-mode -1)
     ;; use visible flash for Ctrl-G bell (bell silent in some VMs)
     (setq visible-bell t)
     ;; Set column number mode by default
     (column-number-mode t)
    
  • Some of my Esoteric settings:

     ;; Allow narrowing buffer focus to region. bound to C-x n n (wide: C-x n w)
     (put 'narrow-to-region 'disabled nil)
     ;; Allow scrolling window left and right. bound to C-x < and C-x >
     (put 'scroll-left 'disabled nil)
     ;; Allow 'set-goal-column. bound to C-x C-n (unset with arg C-x C-n )
     (put 'set-goal-column 'disabled nil)
     ;; Turn OFF tool-bar (-1 off; t on)
     (tool-bar-mode -1)
     ;; Hide vertical scroll bars
     (scroll-bar-mode -1)
     ;; Change to sentence ending in a period-single-space for forward-sentence
     (setq sentence-end-double-space nil)
    
     ;; emacs debugger display level
     ;; choices: emergency : error : warning : debug
     (setq warning-minimum-level :error)
     ;; Do Not enter debugger on error
     (setq debug-on-error nil)
    
     ;;; Add additional auto-load-modes
     ;;; Markdown mode
     (add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode))
    

(created in markdown-mode. HTML produced with markdown-preview: C-c C-c p)