diff options
| author | bard <[email protected]> | 2023-10-08 15:12:25 -0400 |
|---|---|---|
| committer | bard <[email protected]> | 2023-10-08 15:12:25 -0400 |
| commit | 4e8baf9b88dada3bbc0bf030b925430b62cfe297 (patch) | |
| tree | f7cabbadb6e5461a903783fd63388c5ee0d0b2ba | |
| parent | 58fd4bcae9063cdf3d4f00705b87383e85610d7d (diff) | |
migrating to module files
| -rw-r--r-- | bard-lisp/hs-lint.el | 126 | ||||
| -rw-r--r-- | bookmarks | 7 | ||||
| -rw-r--r-- | haskell.el | 5 | ||||
| -rw-r--r-- | init.el | 155 | ||||
| -rw-r--r-- | org.el | 90 | ||||
| -rw-r--r-- | packages.el | 208 |
6 files changed, 43 insertions, 548 deletions
diff --git a/bard-lisp/hs-lint.el b/bard-lisp/hs-lint.el deleted file mode 100644 index 22352c4..0000000 --- a/bard-lisp/hs-lint.el +++ /dev/null @@ -1,126 +0,0 @@ -;;; hs-lint.el --- minor mode for HLint code checking - -;; Copyright 2009 (C) Alex Ott -;; -;; Author: Alex Ott <[email protected]> -;; Keywords: haskell, lint, HLint -;; Requirements: -;; Status: distributed under terms of GPL2 or above - -;; Typical message from HLint looks like: -;; -;; /Users/ott/projects/lang-exp/haskell/test.hs:52:1: Eta reduce -;; Found: -;; count1 p l = length (filter p l) -;; Perhaps: -;; count1 p = length . filter p - - -(require 'compile) - -(defgroup hs-lint nil - "Run HLint as inferior of Emacs, parse error messages." - :group 'tools - :group 'haskell) - -(defcustom hs-lint-command "hlint" - "The default hs-lint command for \\[hlint]." - :type 'string - :group 'hs-lint) - -(defcustom hs-lint-save-files t - "Save modified files when run HLint or no (ask user)" - :type 'boolean - :group 'hs-lint) - -(defcustom hs-lint-replace-with-suggestions nil - "Replace user's code with suggested replacements" - :type 'boolean - :group 'hs-lint) - -(defcustom hs-lint-replace-without-ask nil - "Replace user's code with suggested replacements automatically" - :type 'boolean - :group 'hs-lint) - -(defun hs-lint-process-setup () - "Setup compilation variables and buffer for `hlint'." - (run-hooks 'hs-lint-setup-hook)) - -;; regex for replace suggestions -;; -;; ^\(.*?\):\([0-9]+\):\([0-9]+\): .* -;; Found: -;; \s +\(.*\) -;; Perhaps: -;; \s +\(.*\) - -(defvar hs-lint-regex - "^\\(.*?\\):\\([0-9]+\\):\\([0-9]+\\): .*[\n\C-m]Found:[\n\C-m]\\s +\\(.*\\)[\n\C-m]Perhaps:[\n\C-m]\\s +\\(.*\\)[\n\C-m]" - "Regex for HLint messages") - -(defun make-short-string (str maxlen) - (if (< (length str) maxlen) - str - (concat (substring str 0 (- maxlen 3)) "..."))) - -(defun hs-lint-replace-suggestions () - "Perform actual replacement of suggestions" - (goto-char (point-min)) - (while (re-search-forward hs-lint-regex nil t) - (let* ((fname (match-string 1)) - (fline (string-to-number (match-string 2))) - (old-code (match-string 4)) - (new-code (match-string 5)) - (msg (concat "Replace '" (make-short-string old-code 30) - "' with '" (make-short-string new-code 30) "'")) - (bline 0) - (eline 0) - (spos 0) - (new-old-code "")) - (save-excursion - (switch-to-buffer (get-file-buffer fname)) - (goto-line fline) - (beginning-of-line) - (setf bline (point)) - (when (or hs-lint-replace-without-ask - (yes-or-no-p msg)) - (end-of-line) - (setf eline (point)) - (beginning-of-line) - (setf old-code (regexp-quote old-code)) - (while (string-match "\\\\ " old-code spos) - (setf new-old-code (concat new-old-code - (substring old-code spos (match-beginning 0)) - "\\ *")) - (setf spos (match-end 0))) - (setf new-old-code (concat new-old-code (substring old-code spos))) - (remove-text-properties bline eline '(composition nil)) - (when (re-search-forward new-old-code eline t) - (replace-match new-code nil t))))))) - -(defun hs-lint-finish-hook (buf msg) - "Function, that is executed at the end of HLint execution" - (if hs-lint-replace-with-suggestions - (hs-lint-replace-suggestions) - (next-error 1 t))) - -(define-compilation-mode hs-lint-mode "HLint" - "Mode for check Haskell source code." - (set (make-local-variable 'compilation-process-setup-function) - 'hs-lint-process-setup) - (set (make-local-variable 'compilation-disable-input) t) - (set (make-local-variable 'compilation-scroll-output) nil) - (set (make-local-variable 'compilation-finish-functions) - (list 'hs-lint-finish-hook)) - ) - -(defun hs-lint () - "Run HLint for current buffer with haskell source" - (interactive) - (save-some-buffers hs-lint-save-files) - (compilation-start (concat hs-lint-command " \"" buffer-file-name "\"") - 'hs-lint-mode)) - -(provide 'hs-lint) -;;; hs-lint.el ends here @@ -2,12 +2,7 @@ ;;; This format is meant to be slightly human-readable; ;;; nevertheless, you probably don't want to edit it. ;;; -*- End Of Bookmark File Format Version Stamp -*- -(("org-capture-last-stored" - (filename . "~/Notes/Org-Roam/todo.org") - (front-context-string . "*** TODO Test\n**") - (rear-context-string . "TODO hard drive\n") - (position . 641)) -("School" +(("School" (filename . "~/Documents/School/") (front-context-string . "APUSH.pdf\n -rw-") (rear-context-string . "08 Aug 22 05:26 ") diff --git a/haskell.el b/haskell.el deleted file mode 100644 index eb2f0ed..0000000 --- a/haskell.el +++ /dev/null @@ -1,5 +0,0 @@ -(load-file "~/.emacs.d/bard-lisp/hs-lint.el") -(require 'hs-lint) -(defun bard/haskell-mode-hook () - (local-set-key (kbd "C-c h l") 'hs-lint)) -(add-hook 'haskell-mode-hook 'bard/haskell-mode-hook) @@ -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 "<escape>") 'keyboard-escape-quit) +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see <https://www.gnu.org/licenses/>. + + +;;; 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 "<escape>") '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 @@ -1,90 +0,0 @@ -;; |------------------------------------| -;; | Org Config | -;; |------------------------------------| - -;; Org Variables -(setq org-directory "~/Notes/Org-Roam/") -(setq org-agenda-files (list "~/Notes/Org-Roam/todo.org")) - -;; Making org mode look nice -(setq org-startup-indented t - org-hide-emphasis-markers t - org-startup-with-inline-images t - org-image-actual-width '(300)) - -;; Org todo keywords -(setq org-todo-keywords - '((sequence "TODO" "WAIT" "DONE"))) - -;; Org Agenda -(setq org-agenda-custom-commands - `(("A" "Daily agenda and top priority tasks" - ((tags-todo "*" - ((org-agenda-skip-function '(org-agenda-skip-if nil '(timestamp))) - (org-agenda-skip-function '(org-agenda-skip-entry-if 'todo 'done)) - (org-agenda-overriding-header "All Tasks \n"))) - (agenda "" ((org-agenda-span 1) - (org-agenda-start-day nil) - (org-deadline-warning-days 0) - (org-scheduled-past-days 0) - ;; We don't need the `org-agenda-date-today' - ;; highlight because that only has a practical - ;; utility in multi-day views. - (org-agenda-day-face-function (lambda (date) 'org-agenda-date)) - (org-agenda-format-date "%A %-e %B %Y") - (org-agenda-overriding-header "Today's agenda \n"))) - ;; write skip function that skips saturdays and sundays - (agenda "" ((org-agenda-span 7) - (org-deadline-warning-days 0) - (org-agenda-skip-function '(org-agenda-skip-entry-if 'todo 'done)) - (org-agenda-overriding-header "Upcoming this week \n"))))) - ("Y" "Monthly view for all tasks" - ((agenda "" ((org-agenda-span 365) - (org-deadline-warning-days 2) - (org-agenda-skip-function '(org-agenda-skip-entry-if 'todo 'done)) - (org-agenda-overriding-header "Upcoming this Year\n"))))) - ("S" "Monthly view for all tasks" - ((agenda "" ((org-agenda-span 31) - (org-deadline-warning-days 2) - (org-agenda-skip-function '(org-agenda-skip-entry-if 'todo 'done)) - (org-agenda-overriding-header "Upcoming this month\n"))))))) - -;; Org capture templates -(setq org-capture-templates - '(("h" "Homework" entry (file+olp "~/Notes/Org-Roam/todo.org" "Inbox" "Homework") - "* TODO %?") - ("e" "Extra/Coding" entry (file+olp "~/Notes/Org-Roam/todo.org" "Inbox" "Extra/Coding") - "* TODO %?") - ("r" "Reading List" entry (file+olp "~/Notes/Org-Roam/todo.org" "Inbox" "Watch/Read List") - "* %?") - ("j" "Journal" entry (file+datetree "~/Notes/Org-Roam/journal.org") - "* %U %^{Title}\n %?") - ("a" "Appointment" entry (file+heading "~/Notes/Org-Roam/todo.org" "Appointment") - "* %^{Task}\n %^t\n %?"))) - -;; Org Roam capture templates -(setq org-roam-capture-templates - '(("d" "default" plain - "\n* Tags: \n%? \n\n" - :if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+TITLE: ${title}\n") - :unnarrowed t) - ("n" "notes" plain - "\n\n\n* Tags :: %? \n\n* ${title} \n" - :if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+TITLE: ${title}\n") - :unnarrowed t) - ("b" "bio" plain - "#+ANKI_DECK: Bio \n\n* Tags :: [[id:cfe7bda9-b154-4d6b-989f-6af778a98cbd][Biology]] \n\n* %? \n" - :if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+TITLE: ${title}\n") - :unnarrowed t) - ("u" "apush" plain - "#+ANKI_DECK: APUSH \n\n* Tags :: [[id:06334c1d-5c06-4b70-bfd8-a074c0c36706][APUSH]] \n\n* %? \n" - :if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+TITLE: ${title}\n") - :unnarrowed t) - ("s" "snapshot" plain - (file "~/Notes/Org/snapshot_template.org") - :if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+TITLE: ${title}\n") - :unnarrowed t) - ("i" "idea" plain - "\n* Tags: \n%? \n\n" - :if-new (file+head "Ideas/%<%Y%m%d%H%M%S>-${slug}.org" "#+TITLE: ${title}\n") - :unnarrowed t))) diff --git a/packages.el b/packages.el deleted file mode 100644 index bee3f43..0000000 --- a/packages.el +++ /dev/null @@ -1,208 +0,0 @@ -;; |------------------------------------| -;; | Packages | -;; |------------------------------------| - -(require 'package) - -(setq package-archives '(("melpa" . "https://melpa.org/packages/") - ("org" . "https://orgmode.org/elpa/") - ("elpa" . "https://elpa.gnu.org/packages/"))) - -(package-initialize) -(unless package-archive-contents - (package-refresh-contents)) - -;; Initialize use-package on non-Linux platforms -(unless (package-installed-p 'use-package) - (package-install 'use-package)) - -(require 'use-package) -(setq use-package-always-ensure t) - -;; Ef-themes -(use-package ef-themes - :ensure t - :config - (load-theme 'ef-cyprus t) - (define-key global-map (kbd "<f5>") #'ef-themes-toggle) - (setq ef-themes-to-toggle '(ef-autumn ef-cyprus))) - ;; (setq ef-themes-headings - ;; '((0 variable-pitch 1.8) - ;; (1 variable-pitch 1.3) - ;; (2 regular 1.2) - ;; (3 1.1) - ;; (agenda-structure variable-pitch 1.5) - ;; (t variable-pitch))) - -(use-package rainbow-mode - :ensure t) - -(use-package mixed-pitch - :ensure t - :hook - (olivetti-mode . mixed-pitch-mode) - :config - (setq mixed-pitch-cursor-type 'box)) - -;; Multiple Cursors -(use-package multiple-cursors - :ensure t) - -;; Magit -(use-package magit - :ensure t) - -;; Vertico completion -(use-package vertico - :ensure t - :init - (vertico-mode 1)) - -;; Marginalia - works with vertico -(use-package marginalia - :ensure t - :init - (marginalia-mode)) - -(use-package company - :ensure t - :init - (global-company-mode 1)) - -(use-package orderless - :ensure t) - -(use-package yasnippet - :init - (yas-global-mode) - :ensure t) - -(use-package yasnippet-snippets - :ensure t) - -(use-package which-key - :init - (which-key-mode 1) - :ensure t) - -(use-package org-roam - :ensure t - :custom - (org-roam-directory (file-truename "~/Notes/Org-Roam")) - :bind (("C-c n l" . org-roam-buffer-toggle) - ("C-c n f" . org-roam-node-find) - ("C-c n g" . org-roam-graph) - ("C-c n i" . org-roam-node-insert) - ("C-c n c" . org-roam-capture) - ("C-c n j" . org-roam-dailies-capture-today)) - :config - (org-roam-db-autosync-mode 1)) - -(use-package orderless - :ensure t - :custom - (completion-styles '(orderless basic)) - (completion-category-overrides '((file (styles basic partial-completion))))) - -(use-package projectile - :ensure t) - -(use-package counsel - :ensure t - :config - (setq councel-rg-base-command "rg --no-heading --colors always %s .") - (setq counsel-rg-command-prefix "rg --no-heading --color always %s .")) - -(use-package dashboard - :ensure t - :config - (dashboard-setup-startup-hook) - (setq dashboard-startup-banner "~/.emacs.d/img/catwithscarf.jpg") - (setq dashboard-banner-logo-width 50) - (setq dashboard-banner-logo-height 50) - (setq dashboard-center-content t) - (setq dashboard-items '((recents . 5) - (bookmarks . 5) - (projects . 5))) - (setq dashboard-banner-logo-title "An Old Farmer's Smile") - (setq dashboard-set-footer nil)) - -(use-package elfeed - :ensure t - :config - (global-set-key (kbd "C-x w") 'elfeed) - (setq elfeed-search-filter "+unread -academia")) - -(use-package elfeed-org - :ensure t - :init - (elfeed-org) - :config - (setq rmh-elfeed-org-files (list "~/.emacs.d/feeds.org" - "~/.emacs.d/youtube.org"))) - -(use-package elfeed-goodies - :ensure t - :init - (elfeed-goodies/setup) - :config - (setq elfeed-goodies/powerline-default-separator 'box)) - -;; Distraction-free writing -(use-package olivetti - :config - (defun distraction-free () - "Distraction-free writing environment using Olivetti package." - (interactive) - (if (equal olivetti-mode nil) - (progn - (window-configuration-to-register 1) - (delete-other-windows) - (text-scale-set 0.2) - (setq olivetti-body-width 120) - (olivetti-mode t)) - (progn - (if (eq (length (window-list)) 1) - (jump-to-register 1)) - (olivetti-mode 0) - (text-scale-set 0)))) - :bind - (("<f9>" . distraction-free))) - -(use-package org-cliplink - :ensure t) - -(use-package hl-todo - :ensure t - :init - (global-hl-todo-mode t) - :config - (setq hl-todo-keyword-faces - '(("TODO" error bold) - ("FIXME" error bold) - ("WAIT" warning bold) - ("HACK" font-lock-constant-face bold) - ("DEPRECATED" font-lock-doc-face bold) - ("BUG" error bold)))) - -(use-package pdf-tools - :ensure t) - -(use-package toc-org - :ensure t) - -(use-package expand-region - :ensure t - :bind ("C-=" . er/expand-region)) - -(use-package clojure-mode - :ensure t) - -(use-package cider - :ensure t) - -(use-package clojure-snippets - :ensure t) - -(use-package haskell-mode - :ensure t) |
