diff options
| author | Miquel Sabaté Solà <msabate@suse.com> | 2016-07-06 17:16:14 +0200 |
|---|---|---|
| committer | Miquel Sabaté Solà <msabate@suse.com> | 2016-07-06 17:16:14 +0200 |
| commit | 7c34b25254d99d89ad9769f078f107538f79fba9 (patch) | |
| tree | c047af8324f9a9f490f155eb01a32e5e6c2f80c5 /emacs | |
| parent | fc09c8c2b4874974a1f6d081cfd31a6d136954b7 (diff) | |
| download | dotfiles-7c34b25254d99d89ad9769f078f107538f79fba9.tar.gz dotfiles-7c34b25254d99d89ad9769f078f107538f79fba9.zip | |
emacs: added a way to cleanup the workspace
This is specially useful if you want to start from scratch in a client-daemon
setup.
Signed-off-by: Miquel Sabaté Solà <msabate@suse.com>
Diffstat (limited to 'emacs')
| -rw-r--r-- | emacs/init.el | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/emacs/init.el b/emacs/init.el index f293d66..0b01f75 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -153,6 +153,8 @@ ;; Let flyspell be performant. (defvar flyspell-issue-message-flag nil) +;; Custom functions + ;; Allow users to fetch the latest Emacs' NEWS file. (defun view-emacs-latest-news () "Allow users to fetch the latest Emacs' NEWS file." @@ -164,6 +166,24 @@ (find-file-read-only "/tmp/emacs-news" t)) +(defun mssola-cleanup-workspace () + "Cleanup the current workspace by killing all buffers and windows. +The user will end up in the *scratch* buffer." + + (interactive) + (when (y-or-n-p "Are you sure that you want to cleanup your workspace? ") + (delete-other-windows) + (switch-to-buffer "*scratch*") + + ; Code taken from 'crux-kill-other-buffers in the crux package by + ; @bbatsov. It's the same but the confirmation has been removed since we are + ; already asking for permission before. + (seq-each + #'kill-buffer + (delete (current-buffer) (seq-filter #'buffer-file-name (buffer-list)))))) + +(global-set-key (kbd "C-c a") 'mssola-cleanup-workspace) + ;;; Packages ;; I'm using use-package to handle my installed packages. I don't know if it's |
