From: rearman Date: Tue, 7 Feb 2023 13:41:45 +0000 (-0500) Subject: Add scratch-only function/binding X-Git-Url: https://git.earman.xyz/?a=commitdiff_plain;h=c87f30ebddfa2d57f7d3d1f0e2b8de0a944b2305;p=emacsinit.git Add scratch-only function/binding Add a defun to switch to the scratch buffer, it being the only visible one. Bind it to F5. --- diff --git a/bindings.el b/bindings.el index e8a71b9..8f75d40 100644 --- a/bindings.el +++ b/bindings.el @@ -13,6 +13,7 @@ (global-set-key (kbd "C-c eh") (lambda () (interactive) (find-file (expand-file-name "hooks-puts.el" user-emacs-directory)))) (global-set-key (kbd "C-c eb") (lambda () (interactive) (find-file (expand-file-name "bindings.el" user-emacs-directory)))) (global-set-key (kbd "C-c s") 'eshell) +(global-set-key (kbd "") 'scratch-only) (global-set-key (kbd "") 'recentf-open-files) ;; OVERRIDES (global-set-key [remap move-beginning-of-line] 'smart-beginning-of-line) diff --git a/defuns.el b/defuns.el index 566d728..4e7e6bb 100644 --- a/defuns.el +++ b/defuns.el @@ -143,3 +143,9 @@ Stolen from https://tony-zorman.com/posts/query-replace/2022-08-06-query-replace "Bring up tokyo60 keymap for editing." (interactive) (find-file "~/qmk_firmware/keyboards/tokyokeyboard/tokyo60/keymaps/ehrman/keymap.c")) + +(defun scratch-only () + "Bring up the scratch buffer as the only visible buffer." + (interactive) + (switch-to-buffer "*scratch*") + (delete-other-windows))