Emacs Integration

Factor ships with FUEL, which is a powerful Emacs mode which communicates with a runing Factor instance and provides semantic editing and navigation features.

Quickstart for Mac OS X Emacs

See Emacs Integration on OS X.

Quickstart for Windows Emacs

Download emacs-w32 and install it to "\Program Files\Emacs" or "\Program Files(x86)\Emacs". Factor will autodetect it from these locations.

Make a .emacs with your path to FUEL:

;;; Factor
(load-file "d:/Program Files/factor/misc/fuel/fu.el")

Run Factor, and copy the .emacs file to both "HOME" os-env . and "HOMEPATH" os-env .

USE: editors.emacs

Your emacs should now be running, and commands like + edit or "calendar" edit-vocab should work.

Setup emacs

These instructions should be readily adaptable for other operating systems; in its current form it pertains to Windows XP.

Add the following to your ~/.emacs or other appropriate startup location:

;;; Factor
(load-file "d:/Program Files/factor/misc/fuel/fu.el")

To set the executable and image path for factor use M-x customize-group fuel, then select the Fuel Listener group. Remember to save the changes by selecting "Save for Future Sessions" when finished. Be sure to change the paths appropriately of course.

To start the listener use M-x run-factor.

FUEL, the Factor mode for emacs, has many advanced features. Consult misc/fuel/README for details.

In Win32 environment, if you encounter "M-x run-factor" terminated with "Prompt not found", you should indicate "<FACTOR-DIR>/factor.com" as your "fuel-listener-factor-binary".

; ...additional win32 fuel setting:
(setq fuel-listener-factor-binary "d:/factor/factor.com")

Setup Factor

Finally you need to inform Factor that you want to use Emacs as your editor. Create or modify the .factor-rc file in your home directory. You can find out what factor thinks is your home directory with

USE: io.pathnames home .

and you can even have factor create a blank file in the proper location with

USE: io.directories home "factor-rc" append-path touch-file

Edit that file and add something like:

USING: namespaces editors.emacs ;
"d:/Program Files/emacs-22.3/bin/emacs.exe" \ emacsclient-path set-global

again, change the path appropriately.

Per a recent IRC log, you will probably also need to edit c:/ProgramFiles/factor/basis/editors/emacs/emacs.factor

You should comment out the call to --no-wait because this doesn't exist on Emacsclient for Windows.

At this point Factor should now be integrated with emacs. Invoke the following in the listener to test:

\ + edit

Semantic Editing and Navigation

FUEL includes many useful features for editing Factor code. Press C-c C-h inside a Factor buffer to see a list of keyboard commands.

FUEL Cheatsheet

You'll find here a small sheet (in pdf and OpenOffice) for using FUEL inside Emacs :

Cheatsheets

This revision created on Thu, 26 Nov 2015 06:14:21 by jouborg (add link to OS X article)