Emacs
Содержание:
XEmacs и GNU Emacs
Некоторые главные разработчики XEmacs опубликовали свои точки зрения на раскол между XEmacs и GNU Emacs, например, Стивен Тёрнбулл (Stephen Turnbull) опубликовал краткое изложение аргументов обеих сторон. Одной из главных причин разногласий стали различные взгляды на передачу прав: FSF считает передачу прав FSF необходимым для того, чтобы обеспечить защиту от нарушений GPL, в то время как разработчики XEmacs утверждают, что отсутствие необходимости в передаче прав позволило крупным компаниям принять участие в разработке, так как иногда компании могут лицензировать код, но из-за нежелания конфликтовать с владельцами, компаниям может быть сложно получить разрешение на полную передачу прав на код. Free Software Foundation обладает правами на значительную часть кода XEmacs, так как эти права были переданы во время попыток слияния и совместной разработки. Войдёт ли кусок нового кода из XEmacs в GNU Emacs, часто зависит от желания конкретного автора передать права FSF.
Новые функции одного редактора обычно вскоре появляются и в другом. Более того, многие разработчики вносят изменения в оба проекта, в частности, главные лисп-подсистемы, такие как Gnus и Dired, разрабатываются так, чтобы они работали в обоих редакторах.
Customization
One of Emacs’s main features is its extensibility and the ease of configuration. Emacs has a built-in customization engine. You can do which displays a list of customization options. For how to use this interface, see the Easy Customization info node: . You can set customization opens just for one Emacs session or save them into a so that they are saved across Emacs sessions. Note that this is what the customization interface does if you select «Apply and Save.»
Configuration file
When Emacs is started, it normally tries to load a Lisp program from an “initialization file”, or “init file” for short. This file, if it exists, specifies how to initialize Emacs for you. Emacs looks for your init file using the filenames ‘~/.emacs’, ‘~/.emacs.el’, or ‘~/.emacs.d/init.el’. See the info node «Init File» for more:
Разработка
С самого начала проекта разработчики старались выпускать новые версии редактора как можно чаще, на данный момент в год появляется 2—3 релиза.
Также поддерживается открытость для экспериментов, и XEmacs часто предлагает новые функции раньше других редакторов семейства — например, применение различных шрифтов или использование цветов при работе с текстовым терминалами. С течением времени разработчики активно переписывают код, для того чтобы он соответствовал более современным стандартам. В XEmacs присутствует единая система управления пакетами, написанных независимыми разработчиками. Начиная с 2007 года редактор поддерживает GTK+.
Разработка XEmacs всегда была очень открытой, включая доступ к анонимному CVS, позднее — Mercurial, и доступные всем желающим списки рассылки. Заявляется о стремлении поддерживать полную совместимость с GNU Emacs.
Подготовка выпусков ведётся по трём ветвям: стабильной (stable), гамма (gamma), и бета (beta), нововведения вначале появляются в бете, хотя эти версии могут быть протестированными в недостаточной степени и иметь проблемы со стабильностью и безопасностью.
Getting help
Emacs has a built-in tutorial which can be accessed by clicking the first link on the splash screen and selecting Help->Emacs Tutorial from the menu or by pressing .
Emacs is self-documenting by design. As such, a great deal of information is available to determine the name of a specific command or its keybinding, for example. See all contextual help bindings with C-h C-h.
Emacs also includes a set of reference cards, useful for beginners and experts alike, see (substitute <version> for your version of emacs).
The manuals
If you really want to master Emacs, the most recommended source of documentation remains the official manuals:
- Emacs: the complete Emacs user manual.
- Emacs FAQ.
- Emacs Lisp Intro: if you never used any programming language before.
- Elisp: if you are already familiar with a programming language.
Some users prefer to read books using ‘info’ because of its convenient shortcuts, its paragraphs adapting to window width and the font adapted to current screen resolution. Some find it less irritating to the eyes. Finally you can easily copy content from the book to any Emacs buffer, and you can even execute Lisp code snippets directly from the examples.
You may want to read the Info book to know more about it: C-h i m info <RET>.
Press ? while in info mode for a quick list of shortcuts.
History
Between 1987 and 1993 significant delays occurred in bringing out a new version of GNU Emacs (presumed to be version 19).
In the late 1980s, Richard P. Gabriel’s Lucid Inc. faced a requirement to ship Emacs to support the Energize C++ IDE. So Lucid recruited a team to improve and extend the code,
with the intention that their new version, released in 1991, would form the basis of GNU Emacs version 19. However, they did not have time to wait for their changes to be accepted by the Free Software Foundation (FSF).
Lucid continued developing and maintaining their version of Emacs, while the FSF released version 19 of GNU Emacs a year later, while merging some of the code and adapting some other parts.
When Lucid went out of business in 1994, other developers picked up the code.
Companies such as Sun Microsystems wanted to carry on shipping Lucid Emacs, however, using the trademark had become legally ambiguous because no one knew who would eventually control the trademark «Lucid». Accordingly, the «X» in XEmacs represents a compromise among the parties involved in developing XEmacs.
The «X» in XEmacs is thus not related to the X Window System. XEmacs has always supported text-based terminals and windowing systems other than X11. Installers can compile both XEmacs and GNU Emacs with and without X support. For a period of time XEmacs even had some terminal-specific features, such as coloring, that GNU Emacs lacked.
The software community generally refers to GNU Emacs, XEmacs (and a number of other similar editors) collectively or individually as emacsen (by analogy with boxen) or as emacs, since they both take their inspiration from the original TECO Emacs.
The GNU Emacs Calculator
Calc is an advanced desk calculator and mathematical tool
written by Dave Gillespie that runs as part of the GNU Emacs environment.
This manual, also written (mostly) by Dave Gillespie, is divided into
three major parts: “Getting Started,” the “Calc Tutorial,” and the
“Calc Reference.” The Tutorial introduces all the major aspects of
Calculator use in an easy, hands-on way. The remainder of the manual is
a complete reference to the features of the Calculator.
This file documents Calc, the GNU Emacs calculator, included with
GNU Emacs 26.3.
Copyright 1990–1991, 2001–2019 Free Software Foundation, Inc.
| General description and overview. | |
| A step-by-step introduction for beginners. | |
| Introduction to the Calc reference manual. | |
| Types of objects manipulated by Calc. | |
| Manipulating the stack and trail buffers. | |
| Adjusting display format and other modes. | |
| Basic arithmetic functions. | |
| Transcendentals and other scientific functions. | |
| Operations on vectors and matrices. | |
| Manipulating expressions algebraically. | |
| Operations on numbers with units. | |
| Storing and recalling variables. | |
| Commands for making graphs of data. | |
| Moving data into and out of Calc. | |
| Operating Calc from a keypad. | |
| Working with formulas embedded in a file. | |
| Calc as a programmable calculator. | |
| How you can copy and share Calc. | |
| The license for this documentation. | |
| Customizing Calc. | |
| How to report bugs and make suggestions. | |
| Summary of Calc commands and functions. | |
| The standard Calc key sequences. | |
| The interactive Calc commands. | |
| Functions (in algebraic formulas). | |
| General concepts. | |
| Variables used by Calc (both user and internal). | |
| Internal Lisp math functions. |
Next: ,
Previous: ,
Up:
XEmacs and GNU Emacs
Several of XEmacs’s principal developers have published accounts of the split between XEmacs and GNU Emacs, for example, Stephen Turnbull’s summary of the arguments from both sides. One of the main disagreements involves different views of copyright assignment. The FSF sees copyright assignment to the FSF as necessary to allow it to defend the code against GPL violations,
while the XEmacs developers have argued that the lack of copyright assignment has allowed major companies to get involved, as sometimes companies can license their code but due to a cautious attitude concerning fiduciary duties to shareholders, companies may have trouble in getting permission to assign away code completely.[citation needed]
The Free Software Foundation holds copyright of much of the XEmacs code because of prior copyright assignment during merge attempts and cross-development. Whether a piece of new XEmacs code enters GNU Emacs often depends on the willingness of that individual contributor to assign the code to the FSF. New features in either editor usually show up in the other sooner or later. Furthermore, many developers contribute to both projects.
The XEmacs project has a policy of maintaining compatibility with the GNU Emacs API. For example, it provides a compatibility-layer implementing overlays via the native extent functionality. «XEmacs developers strive to keep their code compatible with GNU Emacs, especially on the Lisp level.»
As XEmacs development has slowed—the most recent stable version 21.4.22 was released in January 2009—XEmacs has incorporated much code from GNU Emacs, while GNU Emacs has implemented many formerly XEmacs-only features. This has led some users to proclaim XEmacs’ death, advocating that its developers contribute to GNU Emacs instead.
Many major packages, such as Gnus and Dired, were formerly developed to work with both, although the main developer of Gnus has announced his intention to move the Gnus tree into the main Emacs trunk and remove XEmacs compatibility code, citing other packages similarly dropping XEmacs support.
In December 2015 project maintainer Stephen J. Turnbull posted a message to an XEmacs development list stating the project was «at a crossroads» in terms of future compatibility with GNU Emacs due to developer attrition and GNU Emacs’ progress. Several options were laid out for future directions including ending development entirely, creating a new fork from the current version of GNU Emacs, or putting the project in maintenance mode in case someone wants to restart development in the future. This last option was the direction decided, with commitments from individual contributors to provide minimal support for the web site and development resources.
Development
From the project’s beginnings, the developers of XEmacs aimed to have a frequent release-cycle.
They also aimed for more openness to experimentation, and XEmacs often offers new features before other emacsen—pioneering (for example) inline images, variable fonts and terminal coloring. Over the years, the developers have extensively rewritten the code in order to improve consistency and to follow modern programming conventions stressing data abstraction. XEmacs has a packaging system for independently maintained Lisp packages. The latest version has GTK+ support
and a native Carbon port for Mac OS X.
XEmacs has always had a very open development-environment, including anonymous CVS, later Mercurial access and publicly accessible development mailing-lists. XEmacs comes with a 500+ page internals manual (Wing, et al., 2004).
Support for Unicode has become a problem for XEmacs. As of 2005, the released version depends on the unmaintained package called Mule-UCS to support Unicode, while the development branch of XEmacs has had robust native support for external Unicode encodings since May 2002, but the internal Mule character sets lack completeness, and development seems stalled as of September 2005.
XEmacs development features three branches: stable, gamma, and beta,
with beta getting new features first, but potentially having less testing, stability and security. The developers released version 20.0 on 9 February 1997, and version 21.0 on 12 July 1998. As of January 2009, the stable branch had reached version 21.4.22 and the beta branch version 21.5.28. No gamma releases exist as of 2007. With the release of XEmacs 21.4.0, version numbers follow a scheme whereby an odd second number signals a development-version, and an even second number indicates a stable release.
История
В конце 1980-х годов компания Ричарда Габриеля (Richard P. Gabriel) Lucid столкнулась с необходимостью использовать Emacs в качестве редактора в своём новом продукте Energize — интегрированной среде разработки для C++. В связи со значительной задержкой между 1987 и 1993 годом в выпуске новой версии GNU Emacs, Lucid набрала команду разработчиков для улучшения и последующего развития кода редактора, ожидая, что их новая версия, выпущенная в 1991 году, станет основой для GNU Emacs 19. Однако, из-за нехватки времени они не смогли передать сделанные ими изменения Free Software Foundation (FSF).
Когда Lucid ушла из бизнеса в 1994 году, другие разработчики продолжили поддерживать код. Такие компании как Sun Microsystems хотели продолжать выпускать Lucid Emacs; однако, использование этой торговой марки стало юридически неоднозначным, из-за того, что никто не знал кто должен контролировать торговую марку «Lucid».
Хотя XEmacs изначально поддерживал X11, он, как и GNU Emacs, изначально мог быть скомпилирован без поддержки графического интерфейса и работать с оконными системами, отличными от X11, таким образом, префикс «X» в названии не связан с поддержкой конкретной оконной системы. Более того, в течение определённого промежутка времени XEmacs обладал некоторыми возможностями при работе с терминалами, такими как подсветка синтаксиса, которых не было в GNU Emacs.
В 2004 году группа разработчиков редактора во главе со Стивом Янгсом (Steve Youngs) создала самостоятельное ответвление — , в качестве причин указывалось нестабильное состояние XEmacs, а также сложность внесения радикальных усовершенствований в связи с консерватизмом сообщества XEmacs.
Features
XEmacs text-editing features commands to manipulate words and paragraphs (deleting them, moving them, moving through them, and so forth), syntax highlighting for making source code easier to read, and «keyboard macros» for performing arbitrary batches of editing commands defined by the user.
XEmacs has comprehensive online help, as well as five manuals available from the XEmacs website. XEmacs supports many human languages as well as editing-modes for many programming and markup-languages. XEmacs runs on many operating systems including Unix/Linux, BSDs and Mac OS X. Running on Mac OS requires X11; while development has started on a native Carbon version. Two versions of XEmacs for the Microsoft Windows environment exist: a native installer and a Cygwin package.
Users can reconfigure almost all of the functionality in the editor by using the Emacs Lisp language. Changes to the Lisp code do not require the user to restart or recompile the editor. Programmers have made available many pre-written Lisp extensions.
Many packages exist to extend and supplement the capabilities of XEmacs. Users can either download them piecemeal through XEmacs’ package manager or apply them in bulk using the xemacs-sumo package or «sumo tarballs». The package manager in XEmacs predates the ELPA package system used by GNU Emacs by almost a decade and is incompatible with it. Since XEmacs 21.1 functionality has been moved out of XEmacs core and made available separately as packages. This allows users to exclude packages they have no need for. XEmacs had a package manager for over a decade before GNU Emacs developed one, but XEmacs must be restarted before new packages are loaded.
4.2 Использование файла .emacs
После того, как вы провели некоторое время в работе с Emacs и
имеете идеи о том, что надо настроить, вы вероятно захотите
настроить некоторые вещи навсегда (или по крайней мере до тех пор,
пока вы не измените свою точку зрения). Если вы будете использовать
Emacs в каждодневной работе, то вы также заметите, что ваш файл
увеличивается со временем. Это Хорошо,
потому-что вы определили как заставить Emacs работать так, как
вы хотите. Для многих программ является позором, что они
позволяют сделать это.
В случае, если вы еще не догадались, Каждый раз при запуске
Emacs, он ищет файл с именем в вашем домашнем
каталоге. Ваш файл —это место, куда вы должны
помещать код на Lisp, если хотите, чтобы он автоматически
выполнялся при запуске, а также файл включает в себя те настройки,
которые вы хотите использовать.
Вот другой пример из моего файла :
(setq inhibit-startup-message t)
Переменная задает будет ли
показывать Emacs приветственное сообщение на старте, или нет. После
того как я насмотрелся на него (потому-что я уже знал как найти
помощь) я нашел способ отключить его.
Как упражнение попробуйте создать собственный файл
и добавить эту строку в него. Затем выйдите из
Emacs и запустите его снова. Вы не должны увидеть стартового сообщения.
Часто когда вы читаете о режиме Emacs (или о пакете), то
документация будет вам предлагать добавить некоторый код в ваш файл
для того, чтобы режим или пакет работали как надо.
GNU Emacs FAQ () содержит некоторые пункты,
относящиеся к файлам , которые вы можете найти
полезными.
Packages
A number of popular extensions are available as packages in the repository, and more still, via the AUR. The name of such packages usually have a ’emacs-‘ prefix (for example, ), though not always (for example, AUR).
Tip: Arch Linux Wiki contributors may be interested in the Emacs Mediawiki package.
Some packages may require you to make changes to your configuration file in order to activate them so that their features are available during an Emacs session. For example, if you install AUR, you will need to add
(load "auctex.el" nil t t) (load "preview-latex.el" nil t t)
to your configuration file. Other packages should let you know how to activate them in the commentary section of their source code or in their README.
Running Emacs
Before launching emacs, you should know how to close it (especially if you run it in a terminal): use the
key sequence.
To start Emacs run:
$ emacs
or, to use it from the console:
$ emacs -nw
or, for fast loading (no .emacs) and editing within CLI:
$ emacs -Q -nw
If you installed the nox version, ’emacs’ and ’emacs -nw’ will be the same.
A file name can also be provided to open that file immediately:
$ emacs filename.txt
No colors
By default, Emacs starts with a color theme showing hyperlinks in dark blue. To start Emacs on a text terminal without any color theme or scheme:
$ emacs -nw --color=no
This will cause all text to appear in the foreground color of the terminal — normally white text on a black background, or black text on a white background.
As a daemon
In order to avoid reloading the Emacs config file every time Emacs starts, you can run Emacs as a daemon:
$ emacs --daemon
You may then connect to the daemon by running:
$ emacsclient -nc
Which creates a new frame (use if you prefer to use it in the terminal) and does not hog the terminal ().
Note that some programs such as Mutt or Git (for commit messages) wait for the editor to finish, so you cannot use the parameter.
If your default editor is set to use it, you will have to specify an alternate editor (e.g. ) for those programs.
As a systemd unit
A systemd unit is included in Emacs 26.1. The unit is installed with Emacs, but it must be enabled after installing Emacs:
$ systemctl --user enable --now emacs
Run this command as the user you want to run the Emacs server as; do not run the command as root. After the service is started, Emacs is ready. The unit file is stored in /usr/lib/systemd/user/emacs.service. Here is the contents of the unit file for reference:
/usr/lib/systemd/user/emacs.service
Description=Emacs text editor Documentation=info:emacs man:emacs(1) https://gnu.org/software/emacs/ Type=simple ExecStart=/usr/bin/emacs --fg-daemon ExecStop=/usr/bin/emacsclient --eval "(kill-emacs)" Environment=SSH_AUTH_SOCK=%t/keyring/ssh Restart=on-failure WantedBy=default.target
Note that systemd user units do not inherit environment variables from a login shell (like ), so you may want to set the variables in instead. See Systemd/User for more information.
It is also recommended to change any GUI start menu entries (or equivalent) for Emacs to point to emacsclient instead of emacs, so that the emacs daemon is used instead of starting a new emacs process.
Возможности
Среди возможностей редактора — команды манипуляции словами и абзацами (удаление, перемещение, передвижение внутри них и так далее), подсветка синтаксиса исходных кодов, клавиатурные макросы для выполнения произвольных последовательностей команд редактирования, определённых пользователем. XEmacs обладает всеобъемлющей встроенной справкой, наравне с пятью руководствами, доступными на веб-сайте программы. Поддержано множество языков. Для редактирования исходных кодов программ реализованы так называемые !!editing-modes для множества языков программирования.
XEmacs может работать на множестве операционных систем, включая различные варианты BSD, Linux, Solaris, Mac OS X. Запуск программы на Mac OS требует X11; хотя разработка родной версии для Carbon начата в 2007 году. Существуют две версии XEmacs для Microsoft Windows: одна не требует установки дополнительного программного обеспечения, а для запуска второй требуется установка Cygwin.
Пользователь может переопределить поведение любой части редактора используя язык программирования — Emacs Lisp — версию Лиспа. Изменения исходного кода не требует перезагрузки или перекомпиляции редактора. Для программистов доступны множество готовых расширений, написанных на Лиспе.