未加星标

Emacs Live - Instant Clojure Development Environment

字体大小 | |
[系统(linux) 所属分类 系统(linux) | 发布者 店小二05 | 时间 2017 | 作者 红领巾 ] 0人收藏点击收藏

Emacs Live - Instant Clojure Development Environment

Emacs is a really powerful tool for Clojure development, although without a guiding hand it can be a bit of a learning curve. Using the Emacs Live its really simple to get a fully featured development environment for Clojure. I will show you how to get Emacs Live installed and how to start using it for Clojure.

I also recommend using EmacsForOSX if you are on a Mac.


Emacs Live - Instant Clojure Development Environment

Emacs Live is a collection of packages for Clojure that include:

Clojure mode - language support nREPL - interactive environment Magit - manage git repositories auto-complete - tab complete expression names & show documentation undo-tree - undo and redo on steroids with a branching history yasnippets - abbreviations automatically expand into function templates Installing Emacs Live

Emacs Live required Emacs 24 or greater, everything else is self contained.

You could just clone the github repository, but the provided install script makes sure everything is set up correctly and also creates a separate folder for your own personal settings. This allows you to tweak Emacs Live to your own style without it getting clobbered by any updates.

Run the following in a terminal window (Mac or linux):

Before anything is installed, the script will move any old Emacs configuration to ~/.emacs.d to a folder called ~/.emacs.d-old .

Once all the Emacs Live configuration files are installed, the script asks you if you want to create your own personal configuration. If so, a new folder will be created called

~/.live-packs/your-current-username-pack .

How to tweak Emacs Live

Its really easy to add your own key bindings and other configurations to Emacs Live, using the personal pack the script created for you. The personal pack has an init.el file in which you can add short simple configurations or load in longer configurations from the config or lib folders.

Key bindings

Emacs live makes several changes to the default key bindings of Emacs. If you want the default key bindings back then you can simply switch off the Emacs Live key bindings by adding the following to the file ~/.emacs-live.el

(live-ignore-packs '(live/bindings-pack))

Alternatively, you can learn to love the Emacs Live bindings, or tweak a few in your own personal pack. I have added a keybinding for launching the Clojure repl and a pair of key bindings for changing the font size, making it easier to change fonts when giving a demo.

To make the change in my personal pack, I added the following to the file ~/.live-packs/jstevenson-pack/config/bindings.el

;; Simpler key bindings for making text in buffers bigger and smaller (define-key global-map (kbd "C-+") 'text-scale-increase) (define-key global-map (kbd "C--") 'text-scale-decrease) ;; Launch Clojure repl via Leiningen - M-x nrepl-jack-in (global-set-key (kbd "C-c C-j") 'nrepl-jack-in) Loading in bigger changes

To keep your init.el file easy to work with, larger customisations can be defined in their own .el files under the config diretory. Then simply add a line to load in these config files in the file ~/.live-packs/jstevenson-pack/config/init.el

See the example where I tweaked the mode line for Emacs when developing Clojure

Upgrading Emacs Live
Emacs Live - Instant Clojure Development Environment

As all the configuration files are hosted on Github then a simple git pull will bring in any new version. As the install script clones the github repository, the remote github repository is already set up.

From inside your ~/.emacs.d folder you can simple do a git pull when you know there is an update (notices are posted to the Emacs Live Google group ).

If you want to know if you are on the latest version or how many versions you are behind, you can use git fetch to get all the latest changes without applying them. The output of git fetch will list any versions that have been created since you installed.

Just the Docs

Emacs Live has documentation using the Emacs Live theme on the Github pages for the Emacs Live project.


Emacs Live - Instant Clojure Development Environment
In Summary

For a developer new to Emacs and Clojure development, getting a great environment to work in is easy. Learning how to use that environment well will take practice, but this is the case with any tools. Muscle memory will kick in pretty quickly, so the more you use Emacs the more natural it will feel.

Thank you.

@jr0cket

This work is licensed under a Creative Commons Attribution 4.0 ShareAlike License , including custom images & stylesheets. Permissions beyond the scope of this license may be available at @jr0cket


Emacs Live - Instant Clojure Development Environment

本文系统(linux)相关术语:linux系统 鸟哥的linux私房菜 linux命令大全 linux操作系统

主题: ClojureGitLinux
分页:12
转载请注明
本文标题:Emacs Live - Instant Clojure Development Environment
本站链接:http://www.codesec.net/view/520216.html
分享请点击:


1.凡CodeSecTeam转载的文章,均出自其它媒体或其他官网介绍,目的在于传递更多的信息,并不代表本站赞同其观点和其真实性负责;
2.转载的文章仅代表原创作者观点,与本站无关。其原创性以及文中陈述文字和内容未经本站证实,本站对该文以及其中全部或者部分内容、文字的真实性、完整性、及时性,不作出任何保证或承若;
3.如本站转载稿涉及版权等问题,请作者及时联系本站,我们会及时处理。
登录后可拥有收藏文章、关注作者等权限...
技术大类 技术大类 | 系统(linux) | 评论(0) | 阅读(51)