-
-
Notifications
You must be signed in to change notification settings - Fork 192
Configuring Lem
Lem reads a lisp configuration file at startup:
$HOME/.lem/init.lisp
You might want to start it with:
(in-package :lem)
so you won't need to prefix all variables and commands.
When we eval lisp expressions with M-:
, the default *package*
is CL-USER. You can change it to Lem's package, so that it's easier to write Lem commands:
(lem-lisp-mode/internal::lisp-set-package "LEM")
Use M-x describe-bindings
or M-x documentation-describe-bindings
.
I didn't find. You can do M-:
and enter (lem:current-mode-keymap)
, but it does not show in which package this keymap is defined.
Probably we should add information about keymaps into the output of the describe-bindings
?
Let's pretend you want to make C-s C-w
to search a symbol at point. By default, C-s
turns on Isearch
minor mode which has it's own keymap. To do what we need, we have to add a C-w
key to this keymap like that:
(lem:define-key lem.isearch:*isearch-keymap*
"C-w"
'lem.isearch:isearch-forward-symbol-at-point)
To make a key execute more than one actions, create a command with define-command
. For example:
(define-command test () ()
(let ((p (lem:current-point)))
(lem:buffer-start p)
(lem-vi-mode/commands:vi-mode-move-to-end-of-line)))
Use (lem-vi-mode:vi-mode)
in the init file (or M-x vi-mode / emacs-mode
).
What is the current mode? (lem::current-global-mode)
(lem-paredit-mode:paredit-mode)
Start Paredit automatically with Lisp files:
;; thks @sasanidas
(add-hook lem:*find-file-hook*
(lambda (buffer)
(when (eq (buffer-major-mode buffer) 'lem-lisp-mode:lisp-mode)
(change-buffer-mode buffer 'lem-paredit-mode:paredit-mode t))))
If you want to start in vi-mode at start-up, add the command to the init file.
this allows to go to the previous line:
(define-key completion-mode-keymap "Shift-Tab" 'completion-previous-line)
it is not part of the Lem 2.0 release but it was added right after.
Do as usual: use (ql:quickload "library")
in a Lisp REPL, or clone a library that is not available in Quicklisp into your ~/quicklisp/local-projects/
directory.
Here's a simple hook that inserts a closing ")" when you write an opening "(":
(defun electric-pair (char)
;; @akasha
(when (eq char #\()
(insert-character (current-point) #\))
(backward-char)))
(add-hook (variable-value 'self-insert-after-hook) 'electric-pair)
If your theme (M-x load-theme
) doesn't satisfy you, try this:
(define-color-theme "my-theme" (<Inherit your current theme>)
(modeline-name-attribute :foreground "...")
(inactive-modeline-name-attribute :foreground "...")
(modeline-major-mode-attribute :foreground "...")
(inactive-modeline-major-mode-attribute :foreground "...")
(modeline-minor-modes-attribute :foreground "...")
(inactive-modeline-minor-modes-attribute :foreground "...")
(modeline-position-attribute :foreground "..." :background "...")
(inactive-modeline-position-attribute :foreground "..." :background "...")
(modeline-posline-attribute :foreground "..." :background "...")
(inactive-modeline-posline-attribute :foreground "..." :background "...")
)
(load-theme "my-theme")