From bd1711aa248d79d4ef6334b3f69be9055bb372b7 Mon Sep 17 00:00:00 2001 From: Mike Woolley Date: Mon, 12 Dec 2022 17:40:10 +0000 Subject: [PATCH] Updated the Emacs editor integration instructions. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ● Added instructions for installing the `boxes` Emacs package from MELPA. ● Updated the manual installation instructions. --- pages/editors-emacs.md | 65 ++++++++++++++++++++++++++++++++---------- 1 file changed, 50 insertions(+), 15 deletions(-) diff --git a/pages/editors-emacs.md b/pages/editors-emacs.md index 287d68b..9b2ca7b 100644 --- a/pages/editors-emacs.md +++ b/pages/editors-emacs.md @@ -2,7 +2,7 @@ title: Editor Integration - Emacs permalink: editors-emacs.html created_at: 1999-04-06 -last_modified_at: 2014-12-23 22:50:00 +0100 +last_modified_at: 2022-12-12 17:34:00 +0000 --- @@ -10,21 +10,56 @@ last_modified_at: 2014-12-23 22:50:00 +0100 # Integration with Emacs -[@zerotao](https://github.com/zerotao) kindly provided the following information on -integrating *boxes* with Emacs: +[![MELPA](https://melpa.org/packages/boxes-badge.svg)](https://melpa.org/#/boxes) -The simple interface (only a single box style, but easy): +The easiest way is to install the `boxes` package from [MELPA](https://melpa.org/#/boxes), however it can also be installed manually if desired: -```lisp -(defun boxes-create () - (interactive) - (shell-command-on-region (region-beginning) (region-end) "boxes -d c-cmt2" nil 1 nil)) +- Installation from MELPA + 1. Make sure [MELPA is in your package archives list](https://melpa.org/#/getting-started). + + 2. `M-x package-install boxes` -(defun boxes-remove () - (interactive) - (shell-command-on-region (region-beginning) (region-end) "boxes -r -d c-cmt2" nil 1 nil)) -``` + 3. Add key bindings for the `boxes` commands to your startup file: -[@zerotao](https://github.com/zerotao) also wrote a -[*boxes* mode for Emacs](https://github.com/{{ site.github }}/blob/master/doc/boxes.el). Remember to update its design -list when you add new designs to your config file. + ```emacs-lisp + (global-set-key "\C-cb" 'boxes-command-on-region) + (global-set-key "\C-cq" 'boxes-create) + (global-set-key "\C-cr" 'boxes-remove) + ``` + + 4. Alternatively, if `use-package` is installed you can automatically install the `boxes` binary & elisp packages and + add the key bindings with the following form, just like magic 😊 + + ```emacs-lisp + (use-package boxes + :ensure t + :ensure-system-package boxes + :bind (("C-c b" . boxes-command-on-region) + ("C-c q" . boxes-create) + ("C-c r" . boxes-remove))) + ``` + +- Manual Installation + 1. [Download](https://github.com/{{ site.github }}/blob/master/doc/boxes.el) `boxes.el` to a directory and add it + to your `load-path`: + + ```emacs-lisp + (add-to-list 'load-path ) + ``` + + 2. Add autoloads to your startup file so `boxes` will be loaded on first use: + + ```emacs-lisp + (autoload 'boxes-command-on-region "boxes" nil t) + (autoload 'boxes-remove "boxes" nil t) + (autoload 'boxes-create "boxes" nil t) + ``` + + 3. Add key bindings for the `boxes` commands to your startup file: + + ```emacs-lisp + (global-set-key "\C-cb" 'boxes-command-on-region) + (global-set-key "\C-cq" 'boxes-create) + (global-set-key "\C-cr" 'boxes-remove) + ``` +