Книга: Learning GNU Emacs, 3rd Edition
11.5 Programming a Major Mode
After you get comfortable with Emacs Lisp programming, you may find that that "little extra something" you want Emacs to do takes the form of a major mode. In previous chapters, we covered major modes for text entry, word processor input, and programming languages. Many of these modes are quite complicated to program, so we'll provide a simple example of a major mode, from which you can learn the concepts needed to program your own. Then, in the following section, you will learn how you can customize existing major modes without changing any of the Lisp code that implements them.
We'll develop Calculator mode, a major mode for a calculator whose functionality will be familiar to you if you have used the Unix dc (desk calculator) command. It is a Reverse Polish (stack-based) calculator of the type made popular by Hewlett-Packard. After explaining some of the principal components of major modes and some interesting features of the calculator mode, we will give the mode's complete Lisp code.
- 6.3. CONSISTENCY MODELS
- 1.3 A Word About Modes
- Table B-1. Support for Java, C, and C++ programming
- 10.7 Starting Modes via Auto-Mode Customization
- Chapter 11. Emacs Lisp Programming
- 2.7.3 Turning On Text Mode and Auto-Fill Mode Automatically
- 7.4.6 Using Outline Minor Mode
- 11.5.1 Components of a Major Mode
- Table A-4. Modes
- Table B-2. Support for Lisp programming
- Table B-3. Support for other programming tasks and languages
- Table B-4. Support for Text Processing