diff --git a/CHANGELOG.develop b/CHANGELOG.develop index e3ba82026b9d..ce84da7eeeb2 100644 --- a/CHANGELOG.develop +++ b/CHANGELOG.develop @@ -78,6 +78,7 @@ the [[file:CHANGELOG.org][CHANGELOG.org]] file. - Added support for native fill column indicator in Emacs 27+ (thanks to Andriy Kmit) - Add support for background transparency aka true transparency. Key bindings are under ~SPC T B~ (thanks to JoshTRN) +- Binding the ~SPC f d~ for deleting current buffer and file (thanks to Lin Sun) *** Breaking Changes **** Major - Support for Emacs 25 or Emacs 26 has been dropped, the minimal Emacs version diff --git a/layers/+spacemacs/spacemacs-defaults/funcs.el b/layers/+spacemacs/spacemacs-defaults/funcs.el index 7463dbb552ef..ed99c9631d5a 100644 --- a/layers/+spacemacs/spacemacs-defaults/funcs.el +++ b/layers/+spacemacs/spacemacs-defaults/funcs.el @@ -570,6 +570,16 @@ FILENAME is deleted using `spacemacs/delete-file' function.." (funcall-interactively #'spacemacs/delete-file filename t)) ;; from magnars +(defcustom spacemacs-keep-legacy-current-buffer-delete-bindings nil + "User deletes current buffer and file without confirmation." + :type 'boolean + :group 'spacemacs) + +(defcustom spacemacs-prompt-current-buffer-delete-bindings t + "User deletes current buffer and file without confirmation." + :type 'boolean + :group 'spacemacs) + (defun spacemacs/delete-current-buffer-file (&optional arg) "Removes file connected to current buffer and kills buffer. If ARG is not nil, assume yes for default." @@ -592,9 +602,16 @@ If ARG is not nil, assume yes for default." (message "Canceled: File deletion"))))) (defun spacemacs/delete-current-buffer-file-yes () - "Removes file connected to current buffer and kills buffer with assume yes." + "Removes file connected to current buffer and kills buffer with assume yes. +Custom the `spacemacs-keep-legacy-current-buffer-delete-bindings' with t +to follow legacy behavior." (interactive) - (funcall #'spacemacs/delete-current-buffer-file t)) + (prog1 + (funcall #'spacemacs/delete-current-buffer-file + (not spacemacs-keep-legacy-current-buffer-delete-bindings)) + (when spacemacs-prompt-current-buffer-delete-bindings + (message "Customer the `spacemacs-keep-legacy-current-buffer-delete-bindings'\ + with t to ask for confirmation.")))) ;; from magnars (defun spacemacs/sudo-edit (&optional arg)