]> git.earman.xyz Git - emacsinit.git/commitdiff
Add scratch-only function/binding
authorrearman <rearman@r717.net>
Tue, 7 Feb 2023 13:41:45 +0000 (08:41 -0500)
committerrearman <rearman@r717.net>
Tue, 7 Feb 2023 13:41:45 +0000 (08:41 -0500)
Add a defun to switch to the scratch buffer, it being the only visible one. Bind
it to F5.

bindings.el
defuns.el

index e8a71b9cc02334fa4b07904e82e55cf430420446..8f75d4063b4036f473ed73309a43835a1c0f6439 100644 (file)
@@ -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 "<f5>") 'scratch-only)
 (global-set-key (kbd "<f8>") 'recentf-open-files)
 ;; OVERRIDES
 (global-set-key [remap move-beginning-of-line] 'smart-beginning-of-line)
index 566d7281d543a6338ef082c2ce62aef87314fab4..4e7e6bba41fc94806ff2be367a9c48ed98bdcf96 100644 (file)
--- 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))