浏览代码

Implemenet buffer kill ask

master
10sr 6 年前
父节点
当前提交
07b0254627
签署人:: 10sr GPG 密钥 ID: 7BEC428194130EB2
共有 1 个文件被更改,包括 22 次插入2 次删除
  1. +22
    -2
      emacs.el

+ 22
- 2
emacs.el 查看文件

@@ -1831,6 +1831,22 @@ This mode is a simplified version of `adoc-mode'."
:type 'string
:group 'awk-preview)

(defcustom awk-preview-kill-orphan-program-buffer
'ask
"This variable decides whether program buffers which do not visit any files
will be killed when exiting awk-preview sessions.

When set to nil, do not kill program buffers.
When set to `ask', ask user whether to kill them.
For other values always kill them silently.

When a program buffer is visiting a file, the buffer will not be killed for any
cases regardless of this variable."
:type '(choice (const t)
(const nil)
(const ask))
:group 'awk-preview)

(cl-defstruct awk-preview--env
(running-p nil)
;; Point of beg in source buffer
@@ -2041,8 +2057,12 @@ DISPLAY non-nil means redisplay buffer as output is inserted."
(with-current-buffer (awk-preview--env-source-buffer awk-preview--env)
(cl-assert awk-preview--env)
(kill-buffer (awk-preview--env-preview-buffer awk-preview--env))
;; TODO: Ask if it should be killed
(kill-buffer (awk-preview--env-program-buffer awk-preview--env))
(when (and (not (buffer-file-name (awk-preview--env-program-buffer awk-preview--env)))
(if (eq 'ask
awk-preview-kill-orphan-program-buffer)
(yes-or-no-p "Program buffer does not visit any file. Kill? ")
awk-preview-kill-orphan-program-buffer))
(kill-buffer (awk-preview--env-program-buffer awk-preview--env)))
(setf (awk-preview--env-running-p awk-preview--env) nil))
(set-window-configuration (awk-preview--env-window-configuration awk-preview--env)))



正在加载...
取消
保存