我正在努力实现这个目标:
(global-set-key [f7] (lambda (save-some-buffers t)))
[f7]保存所有文件缓冲区而不问我任何问题。问题是我不知道如何表达lambda以便为save-some-buffers提供选项。
save-some-buffers is an interactive compiled Lisp function.
It is bound to C-x s.
(save-some-buffers &optional ARG PRED)
Save some modified file-visiting buffers. Asks user about each one.
You can answer `y' to save, `n' not to save, `C-r' to look at the
buffer in question with `view-buffer' before deciding or `d' to
view the differences using `diff-buffer-with-file'.
This command first saves any buffers where `buffer-save-without-query' is
non-nil, without asking.
Optional argument (the prefix) non-nil means save all with no questions.
Optional second argument PRED determines which buffers are considered:
If PRED is nil, all the file-visiting buffers are considered.
If PRED is t, then certain non-file buffers will also be considered.
If PRED is a zero-argument function, it indicates for each buffer whether
to consider it or not when called with that buffer current.
See `save-some-buffers-action-alist' if you want to
change the additional actions you can take on files.
答案 0 :(得分:2)
缺少两件事:参数列表(在这种情况下将为空)和一个interactive
声明,如果没有它,Emacs将不允许您通过键绑定调用该函数。
(global-set-key [f7] (lambda () (interactive) (save-some-buffers t)))