Emacs plug in ( two ) ——Persistent scratch

Time:2021-4-21

1、 Reference

Contents of Emacs series articles — updating

Re-open scratch buffer in Emacs?

persistent-scratch

Lisp Interaction Buffers

2scratch

2.1 basic introduction

When startedeamcsWhen I was young,

(1) It will enter automaticallyLISP interaction mode

Emacs plug in ( two ) ——Persistent scratch

(2) Will automatically generate aLISP interactive buffer——scratch buffer

2.2 access*scratch*

(1) C-x b *scratch*

Execute the above command, it will enter automaticallyscratch buffer

(2) M-x switch-to-buffer *scratch*

Emacs plug in ( two ) ——Persistent scratch

2.3 *scratch*The basic command of

command explain
C-j Execute the current expression and output the result to the next line,Emacs plug in ( two ) ——Persistent scratch
C-x C-e Execute the current expression and output the result to the output area belowEmacs plug in ( two ) ——Persistent scratch

3*scratch*file

3.1 *scratch*Save as file

C-x C-sNamelysave-bufferPut the current*scratch*Save as file

Emacs plug in ( two ) ——Persistent scratch

Emacs plug in ( two ) ——Persistent scratch

3.2 file recovery

(1) Open file

C-x C-fNamelyfind-fileOpen previously saved files

(2) Switching mode

After opening the file by default, the mode to enter isFundamental mode, Equivalent to a normal text editing mode

Need to useM-x lisp-interaction-modeget intoLISP interaction mode

Emacs plug in ( two ) ——Persistent scratch

Emacs plug in ( two ) ——Persistent scratch

Emacs plug in ( two ) ——Persistent scratch

Emacs plug in ( two ) ——Persistent scratch

Emacs plug in ( two ) ——Persistent scratch

4、 Plug inpersistent-scratch

4.1 installing plug-ins

M-x package-install RET persistent-scratch RET

4.2 command list

command explain
persistent-scratch-save Save cacheEmacs plug in ( two ) ——Persistent scratch
persistent-scratch-restore Recover cacheEmacs plug in ( two ) ——Persistent scratch
persistent-scratch-save-to-file Save to specified fileEmacs plug in ( two ) ——Persistent scratch
persistent-scratch-restore-from-file Recover from specified fileEmacs plug in ( two ) ——Persistent scratch

(1) The default installation file directory is

Emacs plug in ( two ) ——Persistent scratch

(2) You can re-enter the*scratch* bufferAfter that, executepersistent-scratch-restoreTo restore the previous record, you can also restore it by command first, and then enter the*scratch* buffer

four . 3 auto save

M-x persistent-scratch-autosave-modeDo you want to turn on auto save

The default save interval is300s

adopt(persistent-scratch-autosave-mode 1)Add toinit.el, you can configure auto save

Emacs plug in ( two ) ——Persistent scratch

Emacs plug in ( two ) ——Persistent scratch