2016-11-06 16:06:44 +01:00
|
|
|
|
;;; boon-tutorial.el --- An Ergonomic Command Mode -*- lexical-binding: t -*-
|
|
|
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
|
|
|
|
|
;; This file contains the tutorial for boon.
|
|
|
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
|
|
|
|
|
|
(require 'boon-core)
|
2016-11-08 21:38:01 +01:00
|
|
|
|
(require 'boon-keys)
|
|
|
|
|
(require 'dash)
|
|
|
|
|
|
|
|
|
|
(defun boon-dump-map (map)
|
2016-11-13 14:45:10 +01:00
|
|
|
|
"Dump the MAP in a format usable to generate a cheat sheet."
|
2016-11-15 21:35:36 +01:00
|
|
|
|
(concat
|
|
|
|
|
"["
|
|
|
|
|
(-reduce (lambda (x y) (concat x "," y))
|
2019-08-25 22:37:45 +02:00
|
|
|
|
(-non-nil
|
|
|
|
|
(--map (let ((b (lookup-key map (make-vector 1 it))))
|
|
|
|
|
(when b
|
|
|
|
|
(format "(%d,(%S,\"%S\"))" it (boon-mnemonic-noformat b map)
|
|
|
|
|
(cond ((symbolp b) b)))))
|
|
|
|
|
(-concat
|
|
|
|
|
(-iterate '1+ ?A 26)
|
|
|
|
|
(-iterate '1+ ?a 26)
|
|
|
|
|
'(?\; ?: ?- ?' ?, ?. ?< ?> ?/ ?? 32 ?\" ?ö ?ä ?Ö ?Ä)))))
|
2016-11-15 21:35:36 +01:00
|
|
|
|
"]"))
|
2016-11-08 21:38:01 +01:00
|
|
|
|
|
2019-08-25 22:37:45 +02:00
|
|
|
|
|
2016-11-13 14:45:10 +01:00
|
|
|
|
(defun boon-dump-cheatsheet (flavour)
|
|
|
|
|
"Dump cheatcheat info for FLAVOUR."
|
2016-11-15 23:18:35 +01:00
|
|
|
|
(let ((el (concat "boon-" flavour ".el")))
|
2016-11-13 14:45:10 +01:00
|
|
|
|
(require 'boon)
|
|
|
|
|
(load el)
|
|
|
|
|
(with-temp-buffer
|
2016-11-15 23:18:35 +01:00
|
|
|
|
(insert "module Layout where\n")
|
2016-11-13 14:45:10 +01:00
|
|
|
|
(insert (format "nil = \"\"\n"))
|
2016-11-15 21:35:36 +01:00
|
|
|
|
(insert (format "commandMap = %s\n" (boon-dump-map boon-command-map)))
|
|
|
|
|
(insert (format "movesMap = %s\n" (boon-dump-map boon-moves-map)))
|
|
|
|
|
(insert (format "selectMap = %s\n" (boon-dump-map boon-select-map)))
|
2016-11-15 23:18:35 +01:00
|
|
|
|
(write-region nil nil (concat flavour ".hs")))))
|
2016-11-13 14:45:10 +01:00
|
|
|
|
|
2019-04-29 21:42:20 +02:00
|
|
|
|
;;;###autoload
|
2016-11-08 21:38:01 +01:00
|
|
|
|
(defun boon-keymap-rev-look (sub map)
|
|
|
|
|
"Return an event yielding SUB from the keymap MAP."
|
|
|
|
|
(let (res)
|
|
|
|
|
(map-keymap (lambda (event b)
|
|
|
|
|
(when (and (consp b) (stringp (car b))) (setq b (cdr b)))
|
|
|
|
|
(when (eq b sub) (setq res event)))
|
|
|
|
|
map)
|
|
|
|
|
(key-description (vector res))))
|
|
|
|
|
|
2016-11-13 14:45:10 +01:00
|
|
|
|
(defun boon-mnemonic-noformat (sub &optional map)
|
2016-11-08 21:38:01 +01:00
|
|
|
|
"Return the mnemonic for SUB from the keymap MAP."
|
|
|
|
|
(let (res)
|
|
|
|
|
(map-keymap (lambda (_event b) (when (and (consp b)
|
|
|
|
|
(stringp (car b))
|
|
|
|
|
(eq (cdr b) sub))
|
|
|
|
|
(setq res (car b))))
|
|
|
|
|
(or map boon-command-map))
|
2016-11-13 14:45:10 +01:00
|
|
|
|
res))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun boon-mnemonic (sub &optional map)
|
|
|
|
|
"Return the formatted mnemonic for SUB from the keymap MAP."
|
|
|
|
|
(format "(mnemonic: %s)" (boon-mnemonic-noformat sub map)))
|
2016-11-08 21:38:01 +01:00
|
|
|
|
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
|
|
|
|
;; utilities to create the tutorial
|
2016-09-08 21:58:23 +02:00
|
|
|
|
;;;###autoload
|
2016-09-04 21:42:27 +02:00
|
|
|
|
(defun boon-gen-key (key)
|
2016-11-06 16:06:44 +01:00
|
|
|
|
"Generate a suitable tutorial string to refer to command KEY."
|
2016-09-04 21:42:27 +02:00
|
|
|
|
(interactive (list (read-key-sequence-vector "key?")))
|
|
|
|
|
(insert "\\\\")
|
|
|
|
|
(insert "[")
|
|
|
|
|
(insert (symbol-name (lookup-key boon-command-map key)))
|
|
|
|
|
(insert "]"))
|
|
|
|
|
|
2016-11-08 21:38:01 +01:00
|
|
|
|
;; (global-set-key (kbd "C-'") 'boon-gen-key)
|
|
|
|
|
|
2016-09-08 21:58:23 +02:00
|
|
|
|
;;;###autoload
|
2016-09-04 21:42:27 +02:00
|
|
|
|
(defun boon-gen-sel-key (key)
|
2016-11-06 16:06:44 +01:00
|
|
|
|
"Generate a suitable tutorial string to refer to selection KEY."
|
2016-09-04 21:42:27 +02:00
|
|
|
|
(interactive (list (read-key "key?")))
|
2016-11-08 21:38:01 +01:00
|
|
|
|
(insert (concat "\" (selector '" (symbol-name (lookup-key boon-select-map (vconcat (list key)))) ") \"")))
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
2016-11-08 21:38:01 +01:00
|
|
|
|
;; (global-set-key (kbd "C-'") 'boon-gen-sel-key)
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
|
(defun boon-tutorial ()
|
2016-11-06 16:06:44 +01:00
|
|
|
|
"Open a buffer with boon tutorial."
|
2016-09-04 21:42:27 +02:00
|
|
|
|
(interactive)
|
|
|
|
|
(switch-to-buffer (generate-new-buffer "BOON-TUTORIAL"))
|
|
|
|
|
(turn-on-boon-mode)
|
2016-11-08 21:38:01 +01:00
|
|
|
|
(let ((x-key (boon-keymap-rev-look boon-x-map boon-command-map)))
|
|
|
|
|
(cl-flet ((selector (sel) (boon-keymap-rev-look sel boon-select-map)))
|
|
|
|
|
(insert (substitute-command-keys (concat
|
2016-10-30 09:34:12 +01:00
|
|
|
|
|
2019-01-05 09:10:57 +01:00
|
|
|
|
"Boon tutorial. See end for copying conditions.
|
|
|
|
|
|
2019-08-18 12:22:47 +02:00
|
|
|
|
|
|
|
|
|
* PREAMBLE
|
|
|
|
|
----------
|
|
|
|
|
|
|
|
|
|
This tutorial mostly assumes that you know Emacs already. Boon
|
|
|
|
|
does not overwrite any familiar key combination. C-x, M-x and C-c
|
|
|
|
|
still work as you're used to. Should you be overwhelmed at any
|
|
|
|
|
point, and old habits kick in, you should feel right at home.
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
2019-01-05 09:10:57 +01:00
|
|
|
|
* INTRODUCTION
|
|
|
|
|
--------------
|
|
|
|
|
|
|
|
|
|
Sometimes the tutorial will mention a mnemonic for a key. A mnemonic
|
|
|
|
|
is a story linking the key to type, to the action that it does. This
|
|
|
|
|
story is often small, maybe just a word. You may use the mnemonics
|
|
|
|
|
provided by the tutorial, but it is best to invent your own. If the
|
|
|
|
|
tutorial says 'mnemonic: nil', this means that the frontend that you
|
|
|
|
|
have activated has not defined a mnemonic for that command.
|
|
|
|
|
|
2019-08-18 12:22:47 +02:00
|
|
|
|
Make sure that Boon is active in this buffer. Call
|
2019-01-05 09:10:57 +01:00
|
|
|
|
'\\[turn-on-boon-mode]' if necessary.
|
|
|
|
|
|
|
|
|
|
Boon mode can be turned off with: '\\[turn-off-boon-mode]'
|
|
|
|
|
it restores the default Emacs experience.
|
|
|
|
|
|
|
|
|
|
Lines that start with the characters \">>\", indicate directions for
|
|
|
|
|
trying a command. For example:
|
|
|
|
|
|
2019-08-18 12:22:47 +02:00
|
|
|
|
>> Type '\\[scroll-up-line]' and '\\[scroll-down-line]' to scroll this text.
|
2019-01-05 09:10:57 +01:00
|
|
|
|
|
|
|
|
|
There is a cheat sheet that can be used as reference while going
|
|
|
|
|
through this tutorial. It's linked in the readme usage section
|
|
|
|
|
https://github.com/jyp/boon#usage
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
* SWITCHING STATES
|
|
|
|
|
------------------
|
2016-11-08 21:38:01 +01:00
|
|
|
|
|
2019-01-05 09:10:57 +01:00
|
|
|
|
Boon has two states:
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
2019-01-05 09:10:57 +01:00
|
|
|
|
- Command state
|
|
|
|
|
|
|
|
|
|
- Insert state
|
|
|
|
|
|
2019-08-18 12:22:47 +02:00
|
|
|
|
Boon indicates the current active state in several ways:
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
|
|
|
|
- The modeline says Boon:<STATE> (where <STATE> can be INS or CMD)
|
|
|
|
|
|
|
|
|
|
- The cursor is a box in command state, and a bar in insert state.
|
|
|
|
|
|
2019-01-05 09:10:57 +01:00
|
|
|
|
- If the powerline package is installed and '(boon-powerline-theme)'
|
|
|
|
|
is invoked, then the state text changes color. This makes it
|
|
|
|
|
possible to see the current state without having to read any text.
|
|
|
|
|
(There is also support for spaceline, but it requires a patch to
|
|
|
|
|
said package at the time of writing)
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
2019-01-05 09:10:57 +01:00
|
|
|
|
You can switch from command state to insert state by typing:
|
|
|
|
|
'\\[boon-set-insert-like-state]' " (boon-mnemonic
|
|
|
|
|
'boon-set-insert-like-state)".
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
2019-01-05 09:10:57 +01:00
|
|
|
|
To switch from insert state to command state, type: '<ESC>'
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
2019-01-05 09:10:57 +01:00
|
|
|
|
Try switching between the states now:
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
2019-04-25 10:18:12 +01:00
|
|
|
|
If you're in command state:
|
2019-01-05 09:10:57 +01:00
|
|
|
|
>> Type: '\\[boon-set-insert-like-state]' to switch to insert state.
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
2019-04-25 10:18:12 +01:00
|
|
|
|
If you're in insert state:
|
2019-01-05 09:10:57 +01:00
|
|
|
|
>> Type: '<ESC>' to switch to command state.
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
* BASIC CURSOR CONTROL
|
|
|
|
|
----------------------
|
|
|
|
|
|
|
|
|
|
How do you move to a specific place within the text on the screen?
|
|
|
|
|
|
|
|
|
|
The whole right-hand side of the keyboard is dedicated to this
|
|
|
|
|
purpose.
|
|
|
|
|
|
|
|
|
|
There are several ways you can do this. You can still use the
|
|
|
|
|
arrow keys, but it's more efficient to keep your right hand
|
2019-08-18 12:22:47 +02:00
|
|
|
|
on the home row and use the commands:
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
2019-01-05 09:10:57 +01:00
|
|
|
|
\\[backward-char] \\[forward-char] \\[previous-line] \\[next-line]
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
|
|
|
|
These characters are equivalent to the four arrow keys, like
|
|
|
|
|
this:
|
|
|
|
|
|
2019-01-05 09:10:57 +01:00
|
|
|
|
Previous line '\\[previous-line]'
|
2016-09-04 21:42:27 +02:00
|
|
|
|
:
|
|
|
|
|
:
|
2019-01-05 09:10:57 +01:00
|
|
|
|
Backward '\\[backward-char]' .... Current cursor position .... Forward '\\[forward-char]'
|
2016-09-04 21:42:27 +02:00
|
|
|
|
:
|
|
|
|
|
:
|
2019-01-05 09:10:57 +01:00
|
|
|
|
Next line '\\[next-line]'
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
2019-01-05 09:10:57 +01:00
|
|
|
|
>> Practice by moving the cursor along the text in the diagram above.
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
2016-09-04 22:20:07 +02:00
|
|
|
|
You'll find it easy to remember these letters by their location
|
|
|
|
|
on the keyboard. Note that, when you navigate within a line your
|
|
|
|
|
hand stays on the home row. Navigating between lines happens on
|
2019-01-05 09:10:57 +01:00
|
|
|
|
the top row. Very soon you will forget the letters that your hand
|
2016-09-04 22:20:07 +02:00
|
|
|
|
is typing when moving the cursor, you'll know intuitively what
|
|
|
|
|
you're doing, as when using arrow keys.
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
2016-09-04 22:20:07 +02:00
|
|
|
|
You will be using these basic cursor positioning commands a lot,
|
|
|
|
|
but there are even faster ways to go about moving the cursor.
|
|
|
|
|
|
2019-08-18 12:22:47 +02:00
|
|
|
|
If moving one character at a time is too slow, you can move by
|
2019-01-05 09:10:57 +01:00
|
|
|
|
words. The '\\[boon-smarter-forward]' key moves forward a word and '\\[boon-smarter-backward]' moves back a word.
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
2019-01-05 09:10:57 +01:00
|
|
|
|
>> Type '\\[boon-smarter-forward]' and '\\[boon-smarter-backward]' a couple of times.
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
2019-01-05 09:10:57 +01:00
|
|
|
|
As in regular Emacs, when you are in the middle of a word, '\\[boon-smarter-forward]' moves
|
|
|
|
|
to the end of the word. When you are in whitespace between words, '\\[boon-smarter-forward]'
|
|
|
|
|
moves to the end of the following word. The '\\[boon-smarter-backward]' key works likewise in
|
|
|
|
|
the opposite direction. In fact, '\\[boon-smarter-forward]' and '\\[boon-smarter-backward]' move by whole syntactic
|
|
|
|
|
units, they will skip over parentheses when it makes sense.
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
2019-01-05 09:10:57 +01:00
|
|
|
|
>> Move the cursor to the \"*\" in the following expression.
|
|
|
|
|
Using: '\\[boon-smarter-forward]', '\\[boon-smarter-backward]', '\\[backward-char]' and '\\[forward-char]' to get to the place you want.
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
|
|
|
|
54 / ((8 + y) * (x - 3))
|
|
|
|
|
|
|
|
|
|
Notice that you can quickly move in the expression while staying
|
|
|
|
|
comfortably on the home row.
|
|
|
|
|
|
2019-01-05 09:10:57 +01:00
|
|
|
|
You can also move to the beginning or end of the current line:
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
2019-01-05 09:10:57 +01:00
|
|
|
|
>> Type '\\[boon-beginning-of-line]' to move to the beginning of a line.
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
2019-01-05 09:10:57 +01:00
|
|
|
|
>> Type '\\[boon-end-of-line]' to move to the end of a line.
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
2019-08-18 12:22:47 +02:00
|
|
|
|
Like '\\[previous-line]' and '\\[next-line]', the keys on the top
|
|
|
|
|
row are line-related.
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
2019-01-05 09:10:57 +01:00
|
|
|
|
When moving up and down, Emacs tries to manage the cursor position
|
|
|
|
|
inside a line intelligently. This often works, but sometimes one need
|
|
|
|
|
to move quickly to the beginning or end of a line after moving up or
|
|
|
|
|
down. You can do all that by staying on the top row.
|
|
|
|
|
|
|
|
|
|
If you want to moving up and down faster, use the shift key:
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
2019-08-18 12:22:47 +02:00
|
|
|
|
>> Type '\\[backward-paragraph]' (pay attention to case) to move to the previous paragraph.
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
2019-08-18 12:22:47 +02:00
|
|
|
|
>> Type '\\[forward-paragraph]' to move to the next paragraph.
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
2019-01-05 09:10:57 +01:00
|
|
|
|
You also can jump several steps at once by typing a number before
|
|
|
|
|
a command.
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
2019-01-05 09:10:57 +01:00
|
|
|
|
>> Try '5' before a movement command. For example:
|
|
|
|
|
'5 i' moves up 5 lines, and `5 o' moves back down 5 lines.
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
2019-01-05 09:10:57 +01:00
|
|
|
|
>> Try all of the above commands now a few times for practice.
|
|
|
|
|
These are the commands that are used most often.
|
|
|
|
|
|
2019-08-18 12:22:47 +02:00
|
|
|
|
Before trying the next two commands, remember that '\\[backward-paragraph]' and '\\[forward-paragraph]' moves
|
2019-01-05 09:10:57 +01:00
|
|
|
|
by paragraph, use them to return to the next section after trying the
|
|
|
|
|
following commands.
|
|
|
|
|
|
|
|
|
|
Two less used cursor motion commands, moves you to the top or bottom of
|
|
|
|
|
the whole text.
|
2019-08-18 12:22:47 +02:00
|
|
|
|
kr
|
2019-01-05 09:10:57 +01:00
|
|
|
|
>> Type '\\[beginning-of-buffer]' to move to the beginning of the whole text.
|
|
|
|
|
|
|
|
|
|
>> Type '\\[end-of-buffer]' to move to the end of the whole text.
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
* OTHER MOVEMENT COMMANDS
|
|
|
|
|
-------------------------
|
|
|
|
|
|
2019-08-18 12:22:47 +02:00
|
|
|
|
- '\\[boon-switch-mark]' " (boon-mnemonic 'boon-switch-mark) "
|
|
|
|
|
pops a mark from the mark ring and jumps to it. This is more
|
|
|
|
|
useful than in regular Emacs because Boon leaves 'bread crumbs'
|
|
|
|
|
whenever you switch to insert state. So this command is very
|
|
|
|
|
useful to go to the last place you were touching.
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
2019-08-18 12:22:47 +02:00
|
|
|
|
If a region is active, this command will exchange point and
|
|
|
|
|
mark instead.
|
|
|
|
|
|
2019-08-25 19:18:51 +02:00
|
|
|
|
- '\\[xref-find-definitions]' " (boon-mnemonic 'xref-find-definitions) " is bound to
|
2019-08-18 12:22:47 +02:00
|
|
|
|
`xref-find-definitions'. (Extremely useful when programming.)
|
2019-08-25 19:18:51 +02:00
|
|
|
|
Go back to where you were using `\\[xref-pop-marker-stack]'.
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
2019-01-05 09:10:57 +01:00
|
|
|
|
If the Avy package is installed:
|
|
|
|
|
- '\\[avy-goto-word-1]' " (boon-mnemonic 'avy-goto-word-1) " activates `avy-goto-word-1'
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
|
|
|
|
|
2019-01-05 09:10:57 +01:00
|
|
|
|
* 'C-x' prefix
|
2016-09-04 21:42:27 +02:00
|
|
|
|
-------------
|
|
|
|
|
|
2019-01-05 09:10:57 +01:00
|
|
|
|
Instead of the 'C-x' prefix; you may just type " x-key "
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
2019-01-05 09:10:57 +01:00
|
|
|
|
>> Type '\\[split-window-below]' to split this window.
|
|
|
|
|
|
|
|
|
|
>> Type '\\[delete-other-windows]' to close the other windows.
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
2016-11-08 21:38:01 +01:00
|
|
|
|
Additionally, the `execute-extended-command' command is bound to
|
2019-01-05 09:10:57 +01:00
|
|
|
|
'\\[execute-extended-command]'. It is a good idea to bind your
|
2016-11-08 21:38:01 +01:00
|
|
|
|
own favourite commands in `boon-x-map', so you can access them
|
2019-01-05 09:10:57 +01:00
|
|
|
|
via " x-key ". (Standard commands are always available under 'C-x')
|
|
|
|
|
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
2019-01-05 09:10:57 +01:00
|
|
|
|
* 'C-c' prefix
|
2016-09-04 21:42:27 +02:00
|
|
|
|
------------
|
|
|
|
|
|
2019-08-18 12:22:47 +02:00
|
|
|
|
Mode-specific commands often have the form 'C-c C-<letter>'.
|
|
|
|
|
These are accessible by typing simply '\\[boon-c-god] <letter>'
|
|
|
|
|
from command state. Unfortunately there is no such binding in
|
|
|
|
|
text mode by default --- so you cannot test this right away. But
|
|
|
|
|
say if you're typing a magit commit message, '\\[boon-c-god] c'
|
|
|
|
|
will confirm the message.
|
2019-01-05 09:10:57 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
* UNDO
|
|
|
|
|
------
|
|
|
|
|
|
|
|
|
|
Undo is bound to '\\[undo]'.
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
|
|
|
|
|
2019-01-05 09:10:57 +01:00
|
|
|
|
* INSERTING
|
|
|
|
|
-----------
|
|
|
|
|
|
|
|
|
|
When you want to insert text, enter insert state by typing:
|
|
|
|
|
'\\[boon-set-insert-like-state]' (can you remember the mnemonic?).
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
|
|
|
|
Ordinary characters, like A, 7, *, etc., are then inserted as you type
|
2019-01-05 09:10:57 +01:00
|
|
|
|
them. To insert a Newline character, simply type '<Return>'.
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
2019-01-05 09:10:57 +01:00
|
|
|
|
In insert state, regular Emacs editing commands also work.
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
2019-01-05 09:10:57 +01:00
|
|
|
|
>> Type '\\[boon-set-insert-like-state]' to enter insert state and type some text
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
2019-01-05 09:10:57 +01:00
|
|
|
|
>> Type '<ESC>' to go back to command state.
|
|
|
|
|
|
|
|
|
|
A single character can also be inserted in command state by first
|
2019-08-18 12:22:47 +02:00
|
|
|
|
typing the quote command: '\\[boon-quote-character]' " (boon-mnemonic 'boon-quote-character) "
|
2019-01-05 09:10:57 +01:00
|
|
|
|
|
2019-08-18 12:22:47 +02:00
|
|
|
|
>> Type '\\[boon-quote-character] *' to insert a single character
|
|
|
|
|
while in command state.
|
2019-01-05 09:10:57 +01:00
|
|
|
|
|
|
|
|
|
And just like you can move several steps at once, you can also insert
|
|
|
|
|
a character several times from command state, by pressing a number key
|
|
|
|
|
before pressing '\\[boon-quote-character]’.
|
|
|
|
|
|
2019-08-18 12:22:47 +02:00
|
|
|
|
>> Try that now -- type '8 \\[boon-quote-character] *' to insert ********.
|
2019-01-05 09:10:57 +01:00
|
|
|
|
|
|
|
|
|
|
2019-08-18 12:22:47 +02:00
|
|
|
|
* DELETING
|
2019-08-25 16:37:08 +02:00
|
|
|
|
----------
|
2019-01-05 09:10:57 +01:00
|
|
|
|
|
2019-08-18 12:22:47 +02:00
|
|
|
|
Deleting text is mostly done with the:
|
2019-01-05 09:10:57 +01:00
|
|
|
|
'\\[boon-take-region]' key " (boon-mnemonic 'boon-take-region) ".
|
|
|
|
|
|
2019-08-18 12:22:47 +02:00
|
|
|
|
The '\\[boon-take-region]' command expects an argument. This argument can be any
|
2016-09-04 21:42:27 +02:00
|
|
|
|
right-hand move command (in `boon-moves-map'), such as '\\[backward-char]'.
|
|
|
|
|
|
|
|
|
|
>> Type '\\[boon-take-region] \\[backward-char]' to delete the character before the cursor
|
|
|
|
|
|
2019-01-05 09:10:57 +01:00
|
|
|
|
In the above instructions, '\\[backward-char]' is the argument to the '\\[boon-take-region]' command.
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
|
|
|
|
>> Type '\\[boon-take-region] \\[boon-smarter-backward]' to delete backwards, up to the beginning of a word
|
|
|
|
|
|
|
|
|
|
You can also use a left-hand _region specifier_ as an argument to
|
2019-08-18 12:22:47 +02:00
|
|
|
|
'\\[boon-take-region]'. One such arguments is '" (selector 'boon-select-wim) "', which refers to the symbol (word) or (sexp)
|
2019-01-05 09:10:57 +01:00
|
|
|
|
at point.
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
2019-01-05 09:10:57 +01:00
|
|
|
|
>> Type '\\[boon-take-region] " (selector 'boon-select-wim) "' to delete the symbol where the cursor is
|
|
|
|
|
(even if it's in the middle of the symbol)
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
2019-01-05 09:10:57 +01:00
|
|
|
|
One of the most useful region specifiers is '\\<boon-select-map>\\[boon-select-line]\\<boon-command-map>', which specifies the
|
2016-09-04 21:42:27 +02:00
|
|
|
|
current line.
|
|
|
|
|
|
2019-01-05 09:10:57 +01:00
|
|
|
|
>> Type '\\[boon-take-region] \\<boon-select-map>\\[boon-select-line]\\<boon-command-map>' to delete the current line.
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
2019-01-05 09:10:57 +01:00
|
|
|
|
The region specifiers are defined in the `boon-select-map' keymap.
|
|
|
|
|
(Type '\\[describe-variable] boon-select-map' '<Return>' to inspect it)
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Region arguments can be given a repeat count.
|
|
|
|
|
|
|
|
|
|
>> Type '\\[boon-take-region] 7 \\[forward-char]' to delete seven characters forward.
|
|
|
|
|
|
2019-01-05 09:10:57 +01:00
|
|
|
|
You can also kill a segment of text by selecting it first, and then
|
|
|
|
|
use the kill command.
|
|
|
|
|
|
|
|
|
|
>> Move the cursor to the \"a\" in \"also\" in the previous paragraph.
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
2019-01-05 09:10:57 +01:00
|
|
|
|
>> Type '\\[boon-drop-mark]'. Emacs should display a message \"mark 0\" at the bottom
|
|
|
|
|
of the screen.
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
2019-01-05 09:10:57 +01:00
|
|
|
|
>> Move the cursor to the \"c\" in \"command\", on the second line of the
|
|
|
|
|
same paragraph.
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
2019-01-05 09:10:57 +01:00
|
|
|
|
>> Type '\\[boon-take-region]'. This will kill the text starting from the \"a\", and
|
|
|
|
|
ending just before the \"c\".
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
2019-01-05 09:10:57 +01:00
|
|
|
|
Selecting text with '\\[boon-drop-mark]' can take a region argument, including
|
|
|
|
|
left-hand once. When this argument is a move command, then '\\[boon-drop-mark]'
|
|
|
|
|
behaves like putting a mark at the the current point.
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
2019-01-05 09:10:57 +01:00
|
|
|
|
>> Type '\\[boon-drop-mark] \\<boon-select-map>\\[boon-select-paragraph]\\<boon-command-map>' to select a paragraph.
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
2019-01-05 09:10:57 +01:00
|
|
|
|
>> Type '\\[boon-drop-mark]' with an active selection to cancel the selection.
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
2019-08-18 12:22:47 +02:00
|
|
|
|
In particular the region specifier `boon-select-line'
|
|
|
|
|
'" (selector 'boon-select-line) "' can be given to the marking
|
|
|
|
|
command '\\[boon-drop-mark]', which is a convenient way to select some lines.
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
2019-01-05 09:10:57 +01:00
|
|
|
|
>> Type '\\[boon-drop-mark] " (selector 'boon-select-line) "' to select the current line.
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
2019-01-05 09:10:57 +01:00
|
|
|
|
>> Type '\\[next-line]' a few times to select some lines.
|
|
|
|
|
|
|
|
|
|
>> Type '\\[boon-take-region]' to delete all selected lines.
|
|
|
|
|
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
2019-08-18 12:22:47 +02:00
|
|
|
|
>> Insert some replacement text and go back to command mode.
|
|
|
|
|
|
|
|
|
|
When deleting the word under the cursor, it is sometimes a
|
|
|
|
|
problem that an space remains. The argument-modifier
|
|
|
|
|
\\<boon-select-map>\\[boon-select-with-spaces] adds the extra
|
|
|
|
|
space to the region.
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
2019-01-05 09:10:57 +01:00
|
|
|
|
>> Move the cursor to a word you wish to kill (Cut).
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
2019-01-05 09:10:57 +01:00
|
|
|
|
>> Type '\\[boon-take-region] \\<boon-select-map>\\[boon-select-with-spaces] \\[boon-select-word]\\<boon-command-map>' to remove the word and it's surrounding spaces.
|
2016-09-04 22:20:07 +02:00
|
|
|
|
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
2019-08-25 16:37:08 +02:00
|
|
|
|
|
|
|
|
|
* REPLACING
|
|
|
|
|
-----------
|
|
|
|
|
|
|
|
|
|
You can kill and switch to insert state with a single command:
|
|
|
|
|
'\\[boon-substitute-region]' " (boon-mnemonic 'boon-substitute-region) ".
|
|
|
|
|
|
|
|
|
|
>> Type '\\[boon-substitute-region] " (selector 'boon-select-wim) "' to replace the word/symbol at point.
|
|
|
|
|
|
|
|
|
|
It is sometimes useful to replace a single character. You can
|
|
|
|
|
quickly replace the character at point using the command
|
|
|
|
|
\\[boon-replace-by-character].
|
|
|
|
|
|
|
|
|
|
>> Fix this tipo by moving on the `i' and type \\[boon-replace-by-character] y
|
|
|
|
|
|
|
|
|
|
A typical character replacement is a change of case. The command
|
|
|
|
|
\\[boon-toggle-case] is made for this special purpose.
|
|
|
|
|
|
|
|
|
|
>> move to the beginning of this sentence and type \\[boon-toggle-case] to fix is case.
|
|
|
|
|
|
|
|
|
|
>> Select a whole sentence and use \\[boon-toggle-case] to change its capitalization.
|
|
|
|
|
|
2019-08-18 12:22:47 +02:00
|
|
|
|
* (Copy, `kill-ring-save')
|
|
|
|
|
--------------------------
|
2019-01-05 09:10:57 +01:00
|
|
|
|
|
2019-08-18 12:22:47 +02:00
|
|
|
|
The command for coping is: '\\[boon-treasure-region]'. " (boon-mnemonic 'boon-treasure-region) "
|
2019-01-05 09:10:57 +01:00
|
|
|
|
|
|
|
|
|
It adds the copied text to the `kill-ring' but doesn't remove it from
|
|
|
|
|
the buffer.
|
|
|
|
|
|
2019-08-18 12:22:47 +02:00
|
|
|
|
The command '\\[boon-treasure-region]' behaves like
|
|
|
|
|
'\\[boon-take-region]', if a region is active, then the region
|
|
|
|
|
contents gets copied. Otherwise it expects a motion command.
|
2019-01-05 09:10:57 +01:00
|
|
|
|
|
|
|
|
|
>> Type '\\[boon-treasure-region] " (selector 'boon-select-wim) "' to copy the symbol under the cursor.
|
|
|
|
|
|
|
|
|
|
>> Type '\\[boon-treasure-region] \\[boon-drop-mark]' to copy the current line.
|
|
|
|
|
|
|
|
|
|
|
2019-08-18 12:22:47 +02:00
|
|
|
|
* (Paste, `yank')
|
|
|
|
|
-----------------
|
2019-01-05 09:10:57 +01:00
|
|
|
|
|
2019-08-18 12:22:47 +02:00
|
|
|
|
The command for fetching (yanking, pasting) is: '\\[boon-splice]' " (boon-mnemonic 'boon-splice) "
|
2019-01-05 09:10:57 +01:00
|
|
|
|
|
|
|
|
|
>> Try it, type '\\[boon-splice]' to yank the text back from the `kill-ring'.
|
|
|
|
|
|
|
|
|
|
A numeric argument to '\\[boon-splice]' is the number of times that you want to
|
|
|
|
|
yank the text.
|
|
|
|
|
|
|
|
|
|
'\\[yank-pop]' (shift f) calls `yank-pop', which replaces the just yanked text
|
|
|
|
|
with the previous entry in the `kill-ring'
|
|
|
|
|
|
|
|
|
|
|
2019-08-18 12:22:47 +02:00
|
|
|
|
* REPEAT
|
2019-01-05 09:10:57 +01:00
|
|
|
|
---------
|
|
|
|
|
|
|
|
|
|
The last complex command can be repeated by typing: '\\[boon-repeat-command]'.
|
|
|
|
|
|
|
|
|
|
In Emacs, complex commands are defined as those which demand
|
|
|
|
|
minibuffer input. This definition includes commands which take region
|
|
|
|
|
arguments, such as `boon-take-region' and `boon-substitute-region'.
|
|
|
|
|
We extend this definition with the insert command.
|
2017-05-08 16:33:15 +02:00
|
|
|
|
|
2019-01-05 09:10:57 +01:00
|
|
|
|
>> Substitute a word by typing: '\\[boon-substitute-region] " (selector 'boon-select-wim) "'
|
|
|
|
|
(it removes the word and enters insert state).
|
2017-05-08 16:33:15 +02:00
|
|
|
|
|
2019-01-05 09:10:57 +01:00
|
|
|
|
>> Type another word as a replacement.
|
|
|
|
|
|
|
|
|
|
>> Return to command state with: '<ESC>'
|
|
|
|
|
|
|
|
|
|
>> Move the cursor to another word and type: '\\[boon-repeat-command]'
|
|
|
|
|
(the word was substituted with the same replacement text).
|
2017-05-08 16:33:15 +02:00
|
|
|
|
|
|
|
|
|
All complex commands, including inserts, are saved in the
|
2019-08-18 12:22:47 +02:00
|
|
|
|
‘command-history’. You can can conjure up (and possibly fix) any complex
|
2019-01-05 09:10:57 +01:00
|
|
|
|
command of your choice using '\\[repeat-complex-command]'.
|
2017-05-08 16:33:15 +02:00
|
|
|
|
|
|
|
|
|
|
2016-09-04 21:42:27 +02:00
|
|
|
|
* WHITESPACE
|
|
|
|
|
------------
|
|
|
|
|
|
2019-01-05 09:10:57 +01:00
|
|
|
|
While using standard Emacs commands, it sometimes gets annoying to
|
|
|
|
|
manage whitespace. Yanking a word may leave extra space here, and a
|
|
|
|
|
lack of space there. In Boon, repeating the '\\[boon-splice]' command automatically
|
|
|
|
|
fixes spaces, using a heuristic based on the syntax-table.
|
|
|
|
|
|
|
|
|
|
>> Move the cursor to the \"v\" inside the following quotes: \" very\"
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
2019-01-05 09:10:57 +01:00
|
|
|
|
>> Type: '\\[boon-treasure-region] \\<boon-select-map>\\[boon-select-with-spaces] \\[boon-select-word]\\<boon-command-map>' to copy the word with the leading space.
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
2019-01-05 09:10:57 +01:00
|
|
|
|
>> Move the cursor to the first letter of the word \"annoying\" in the
|
|
|
|
|
previous paragraph.
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
2019-01-05 09:10:57 +01:00
|
|
|
|
>> Type: '\\[boon-splice]' to yank (paste) and notice how the spacing is wrong.
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
2019-01-05 09:10:57 +01:00
|
|
|
|
>> Repeat '\\[boon-splice]' and see how the spacing gets fixed for you.
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
2019-01-05 09:10:57 +01:00
|
|
|
|
In Emacs, killing extra spaces between words can be done in hindsight.
|
|
|
|
|
That is, you can cut a word with or without spaces before or after it.
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
2019-01-05 09:10:57 +01:00
|
|
|
|
But Emacs automatically \"glues\" adjacent cuts in the `kill-ring'.
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
2019-01-05 09:10:57 +01:00
|
|
|
|
With Boon, cutting spaces can also be done in foresight, even in the
|
|
|
|
|
middle of a word, using the region selector transformer: '\\<boon-select-map>\\[boon-select-with-spaces]'. It
|
|
|
|
|
includes the space following a word or the leading space if it's the
|
|
|
|
|
last word (ending with a period).
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
|
|
|
|
|
2019-01-05 09:10:57 +01:00
|
|
|
|
* ENCLOSURES (PARENS, ETC.)
|
|
|
|
|
---------------------------
|
|
|
|
|
|
|
|
|
|
Boon provides help with manipulating enclosures.
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
2019-08-18 12:22:47 +02:00
|
|
|
|
The command '\\[boon-enclose]' " (boon-mnemonic 'boon-enclose) " adds enclosures around a region.
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
|
|
|
|
It takes two arguments:
|
|
|
|
|
|
2019-01-05 09:10:57 +01:00
|
|
|
|
1. The kind of enclosure to use ('p' for regular parentheses)
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
2019-01-05 09:10:57 +01:00
|
|
|
|
2. The region to surround. This region is specified by the same
|
|
|
|
|
language as the arguments to '\\[boon-take-region]' or '\\[boon-drop-mark]' commands.
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
2019-08-18 12:22:47 +02:00
|
|
|
|
>> With the cursor over a word, type '\\[boon-enclose] p \\<boon-select-map>\\[boon-select-wim]\\<boon-command-map>' to enclose it in parens.
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
2019-01-05 09:10:57 +01:00
|
|
|
|
It is often useful to put enclosures around what has just been pasted.
|
|
|
|
|
The just pasted region is accessible with: '\\[boon-toggle-mark]' (single quote).
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
2019-01-05 09:10:57 +01:00
|
|
|
|
>> Delete a word with '\\[boon-take-region] \\<boon-select-map>\\[boon-select-word]\\<boon-command-map>', then paste it with '\\[boon-splice]'.
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
2019-01-05 09:10:57 +01:00
|
|
|
|
>> Put parens around the just pasted word with: '\\[boon-enclose] p \\[boon-toggle-mark]'.
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
2019-08-18 12:22:47 +02:00
|
|
|
|
>> Inspect and customize the kind of enclosures available with:
|
2019-01-05 09:10:57 +01:00
|
|
|
|
'\\[customize-variable] boon-enclosures' '<Return>'
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
2019-01-05 09:10:57 +01:00
|
|
|
|
It is also possible to remove enclosures with the '\\<boon-select-map>\\[boon-select-borders]\\<boon-command-map>' operator, which
|
|
|
|
|
transforms a region argument to its enclosure (the first and last characters).
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
2019-01-05 09:10:57 +01:00
|
|
|
|
Just delete the parentheses:
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
2019-01-05 09:10:57 +01:00
|
|
|
|
>> Move the cursor inside this (sexp).
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
2019-01-05 09:10:57 +01:00
|
|
|
|
>> Type '\\[boon-take-region] \\<boon-select-map>\\[boon-select-borders] \\[boon-select-outside-pairs]\\<boon-command-map>'.
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
2019-01-05 09:10:57 +01:00
|
|
|
|
Or delete the whole expression:
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
2019-01-05 09:10:57 +01:00
|
|
|
|
>> Move the cursor inside this (sexp).
|
|
|
|
|
|
|
|
|
|
>> Type '\\[boon-take-region] \\<boon-select-map>\\[boon-select-outside-pairs]\\<boon-command-map>'.
|
|
|
|
|
|
|
|
|
|
The '\\<boon-select-map>\\[boon-select-borders]\\<boon-command-map>' operator is especially useful when applied to '\\<boon-select-map>\\[boon-select-outside-pairs]\\<boon-command-map>', '\\[boon-smarter-backward]'
|
|
|
|
|
and '\\[boon-smarter-forward]' --- but it works on any region.
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
|
|
|
|
|
2019-08-25 17:15:39 +02:00
|
|
|
|
* NAVIGATION (BROWSE)
|
|
|
|
|
---------------------
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
2019-08-25 17:05:50 +02:00
|
|
|
|
A number of keys are reserved for navigation.
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
2019-08-25 17:05:50 +02:00
|
|
|
|
To search for the next/previous occurence of the word at point,
|
|
|
|
|
use the keys \\[boon-qsearch-next-at-point] and \\[boon-qsearch-previous-at-point].
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
2019-08-25 17:15:39 +02:00
|
|
|
|
Searching for all occurences of a string is bound to the key
|
|
|
|
|
`\\[occur]' " (boon-mnemonic 'occur) ". (Note: it is recommended to rebind this key to
|
|
|
|
|
`swiper' (from the package of the same name))
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
2019-08-25 17:05:50 +02:00
|
|
|
|
Once you have completed a search you can quickly navigate
|
|
|
|
|
through the list of searches using the keys
|
2019-08-25 22:18:32 +02:00
|
|
|
|
`\\[boon-navigate-backward]' " (boon-mnemonic 'boon-navigate-backward) " and `\\[boon-navigate-forward]' "(boon-mnemonic 'boon-navigate-forward)".
|
2019-01-05 09:10:57 +01:00
|
|
|
|
|
2019-08-25 17:05:50 +02:00
|
|
|
|
>> Type `\\[occur]' navig <Return>
|
2019-08-25 22:18:32 +02:00
|
|
|
|
>> Examine some of the occurences in the buffer using `\\[boon-navigate-backward]' and `\\[boon-navigate-forward]'.
|
2019-08-25 17:15:39 +02:00
|
|
|
|
|
|
|
|
|
>> Type `\\[isearch-forward]' navig <Return>
|
|
|
|
|
>> Examine some more of the occurences in the buffer.
|
2019-01-05 09:10:57 +01:00
|
|
|
|
|
2019-08-25 22:18:32 +02:00
|
|
|
|
The keys `\\[boon-navigate-backward]' and `\\[boon-navigate-forward]' will perform by default `previous-error' and
|
2019-08-25 17:05:50 +02:00
|
|
|
|
`next-error', which are in fact versatile navigation commands in
|
|
|
|
|
Emacs, allowing you to browse not only errors but `occur' or grep
|
|
|
|
|
occurences and many other things depending on context. However, additionally, if you
|
|
|
|
|
have performed a search using `isearch', `swiper' or
|
2019-08-25 22:18:32 +02:00
|
|
|
|
\\[boon-qsearch-next-at-point] and \\[boon-qsearch-previous-at-point], then `\\[boon-navigate-backward]' (backward) and `\\[boon-navigate-forward]'
|
2019-08-25 17:05:50 +02:00
|
|
|
|
will navigate through the matches. Finally, the same keys will
|
|
|
|
|
cycle through multiple cursors when they are active.
|
|
|
|
|
(Use \\[boon-quit] to exit such contexts.)
|
2019-08-18 12:22:47 +02:00
|
|
|
|
|
2019-01-05 09:10:57 +01:00
|
|
|
|
|
|
|
|
|
* MULTIPLE REGIONS
|
|
|
|
|
------------------
|
2016-09-04 22:20:07 +02:00
|
|
|
|
|
2019-01-05 09:10:57 +01:00
|
|
|
|
Boon provides a region operator that works on all occurrences of a
|
|
|
|
|
string in a region. The operator takes two arguments:
|
|
|
|
|
1. A string.
|
|
|
|
|
2. And a region that contains the matching strings.
|
|
|
|
|
You can remove all occurrences of Boon in this paragraph:
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
2019-01-05 09:10:57 +01:00
|
|
|
|
>> Move the cursor inside the word \"Boon\" in the previous paragraph.
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
2019-01-05 09:10:57 +01:00
|
|
|
|
>> Type: '\\[boon-take-region] \\<boon-select-map>\\[boon-select-occurences] \\[boon-select-wim] \\[boon-select-paragraph]\\<boon-command-map>'
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
|
|
|
|
|
2019-01-05 09:10:57 +01:00
|
|
|
|
* MULTIPLE CURSORS
|
|
|
|
|
------------------
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
2019-01-05 09:10:57 +01:00
|
|
|
|
If you have the \"multiple-cursors\" package installed, then you can
|
|
|
|
|
replace all occurrences.
|
|
|
|
|
|
|
|
|
|
>> Undo the previous command.
|
|
|
|
|
|
|
|
|
|
>> Move the cursor inside the word \"Boon\" again.
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
|
|
|
|
>> Type '\\[boon-substitute-region] \\<boon-select-map>\\[boon-select-occurences] \\[boon-select-wim] \\[boon-select-paragraph]\\<boon-command-map>'
|
2019-01-05 09:10:57 +01:00
|
|
|
|
|
|
|
|
|
>> Type the replacement text.
|
|
|
|
|
|
|
|
|
|
>> Exit \"multiple-cursors\" by typing '<ESC>' repeatedly.
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
|
|
|
|
Boon has special support for multiple cursors, which means that all
|
2019-01-05 09:10:57 +01:00
|
|
|
|
commands described in this tutorial should work out of the box with
|
|
|
|
|
multiple cursors.
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
* SPECIAL BUFFERS
|
|
|
|
|
-----------------
|
|
|
|
|
|
2019-01-05 09:10:57 +01:00
|
|
|
|
Certain Emacs modes already offer their own command system. Such
|
|
|
|
|
modes include \"dired\", \"magit\", and others. In such buffers, it
|
|
|
|
|
makes little sense to have an insert state, and most edit commands
|
2019-04-29 21:42:20 +02:00
|
|
|
|
do not make sense either.
|
2019-01-05 09:10:57 +01:00
|
|
|
|
|
|
|
|
|
In such modes Boon switches to a \"special state\", where the modeline
|
|
|
|
|
shows: Boon:SPC, and only overrides the 'x' key, which is bound to
|
|
|
|
|
`boon-x-map'.
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
|
|
|
|
You can get the original behavior of x keys by prefixing it
|
2019-04-29 21:42:20 +02:00
|
|
|
|
with (\\<boon-special-map>\\[boon-quote-character]). For example, in \"dired\",
|
|
|
|
|
\\<boon-special-map>\\[boon-quote-character] x
|
|
|
|
|
will execute the pending actions.
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
|
|
|
|
|
2019-08-18 12:22:47 +02:00
|
|
|
|
* IF EMACS STOPS RESPONDING
|
|
|
|
|
---------------------------
|
|
|
|
|
|
|
|
|
|
If Emacs stops responding to your commands, you can stop it safely
|
|
|
|
|
by typing 'C-g'. You can also use 'C-g' to stop a command which is
|
|
|
|
|
taking too long to execute.
|
|
|
|
|
|
|
|
|
|
And 'C-g' can discard an argument or cancel a command that you do not
|
|
|
|
|
want to finish.
|
|
|
|
|
|
|
|
|
|
'<ESC>' is also an alternative which works in many contexts.
|
|
|
|
|
|
|
|
|
|
|
2016-09-04 21:42:27 +02:00
|
|
|
|
* COPYING
|
|
|
|
|
---------
|
|
|
|
|
|
2019-01-05 09:10:57 +01:00
|
|
|
|
This tutorial descends from a long line of Emacs tutorials starting
|
|
|
|
|
with the one written by Stuart Cracraft for the original Emacs.
|
2016-09-04 21:42:27 +02:00
|
|
|
|
|
|
|
|
|
This version of the tutorial is not a part of GNU Emacs, but derived
|
|
|
|
|
from the standard Emacs tutorial,
|
|
|
|
|
|
|
|
|
|
|
2019-08-18 12:22:47 +02:00
|
|
|
|
Copyright (C) 1985, 1996, 1998, 2001-2019 Free Software Foundation,
|
2016-09-04 21:42:27 +02:00
|
|
|
|
Inc.
|
2016-11-08 21:38:01 +01:00
|
|
|
|
")))))
|
2016-11-06 16:06:44 +01:00
|
|
|
|
(goto-char 1))
|
|
|
|
|
|
|
|
|
|
;;; boon-tutorial.el ends here
|