Skip to content

EricCrosson/unkillable-scratch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

unkillable-scratch Build Status MELPA Stable MELPA

Disallow the *scratch* buffer from being killed

Install

From MELPA

(use-package unkillable-scratch
  :ensure t
  :pin melpa-stable
  :config (unkillable-scratch t))

Or manually, after downloading into your load-path

(require 'unkillable-scratch)
(unkillable-scratch t)

Use

The variable unkillable-scratch-behavior defines the action taken when a kill is attempted on a buffer matching one or more of the regexp's in the list unkillable-buffers. This list will only match one buffer by default, the *scratch* buffer.

This package treats the *scratch* buffer specially; in the event of a call to kill-buffer the buffer contents will be replaced with initial-scratch-message. To disable this behavior set unkillable-scratch-do-not-reset-scratch-buffer to t.

The following values of unkillable-scratch-behavior are supported

Setting Meaning
'bury bury the buffer instead of killing it (default)
'do-nothing disallow the attempted kill from occurring
'kill kill the buffer -- same as disabling the minor mode

Related

persistent-scratch is definitely worth a look.

Acknowledgments

The inspiration to make the unkillable-buffers list came from Donald Curtis (milkypostman)

Contributors

  • @tarsius for advice on best-practices
  • @djl for the feature to persist *scratch*-buffer contents

Regrets

If I were the type of person to proliferate breaking-changes, I would rename the unkillable-scratch minor-mode to unkillable-scratch-mode for conventions' sake.

Making this change would necessitate re-publishing the package to MELPA and only consume the time of the MELPA maintainers and every user of this package without making any functional changes, so for now just note that said function is enabling a global minor-mode.

License

GPL 2 (or higher) © Free Software Foundation, Inc.