ErgoEmacs - a way to Lisp

If you enjoy programming, then, for sure, you are permanently in a state of searching for the best tools, the best ideas, the best solutions. And you know, Emacs was the final stop for me personally. Or rather, its assembly called ErgoEmacs. Under the cut will be an attempt to make a logical and consistent story about the use of this text editor in the context of getting to know it for the first time in life (not going into strong specifics, but rather trying to catch the general idea); ideological propaganda (emaxa in general and lisp in particular); small criticism of the last of articles on Habré on this subject, as well as a small philosophical conclusion. If you want to expand your horizons, I ask for a cat.

Foreword


I decided to write this article after reading this because if I hadn’t used Emacs, I wouldn’t understand anything (from the article referenced), but if I used it, I would understand that if I didn’t use it, then nothing I would not understand. The article was written haphazardly, using a simple compilation (of factual material, links to resources and its own .emacs [settings file]), which obviously will not help attract new adherents to our ranks. Let's try to fix the situation.

1. Preliminary information


So, it is initially assumed that you:

  • Windows user (I will describe some of the pitfalls when installing Emacs on this particular OS). If you use Linux or Mac, then, unfortunately, you will have to deal with the difficulties encountered when working with the editor (if they certainly will).
  • Fluent in ten-finger blind typing. If this condition is not met, the feasibility of switching to Emacs and its use tends to zero.
  • Love to program. If programming is just your job and you don’t want to get satisfaction or pleasure from it, then you need to rethink Emacs’ life
  • Know (love) Lisp. This is more a wish than a requirement, but it seems to me that love of Lisp (or at least his knowledge, or the desire to study it), in some way, is the determining factor in choosing this editor. Although, this is purely my personal opinion and it is not a dogma (unlike the previous two points)


2. Why Emacs?


The question is just as rhetorical for any emaxer as meaningless for any person who opens this editor for the first time. The formal answer is the following - when working with Emacs, you get the opportunity:

  • To control the cursor (in the editor’s working field) from the keyboard (without taking your hands off and without changing the position of 8 fingers out of 10)
  • It is relatively easy (in comparison with any IDEs) to automate, reprogram, configure and create anything (new menu items, "binding" of keys, functions, macros, auto-mix, extensions, etc., etc.)

Generally speaking, these are all of really objective indicators of utility (cross-platform, low hardware requirements, etc. I don’t take into account, since this is of little use, given some difficulty in studying the program). But, from my point of view, and based on my experience of using the editor, the two points described are enough to start getting maximum pleasure and convenience in the process (even if after some time spent mastering the capabilities of Emacs).

Additional bonuses appear if you program in Common Lisp . Installing Emacs, SBCL , Slime, and quicklispyou essentially get a “native” development environment. A lot of add-ons of varying degrees of usefulness and quality have been written for Emacs, but in general, for Web development, this is enough. There is also an excellent package manager and library manager that will make your life much easier. There are many excellent themes for comfortable work.

But the most important thing, in the context of the issue we are discussing, is that there are smart Chinese. And one of them, by the name of Xah Lee (an old, scorched emaxer), created the Emacs assembly, "re-bind" almost all the actively used keyboard shortcuts (and in the basic emax, to put it mildly, they are not convenient and not obvious), added some points the menu and set the sea of ​​necessary (in each economy) plug-ins and with a dozen themes. He called the whole thing ErgoEmacs?, subtly hinting to future users that its assembly is "somewhat more convenient" than the basic editor. I believe that the initial acquaintance (and everything subsequent in principle, too), you need to start with this assembly. And the main reason for this is the simplicity of mastering (and using) the program, compared to installing the basic version (this is due to the keyboard shortcuts, the time saved to install and configure the plug-ins, and the excellent "tutorial" for this assembly). It is also highly likely that the young adept will not spit on the monitor screen and will not close this complex and incomprehensible editor, as is usually the case when a mentally (mentally, ideally) unprepared person installs Emacs.

3. Pitfalls when installing ErgoEmacs on Windows


  • Before installing the editor, create the HOME system variable, the value of which should be the address of the folder of the same name created in advance in the root of the system partition of the disk:

  • Go to the HOME folder properties in the security tab and give yourself (as a user, not as an administrator) all rights to actions with the folder, and also make yourself (as a user, not as an administrator) the owner of this folder:


  • Install ErgoEmacs
  • Do not run. Do the same thing (rights, owner) with the folder in which the editor is installed
  • Create a ".emacs" file in the HOME folder
  • Run the editor, select the theme, choose the default font, save the settings (everything can be done through the menu)

On this, the basic setup of emax is, in principle, completed. You can start experimenting and creating. I highly recommend reading the tutorial on the project website, learning the basic key combinations (to move the cursor, for example, hold Alt and press J, K, L, I). In the assembly, by default, instead of the “Mx” key combination, the “Ma” key combination is provided (where M is Alt). Look at least the first three (the very basics) lectures of the podcast Dmitry Bushenko . You can also familiarize yourself with the creation of the same Dmitry Bushenko, co-authored with A. Ott, “Programming Emacs for Editting and Refactoring Code”, which gives the programming base emacs lisp. Consider creating a Common Lisp development environment from Emacs - the next video to help . Buy an ergonomic keyboard. And you will be happy.

4. ErgoEmacs - a way to Lisp


Actually this article is not about ErgoEmacs (although most of it was about him). It is about Lisp (more precisely about the modern dialect of this language - Common Lisp). Because, in my opinion, forcing a person to use even ErgoEmacs (not to mention the basic version of this editor) is extremely difficult without good reason. And the main reason was and always will be Lisp. If you like Lisp, you program in Emacs. And this statement does not need proof.
Ultimately, the final authority determining the choice of an idea (language, concept, theory, faith) is the concept of "beauty." There is no more terrible insult to a physicist, for example, than telling him that his theory is not beautiful. The reflexivity of our thinking and the possibility of an absolute justification for anything else (any method is based on some axiomatic part that is taken “on faith” [unproven]) “force us to see beauty” in symmetry and / or self-similarity (for example) . Lisp in this regard, in my opinion, is the most beautiful and expressive language. It reflects the way and principle of our thinking (which, in fact, is not surprising, because this language was created for the study of artificial intelligence).

Yes, Lisp has crashed as a system programming language, and both applied , and Lisp-machines became exhibits of museums. But is Lisp to blame? I think not. I will not delve into the history of Symbolics, Inc. , the largest player on the market for lisp machines, system and application software written in Lisp, but one of the key engineers of this company was none other than Richard Stallman - the god of modern Linuxoids and the founder of Free Software Foundaion. Stallman, for ideological reasons, hated the idea of ​​commercial software and stole code from Symbolics, copying it into the free MIT product. When this was revealed, he sent an e-mail to the company and threatened to blow it with dynamite. Both funny and sad. This is one of the more or less specific reasons for the collapse of Lisp. But it is far from key, in my opinion.

The root of the problem is the ideology of modern society. Lisp was at the peak of popularity during the boom of research in the field of artificial intelligence and the creation of expert systems . When humanity was tired of doing development, and wanted to get pleasure (selling and buying), then Lisp left the stage. He became unnecessary. He is an artifact of modern society - a unique subject and having special properties, but practically not used for its intended purpose due to its complexity (in studying, reproducing) and the absence of tasks of an appropriate scale.

Nevertheless, this does not detract from the power, beauty and expressiveness of the language, as well as its homomorphism to human intelligence.

PS


If anyone is interested in my .emacs, then here it is.
.emacs
(add-to-list 'load-path "~ / .emacs.d /")
(add-to-list' load-path "C: / slime")
(add-to-list 'load-path "C: /sbcl/sbcl.exe »)
(add-to-list 'custom-theme-load-path" ~ / .emacs.d / themes ")

(load (expand-file-name" ~ / quicklisp / slime-helper. el "))
;; Replace "sbcl" with the path to your implementation
(setq inferior-lisp-program "C: /sbcl/sbcl.exe")

(setq show-paren-style 'expression)
(show-paren-mode 2)

(menu-bar -mode 1)
(tool-bar-mode -1)

(setq make-backup-files nil); Don't want any backup files
(setq auto-save-list-file-name nil); Don't want any .saves files
(setq auto-save-default nil); Don '


(setq default-buffer-file-coding-system 'utf-8-unix)

(require' slime)

(setq slime-net-coding-system 'utf-8-unix)

(slime-setup' (slime-fancy))

(setq lisp-indent-function 'common-lisp-indent-function)

;; built-in
(require 'ido)
(ido-mode t)
(setq ido-enable-flex-matching t)


;; built-in
(require 'bs)
(setq bs-configurations
' (("files" "^ \\ * scratch \\ *" nil nil bs-visits-non-file bs-sort-buffer-interns-are-last) ))

(global-set-key (kbd "") 'bs-show)

(require' sr-speedbar)
(global-set-key (kbd "") 'sr-speedbar-toggle)

(when (> = emacs- major-version 24)
(require '

(add-to-list 'package-archives' ("melpa". " melpa.milkbox.net/packages ") t)
)

(global-set-key (kbd "")' other-window)
(global-set- key (kbd "") 'slime-eval-defun)
(global-set-key (kbd "")' slime-eval-last-expression)
(global-set-key (kbd "") 'slime-compile-file )

(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(Cua-mode t nil (cua-base))
' (custom-enabled-themes (quote (deeper-blue)))
'(show-paren-mode t)
'(tool-bar-mode nil))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance
.; ; If there is more than one, they won't work right.
'(Default ((t (: family "Consolas": foundry "outline": slant normal: weight bold: height 158: width normal))))
' ( completions-common-part ((t (: inherit default: foreground "red"))))
'(diredp-compressed-file-suffix ((t (: foreground "# 7b68ee"))))
' (diredp-ignored- file-name ((t (: foreground "#aaaaaa")))))
'(show-paren-match ((((class color) (background light)) (: background "azure2")))))

(setq TeX -auto-save t)
(setq TeX-parse-self t)
(setq tex-save-query nil)
(setq tex-pdf-mode t)

Also popular now: