Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Toggle current buffer and *scratch* buffer.
(defvar toggle-scratch-prev-buffer nil)
(defun toggle-scratch()
"go to *scratch* buffer"
(interactive)
(if (not (string= "*scratch*" (buffer-name)))
(progn
(setq toggle-scratch-prev-buffer (buffer-name))
(switch-to-buffer "*scratch*"))
(switch-to-buffer toggle-scratch-prev-buffer)))
(global-set-key (kbd "C-'") 'toggle-scratch)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.