[Previous] [Next] [Contents] [Index]


    Emacs Integration

(UNIX Only)

On UNIX, Emacs can be used as an external text editor in Telelogic Tau. By configuring Telelogic Tau to use Emacs for handling text documents, the Organizer can interact with Emacs in the same way as with the other Editors.

Handling of SOMT implementation links is supported.

This chapter contains a user manual to Emacs in Telelogic Tau; the functionality it adds and the new commands.

Table of Contents 

Overview

Introduction

The implementation works with GNU Emacs version 19.31 or later, and only on UNIX systems. It does not work with any Emacs for Windows.

It is assumed that you are familiar with Emacs terminology and how to use Emacs. Some experience with installing Emacs Lisp packages is also required when setting up the integrated environment.

Text Document Handling

By setting preferences to use Emacs as text editor in Telelogic Tau, text editing support in Emacs is offered both from the Organizer and editors. Text document handling is implemented in the Lisp package "sdtemacs".

In the Organizer, text documents are identified by the document type "Text Plain" when you add new or existing documents. A new Emacs instance will always be started, even though there may exist one already (started from outside Telelogic Tau).

Link Handling

The Lisp package "sdtlinks" defines the minor mode SDTlinks which supports SOMT implementation links in text documents. This gives the possibility to handle link endpoints and follow the links defined for these endpoints. The support for link handling is optional.

When the SDTlinks mode is active, endpoints are displayed with a typeface differing from the plain text. Type faces for endpoints with and without links are configurable, see Type Faces for Endpoints.

To be able to represent endpoints in text files, the file contents differ from what is seen in the Emacs buffer containing a file with endpoints. The file format for endpoints look like this:

where anchor is an integer uniquely identifying the endpoint and text is the endpoint text. If the SDTlinks mode is inactive, this raw file contents is displayed in the Emacs buffer.

Caution! 

When the SDTlinks mode is inactive:

Do not alter any text representing endpoints (described in Link Handling).

Do not duplicate text containing endpoints since this will yield unpredictable results as each endpoint is uniquely identified in a file.

As a general principle, Undo is not available for the link handling commands.

Installation

Text Document Handling

To be able to use Emacs as an external editor in Telelogic Tau:

  1. Put the file sdtemacs.el in a Lisp directory known to Emacs (load-path). By default, the file is installed in $telelogic/include/lisp.
  2. Byte-compile sdtemacs.el for increased execution speed.
  3. Put the line:
    (require 'sdtemacs)
    in your ~/.emacs file or in the file default.el in the ../lisp directory of the Emacs distribution.

Make sure that the environment variable $telelogicbin is correctly set.

Link Handling

To be able to use link handling functions in Emacs:

  1. Put the file sdtlinks.el in a Lisp directory known to Emacs (load-path). By default, the file is installed in $telelogic/include/lisp.
  2. Byte-compile sdtlinks.el for increased execution speed.
  3. Put the line:
    (require 'sdtlinks)
    in your ~/.emacs file or in the file default.el in the ../lisp directory of the Emacs distribution.

Sdtlinks requires sdtemacs, that is, you must install sdtemacs in order to use sdtlinks.

Installation Example

An example of using both packages:

Preferences

In the Preference Manager, the following parameters should be set:

Parameter Value

SDT* TextEditor

Emacs

SDT* EmacsCommand

The command that starts GNU Emacs from a UNIX shell (the default is "emacs").

Customizing

Type Faces for Endpoints

The type face for endpoints without associated links is called sdtlinks-endpoint-face. The default appearance is underlined, blue text.

The type face for endpoints with associated links is called sdtlinks-endpoint-with-links-face. The default appearance is underlined, bold, blue text.

These type faces can be redefined.


Example 22       

An example to make endpoints without associated links appear as bold, red text:


Maximum Number of Endpoints in a Document

Due to the nature of the execution environment for Emacs, only a finite number of endpoints are manageable in a document. By default, this limit is set to 1000 endpoints, which should be sufficient for most situations. If, however, a larger number is required, this can be achieved by setting the variable sdtemacs-max-no-of-endpoints.


Example 23       

An example to allow 1500 endpoints:


Emacs Commands

This section lists and describes the Emacs commands and key bindings associated with the integration with Telelogic Tau. Both new commands and the affected ordinary (existing) commands are described.

Text Document Handling

New Commands

Connect

M-x sdtemacs-connect connects to Telelogic Tau. Automatic connection can be performed when starting Emacs by providing the UNIX command switch post (emacs -post). This is done when Telelogic Tau starts Emacs.

Disconnect

M-x sdtemacs-disconnect disconnects from Telelogic Tau. All buffers taking part in the interaction with Telelogic Tau will be unloaded after asking about saving modified buffers. Exiting Emacs will disconnect from Telelogic Tau.

Show Organizer

M-x sdtemacs-show-organizer opens or raises the Organizer Main window.

Show SDT Reference

M-x sdtemacs-show-reference shows an SDT reference in an appropriate editor. This requires that the reference text is selected or that the point is placed inside it.

Affected Ordinary Commands

Exit Emacs (C-x C-c)

Disconnects from Telelogic Tau before exiting.

New File (C-x b <new buffer>, C-x C-f <new file>)

The new buffer is notified to Telelogic Tau and takes part in the interaction with Telelogic Tau.

Open File (C-x C-f <filename>)

The loaded buffer is notified to Telelogic Tau and takes part in the interaction with Telelogic Tau.

Save (C-x C-s) and Save As (C-x C-w <filename>)

The buffer is notified as saved to Telelogic Tau.

Close File (C-x k)

The buffer is notified as unloaded to Telelogic Tau.

First Modification of Buffer Text

The buffer is notified as modified to Telelogic Tau.

Link Handling

The minor mode SDTlinks, which implements the link handling commands, requires that Emacs is connected to Telelogic Tau, and will try to connect when switched on if this is not the case. All buffers loaded when connected will automatically have this mode active.

New Commands

SDT Links Mode

M-x sdtlinks-mode toggles the minor mode SDTlinks. This is useful if performing editing operations that cannot be done without unintentionally deleting endpoints, e.g. moving (Cut and Paste) a region of text containing endpoints.

Caution! 

When SDTlinks is inactive:

Do not alter any text representing endpoints (described in Link Handling).

Do not duplicate text containing endpoints since this will yield unpredictable results as each endpoint is uniquely identified in a file.

Create Endpoint

M-x sdtlinks-create-endpoint (C-c C-c) creates a new endpoint that will be marked with a special type face in the text (see Type Faces for Endpoints) and notified to Telelogic Tau. This command requires that the region of text to convert to an endpoint is selected, i.e. both mark and point must be set. Endpoints are not allowed to overlap and must consist of at least one character.

Delete Endpoint

M-x sdtlinks-delete-endpoint (C-c C-d) deletes an endpoint. The endpoint text will be converted to plain text and the deletion will be notified to Telelogic Tau. All links associated with the endpoint will be cleared. This command requires that point is placed inside the endpoint text.

Follow Link

M-x sdtlinks-follow-link (C-c C-f) follows one of the links associated with the selected endpoint. This results in displaying the endpoint on the other end of the link in an appropriate editor. If only one link is associated with the endpoint, this link is followed. Otherwise, a choice between the associated links is offered in a popup menu:

Figure 139  Choose link to follow

Extracted pic [1]

Each menu item, representing a link, is of the format:

where:

This command requires that point is placed inside the text of an endpoint marked as having associated links, see Type Faces for Endpoints.

Show Endpoint in Link Manager

M-x sdtlinks-show-endpoint-in-link-manager (C-c C-s) opens the Link Manager and shows the selected endpoint. This requires that point is placed inside the endpoint text.

Affected Ordinary Commands

Modification of Endpoint Text

The endpoint is notified as modified to Telelogic Tau. When point is placed directly after the endpoint text, added characters will become part of the endpoint text.

Cut/Clear (C-w, C-k, M-k and many more)

For all endpoints within the region, Delete Endpoint (see Delete Endpoint) is executed.

Copy Region (M-w)

Endpoints in the copy of the region is represented as plain text.

Insert File (C-x i <filename>)

For all endpoints in the inserted file, Create Endpoint (see Create Endpoint) is executed. Associated links are not handled.

If point is within an endpoint and the file to insert have endpoints, the operation will fail since overlapping endpoints are not allowed.

Undo (C-x u, C-_)

No undo information is recorded for the link handling commands. Consequently, these commands cannot be undone.

Command Summary

Command Description

M-x sdtemacs-connect

Connect

M-x sdtemacs-disconnect

Disconnect

M-x sdtemacs-show-organizer

Show Organizer

M-x sdtemacs-show-reference

Show SDT Reference

M-x sdtlinks-mode

SDT Links Mode

M-x sdtlinks-create-endpoint (C-c C-c)

Create Endpoint

M-x sdtlinks-delete-endpoint (C-c C-d)

Delete Endpoint

M-x sdtlinks-follow-link
(C-c C-f)

Follow Link

M-x sdtlinks-show-endpoint-in-link-manager (C-c C-s)

Show Endpoint in Link Manager


[Previous] [Next] [Contents] [Index]