Skip to content

* layers/+spacemacs/spacemacs-defaults/funcs.el: customer variable for spacemacs/delete-buffer-file #16403

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.develop
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
21 changes: 19 additions & 2 deletions layers/+spacemacs/spacemacs-defaults/funcs.el
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand All @@ -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)
Expand Down
Loading