Fix quit confirmations in daemon; add for frames
+ Add quit confirmation when closing a frame with real buffers + Ensure quit confirmations also work in daemon frames (tty or gui)
This commit is contained in:
parent
d8c7ce8c4e
commit
66cfbb2563
3 changed files with 28 additions and 3 deletions
|
@ -68,6 +68,9 @@
|
|||
+ =tools/password-store= -- Emacs as a password manager, using [[https://www.passwordstore.org/][pass]] as a backend.
|
||||
+ =app/irc= -- Emacs as an IRC client, using circe (contributed by [[https://github.com/bandresen][brandresen]])
|
||||
+ =core=
|
||||
+ =core-ui=
|
||||
+ Add quit confirmation when trying to close a frame that contains real buffers.
|
||||
+ Fix quit confirmations for clients connected to ~emacs --daemon~ with ~emacsclient~.
|
||||
+ =core-packages=
|
||||
+ When a quelpa package is deleted, its build repo (in ~quelpa-build-dir~) is now deleted with it.
|
||||
+ =feature=
|
||||
|
|
|
@ -50,3 +50,12 @@ window changes before then, the undo expires."
|
|||
(doom-resize-window (truncate (/ (frame-width) 1.2)) t)
|
||||
(doom-resize-window (truncate (/ (frame-height) 1.2)))
|
||||
t)))
|
||||
|
||||
;;;###autoload
|
||||
(defun doom/delete-frame ()
|
||||
"Delete the current frame, but ask for confirmation if it isn't empty."
|
||||
(interactive)
|
||||
(if (cdr (frame-list))
|
||||
(when (doom-quit-p "Close frame?")
|
||||
(delete-frame))
|
||||
(save-buffers-kill-emacs)))
|
||||
|
|
|
@ -34,12 +34,23 @@
|
|||
pos-tip-border-width 1
|
||||
;; no beeping or blinking please
|
||||
ring-bell-function #'ignore
|
||||
visible-bell nil
|
||||
;; Ask for confirmation on quit only if real buffers exist
|
||||
confirm-kill-emacs (lambda (_) (if (doom-real-buffers-list) (y-or-n-p "››› Quit?") t)))
|
||||
visible-bell nil)
|
||||
|
||||
(fset #'yes-or-no-p #'y-or-n-p) ; y/n instead of yes/no
|
||||
|
||||
;; Ask for confirmation when trying to kill emacs or close a frame that has real
|
||||
;; buffers open in it.
|
||||
(defun doom-quit-p (&optional prompt)
|
||||
"Return t if this session should be killed; prompts the user for
|
||||
confirmation."
|
||||
(interactive)
|
||||
(if (ignore-errors (doom-real-buffers-list))
|
||||
(or (yes-or-no-p (format "››› %s" (or prompt "Quit Emacs?")))
|
||||
(ignore (message "Aborted")))
|
||||
t))
|
||||
(setq confirm-kill-emacs nil)
|
||||
(add-hook 'kill-emacs-query-functions #'doom-quit-p)
|
||||
|
||||
;; show typed keystrokes in minibuffer
|
||||
(setq echo-keystrokes 0.02)
|
||||
;; ...but hide them while isearch is active
|
||||
|
@ -119,6 +130,8 @@ mode is detected.")
|
|||
;; Bootstrap
|
||||
;;
|
||||
|
||||
(global-set-key [remap delete-frame] #'doom/delete-frame)
|
||||
|
||||
;; auto-enabled in Emacs 25+; I'd rather enable it manually
|
||||
(global-eldoc-mode -1)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue