You are not logged in Log in Join
You are here: Home » Members » nemeth » Using Emacs with Zope on RedHat 6.1

Log in
Name

Password

 

Using Emacs with Zope on RedHat 6.1

Learning Zope - Using Emacs with Zope on RedHat 6.1 Author: Miklos Nemeth, [email protected]
Last modified: 2000.1.16

Why using Emacs with Zope?

Zope has its own development interface, where the programmer has a multiline edit box in an HTML form for editing DTML source code.

This IDE (integrated development environment) is quite acceptable for browsing the application repository, creating and customizing objects, managing the environment and even for writing small to medium size DTML scripts (mainly DTML methods and PythonMethod (a separate (non-standard) Zope product) objects). However, it may be clumsy for editing large HTML/DTML documents.

Perhaps the most popular programmer editor is Emacs/XEmacs (besides vi). There are (at least two) packages for Emacs that allow programmers to edit files on-line through FTP. These Emacs packages are ange-ftp and efs; both available in Andy Norman's Web Zone (hplbwww.hpl.hp.com/people/ange). The package ange-ftp is part of the emacs (20.4) package for RedHat 6.1, but efs is not.

Using ange-ftp in general

The package ange-ftp is included in the Emacs package shipped with RedHat. Using ange-ftp is very simple:
  1. Just start opening a file the normal way: C-x C-f
  2. Enter a special path to the ftp server: /[email protected]:/dir1/file1
  3. The password of user1 is requested by Emacs
  4. You may even use the path or file name completion facility (pressing the TAB button).
The ange-ftp package may also be used with ftp servers listening on non-standard (ie. non-21) ports, but you must use an emacs data entry trick. The only problem is in getting the "space" charachter between the hostname and the port number. You do that by using C-q which is a quoted insert, because if you just press the space bar, Emacs thinks you are done entering your request and goes to look up the source.
/[email protected][C-q][SPACEBAR]2222:filename
where [C-q] is a control-q and [SPACEBAR] is where you hit the spacebar. For this info many thanks to Kathleen G. Holland ([email protected]).

By default ange-ftp does not create backup files.

Using ange-ftp with Zope

Zope has a built in FTP server running by default on port 8021. You may configure the start script to use the default FTP port (21) if your host does not have the standard ftp server using this port. Be warned, if you specify a port below 1024 you have to start ZServer as root.

You may open DTML documents and methods using Emacs (ie. ange-ftp): just enter the path to your folder: /superuser@localhost 8021:/Cms and you will get a list of the content of the directory. (Remember pressing C-q to be able to enter the space character before the port number.)

You may navigate through your Zope repository by pressing enter on the name of a folder, and may open the required file by pressing enter on its name.

You may also use the path and file name completion facility. If you open a DTML script, its id (normally) does not have an extension. If you want to use HTML mode for the file opened switch emacs to html-mode: M-x html-mode.

You may create new files, but these always will be of type DTML Document: /[email protected] 8021:/Cms/myNewDoc

Before using emacs with your Zope repository you should be aware of that

  1. You cannot use version objects via FTP. If you open a file stored in Zope with emacs it is always opened outside of any version object. If someone changed a document in a version, and you open that document, you will get the original version, but you cannot save your changes.
  2. You cannot login with the name of a user who has no permission to perform an FTP ls (ie. list) command in the / or any directory in the path to the file. For example in my initial setup I created users only in the "application folders" (folders in the root folder). These users cannot use Emacs with Zope. If your programmers want to use Emecs (which is highly probable) you should create the users in the root folder. This is a problem with ange-ftp and efs, not with FTP or Zope.

Using efs with Zope

The efs package is used by many Emacs/XEmacs users. The efs package has a bit different way of specifying the port number:
/[email protected]#8021:/dir1/file1
Nonetheless, the usage of eps is (almost) the same as ange-ftp.

However, efs makes backup files by default by renaming the original to a file name with a ~ character suffixed, and then creates a new file with the original name. When this file is created Zope takes it as a DTML Document object. A general solution is to switch off making backup files:

(setq efs-make-backup-file nil)
(setq make-backup-files nil)
Sometimes switching off only efs-make-backup-file is enough but sometimes not. Switching off make-backup-file has the disadvantage that no backup files are created at all, even not for local files.

For a RedHat user efs is not required, ange-ftp works fine. Downloading and installing efs may not be an easy job, and efs also has the same problems (mentioned above) with Zope as ange-ftp.