From 4e8baf9b88dada3bbc0bf030b925430b62cfe297 Mon Sep 17 00:00:00 2001 From: bard Date: Sun, 8 Oct 2023 15:12:25 -0400 Subject: migrating to module files --- init.el | 155 ++++++++++++++++++---------------------------------------------- 1 file changed, 42 insertions(+), 113 deletions(-) (limited to 'init.el') diff --git a/init.el b/init.el index 4d1ac29..d2fae05 100644 --- a/init.el +++ b/init.el @@ -1,32 +1,48 @@ -;; |------------------------------------| -;; | Gen Config | -;; |------------------------------------| +;;; init.el --- init.el -*- lexical-binding: t -*- -;; Loading all other files -(setq my-config-files '("~/.emacs.d/packages.el" - "~/.emacs.d/org.el" - "~/.emacs.d/haskell.el")) +;; Author: BardofSprites +;; Maintainer: BardofSprites +;; Version: 0.1.0 +;; Package-Requires: ((emacs "28.2")) -(dolist (config-file my-config-files) - (load config-file)) +;; This file is not part of GNU Emacs -;; GHC Path -;; (let ((my-ghcup-path (expand-file-name "~/.ghcup/bin"))) -;; (setenv "PATH" (concat my-ghcup-path ":" (getenv "PATH"))) -;; (add-to-list 'exec-path my-ghcup-path)) +;; This program is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. -;; (let ((my-cabal-path (expand-file-name "~/.cabal/bin"))) -;; (setenv "PATH" (concat my-cabal-path ":" (getenv "PATH"))) -;; (add-to-list 'exec-path my-cabal-path)) +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. -;; Esc key quit prompts -(global-set-key (kbd "") 'keyboard-escape-quit) +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see . + + +;;; Commentary: -;; Fonts -(set-face-attribute 'default nil :font "Iosevka Comfy" :height 140) -(set-face-attribute 'variable-pitch nil :font "Iosevka Comfy Wide" :height 140) +;;; Code: -(add-to-list 'default-frame-alist '(font . "Iosevka Comfy-14.5")) +;; Add the directories to the load path +(add-to-list 'load-path (expand-file-name "bard-elisp" user-emacs-directory)) +(add-to-list 'load-path (expand-file-name "bard-emacs-modules" user-emacs-directory)) + +;; Function to load all .el files in a directory +(defun load-directory (dir) + "Load all .el files in the specified directory." + (dolist (file (directory-files dir t "\\.el$")) + (load file))) + +;; Load all .el files in the bard-elisp directory +(load-directory (expand-file-name "bard-elisp" user-emacs-directory)) + +;; Load all .el files in the bard-emacs-modules directory +(load-directory (expand-file-name "bard-emacs-modules" user-emacs-directory)) + +;; Esc key quit prompts +(global-set-key (kbd "") 'keyboard-escape-quit) ;; No Backups (setq auto-save-default nil) @@ -41,107 +57,20 @@ desktop-restore-eager t desktop-restore-=frams t desktop-restory-in-current-display t - desktop-files-not-to-save "\(^$\\|\\*scratch\\*\\|\\*Messages\\*\\|\\*dashboard\\*\\|\\*Async-native-compile-log\\*)") + desktop-files-not-to-save "\(^$\\|\\*scratch\\*\\|\\*Messages\\*\\|\\*dashboard\\*\\|\\*Async-native-compile-log\\*|\\*Music\\*)") ;; |------------------------------------| -;; | UI Config | +;; | General Keybinds | ;; |------------------------------------| -(setq inhibit-startup-message t) -(scroll-bar-mode -1) -(tool-bar-mode -1) -(tooltip-mode -1) -(set-fringe-mode 10) -(menu-bar-mode -1) -(setq inhibit-startup-screen t) -(tool-bar-mode 0) -(setq frame-title-format "GNU Emacs") -(setq display-line-numbers-type 'relative) - -;; |------------------------------------| -;; | Modes and Hooks | -;; |------------------------------------| -;; pair parens and quotes automatically -(electric-pair-mode 1) -(defun bard/common-modes-hook () - "Commonly used modes, bundled in one hook" - (display-line-numbers-mode 1) - (hl-todo-mode 1)) - -(add-hook 'org-mode-hook 'bard/common-modes-hook) -(add-hook 'fundamental-mode-hook 'bard/common-modes-hook) -(add-hook 'emacs-lisp-mode-hook 'bard/common-modes-hook) -(add-hook 'haskell-mode-hook 'bard/common-modes-hook) -(add-hook 'clojure-mode-hook 'bard/common-modes-hook) - -;; |------------------------------------| -;; | Keybinds | -;; |------------------------------------| - -;; Org Agenda -(defun bard/primary-agenda () - "For viewing my custom agenda" - (interactive) - (org-agenda nil "A") - (delete-other-windows)) - -(global-set-key (kbd "C-' a") 'bard/primary-agenda) - -;; Surround region with character -(defun bard/wrap-text-with-markers (start-marker end-marker marker) - "Surround marked text with any character." - (interactive "r\nsEnter marker (e.g., \"): ") - (save-excursion - (goto-char end-marker) - (insert marker) - (goto-char start-marker) - (insert marker))) - -(global-set-key (kbd "C-c s") 'bard/wrap-text-with-markers) - -(defun bard/copy-current-line () - "Copy the current line." - (interactive) - (let ((line-text (buffer-substring (line-beginning-position) (line-end-position)))) - (kill-new line-text) - (message "Copied current line"))) - -(global-set-key (kbd "C-c l") 'bard/copy-current-line) - -;; Multiple cursors -(global-set-key (kbd "C-S-c C-S-c") 'mc/edit-lines) -(global-set-key (kbd "C->") 'mc/mark-next-like-this) -(global-set-key (kbd "C-<") 'mc/mark-previous-like-this) -(global-set-key (kbd "C-c C-<") 'mc/mark-all-like-this) -(global-set-key (kbd "C-\\") 'mc/skip-to-next-like-this) -(global-set-key (kbd "C-:") 'mc/skip-to-previous-like-this) - ;; Buffer switching (global-set-key (kbd "C-.") 'next-buffer) (global-set-key (kbd "C-,") 'previous-buffer) - -;; Ibuffer (global-set-key (kbd "C-x C-b") 'ibuffer) -;; Org Cliplink -(global-set-key (kbd "C-x p i") 'org-cliplink) - ;; Desktop/session save (global-set-key (kbd "C-' s") 'desktop-save-in-desktop-dir) (global-set-key (kbd "C-' r") 'desktop-read) +(provide 'init) - - -(custom-set-variables - ;; custom-set-variables was added by Custom. - ;; If you edit it by hand, you could mess it up, so be careful. - ;; Your init file should contain only one such instance. - ;; If there is more than one, they won't work right. - '(package-selected-packages - '(elfeed-goodies elfeed-org elfeed rainbow-mode vterm yasnippet-snippets which-key vertico use-package toc-org tao-theme projectile pdf-tools org-roam org-cliplink orderless olivetti multiple-cursors mixed-pitch marginalia magit hl-todo haskell-mode expand-region ef-themes dashboard counsel company clojure-snippets cider))) -(custom-set-faces - ;; custom-set-faces was added by Custom. - ;; If you edit it by hand, you could mess it up, so be careful. - ;; Your init file should contain only one such instance. - ;; If there is more than one, they won't work right. - ) +;;; init.el ends here -- cgit v1.2.3