Files
autoscratch/README.md

46 lines
2.0 KiB
Markdown
Raw Normal View History

2017-07-19 11:26:06 +02:00
[![Build Status](https://travis-ci.org/TLINDEN/autoscratch.svg?branch=master)](https://travis-ci.org/TLINDEN/autoscratch)
2017-07-15 16:29:19 +02:00
# autoscratch-mode - automatically switch scratch buffer mode
*Author:* T.v.Dein <tlinden AT cpan DOT org><br>
2017-07-15 16:30:20 +02:00
*URL:* [https://github.com/tlinden/autoscratch](https://github.com/tlinden/autoscratch)<br>
2017-07-15 16:29:19 +02:00
## Introduction
This simple major mode can be used as the initial major mode for
the scratch buffer. It automatically switches to another major mode
based on regexes triggered by text input.
In the default configuration it responds to the first
non-whitespace character entered into the scratch buffer and
switches major mode based on this. See the variable
`autoscratch-triggers-alist` for the defaults. For example, if you
enter a paren, it will switch to `emacs-lisp-mode`.
## Configuration
The minimum configuration looks like this:
2017-07-18 19:46:02 +02:00
(require 'autoscratch-mode)
2017-07-15 16:29:19 +02:00
(setq initial-major-mode 'autoscratch-mode)
2017-07-17 17:17:43 +02:00
(setq initial-scratch-message "")
(setq inhibit-startup-screen t)
2017-07-15 16:29:19 +02:00
You may, however, configure the trigger list
`autoscratch-triggers-alist` according to your preferences. This
list consists of cons cells, where the `car` is a regexp and the
`cdr` an emacs lisp form (e.g. a lambda or defun). If you want to
use regexps which match more than one character, then you need to
2017-07-15 21:45:04 +02:00
set `autoscratch-trigger-on-first-char` to `nil` and possibly tune
2017-07-15 16:29:19 +02:00
`autoscratch-trigger-after` accordingly.
If no regexp matches and/or `autoscratch-trigger-after` is
exceeded, then the `autoscratch-default-trigger` form will be
executed, which by default is `fundamental-mode`, but you can of
course change this.
Autoscratch can also be configured to rename the current buffer
after it switched mode based on a trigger and create a new
`autoscratch-buffer` in the background. In order to enable this
feature, set `autoscratch-fork-after-trigger` to t.