From ccbacd0f3573f7271eab480895f444a8714061a4 Mon Sep 17 00:00:00 2001 From: Evie Litherland-Smith Date: Wed, 21 Feb 2024 14:02:53 +0000 Subject: [PATCH] Move buffer shortcuts into own file --- config/buffers.org | 65 +++++++++++++++++++++++++++++++++++++++++++++ config/defaults.org | 49 ---------------------------------- 2 files changed, 65 insertions(+), 49 deletions(-) create mode 100644 config/buffers.org diff --git a/config/buffers.org b/config/buffers.org new file mode 100644 index 0000000..49a1b25 --- /dev/null +++ b/config/buffers.org @@ -0,0 +1,65 @@ +#+title: Buffer Config +#+author: Evie Litherland-Smith +#+email: evie@xenia.me.uk +#+language: en +#+filetags: :emacs:config: +#+property: header-args:emacs-lisp :tangle yes :mkdirp yes :results output silent +* Common buffer shortcuts +** Scratch buffer +#+begin_src emacs-lisp + ;; Scratch buffer shortcut + (keymap-global-set "C-c w x" #'scratch-buffer) +#+end_src +** emacs init file +#+begin_src emacs-lisp + ;; Config file shortcut + (defun my/open-init-file () + "Open emacs init file" + (interactive) + (find-file (locate-user-emacs-file "init.el"))) + (keymap-global-set "C-c w c" #'my/open-init-file) +#+end_src +** NixOS config flake +#+begin_src emacs-lisp + ;; NixOS flake shortcut + (defun my/open-nixos-flake () + "Open NixOS system config flake" + (interactive) + (let ((flake "/etc/nixos/flake.nix")) + (if (file-exists-p flake) + (find-file flake) + (warn (concat flake " not found"))))) + (keymap-global-set "C-c w n" #'my/open-nixos-flake) +#+end_src +** Templates file +#+begin_src emacs-lisp + ;; Tempel template file shortcut + (with-eval-after-load 'tempel + (defun my/open-template-file () + "Open `tempel' template file" + (interactive) + (find-file tempel-path)) + (keymap-global-set "C-c w t" #'my/open-template-file)) +#+end_src +** Org directory +#+begin_src emacs-lisp + ;; Org directory shortcut + (with-eval-after-load 'org + (defun my/open-org-directory () + "Open base org-mode directory in dired" + (interactive) + (find-file org-directory)) + (keymap-global-set "C-c w o" #'my/open-org-directory)) +#+end_src +** RSS feeds file +#+begin_src emacs-lisp + ;; Elfeed feeds file shortcut + (with-eval-after-load 'org + (defun my/open-feeds-file () + "Open org file containing elfeed sources" + (interactive) + (require 'elfeed) + (require 'elfeed-org) + (find-file (expand-file-name "feeds.org" elfeed-base-directory)))) + (keymap-global-set "C-c w f" #'my/open-feeds-file) +#+end_src diff --git a/config/defaults.org b/config/defaults.org index a0b025b..342ce79 100644 --- a/config/defaults.org +++ b/config/defaults.org @@ -73,55 +73,6 @@ (recentf-max-saved-items 2048)) #+end_src -* Frequent buffer shortcuts -#+begin_src emacs-lisp - ;; Config file shortcut - (defun my/open-init-file () - "Open emacs init file" - (interactive) - (find-file (locate-user-emacs-file "init.el"))) - (keymap-global-set "C-c w c" #'my/open-init-file) - - ;; NixOS flake shortcut - (defun my/open-nixos-flake () - "Open NixOS system config flake" - (interactive) - (let ((flake "/etc/nixos/flake.nix")) - (if (file-exists-p flake) - (find-file flake) - (warn (concat flake " not found"))))) - (keymap-global-set "C-c w n" #'my/open-nixos-flake) - - ;; Scratch buffer shortcut - (keymap-global-set "C-c w x" #'scratch-buffer) - - ;; Tempel template file shortcut - (with-eval-after-load 'tempel - (defun my/open-template-file () - "Open `tempel' template file" - (interactive) - (find-file tempel-path)) - (keymap-global-set "C-c w t" #'my/open-template-file)) - - ;; Org directory shortcut - (with-eval-after-load 'org - (defun my/open-org-directory () - "Open base org-mode directory in dired" - (interactive) - (find-file org-directory)) - (keymap-global-set "C-c w o" #'my/open-org-directory)) - - ;; Elfeed feeds file shortcut - (with-eval-after-load 'org - (defun my/open-feeds-file () - "Open org file containing elfeed sources" - (interactive) - (require 'elfeed) - (require 'elfeed-org) - (find-file (expand-file-name "feeds.org" elfeed-base-directory)))) - (keymap-global-set "C-c w f" #'my/open-feeds-file) -#+end_src - * package-archive with priorities #+begin_src emacs-lisp :results output silent (when (require 'package nil :noerror)