サイトマップ 更新履歴 ニュース Elispセクション 利用手引

EmacsPortableApp

Last edit

Changed:

< ==== Selecting the Home directory with !EmacsOptions.exe ====

to

> ==== Selecting the Home directory with EmacsOptions.exe ====

Changed:

< == Running !EmacsPortable.App ==

to

> == Running EmacsPortable.App ==

Changed:

< == How !EmacsPortable.App Works ==

to

> == How EmacsPortable.App Works ==

Changed:

< === TODO Add !NotifyPlugin to the downloads. ===

to

> === TODO Add NotifyPlugin to the downloads. ===


Contents

  1. EmacsPortable.App Introduction
  2. EmacsPortable.App Idiosyncrasies
    1. Home Directory configuration
      1. USB home directory
      2. EXEDIR home directory
      3. Home if Exists
      4. System home directory
      5. Selecting the Home directory with EmacsOptions.exe
    2. Emacs-only directory aliases
    3. Font installation, if needed
      1. STARTED Allow Mac to install specific fonts.
  3. Running EmacsPortable.App
    1. Running Debug under windows
  4. Customizing and using your own packages
    1. Startup Customization
      1. Emacs Version
      2. Register Org-protocol
      3. Startup Font, Color, Geometry
      4. Proxy
      5. Setting Startup Environment variables
      6. Determining if Emacs Binaries should be zipped
      7. LiberKey Support
      8. Associations Support
    2. General Customization
  5. Full computer name:* bob.gnu.org
  6. Domain:* gnu.org
    1. Installing Additional Libraries
    2. Using Pre-installed libraries
    3. Load Path
    4. Literate Initialization
    5. Home Directory
  7. How EmacsPortable.App Works
    1. EmacsPortable.App Startup (Windows Only)
    2. Proxy Configuration (Windows Only)
    3. Fonts
      1. Windows
      2. Mac OS X
    4. DOS Version
  8. Using Specific Applications
    1. Adding Paths (Windows Only)
      1. General Paths
      2. Local Paths [local]
      3. Portable Paths [portable]
      4. Relative Paths [exedir]
      5. Info Paths
      6. Unix Manual Paths
    2. Java-based Apps
    3. Python based Apps
    4. Version control Software
      1. Bazaar
      2. Subversion in Windows
    5. SumatraPDF Portable
    6. GPG for encryption
    7. MikTeX Portable
    8. Unix Ports
      1. Cygwin
      2. MSYS
      3. GnuWin32
      4. EzWin
    9. PuTTY
      1. PuTTY and magit
      2. PuTTY and Tramp
      3. PuTTYPortable
      4. PuTTY and Proxy settings
  9. Icons
  10. Bleeding edge emacs
  11. EmacsPortable.App Wish List/TODO list
    1. TODO Add Mac Support of Daemon Mode
    2. TODO Add Mac Support of Portable Dictionaries
    3. TODO Make the proxy settings a little less finicky.
    4. TODO Add XML to the NSIS downloads
    5. TODO Add Large String support to the NSIS compiler.
    6. TODO Add md5 to the NSIS downloads
    7. TODO Add NotifyPlugin to the downloads.

EmacsPortable.App Introduction

EmacsPortable.App attempts to make a portable version of Emacs that runs off a USB drive under either Windows, or Mac OSX.

To install before a release, please follow [[*Using%20EmacsPortable.App%20before%20a%20release][the directions for using EmacsPortable.App before a release]].

EmacsPortable.App Idiosyncrasies

Home Directory configuration

The HOME Directory is where Emacs stores the .emacs file; Other emacs programs also store information here. EmacsPortable.App has a few options for home directories

USB home directory

If the DatainiEmacsPortableApp.ini file contains an ini Home Entry

  [EmacsPortableApp]
  Home=USB:/Documents/

The USB directory is changed for what EmacsPortableApp deems is the usb directory. This setting uses the PortableApps Documents Directory as the home-directory. This is slightly different depending on the platform.

The advantage of this methodology is that under windows, Emacs can be copied to the hard-drive to speed up the run-time, and the initialization from the hard drive

EXEDIR home directory

If the DatainiEmacsPortableApp.ini file contains an ini Home Entry

  [EmacsPortableApp]
  Home=EXEDIR:/Data/Home

The EXEDIR directory is changed for the base directory that EmacsPortable.App is run from.

The advantage to this methodology is that you can drag and drop Emacs and all your customizations will be dragged with it.

Home if Exists

If the DatainiEmacsPortableApp.ini file contains a full path, then the home is set when that file exists. For example:

  [EmacsPortableApp]
  Home=c:\

will set the home directory to c:\ on Windows computers. Currently, this is supported only on windows.

System home directory

If the DatainiEmacsPortableApp.ini file contains an ini Home Entry that doesn’t start with either EXEDIR:/ or USB:/, and doesn’t exist then the original home directory is maintained.

  [EmacsPortableApp]
  Home=Set as original

Selecting the Home directory with EmacsOptions.exe

When using EmacsOptions.exe, you do not have to worry about selecting which type of file is used. If you select a directory on the USB drive, the EmacsPortableApp is updated accordingly. If you select location within the portable app directory, the EXEDIR is replaced. Note that any where else may change depending on the computer you use.

Emacs-only directory aliases

Emacs has a list of aliases that are convinces, but do not correspond with an actual directory.

Alias True Directory Directory Purpose
tmpTemporary Directory Temporary Directory.
~ahk/Other/source/ahk AHK Sources Directory
~app/App/EmacsPortable.App Application Files
~doc/USB Drive:/Documents Documents Directory
~el-get Data/lisp/el-get El Git package Repository
~elpa/Data/lisp/elpa Elpa Package Repository
~ep/.EmacsPortable.App Directory
~h/System Home Directory System Home Directory
~ini/Data/ini EmacsPortable.App ini files
~kick/Data/lisp/kicker Kicker Directory
~nsi/Other/source/nsi NSIS Sources Directory
~pa/USB Drive:/PortableAppsPortable Apps
~rcp/Data/lisp/kicker/rcp extra el-get recipies Directory
~saves/Data/saves EmacsPortable.App Saves
~shared/Data/start/shared Shared Customizations
~site-lisp/App/site-lisp Site Lisp Directory
~snips/Data/snippets YaSnippets
~src/Data/src EmacsPortable.App lisp source files
~start/Data/start EmacsPortable.App Customizations
~system/Data/start/system System-based Customizations
~themes/Data/themes Emacs 24 Theme Directory
~usb/USB Drive USB Drive
~user/Data/start/user User-based Customizations

Other aliases are added ~el-get/package/elpa is changed to ~elpa, as if it were a symbolic link. Since symbolic links are not supported in windows, this is handled by emacs only.

Font installation, if needed

Will install specific fonts, if needed.

STARTED Allow Mac to install specific fonts.

Running EmacsPortable.App

Running Debug under windows

Under windows, debug mode starts gdb if found. Additionally, if App/gdbinit is found, gdb sources this before running emacs. You can download an appropriate gdbinit for emacs here.

Customizing and using your own packages

The settings in EmacsPortable.app were originally fork of the literate starter kit by Eric Schulte (some of my documentation text is probably reminiscent of . Now my philosophy is a little more liberal in providing a customized emacs that does not include too much startup customizations, but allow you to pull your own startup customizations if you wish, or test out other people’s startup settings.

The defaults built into the EmacsPortable.App are only the beginning of most users customization of Emacs to suite their needs. EmacsPortable.App provides provides a number of places for additional user and system specific customization. These are designed in such a way that it will be easy for you to continue tracking your own personal customization inside EmacsPortable.App while retaining your ability to pull down general updates to EmacsPortable.App without conflict.

Startup Customization

The EmacsOptions.exe allows you to set Emacs startup options via a GUI. This is mirrored in the DatainiEmacsPortable.ini file.

Emacs Version

This selects the version of Emacs that EmacsPortable.App will be running. This is useful if you run different versions of Emacs to possibly test lisp code, or use features not previously used.

Register Org-protocol

This registers Org-protocol and also associates org-protocol actions with adobe acrobat/adobe acrobat reader.

Startup Font, Color, Geometry

This allows the initial font/color and gemoetry options to be specified so that emacs will startup with these options enabled. These are called from the command line and do not affect the registry.

Proxy

This allows proxy settings to be dynamically determined based on your location. Your password is encrypted based on the location as well. This works on windows only.

Setting Startup Environment variables

By creating or editing an environment ini file at Data/ini/Environment.ini, startup environmental variables may be set. For example, if you use the colemak keyboard with the ergoemacs package, the following ini-file will set the ERGOEMACS_KEYBOARD_LAYOUT to the proper value

[Environment]
ERGOEMACS_KEYBOARD_LAYOUT=colemak

Determining if Emacs Binaries should be zipped

Emacs binaries can be zipped to save space. This requires that the emacs binaries are extracted to the temporary directory before running. I have found that running emacs in this manner is faster than running it on the USB stick alone. If not selected the binaries will run from the usb drive. If you are running EmacsPortable.App locally

LiberKey Support

EmacsPortable.App will add LiberKey File associations when it locates LiberKey, and the LiberKey support is checked. Note that you should restart LiberKey and make sure that the associations actually installed correctly.

Associations Support

EmacsPortable.App handles file associations in the following ways:

General Customization

echo $USER

If your configuration starts to feel cramped in a single file (although with the nested headlines of an Org-mode file, that could take a while) and you want to stretch your config’s legs, you can also create a directory named after your system user name, like Data/init/user/$USER. If a such a directory exists, it will be added to the load-path, and any elisp or org-mode w/embedded elisp files in it will be loaded.

hostname

In windows, the hostname is found by right-clicking on my-computer and clicking on Properties. After that, click on the Computer Name tab. This should have two properties:

Full computer name:* bob.gnu.org

Domain:* gnu.org

When the domain is removed from the Full computer name, the hostname is found. In this case, the host-name is bob.

If a specific setup for a host gets too cramped, you can also create a directory named after your system user name, like Data/init/user/$USER. If a such a directory exists, it will be added to the load-path, and any elisp or org-mode w/embedded elisp files in it will be loaded.

Installing Additional Libraries

  1. You can grab it’s source and place it directly in the /Data/src directory. Any packages found there will automatically be added to your load-path when Emacs starts up, and are guaranteed not to conflict with future updates.
  2. You can use el-get to install the package.

Note that el-get allows you to be more up-to-date since it usually syncs with the software developer’s repository. This is good and bad, so beware the bleeding edge. As a consequence, this requires command line versions of git and other package managers to be available to el-get.

Using Pre-installed libraries

Load Path

Load Path for source directory is in Data/src.

Literate Initialization

When using EmacsPortable.App’s startup mechanism, t

  1. Any .org, .el or .elc files in Data/init and loads them
  2. User-based .org, .el, or .elc files in Data/init/user.
  3. System based .org, .el or .elc files in Data/init/system.

Home Directory

How EmacsPortable.App Works

EmacsPortable.App Startup (Windows Only)

The Pseudo-Daemon Start-up script among other things:

This allows you to “close” out of Emacs while maintaining a running Emacs.

The startup script also sets the environment variable EMACS_SERVER_FILE to the temporary directory

$TEMP\ep\EmacsPortable.App-Server-$EMACS_VERSION\server

Subsequent calls to emacsclient.exe specify this server location. Therefore an emacs server can be run for each distinct emacs version

More information about the startup is found in site-start.org

Proxy Configuration (Windows Only)

EmacsPortable.App will setup the HTTPS_PROXY, HTTP_PROXY and FTP_PROXY based on the connection specific setup. To use a proxy, set it up with EmacsOptions.exe.

This is sufficient for some packages, but not for gnus.

The information is stored by the blowfish encryption algorithm. However the HTTP_PROXY environment variable will contain the password in clear text.

Fonts

Windows

Under windows the fonts in the Appfonts directory are temporarily installed by opening them using fontview (if they are not already installed on the base system). This is done by a autohotkey script. Once Emacs Exits, the fonts are “uninstalled” by closing the fontview window. Currently this is done by showing the window and then closing it.

Mac OS X

Currently unsupported.

DOS Version

The dos version starts up emacs in a dos command prompt window. When trying to do anything with the EmacsPortableDOS command, it will attempt to do that command in the initial DOS box. This is just a test environment, and is likely not very reasonable to use.

Using Specific Applications

Adding Paths (Windows Only)

Most of the specific applications work by adding paths and changing environmental variables. This is controlled by App/ini/paths.ini. EmacsPortableApp looks at the following sections

General Paths

Local Paths [local]

Local paths are paths that emacs checks that are locally available. They are specified by NAME=Local Path Snippet. An example of this is:

[local]
git=msysgit\msysgit\bin
git2=msysgit\bin
gitmsys=msysgit\msysgit\mingw\bin
gitmsys2=msysgit\mingw\bin

In this example git The following paths are checked:

  1. c:\msysgit\msysgit\bin
  1. %ProgramFiles%\msysgit\msysgit\bin

If they exist they are added to the path environment before starting emacs. If the directory in fact exists, then two additional ini sections are checked, [local.git.path] and [local.git.set].

For the git local setup, there are two sections. The first local.git.path is specified as follows:

[local.git.path]
git_install_root=msysgit\msysgit

Then each key is added to the environment putting the root location before the right handed value. In this case, the environmental variable is set to c:\msysgit\msysgit or %ProgramFiles%\msysgit\msysgit depending on which path was found.

The other type of section that is used is the [local.git.set]. In the case of git this section is defined as:

[local.git.set]
PLINK_PROTOCOL=ssh

Therefore, if git is found then the environmental variable PLINK_PROTOCOL is set to ssh.

Portable Paths [portable]

The portable paths are set in the same way as the local paths with the exception of the places they check for the existence of paths. The portable section checks for paths in USB:\, and USB:\PortableApps\.

Relative Paths [exedir]

The exedir section checks for paths relative to the portable application.

Info Paths

Emacs uses Info for most everything. You can add info paths that Emacs doesn’t know about by a similar manner as the general paths, above.

Unix Manual Paths

Java-based Apps

EmacsPortable supports PlantUML and ditaa for org-mode assuming that JavaPortable is installed.

PlantUML requires dot from GraphViz. Therefore, GraphVizPortable would need to be installed for PlantUML to work.

Python based Apps

By installing Python Portable into your PortableApps Directory, python is available to Emacs. This is useful for installing Bazaar, which Emacs uses as its version control.

Version control Software

Bazaar

I have created a portable Bazaar. There are some reports of troubling errors.

Subversion in Windows

Not quite portable, but you can get the binaries here.

Running in subversion from within EmacsPortable.App is portable, though. Emacs will set the %AppData% Environment variable to Data/AppData and set %ALLUSERSPROFILE% to Data/AppData

SumatraPDF Portable

Using AUCTeX inverse-search and forward search is supported with SumatraPDFPortable. There should be no set-up, EmacsPortable.App with setup both Emacs and SumatraPDFPortable.

GPG for encryption

EmacsPortableApp looks for the gpg package that is installed with Mozilla Thunderbird. First install Thunderbird Portable:

http://portableapps.com/support/thunderbird_portable

Then install gpg from here

http://portableapps.com/support/thunderbird_portable#encryption

MikTeX Portable

If you extract MikTeX portable to PortableApps/MikTexPortable/, EmacsPortable.App will be recognized and used.

Unix Ports

Cygwin

MSYS

Supports MSYS portable.

GnuWin32

EzWin

PuTTY

PuTTY and magit

Since magit and OpenSSH does not work correctly in windows, you can use PuTTY to connect to your host via plink. Note that you must connect to the host first via PuTTY or you will get one of the following error messages:

The server's host key is not cached in the registry. You
 have no guarantee that the server is the computer you
 think it is.
 The server's rsa2 key fingerprint is:
 ssh-rsa 2048 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00
 Connection abandoned.
 fatal: The remote end hung up unexpectedly

or

WARNING - POTENTIAL SECURITY BREACH!
 The server's host key does not match the one PuTTY has
 cached in the registry. This means that either the
 server administrator has changed the host key, or you
 have actually connected to another computer pretending
 to be the server.
 The new rsa2 key fingerprint is:
 ssh-rsa 2048 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00
 Connection abandoned.
 fatal: The remote end hung up unexpectedly

The information about setting up GIT to use putty are located here.

http://sitaramc.github.com/gitolite/contrib_putty.html

This is done automatically when running TRAMP.

Therefore, if you want to use magit for github, you need open puttyportable and attempt to open git@github.com so it can cache the host id.

PuTTY and Tramp

From Jeremy Engilsh there is a tutorial on how to get TRAMP to work with windows 2K. This is adapted from that tutorial.

EmacsPortable.App will download and setup the appropriate files for PuTTY portable, if you need them. In addition to putty.exe, you will need:

  1. Generate a Key

Use Puttygen to generate a key. Puttygen should be in the PuttyPortable application.

[[./Other/img/PuTTYKeyGenerator0.png]] [[./Other/img/PuTTYKeyGenerator1.png]]

  1. Save the public key

This is under File->Save Private Key

  1. Export the key to an open ssh key.

This is under Conversions->Export OpenSSH Key

  1. Copy the key to the server.

This can be done with a secure file transfer like FileZilla.

Or, if ssh is working for you, you can use the following shell command

scp key user@host:~/
  1. Log into the host and add to authorized keys
ssh example.server.com
mkdir ~./ssh
chmod 700 ~/.ssh
cat ~/key >> ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
rm ~/key
  1. Let EmacsPortable.App know about the key

Use EmacsOptions.exe to select the PuTTy key. If you want it to be portable keep the key on the USB drive OR in the executable directory.

  1. Run EmacsPortable.App.

EmacsPortable.App will start pageant.exe if it is not already running and set up tramp to use plink. This is done by the site-start.

PuTTYPortable

To use the settings of PuTTYPortable, you have to have a PuTTYPortable session open.

PuTTY and Proxy settings

PuTTY currently stores proxy settings in the registry. If EmacsPortable.App is started up AND PuTTY Pageant has not started up, then:

Therefore, you do not need to always manually edit proxy settings, and plink should work most of the time.

Icons

Icons came from various places:

Bleeding edge emacs

These are notes to use the bleeding edge emacs.

Goto the App directory, and under a command prompt that has bzr installed, type

bzr branch --stacked bzr://bzr.savannah.gnu.org/emacs/trunk emacs-bzr

EmacsPortable.App Wish List/TODO list

TODO Add Mac Support of Daemon Mode

[2011-12-14 Wed 21:48]

TODO Add Mac Support of Portable Dictionaries

(should be the same between platforms)

TODO Make the proxy settings a little less finicky.

TODO Add XML to the NSIS downloads

TODO Add Large String support to the NSIS compiler.

TODO Add md5 to the NSIS downloads

TODO Add NotifyPlugin to the downloads.