How to automatically save files on lose focus in Emacs

前端 未结 5 1111
日久生厌
日久生厌 2020-12-09 16:23

Is it possible to configure Emacs, so that it saves all files when the emacs window loses focus?

5条回答
  •  醉话见心
    2020-12-09 17:05

    Not sure if this is what you want.

    (defun dld-deselect-frame-hook ()
      (save-some-buffers 1))
    
    (add-hook 'deselect-frame-hook 'dld-deselect-frame-hook)
    

    From: http://www.dribin.org/dave/blog/archives/2003/09/10/emacs/

    EDIT: It only seems to work in XEmacs

提交回复
热议问题