emacs插件(2)——持久化scratch

1、參考

emacs系列文章目錄——更新inghtml

Re-open scratch buffer in Emacs?node

persistent-scratchsegmentfault

Lisp Interaction Buffers緩存

2、scratch

2.1 基本介紹

當啓動eamcs的時候,spa

(1)會自動進入lisp交互模式插件

image.png

(2)會自動產生一個lisp交互式的buffer——scratch bufferrest

2.2 進入 *scratch*

(1) C-x b *scratch* code

執行上面的命令,將自動進入 scratch bufferhtm

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

image.png

2.3 *scratch* 的基本命令

命令 說明
C-j 執行當前的表達式,結果輸出到下一行,image.png
C-x C-e 執行當前的表達式,結果輸出到下面的輸出區域 image.png

3、*scratch* 文件

3.1 *scratch* 保存爲文件

C-x C-ssave-buffer將當前*scratch* 保存爲文件

image.png

image.png

3.2 文件恢復

(1) 打開文件

C-x C-ffind-file 打開以前保存的文件

(2) 切換模式

默認打開文件後,進入的模式是 Fundamental mode, 至關於一個普通文本編輯模式

須要使用 M-x lisp-interaction-mode進入lisp交互模式

image.png

image.png

image.png

image.png

image.png

4、插件 persistent-scratch

4.1 安裝插件

M-x package-install RET persistent-scratch RET

4.2 命令列表

命令 說明
persistent-scratch-save 保存緩存 image.png
persistent-scratch-restore 恢復緩存 image.png
persistent-scratch-save-to-file 保存到指定文件 image.png
persistent-scratch-restore-from-file 從指定文件恢復 image.png

(1) 默認的安裝文件目錄是

image.png

(2) 能夠在從新進入*scratch* buffer後,執行 persistent-scratch-restore, 恢復以前的記錄,也能夠先經過命令恢復,再進入到*scratch* buffer

4.3 自動保存

M-x persistent-scratch-autosave-mode 是否開啓自動保存

默認的保存間隔是 300s

經過(persistent-scratch-autosave-mode 1)添加到init.el, 能夠配置自動保存

image.png

image.png

相關文章
相關標籤/搜索