Why does emacs use lisp




















By the time they had a real release, I did too. In this way, for two years, I prevented them from wiping out Lisp Machines Incorporated, and the two companies went on.

But, I didn't want to spend years and years punishing someone, just thwarting an evil deed. Meanwhile, it was time to start building a new community to replace the one that their actions and others had wiped out.

The war that Symbolics started was what wiped out MIT, but there were other events going on then. There were people giving up on cooperation, and together this wiped out the community and there wasn't much left.

Once I stopped punishing Symbolics, I had to figure out what to do next. I had to make a free operating system, that was clear—the only way that people could work together and share was with a free operating system.

At first, I thought of making a Lisp-based system, but I realized that wouldn't be a good idea technically. To have something like the Lisp machine system, you needed special purpose microcode. That's what made it possible to run programs as fast as other computers would run their programs and still get the benefit of typechecking.

Without that, you would be reduced to something like the Lisp compilers for other machines. The programs would be faster, but unstable. Now that's okay if you're running one program on a timesharing system—if one program crashes, that's not a disaster, that's something your program occasionally does. But that didn't make it good for writing the operating system in, so I rejected the idea of making a system like the Lisp machine.

I decided instead to make a Unix-like operating system that would have Lisp implementations to run as user programs. The kernel wouldn't be written in Lisp, but we'd have Lisp. In doing this, I aimed to make the absolute minimal possible Lisp implementation.

The size of the programs was a tremendous concern. There were people in those days, in , who had one-megabyte machines without virtual memory. They wanted to be able to use GNU Emacs. This meant I had to keep the program as small as possible. For instance, at the time the only looping construct was while , which was extremely simple. There was no way to break out of the while statement, you just had to do a catch and a throw, or test a variable that ran the loop.

That shows how far I was pushing to keep things small. Obviously, machines are bigger now, and we don't do it that way any more. We put in caar and cadr and so on, and we might put in another looping construct one of these days. We're willing to extend it some now, but we don't want to extend it to the level of common Lisp.

I implemented Common Lisp once on the Lisp machine, and I'm not all that happy with it. They don't seem quite Lispy to me; I'll do it sometimes but I minimize the times when I do that. That was not the end of the GNU projects involved with Lisp. Later on around , we were looking into starting a graphical desktop project. It was clear that for the programs on the desktop, we wanted a programming language to write a lot of it in to make it easily extensible, like the editor.

The question was what it should be. At the time, TCL was being pushed heavily for this purpose. I had a very low opinion of TCL, basically because it wasn't Lisp. It looks a tiny bit like Lisp, but semantically it isn't, and it's not as clean. Not Common Lisp, because it was too large. The idea was that we would have a Scheme interpreter designed to be linked into applications in the same way TCL was linked into applications. We would then recommend that as the preferred extensibility package for all GNU programs.

There's an interesting benefit you can get from using such a powerful language as a version of Lisp as your primary extensibility language. You can implement other languages by translating them into your primary language. But if your primary language is Lisp, it's not that hard to implement other things by translating them. Our idea was that if each extensible application supported Scheme, you could write an implementation of TCL or Python or Perl in Scheme that translates that program into Scheme.

Then you could load that into any application and customize it in your favorite language and it would work with other customizations as well. As long as the extensibility languages are weak, the users have to use only the language you provided them.

But when you have a powerful language that can implement others by translating into it, then you give the user a choice of language and we don't have to have a language war anymore. That's what we're hoping Guile, our scheme interpreter, will do. We had a person working last summer finishing up a translator from Python to Scheme. I don't know if it's entirely finished yet, but for anyone interested in this project, please get in touch.

So that's the plan we have for the future. I haven't been speaking about free software, but let me briefly tell you a little bit about what that means. Free software does not refer to price; it doesn't mean that you get it for free.

You may have paid for a copy, or gotten a copy gratis. Easy Menu A convenience macro for defining menus. Extended Menu Items More complex menu item definitions. Menu Separators Drawing a horizontal line through a menu.

Alias Menu Items Using command aliases in menu items. Major and Minor Modes Hooks How to use hooks; how to write code that provides hooks. Major Modes Defining major modes. Minor Modes Defining minor modes. Mode Line Format Customizing the text that appears in the mode line. Imenu Providing a menu of definitions made in a buffer. Font Lock Mode How modes can highlight text according to syntax.

Auto-Indentation How to teach Emacs to indent for a major mode. Desktop Save Mode How modes can have buffer state saved between Emacs sessions. Hooks Running Hooks How to run a hook. Setting Hooks How to put functions on a hook, or remove them. Auto Major Mode How Emacs chooses the major mode automatically.

Mode Help Finding out how to use a mode. Derived Modes Defining a new major mode based on another major mode. Basic Major Modes Modes that other modes are often derived from. Mode Hooks Hooks run at the end of major mode functions. Tabulated List Mode Parent mode for buffers containing tabulated data.

Generic Modes Defining a simple major mode that supports comment syntax and Font Lock mode. Example Major Modes Text mode and Lisp modes. Keymaps and Minor Modes How a minor mode can have its own keymap.

Defining Minor Modes A convenient facility for defining minor modes. Mode Line Data The data structure that controls the mode line. Mode Line Top The top level variable, mode-line-format. Mode Line Variables Variables used in that data structure. Properties in Mode Using text properties in the mode line. Header Lines Like a mode line, but at the top.

Emulating Mode Line Formatting text as the mode line would. Search-based Fontification Fontification based on regexps. Customizing Keywords Customizing search-based fontification. Other Font Lock Variables Additional customization facilities. Levels of Font Lock Each mode can define alternative levels so that the user can select more or less. Precalculated Fontification How Lisp programs that produce the buffer contents can also specify how to fontify it.

Syntactic Font Lock Fontification based on syntax tables. Region to Refontify Controlling which region gets refontified after a buffer change.

Operator Precedence Grammars A very simple parsing technique. Documentation Documentation Basics Where doc strings are defined and stored. Accessing Documentation How Lisp programs can access doc strings. Keys in Documentation Substituting current key bindings. Text Quoting Style Quotation marks in doc strings and messages.

Describing Characters Making printable descriptions of non-printing characters and key sequences. Help Functions Subroutines used by Emacs help facilities. Files Visiting Files Reading files into Emacs buffers for editing. Saving Buffers Writing changed buffers back into files. Reading from Files Reading files into buffers without visiting.

Writing to Files Writing new files from parts of buffers. File Locks Locking and unlocking files, to prevent simultaneous editing by two people. Information about Files Testing existence, accessibility, size of files.

Changing Files Renaming files, changing permissions, etc. File Names Decomposing and expanding file names. Contents of Directories Getting a list of the files in a directory. Magic File Names Special handling for certain file names.

Format Conversion Conversion to and from various file formats. Visiting Files Visiting Functions The usual interface functions for visiting. Subroutines of Visiting Lower-level subroutines that they use. Information about Files Testing Accessibility Is a given file readable?

Kinds of Files Is it a directory? A symbolic link? Truenames Eliminating symbolic links from a file name. File Attributes File sizes, modification times, etc. Extended Attributes Extended file attributes for access control.

Locating Files How to find a file in standard places. Relative File Names Some file names are relative to a current directory. File Name Expansion Converting relative file names to absolute ones. Unique File Names Generating names for temporary files. File Name Completion Finding the completions for a given file name.

Standard File Names If your package uses a fixed file name, how to handle various operating systems simply. Format Conversion Round-Trip Using format-alist. Format Conversion Piecemeal Specifying non-paired conversion. Auto-Saving How auto-save files are made; how their names are chosen. Reverting revert-buffer , and how to customize what it does. Rename or Copy Two alternatives: renaming the old file or copying it.

Numbered Backups Keeping multiple backups for each source file. Backup Names How backup file names are computed; customization. Buffers Buffer Basics What is a buffer? Current Buffer Designating a buffer as current so that primitives will access its contents. Buffer Names Accessing and changing buffer names. Buffer File Name The buffer file name indicates which file is visited. Buffer Modification A buffer is modified if it needs to be saved. Read Only Buffers Modifying text is not allowed in a read-only buffer.

Buffer List How to look at all the existing buffers. Creating Buffers Functions that create buffers. Killing Buffers Buffers exist until explicitly killed. Indirect Buffers An indirect buffer shares text with some other buffer. Swapping Text Swapping text between two buffers.

Buffer Gap The gap in the buffer. Windows Basic Windows Basic information on using windows. Windows and Frames Relating windows to the frame they appear on. Resizing Windows Changing the sizes of windows.

Preserving Window Sizes Preserving the size of windows. Splitting Windows Splitting one window into two windows. Deleting Windows Deleting a window gives its space to other windows. Recombining Windows Preserving the frame layout when splitting and deleting windows. Selecting Windows The selected window is the one that you edit in. Cyclic Window Ordering Moving around the existing windows. Buffers and Windows Each window displays the contents of a buffer. Switching Buffers Higher-level functions for switching to a buffer.

Displaying Buffers Displaying a buffer in a suitable window. Window History Each window remembers the buffers displayed in it. Dedicated Windows How to avoid displaying another buffer in a specific window. Quitting Windows How to restore the state prior to displaying a buffer. Atomic Windows Preserving parts of the window layout. Window Point Each window has its own location of point. Window Start and End Buffer positions indicating which text is on-screen in a window.

Textual Scrolling Moving text up and down through the window. Vertical Scrolling Moving the contents up and down on the window. Horizontal Scrolling Moving the contents sideways on the window. Coordinates and Windows Converting coordinates to windows. Mouse Window Auto-selection Automatically selecting windows with the mouse. Window Configurations Saving and restoring the state of the screen.

Window Parameters Associating additional information with windows. Window Hooks Hooks for scrolling, window size changes, redisplay going past a certain point, or window configuration changes. Displaying Buffers Choosing Window How to choose a window for displaying a buffer. Buffer Display Action Functions Support functions for buffer display. Buffer Display Action Alists Alists for fine-tuning buffer display action functions. Choosing Window Options Extra options affecting how buffers are displayed.

Precedence of Action Functions A tutorial explaining the precedence of buffer display action functions. The Zen of Buffer Display How to avoid that buffers get lost in between windows. Side Window Options and Functions Further tuning of side windows. Frame Layouts with Side Windows Setting up frame layouts with side windows. Frames Creating Frames Creating additional frames. Multiple Terminals Displaying on several different devices. Frame Geometry Geometric properties of frames.

Frame Parameters Controlling frame size, position, font, etc. Terminal Parameters Parameters common for all frames on terminal. Frame Titles Automatic updating of frame titles. Deleting Frames Frames last until explicitly deleted. Finding All Frames How to examine all existing frames. Minibuffers and Frames How a frame finds the minibuffer to use.

Input Focus Specifying the selected frame. Visibility of Frames Frames may be visible or invisible, or icons. Frame Configurations Saving the state of all frames. Child Frames Making a frame the child of another. Mouse Tracking Getting events that say when the mouse moves. Mouse Position Asking where the mouse is, or moving it.

Pop-Up Menus Displaying a menu for the user to select from. Dialog Boxes Displaying a box to ask yes or no. Pointer Shape Specifying the shape of the mouse pointer. Window System Selections Transferring text to and from other X clients. Drag and Drop Internals of Drag-and-Drop implementation. Color Names Getting the definitions of color names. Text Terminal Colors Defining colors for text terminals.

Resources Getting resource values from the server. Display Feature Testing Determining the features of a terminal. Frame Geometry Frame Layout Basic layout of frames. Frame Font The default font of a frame and how to set it.

Frame Position The position of a frame on its display. Implied Frame Resizing Implied resizing of frames and how to prevent it. Initial Parameters Specifying frame parameters when you make a frame. Window Frame Parameters List of frame parameters for window systems. Geometry Parsing geometry specifications. Position Parameters The position of the frame on the screen. Layout Parameters Size of parts of the frame, and enabling or disabling some parts.

Buffer Parameters Which buffers have been or should be shown. Frame Interaction Parameters Parameters for interacting with other frames. Mouse Dragging Parameters Parameters for resizing and moving frames with the mouse. Management Parameters Communicating with the window manager.

Cursor Parameters Controlling the cursor appearance. Font and Color Parameters Fonts and colors for the frame text. Positions Point The special position where editing takes place.

Motion Changing point. Excursions Temporary motion and buffer changes. Narrowing Restricting editing to a portion of the buffer. Motion Character Motion Moving in terms of characters.

Word Motion Moving in terms of words. Buffer End Motion Moving to the beginning or end of the buffer. Text Lines Moving in terms of lines of text. Screen Lines Moving in terms of lines as displayed. List Motion Moving by parsing lists and sexps. Skipping Characters Skipping characters belonging to a certain set. Markers Overview of Markers The components of a marker, and how it relocates.

Predicates on Markers Testing whether an object is a marker. Creating Markers Making empty markers or markers at certain places. Marker Insertion Types Two ways a marker can relocate when you insert where it points.

Moving Markers Moving the marker to a new buffer or position. The Mark How the mark is implemented with a marker. The Region How to access the region.

Text Near Point Examining text in the vicinity of point. Buffer Contents Examining text in a general fashion. Comparing Text Comparing substrings of buffers. Insertion Adding new text to a buffer. Commands for Insertion User-level commands to insert text. Deletion Removing text from a buffer. User-Level Deletion User-level commands to delete text.

The Kill Ring Where removed text sometimes is saved for later use. Undo Undoing changes to the text of a buffer.

Maintaining Undo How to enable and disable undo information. How to control how much information is kept.

Filling Functions for explicit filling. Margins How to specify margins for filling commands. Adaptive Fill Adaptive Fill mode chooses a fill prefix from context. Auto Filling How auto-fill mode is implemented to break lines. Sorting Functions for sorting parts of the buffer.

Columns Computing horizontal positions, and using them. Indentation Functions to insert or adjust indentation. Case Changes Case conversion of parts of the buffer. Text Properties Assigning Lisp property lists to text characters. Substitution Replacing a given character wherever it appears.

Registers How registers are implemented. Accessing the text or position stored in a register. Transposition Swapping two portions of a buffer. Decompression Dealing with compressed data.

Base 64 Conversion to or from base 64 encoding. Atomic Changes Installing several buffer changes atomically. Change Hooks Supplying functions to be run when text is changed.

Kill Functions Functions that kill text. Yanking How yanking is done. Yank Commands Commands that access the kill ring. Low-Level Kill Ring Functions and variables for kill ring access. Internals of Kill Ring Variables that hold kill ring data. Indentation Primitive Indent Functions used to count and insert indentation. Mode-Specific Indent Customize indentation for different modes.

Region Indent Indent all the lines in a region. Relative Indent Indent the current line based on previous lines. Indent Tabs Adjustable, typewriter-like tab stops. Motion by Indent Move to first non-blank character. Text Properties Examining Properties Looking at the properties of one character. Special forms to evaluate predicates and execute a function depending on the evaluation.

The syntax is enough to understand it. The car , cdr and cons are fundamental functions to work with lists. Car returns the head of a list, its first element. Instead of using cdr repeatedly, we can use nthcdr and pass the repeat number of times as argument:.

If we want to set values from a list, we need to use setcar and setcdr. This actually changes the original list. A classical thing to do is loop through a list:. Another common task is to do something a certain number of times:. The other two forms, dolist and dotimes are macros. Macros are one step ahead special forms, a syntax sugar for some common tasks.

The progn evaluates each of its arguments and returns the value of the last one. Where and why: since progn is a single expression and can produce side effects and return a single value, it can be used as argument to other functions, or wherever we can have only one expression but we want to do more than one thing.

In the kill-region So if you enjoy using Emacs, but you find that things aren't always to your liking, then I would definitely recommend that you start to learn elisp. Don't feel that you have to know it all, but just be willing to pick up bits and pieces over time, and you will undoubtedly find that Emacs becomes better and better as time goes on.

Make sure you search for solutions before you start coding something, though -- in a great many instances, someone has already done the hard work for you :. It's all about if you want to open a single program - Emacs - and have it contain your email, irc, and web browser, or use it as a text editor. But most of those previously mentioned things are already written for you - so Depends what your goals and your interests are. Some people learn Emacs Lisp in order to use Emacs.

Some people learn Emacs in order to use Emacs Lisp. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. Asked 11 years, 4 months ago. Active 10 years, 2 months ago. Viewed 1k times. Thank you. Improve this question. Will Hartung k 19 19 gold badges silver badges bronze badges. Similar question here: stackoverflow. Add a comment. Active Oldest Votes. Improve this answer. Owen S. Thumbs up for the hack.



0コメント

  • 1000 / 1000