开发者

What do each of these stand for after the "Save file?" prompt: (y, n, !, ., q, C-r, d or C-h)

开发者 https://www.devze.com 2023-02-22 01:44 出处:网络
The question is pretty self-explanatory. When I close emacs and some changes are unsaved, I\'m asked if I want to save the file and given this list of opt开发者_开发问答ions. I assume \"y\" and \"n\"

The question is pretty self-explanatory. When I close emacs and some changes are unsaved, I'm asked if I want to save the file and given this list of opt开发者_开发问答ions. I assume "y" and "n" are "yes" and "no", but what are the other options?


Type ? and you'll get a buffer showing:

Type SPC or `y' to save the current buffer;
DEL or `n' to skip the current buffer;
RET or `q' to give up on the save (skip all remaining buffers);
C-g to quit (cancel the whole command);
! to save all remaining buffers;
C-r to view this buffer;
d to view changes in this buffer;
or . (period) to save the current buffer and exit.

If you want to add/change actions that happen during the save-some-buffers function, then you can modify the variable save-some-buffers-action-alist. Perhaps if you wanted to add a binding to save the changes and kill the buffer via the key k. You could do this:

(add-to-list 'save-some-buffers-action-alist
             `(?k ,(lambda (buf) (save-buffer buf) (kill-buffer buf))
                  ,(purecopy "save changes and kill the buffer")))

If you look at the documentation for save-some-buffers, it will direct you to save-some-buffers-action-alist - which further directs you to map-y-or-n-p - which actually does have documentation on the format of that variable.

0

精彩评论

暂无评论...
验证码 换一张
取 消