Automatically switch major mode from *scratch*
Emacs Lisp Shell
Switch branches/tags
Nothing to show
Latest commit 9c602ea Jul 30, 2017 Thomas von Dein Thomas von Dein avoid renaming self, which happened from time to time
Permalink
Failed to load latest commit information.
test more tests Jul 19, 2017
.travis.yml +test Jul 18, 2017
Cask rename Jul 18, 2017
LICENSE Initial commit Jul 15, 2017
README.md clean eof Jul 26, 2017
autoscratch-mode.el avoid renaming self, which happened from time to time Jul 30, 2017
run-tests.sh fixagain Jul 19, 2017

README.md

Build Status

autoscratch-mode - automatically switch scratch buffer mode

Author: T.v.Dein
URL: https://github.com/tlinden/autoscratch

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:

    (require 'autoscratch-mode)
    (setq initial-major-mode 'autoscratch-mode)
    (setq initial-scratch-message "")
    (setq inhibit-startup-screen t)

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 set autoscratch-trigger-on-first-char to nil and possibly tune 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.