UNIX Emacs: a Retrospective Lessonsfor Flexible System Design

UNIX Emacs: a Retrospective Lessonsfor Flexible System Design

UNIX Emacs: A Retrospective Lessonsfor Flexible System Design Nathaniel S. Borenstein Information Technology Center and Computer ScienceDepartment Carnegie-Mellon University JamesGosling Sun Microsystems,Inc. Abstract UNIX Emacs is well-known and widely used as a developers of future extensible systems and text editor that has been extended in a remarkable testbeds. number of directions, not always wisely. Because it is programmable in a powerful yet simple This paper is an informal reflection of many years programming language, Emacs has been used as a of experience with Emacs. One of the authors development tool for the construction of some (Gosling) is the author of UNIX Emacs and of remarkably complex user-oriented programs. many extension packages for it. The other Indeed, it has served as both a user interface (Borenstein) is the author of several of the largest management system and a user interface toolkit, UNIX Emacs applications [Z, 31. In addition to though it was designed as neither. In this paper, personal experience, this paper also reflects the we discuss the features that have made it so results of a survey, conducted over the ARPA popular for user interface development, in an Internet, of several dozen Emacs programmers. It attempt to derive lessons of value for more is unabashedly anecdotal, and the authors make powerful and more systematically designed no pretense of having conducted systematic systems in the future. studies to prove our conclusions. Rather, we are simply attempting to convey the lessons we feel I. Introduction can be learned from the Emacs experience. Designing gencralizcd tools for user interface II. What is Emacs? design and user interface management systems are now subjects of widespread interest. In order to The name “Emacs” has become a generic term, better understand what such systems should do in referring to an entire famiiy of powerful, the future, it helps to have a clear understanding extensible text editors, beginning with the original of what has come before. Although many systems ITS/Tops-20 Emacs [4]. That family has grown have been explicitly designed to serve these and matured to the point where it now includes a purposes, few have been very widely used. wide variety of programs that rcsemblc their predecessors to greater or lesser degree, as UNIX Emacs [I ] is a popular text editor with a surveyed by Stallman [5]. The present paper powerful extension facility, that has dcvcloped a discusses one of the most widely-used versions of large and extremely satisfied user community. Emacs, known commonly as “UNIX Emacs”, but The cxtcnsion facility has allowed Emacs to be also available for other operating systems, and used, not merely as a text editor, but as a general occasionally referred to as “Gosling Emacs.” In testbed for user interface design, and as a user this paper, the term “UNIX Emacs” will bc interface management system (UIMS). Of course, applied rather freely to both the early non- Emacs was designed neither as a tcstbcd nor a commercial and the more recent commercial UIMS, but simply as a text editor. That it was versions of the program. flexible enough to be extended so far aBeId offers us the opportunity to learn from its example, in The most powerful versions of Emacs arc al! both positive and negative ways. extensible in some extension language. ITS Emacs was extensible in TECO, an extremely baroque In this paper, we will briefly describe Emacs and but powerful language in which Emacs itself was its uses. We will then try to describe the most implemcntcd. Despite the clifliculty of important features of Emacs that have programming in TECO, a wide variety of contributed to its success,and also to recount the extension packages, including mail and bulletin problems that have been most frustrating to board readers, have been implcmcnted for that serious Emacs users. From this overview, we will version of Emacs. then oIIcr suggestions that may be of USCto the Permission to copy without fee all or part of this material is granted pro- vided that the copies are not made or distributed for direct commercial advantage, the ACM copyright notice and the title of the publication and its date appear, and notice is given that copying is by permission of the 95 Association for Computing Machinery. To copy otherwise, or to republish, rewires a fee and/or specific permission. @ 1988ACM 0-89791-283-7/88/0010/0095 $1.50 UNIX Emacs ofkrcd two major innovations over dircrcnt Emacs programs have been written to its prcdeccssors. First, because it was manage electronic communication (mail, bulletin implemcntcd under UNIX, it included powerful boards, UNIX nctncws, etc.). Others have process management facilities, allowing, for implcmcnted sprcadshccts, animation, database example, text to be filtered through arbitrary access, specialized program editing fcaturcs, and programs, and also allowing diKerent programs to even a BASIC interpreter. The longest Emacs be run in separate windows. Second, though program known to the authors is about 3000 lines UNIX Emacs is implemented in C, it is cxtCnsible of source code, defining approximately 150 in a LISP-like language known as mlisp or Mock scparatc functions. Clearly the user community Lisp. The decision to USCa direreni language for regards .mlisp as a programming language extension than the one used for implementation powerful enough to do a wide range of tasks was a crucial one; it appears responsible for most beyond those related to simply editing text. of the best and worst aspects of UNIX Emacs as perceived by those who have used it most 111.What is Good about UNIX Emacs and mlisp? extcnsivcly. A discussion of the virtues and flaws of mlisp will comprise the bulk of this paper. A Why have so many application progra.ms, few brief examples, however, will scrvc to particularly user-oriented ones, been written in introduce the unfamiliar reader to the flavor of UNIX Emacs, using mlisp, when so many other the language. languages are available to the UNIX programmer? In an attempt to answer this The statement question, we distributed a questionnaire to Ema& programmers via the “UNIX-EMACS” mailing (defun (change-presidents list on the ARPA Internet and the UNIX Usenct. (replace-string “Reagan” We asked only a dozen questions, niostly open- “Mondale” ) ) ) ended ones like “If you were designing an editor extension language, what might you do that is totally dilferent from mlisp? What would you defines a new function, “change-presidents” that most particularly want to keep the same?’ will, when called, replace any occurrence of the Questions like these yield very interesting and word “Reagan” appearing after the cursor illuminating answers that are, unfortunately, position in the current document into the word extremely difficult to tabulate meaningfully. The “Mondale”. For a more complex example, the summary below represents the aggregate of the’ next program will also make sure that the new responses in the survey, with no pretense of word “Mondale” is alone and indented on a line. completeness or of meaningful quantitative data. Comments begin with semi-colons and are italicized here. Extensibility (defun The one point on which nearly everyone seems to (change-and-indent-presidents agree is that the best thing about UNIX Emacs is (save-excursion; Save that mlisp exists. No one even suggested that context &restorewhendone Emacs would be better without the powerful (while facility for extension and customization, although ( ! (error-occurred ; Keep it is clear that such facilities, if abused, can create loopinguntilerror an environment that changes so radically from (search-forward day to day as to be unusable for most people. “Reagan”) Donner and Notkin [6] discuss extension ,(delete-previous-word) mechanisms in general and oIT’er several (delete-white-space) ; convincing arguments for their desirability; the Delete surrounding spaces experience of Emacs users suggests that this (if (! (bolp)) desirability should- bc taken as a given. The (newline)) integration of powerful editing facilities with a ; Insertnewlineifnotat full-fledged programming language seems beginning unquestionably useful, though it remains a matter (if (! (eolp)) of some debate whether this combination is best (newline-and-backup)) achicvcd by an cxtcnsion language for a text ; Similar for end of line editor or by implementing the text editor as a (insert-string ” subroutine library in an existing programming Mondale”))l)))l language. Our experience suggests, in fact, that such a dcbatc is unresolvable, because such Mlisp is used for programs ranging from simple mechanisms serve rather difkrcnt purposes, and but repetitive editing tasks to elaborate user arc hot/t highly desirable. interface or even database systems. Dozens of 96 Simplicity of string length and storage management, and fast primitives are provided for taking portions of Nearly equally unanimous is the pcrccption that strings. OF course, one can argue that strings mlisp is a very simple and clcgant language, wcll- should be taken for granted as a basic data type suited to its intended application domain (editing in any reasonable programming language, but the text). Our survey rcvealcd that mlisp is gcncrally notion is still rather radical in the UNIX/C pcrceivcd to be an unusually easy language to community. learn and to use, perhaps partly bccausc it omitted complex features crucial to system For more complex operations, Emacs provides programming. The simplicity of mlisp will be a text “buITers” in which text can be inserted and recurring theme in discussions of both its virtues then manipulated with the full complement of and failings in the sections that follow. Emacs commands, including regular expression searching which can be used to implement A significant part of mlisp’s simplicity stems from complex parsing quite painlessly -- that is, without the implicit context available to a host of mlisp attention to the details of breaking words into commands.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    7 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us