diff --git a/core/core-packages.el b/core/core-packages.el index 91e588e..d988b76 100644 --- a/core/core-packages.el +++ b/core/core-packages.el @@ -26,34 +26,15 @@ use-package-always-demand nil use-package-expand-minimally t) -(defvar core-modules '(smartparens idle-highlight-mode find-file-in-project smex scpaste helm flycheck undo-tree dired-hacks-utils flycheck eshell-prompt-extras fuzzy deferred auto-async-byte-compile markdown-mode async)) - -(defvar package-refreshed-this-session nil) - -(defun maybe-refresh-package-contents (package) - "Refresh package contents if PACKAGE is not installed and if contents have not been refreshed this session." - (unless (or package-refreshed-this-session (package-installed-p package)) - (package-refresh-contents) - (setq package-refreshed-this-session t))) - - (defun require-package (package) - "Ensure PACKAGE is installed." + "Ensure PACKAGE is installed, with error handling." (unless (package-installed-p package) - (maybe-refresh-package-contents package) (condition-case err - (eval `(use-package ,package - :ensure t)) + (progn + (package-refresh-contents) + (package-install package)) (error (message "Failed to install %s: %S" package err))))) - -(defun module-list-install (modules-list) - "Install missing modules from MODULES-LIST." - (dolist (module modules-list) - (require-package module))) - -(module-list-install core-modules) - (defun add-subfolders-to-load-path (parent-dir) "Add subfolders of PARENT-DIR to load path." (let ((default-directory parent-dir)) diff --git a/early-init.el b/early-init.el index ca4b551..bad8145 100644 --- a/early-init.el +++ b/early-init.el @@ -22,12 +22,6 @@ (global-display-line-numbers-mode 1) -(require 'linum) -(global-linum-mode 0) -(global-linum-mode -1) - -;; BUG -(setq outline-minor-mode-prefix "\C-c \C-o") ;; Optimizations for faster startup (setq file-name-handler-alist-original file-name-handler-alist) @@ -46,9 +40,6 @@ (push '(vertical-scroll-bars) default-frame-alist) -(setq package-enable-at-startup nil) - - (defconst main-savefile-dir (expand-file-name "savefile" user-emacs-directory)) ;; Ensure savefile directory exists (unless (file-exists-p main-savefile-dir) @@ -61,7 +52,6 @@ (require 'core-packages) (require 'core-feel) (require 'core-util) -(require 'core-native-comp) (require 'core-look) (package-initialize) diff --git a/init.el b/init.el index 0267a23..154bc1a 100644 --- a/init.el +++ b/init.el @@ -5,71 +5,11 @@ (add-to-list 'load-path packages-dir) ;; Load core and package configurations -;; (require 'pkg-elpaca) -(require 'pkg-ido) -(require 'pkg-corfu2) -(require 'pkg-org) -(require 'pkg-discover) -(require 'pkg-git) -;; (require 'pkg-company) -(require 'pkg-flycheck) -(require 'pkg-ssh) -(require 'pkg-docker) -(require 'pkg-feel) -(require 'pkg-lsp) -(require 'pkg-latex) -(require 'pkg-yaml) -(require 'pkg-php) -(require 'pkg-projectile) -(require 'pkg-bash) -(require 'pkg-search) -(require 'pkg-eshell) -(require 'pkg-rust) -(require 'pkg-emms) -(require 'pkg-web) -(require 'pkg-systemd) -(require 'pkg-multipleCursor) -(require 'pkg-mouvement) -;; (require 'pkg-dhall) -;; (require 'pkg-terraform-lsp) -;; (require 'pkg-go) -(require 'pkg-irc) -;; (require 'pkg-straight) +(require 'pkg-loader) - -(require 'pkg-flutter) -(require 'pkg-terraform) -;; (require 'pkg-corfu) - -;; (require 'pkg-combobulate) (add-to-list 'custom-theme-load-path theme-dir) -;; (require 'pkg-theme) (load-theme 'my-solarized-dark t) - -;; (use-package 'gptel) - -;; Llama.cpp offers an OpenAI compatible API -;; (gptel-make-openai "llama-cpp" ;Any name -;; :stream t ;Stream responses -;; :protocol "http" -;; :host "localhost:8000" ;Llama.cpp server location -;; :models '("test")) ;Any names, doesn't matter for Llama - -;; ;; Execute the following only if emacs is compiled with treesit -;; (when (featurep 'treesit) -;; (use-package combobulate -;; :ensure t)) - - -;; Execute the following only if emacs is compiled with treesit -;; (if (featurep 'treesit) -;; (require 'pkg-combobulate)) - -;; (native-compile-async "/home/michael/.emacs.d" 'recursively) - -;; Remove .elc files on save - (use-package emacs :config (winner-mode 1) @@ -82,9 +22,3 @@ (delete-file (concat buffer-file-name "c")))) nil t))) (add-to-list 'auto-mode-alist '("\\.log\\'" . auto-revert-mode))) - -(use-package no-littering - :ensure t - :config - (setq auto-save-file-name-transforms - `((".*" ,(no-littering-expand-var-file-name "auto-save/") t)))) diff --git a/packages/pkg-bash.el b/packages/pkg-bash.el index 0ba84dd..2901201 100644 --- a/packages/pkg-bash.el +++ b/packages/pkg-bash.el @@ -1,36 +1,43 @@ -;; Bash settings +;;; pkg-bash.el --- Bash completion -*- lexical-binding: t -*- -(require-package 'bash-completion) +;;; Commentary: +;; This package configures bash completion. + +;;; Code: -;; Function to turn off indent-tabs-mode -(defun turn-off-indent-tabs-mode () - "Turn off the use of tabs for indentation." - (setq indent-tabs-mode nil) - (setq tab-width 8)) +(require-package 'bash-completion) +(use-package bash-completion + :defer t + :config + ;; Function to turn off indent-tabs-mode. + (defun turn-off-indent-tabs-mode () + "Turn off the use of tabs for indentation." + (setq indent-tabs-mode nil) + (setq tab-width 8)) -;; Add hook for shell script mode -(add-hook 'sh-mode-hook 'turn-off-indent-tabs-mode) + ;; Add hook for shell script mode. + (add-hook 'sh-mode-hook 'turn-off-indent-tabs-mode) -;; Function to generate auto-complete candidates for bash -(defun ac-bash-candidates () - "Generate a list of potential completions for the current bash command. + ;; Function to generate auto-complete candidates for bash. + (defun ac-bash-candidates () + "Generate a list of potential completions for the current bash command. This function is a modified version of `bash-completion-dynamic-complete' from bash-completion.el." - (when bash-completion-enabled - (let* ((start (comint-line-beginning-position)) - (pos (point)) - (tokens (bash-completion-tokenize start pos)) - (open-quote (bash-completion-tokenize-open-quote tokens)) - (parsed (bash-completion-process-tokens tokens pos)) - (line (cdr (assq 'line parsed))) - (point (cdr (assq 'point parsed))) - (cword (cdr (assq 'cword parsed))) - (words (cdr (assq 'words parsed))) - (stub (nth cword words)) - (completions (bash-completion-comm line point words cword open-quote)) - ;; Override configuration for comint-dynamic-simple-complete. - ;; Bash adds a space suffix automatically. - (comint-completion-addsuffix nil)) - completions))) + (when bash-completion-enabled + (let* ((start (comint-line-beginning-position)) + (pos (point)) + (tokens (bash-completion-tokenize start pos)) + (open-quote (bash-completion-tokenize-open-quote tokens)) + (parsed (bash-completion-process-tokens tokens pos)) + (line (cdr (assq 'line parsed))) + (point (cdr (assq 'point parsed))) + (cword (cdr (assq 'cword parsed))) + (words (cdr (assq 'words parsed))) + (stub (nth cword words)) + (completions (bash-completion-comm line point words cword open-quote)) + ;; Override configuration for comint-dynamic-simple-complete. + ;; Bash adds a space suffix automatically. + (comint-completion-addsuffix nil)) + completions)))) (provide 'pkg-bash) diff --git a/packages/pkg-corfu2.el b/packages/pkg-corfu2.el index 2e88d28..5158bfc 100644 --- a/packages/pkg-corfu2.el +++ b/packages/pkg-corfu2.el @@ -6,69 +6,75 @@ ;;; Code: -(require 'use-package) -(require 'completion-preview) ;; Require completion-preview - +(require-package 'corfu) (use-package corfu - :ensure t + :defer t :after cape :custom + ;; Enable cycling through completion candidates. (corfu-cycle t) - (corfu-auto t) ;; Keep corfu-auto as it is - (corfu-auto-prefix 2) ;; Keep corfu-auto-prefix as it is + ;; Enable auto-completion. + (corfu-auto t) + ;; Set the prefix length for auto-completion. + (corfu-auto-prefix 2) + ;; Set the delay for the popup info. (corfu-popupinfo-delay '(0.5 . 0.2)) + ;; Insert the current candidate on preview. (corfu-preview-current 'insert) - (corfu-preselect 'always) ;; Experiment with this + ;; Always preselect the first candidate. + (corfu-preselect 'always) + ;; Don't quit on exact match. (corfu-on-exact-match nil) :bind (:map corfu-map ("M-p" . corfu-previous) ("M-n" . corfu-next) ("M-d" . corfu-info-documentation)) :init + ;; Enable Corfu globally. (global-corfu-mode) - (global-completion-preview-mode)) ;; Enable completion-preview globally + ;; Enable completion preview globally. + (global-completion-preview-mode)) +(require-package 'corfu-popupinfo) (use-package corfu-popupinfo - :ensure nil + :defer t :after corfu :hook (corfu-mode . corfu-popupinfo-mode) :custom + ;; Set the delay for the popup info. (corfu-popupinfo-delay '(0.5 . 0.2))) +(require-package 'corfu-echo) (use-package corfu-echo - :ensure nil + :defer t :after corfu :hook (corfu-mode . corfu-echo-mode) :custom - (corfu-doc-border "#FFB6C1") ;; Customize border color (light pink) - (corfu-doc-max-width 60) ;; Adjust documentation width - (corfu-doc-position 'window)) ;; Position documentation window ('window or 'inline) - - - + ;; Customize the border color of the echo area. + (corfu-doc-border "#FFB6C1") + ;; Adjust the documentation width. + (corfu-doc-max-width 60) + ;; Position the documentation window. + (corfu-doc-position 'window)) + +(require-package 'cape) (use-package cape - :ensure t - :defer nil ; Don't defer loading - :init ; Move configuration to :config to ensure cape is loaded - - - + :defer t + :init + ;; Set the completion at point functions. (setq completion-at-point-functions - (list - (cape-capf-super - #'cape-file - #'cape-dabbrev - #'cape-abbrev ; Changed from cape-keyword - #'cape-line - #'cape-dict))) - - ;; Configure Cape settings + (list + (cape-capf-super + #'cape-file + #'cape-dabbrev + #'cape-abbrev + #'cape-line + #'cape-dict))) + ;; Configure Cape settings. (setq cape-dabbrev-min-length 2 cape-dabbrev-check-other-buffers 'some) - - ;; Ensure Cape works well with Corfu + ;; Ensure Cape works well with Corfu. (advice-add 'cape-wrap-buster :around 'cape-capf-buster) - :bind (("C-c p t" . complete-tag) ("C-c p d" . cape-dabbrev) ("C-c p h" . cape-history) @@ -78,61 +84,77 @@ ("C-c p l" . cape-line) ("C-c p w" . cape-dict))) +(require-package 'orderless) (use-package orderless - :ensure t + :defer t :custom + ;; Set the completion styles. (completion-styles '(orderless basic)) + ;; Set the completion category overrides. (completion-category-overrides '((file (styles . (partial-completion orderless))) (command (styles orderless-prefixes orderless)) (variable (styles orderless-prefixes orderless)) (symbol (styles orderless-prefixes orderless)))) + ;; Set the orderless component separator. (orderless-component-separator #'orderless-escapable-split-on-space) + ;; Set the orderless matching styles. (orderless-matching-styles '(orderless-literal orderless-regexp orderless-initialism orderless-flex)) :config + ;; Set the orderless style dispatchers. (setq orderless-style-dispatchers '(orderless-affix-dispatch)) (setq completion-category-defaults nil)) +(require-package 'vertico) (use-package vertico - :ensure t + :defer t :custom + ;; Enable cycling through completion candidates. (vertico-cycle t) + ;; Set the number of candidates to show. (vertico-count 13) + ;; Enable resizing of the Vertico minibuffer. (vertico-resize t) + ;; Enable multiform mode. (vertico-multiform-mode t) :init + ;; Enable Vertico mode. (vertico-mode) :config + ;; Set the vertico multiform categories. (setq vertico-multiform-categories '((file grid) (consult-grep buffer) (consult-location buffer))) - - ;; Persist history over Emacs restarts + ;; Persist history over Emacs restarts. + (require-package 'savehist) (use-package savehist + :defer t :init (savehist-mode)) - - ;; Add extensions + ;; Add extensions. + (require-package 'vertico-directory) (use-package vertico-directory + :defer t :after vertico - :ensure nil - ;; More convenient directory navigation commands :bind (:map vertico-map ("RET" . vertico-directory-enter) ("DEL" . vertico-directory-delete-char) ("M-DEL" . vertico-directory-delete-word)) - ;; Tidy shadowed file names :hook (rfn-eshadow-update-overlay . vertico-directory-tidy))) +(require-package 'marginalia) (use-package marginalia - :ensure t + :defer t :init (marginalia-mode) :custom + ;; Align the annotations to the right. (marginalia-align 'right) + ;; Set the maximum relative age of annotations. (marginalia-max-relative-age 0)) +(require-package 'consult) (use-package consult - :ensure t + :defer t :bind (("C-s" . consult-line) ("C-x b" . consult-buffer) ("M-y" . consult-yank-pop) @@ -145,28 +167,29 @@ ("C-x r b" . consult-bookmark) ("C-c k" . consult-kmacro)) :custom + ;; Set the preview key. (consult-preview-key 'any) + ;; Set the narrow key. (consult-narrow-key "<") :config - ;; Check if ripgrep (rg) is available + ;; Check if ripgrep (rg) is available. (when (executable-find "rg") - ;; Only bind and configure ripgrep if it's available + ;; Only bind and configure ripgrep if it's available. (global-set-key (kbd "M-s r") #'consult-ripgrep) - - ;; Configure consult-ripgrep to use .gitignore + ;; Configure consult-ripgrep to use .gitignore. (setq consult-ripgrep-args (concat "rg --null --line-buffered --color=ansi --max-columns=1000 " "--no-heading --line-number . -H --no-ignore --hidden " "-g !.git"))) - - ;; Configure the asynchronous search behavior + ;; Configure the asynchronous search behavior. (setq consult-async-min-input 2) (setq consult-async-refresh-delay 0.15) (setq consult-async-input-throttle 0.2) (setq consult-async-input-debounce 0.1)) +(require-package 'consult-xref) (use-package consult-xref - :ensure nil ; It's part of consult, so we don't need to ensure it separately + :defer t :after (consult xref) :config (setq xref-show-xrefs-function #'consult-xref @@ -176,42 +199,51 @@ :preview-key (list :debounce 0.2 'any))) +(require-package 'consult-project-extra) (use-package consult-project-extra - :ensure t + :defer t :after consult :bind (("C-c p f" . consult-project-extra-find) ("C-c p o" . consult-project-extra-find-other-window))) +(require-package 'embark) (use-package embark - :ensure t + :defer t :bind (("C-." . embark-act) ("M-." . embark-dwim) ("C-h B" . embark-bindings)) :init (setq prefix-help-command #'embark-prefix-help-command)) +(require-package 'embark-consult) (use-package embark-consult - :ensure t + :defer t :after (embark consult) :hook (embark-collect-mode . consult-preview-at-point-mode)) +(require-package 'kind-icon) (use-package kind-icon - :ensure t + :defer t :after corfu :custom + ;; Use icons in the completion list. (kind-icon-use-icons t) + ;; Set the default face for the icons. (kind-icon-default-face 'corfu-default) + ;; Don't blend the background of the icons. (kind-icon-blend-background nil) + ;; Set the blend fraction. (kind-icon-blend-frac 0.08) :config - + ;; Add the kind-icon margin formatter to Corfu. (add-to-list 'corfu-margin-formatters #'kind-icon-margin-formatter)) - -;; Enable recursive minibuffers and savehist +;; Enable recursive minibuffers. (setq enable-recursive-minibuffers t) +(require-package 'savehist) (use-package savehist + :defer t :init (savehist-mode)) diff --git a/packages/pkg-discover.el b/packages/pkg-discover.el index 01b9e4f..727904b 100644 --- a/packages/pkg-discover.el +++ b/packages/pkg-discover.el @@ -1,8 +1,20 @@ -(require-package 'discover) -(require-package 'discover-my-major) +;;; pkg-discover.el --- Discover key bindings -*- lexical-binding: t -*- + +;;; Commentary: +;; This package configures discover to help find key bindings. -(global-set-key (kbd "C-h C-m") 'discover-my-major) -(global-set-key (kbd "C-h M-m") 'discover-my-mode) +;;; Code: +(require-package 'discover) +(use-package discover + :defer t + :config + (require-package 'discover-my-major) + (use-package discover-my-major + :defer t) + ;; Bind discover-my-major to "C-h C-m". + (global-set-key (kbd "C-h C-m") 'discover-my-major) + ;; Bind discover-my-mode to "C-h M-m". + (global-set-key (kbd "C-h M-m") 'discover-my-mode)) (provide 'pkg-discover) diff --git a/packages/pkg-docker.el b/packages/pkg-docker.el index c901fd0..0c0800c 100644 --- a/packages/pkg-docker.el +++ b/packages/pkg-docker.el @@ -1,14 +1,28 @@ -(require 'tramp-container) +;;; pkg-docker.el --- Docker integration -*- lexical-binding: t -*- -(require-package 'dockerfile-mode) - -(require-package 'docker) +;;; Commentary: +;; This package configures Docker integration with docker.el and +;; dockerfile-mode. +;;; Code: -(add-to-list 'auto-mode-alist '("Dockerfile\\'" . dockerfile-mode)) +(require-package 'docker) +(use-package docker + :defer t) -(add-hook 'dockerfile-mode-hook '(lambda() +(require-package 'dockerfile-mode) +(use-package dockerfile-mode + :defer t + :config + ;; Associate Dockerfiles with dockerfile-mode. + (add-to-list 'auto-mode-alist '("Dockerfile\\'" . dockerfile-mode)) + ;; Set the indentation for dockerfile-mode. + (add-hook 'dockerfile-mode-hook '(lambda() (setq-local sh-basic-offset 2) - (setq-local indent-line-function #'sh-indent-line))) + (setq-local indent-line-function #'sh-indent-line)))) + +(require-package 'tramp-container) +(use-package tramp-container + :defer t) (provide 'pkg-docker) diff --git a/packages/pkg-emms.el b/packages/pkg-emms.el index 237e30d..9f24b56 100644 --- a/packages/pkg-emms.el +++ b/packages/pkg-emms.el @@ -1,11 +1,20 @@ -(defun mike-emms () - "Mike's emms launcher'" - (interactive) - (require 'emms-setup) - (emms-all) - (emms-default-players) - - (setq emms-info-asynchronously t) -) +;;; pkg-emms.el --- Emacs Multimedia System configuration -*- lexical-binding: t -*- + +;;; Commentary: +;; This package configures EMMS, the Emacs Multimedia System. + +;;; Code: + +(use-package emms + :defer t + :config + (defun mike-emms () + "Mike's emms launcher'" + (interactive) + (require 'emms-setup) + (emms-all) + (emms-default-players) + + (setq emms-info-asynchronously t))) (provide 'pkg-emms) diff --git a/packages/pkg-eshell.el b/packages/pkg-eshell.el index 1fab5ab..d126c06 100644 --- a/packages/pkg-eshell.el +++ b/packages/pkg-eshell.el @@ -1,94 +1,56 @@ -(require 'eshell) -(require 'em-smart) -(setq eshell-where-to-jump 'begin) -(setq eshell-review-quick-commands nil) -(setq eshell-smart-space-goes-to-end t) +;;; pkg-eshell.el --- Eshell configuration -*- lexical-binding: t -*- -;; TODO in recent version of emacs, the function named shell-mode is not recognized anymore.. +;;; Commentary: +;; This package configures Eshell, the Emacs shell. -;; (add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on) +;;; Code: -;; (add-hook 'eshell-preoutput-filter-functions -;; 'ansi-color-filter-apply) +(use-package eshell + :defer t + :config + (use-package em-smart + :defer t) + (setq eshell-where-to-jump 'begin) + (setq eshell-review-quick-commands nil) + (setq eshell-smart-space-goes-to-end t) -;; (add-hook 'eshell-preoutput-filter-functions -;; 'ansi-color-apply) - -;; (ansi-color-for-comint-mode-on) -;; (defun eshell-handle-ansi-color () -;; (ansi-color-apply-on-region eshell-last-output-start eshell-last-output-end)) -;; (add-hook 'eshell-mode-hook -;; '(lambda () -;; (add-to-list -;; 'eshell-output-filter-functions -;; 'eshell-handle-ansi-color))) - - -;; (eval-after-load 'esh-opt -;; (progn -;; (autoloadp 'eshell-prompt-extras))) -;; (setq eshell-highlight-prompt nil -;; eshell-prompt-function 'epe-theme-lambda) - - -(defun eshell-here () - "Opens up a new shell in the directory associated with the + (defun eshell-here () + "Opens up a new shell in the directory associated with the current buffer's file. The eshell is renamed to match that directory to make multiple eshell windows easier." - (interactive) - (let* ((parent (if (buffer-file-name) - (file-name-directory (buffer-file-name)) - default-directory)) - (height (/ (window-total-height) 3)) - (name (car (last (split-string parent "/" t))))) - (split-window-vertically (- height)) - (other-window 1) - (eshell "new") - (rename-buffer (concat "*eshell: " name "*")) - - (insert (concat "ls")) - (eshell-send-input))) - -(defun eshell/x () - (insert "exit") - (eshell-send-input) - (delete-window)) - - - - - - -;;(defun eshell-toggle () -;; (if (bound-and-true-p 'shell-mode) -;; (eshell-here) -;; (eshell/x) -;; ) - -;; ) - - -(global-set-key (kbd "C-!") 'eshell-toggle) - - - -(require 'em-smart) -(setq eshell-where-to-jump 'begin) -(setq eshell-review-quick-commands nil) -(setq eshell-smart-space-goes-to-end t) - -(setq password-cache t) ; enable password caching -(setq password-cache-expiry 3600) ; for one hour (time in secs) -(setq eshell-prefer-lisp-functions t) -(add-hook 'eshell-mode-hook 'eshell-smart-initialize) - -;; Start eshell or switch to it if it's active. -(global-set-key (kbd "C-x m") 'eshell) - -;; Start a new eshell even if one is active. -(global-set-key (kbd "C-x M") (lambda () (interactive) (eshell t))) - -;; Start a regular shell if you prefer that. -(global-set-key (kbd "C-x M-m") 'shell) + (interactive) + (let* ((parent (if (buffer-file-name) + (file-name-directory (buffer-file-name)) + default-directory)) + (height (/ (window-total-height) 3)) + (name (car (last (split-string parent "/" t))))) + (split-window-vertically (- height)) + (other-window 1) + (eshell "new") + (rename-buffer (concat "*eshell: " name "*")) + + (insert (concat "ls")) + (eshell-send-input))) + + (defun eshell/x () + (insert "exit") + (eshell-send-input) + (delete-window)) + + (global-set-key (kbd "C-!") 'eshell-toggle) + + (setq password-cache t) ; enable password caching + (setq password-cache-expiry 3600) ; for one hour (time in secs) + (setq eshell-prefer-lisp-functions t) + (add-hook 'eshell-mode-hook 'eshell-smart-initialize) + + ;; Start eshell or switch to it if it's active. + (global-set-key (kbd "C-x m") 'eshell) + + ;; Start a new eshell even if one is active. + (global-set-key (kbd "C-x M") (lambda () (interactive) (eshell t))) + + ;; Start a regular shell if you prefer that. + (global-set-key (kbd "C-x M-m") 'shell)) (provide 'pkg-eshell) diff --git a/packages/pkg-feel.el b/packages/pkg-feel.el index dcff4d5..723312a 100644 --- a/packages/pkg-feel.el +++ b/packages/pkg-feel.el @@ -1,11 +1,31 @@ -;; Install necessary packages -(use-package diminish :ensure t) +;;; pkg-feel.el --- General look and feel -*- lexical-binding: t -*- + +;;; Commentary: +;; This package configures the general look and feel of Emacs. + +;;; Code: + +(require-package 'diminish) +(use-package diminish + :defer t) (require-package 'minimap) -;; (require-package 'flx-isearch) +(use-package minimap + :defer t) + (require-package 'expand-region) +(use-package expand-region + :defer t) (require-package 'operate-on-number) +(use-package operate-on-number + :defer t) + +(require-package 'volatile-highlights) +(use-package volatile-highlights + :defer t + :config + (volatile-highlights-mode t)) ;; Variables (defvar main-savefile-dir @@ -37,11 +57,6 @@ ;; Highlight the current line (global-hl-line-mode +1) -(use-package volatile-highlights - :config - (volatile-highlights-mode t)) - -;; (diminish 'volatile-highlights-mode) ;; Whitespace-mode config (require 'whitespace) diff --git a/packages/pkg-flutter.el b/packages/pkg-flutter.el index 526b563..6c73e42 100644 --- a/packages/pkg-flutter.el +++ b/packages/pkg-flutter.el @@ -1,121 +1,84 @@ -(setq lsp-dart-sdk-dir "/opt/flutter/") -(add-to-list 'exec-path (concat lsp-dart-sdk-dir "bin/")): +;;; pkg-flutter.el --- Flutter configuration -*- lexical-binding: t -*- + +;;; Commentary: +;; This package configures Flutter support with lsp-dart. + +;;; Code: + +(require-package 'dart-mode) (use-package dart-mode + :defer t :after lsp-mode - :ensure t ; Ensure dart-mode is installed - :hook (dart-mode-hook . lsp)) ; Activate LSP automatically - + :hook (dart-mode-hook . lsp)) +(require-package 'lsp-mode) (use-package lsp-mode - :commands lsp ; Make the `lsp` command available + :defer t + :commands lsp :init - (setq lsp-keymap-prefix "C-c l") ; Define your preferred prefix key (e.g., "C-c l") - + (setq lsp-keymap-prefix "C-c l") :hook - ((lsp-mode . lsp-enable-which-key-integration) ; Enable which-key integration for LSP commands + ((lsp-mode . lsp-enable-which-key-integration) (lsp-mode . (lambda () - ;; Customize LSP keybindings to work seamlessly with Corfu - (define-key lsp-mode-map (kbd "TAB") #'completion-at-point)))) ; Use `TAB` for completion in LSP mode - + (define-key lsp-mode-map (kbd "TAB") #'completion-at-point)))) :custom - (lsp-completion-provider :none) ; Use Corfu for completion - (lsp-enable-snippet nil) ; Disable LSP snippets (optional, if they cause issues) - (lsp-completion-show-detail t) ; Show details in completion candidates - (lsp-completion-show-kind t) ; Show the kind of completion candidate + (lsp-completion-provider :none) + (lsp-enable-snippet nil) + (lsp-completion-show-detail t) + (lsp-completion-show-kind t) (lsp-headerline-breadcrumb-segments '(path-up-to-project file symbols)) - (lsp-file-watch-threshold 1500) ; Raise file-watching threshold - (lsp-enable-file-watchers nil) ; Disable file watchers - (lsp-enable-symbol-highlighting nil) ; Disable symbol highlighting - (gc-cons-threshold 100000000) ; Increase garbage collection threshold - (read-process-output-max (* 1024 1024)) ; Increase max output from LSP servers -) - -;; (use-package lsp-mode -;; :init -;; ;; set prefix for lsp-command-keymap (few alternatives - "C-l", "C-c l") -;; (setq lsp-keymap-prefix "C-c l") + (lsp-file-watch-threshold 1500) + (lsp-enable-file-watchers nil) + (lsp-enable-symbol-highlighting nil) + (gc-cons-threshold 100000000) + (read-process-output-max (* 1024 1024))) -;; :hook (;; replace XXX-mode with concrete major-mode(e. g. python-mode) -;; ;; if you want which-key integration -;; (lsp-mode . lsp-enable-which-key-integration)) -;; :commands lsp) +(require-package 'lsp-ui) (use-package lsp-ui + :defer t :commands (lsp-ui-mode lsp-ui-doc-mode) :after lsp-mode :custom - (lsp-ui-sideline-enable t) ; Keep sideline enabled for other info - (lsp-ui-sideline-show-hover t) ; Enable hover for quick info (non-intrusive) - (lsp-ui-doc-enable nil) ; Disable the separate doc buffer - (lsp-ui-sideline-show-code-actions nil)) ; Disable code actions in sideline -;; (use-package lsp-ui ; Enhanced LSP UI elements -;; :commands (lsp-ui-mode lsp-ui-doc-mode) -;; :after lsp-mode ; Load after `lsp-mode` is loaded -;; :custom -;; (lsp-ui-sideline-show-hover nil) -;; (lsp-ui-doc-enable nil) -;; (lsp-ui-sideline-show-code-actions nil)) + (lsp-ui-sideline-enable t) + (lsp-ui-sideline-show-hover t) + (lsp-ui-doc-enable nil) + (lsp-ui-sideline-show-code-actions nil)) (add-hook 'dart-mode-hook #'lsp-deferred) (add-hook 'dart-mode-hook #'lsp-ui-mode) -;; optionally (setq lsp-disabled-clients '(semgrep-ls)) -;; ;; Ensure the cl-generic package is required -;; (require 'cl-generic) - -;; ;; Re-declare lsp-execute-command as a generic function -;; (cl-defgeneric lsp-execute-command (command &optional arguments) -;; "Execute a command in the LSP server.") - - -;; (cl-defgeneric lsp-clients-extract-signature-on-hover (signature) -;; "Extract signature on hover in LSP clients.") -;; (cl-defgeneric lsp-execute-command (command &optional arguments) -;; "Execute a command in the LSP server.") - - -;; ;; Re-declare lsp-process-id as a generic function -;; (cl-defgeneric lsp-process-id (workspace) -;; "Return the process id for the LSP workspace.") - -;; if you are helm user -;; if you are ivy user -(use-package lsp-ivy :commands lsp-ivy-workspace-symbol) -(use-package lsp-treemacs :commands lsp-treemacs-errors-list) - -;; optionally if you want to use debugger -(use-package dap-mode) -;; (use-package dap-LANGUAGE) to load the dap adapter for your language - -;; optional if you want which-key integration -(use-package which-key - :config - (which-key-mode)) - -(use-package lsp-mode - :ensure t - :commands lsp) ; Make 'lsp' command available +(require-package 'lsp-ivy) +(use-package lsp-ivy + :defer t + :commands lsp-ivy-workspace-symbol) +(require-package 'lsp-treemacs) (use-package lsp-treemacs - :ensure t - :after lsp-mode) + :defer t + :commands lsp-treemacs-errors-list) -(use-package flycheck - :ensure t) +(require-package 'dap-mode) +(use-package dap-mode + :defer t) -;; Performance settings -(setq gc-cons-threshold (* 100 1024 1024) -  read-process-output-max (* 1024 1024)) +(require-package 'which-key) +(use-package which-key + :defer t + :config + (which-key-mode)) +(require-package 'lsp-dart) (use-package lsp-dart - :ensure t + :defer t :hook (dart-mode . lsp)) -; 🔹 Configure projectile to find the package pubspec.yaml and set the folder as project root: (with-eval-after-load 'projectile (add-to-list 'projectile-project-root-files-bottom-up "pubspec.yaml") (add-to-list 'projectile-project-root-files-bottom-up "BUILD")) +(setq lsp-dart-sdk-dir "/opt/flutter/") +(add-to-list 'exec-path (concat lsp-dart-sdk-dir "bin/")) (provide 'pkg-flutter) diff --git a/packages/pkg-flycheck.el b/packages/pkg-flycheck.el index 03b0d69..910694c 100644 --- a/packages/pkg-flycheck.el +++ b/packages/pkg-flycheck.el @@ -1,4 +1,12 @@ -(require-package 'flycheck) +;;; pkg-flycheck.el --- On-the-fly syntax checking -*- lexical-binding: t -*- + +;;; Commentary: +;; This package configures Flycheck for on-the-fly syntax checking. +;;; Code: + +(require-package 'flycheck) +(use-package flycheck + :defer t) (provide 'pkg-flycheck) diff --git a/packages/pkg-git.el b/packages/pkg-git.el index eb50cc1..2f9ef56 100644 --- a/packages/pkg-git.el +++ b/packages/pkg-git.el @@ -1,6 +1,16 @@ +;;; pkg-git.el --- Git integration -*- lexical-binding: t -*- + +;;; Commentary: +;; This package configures Git integration with Magit, git-gutter, and +;; git-gutter-fringe. + +;;; Code: + +(require-package 'magit) (use-package magit + :defer t :config - ;; Remove obsolete hooks before enabling wip-mode + ;; Remove obsolete hooks before enabling wip-mode. (setq magit-status-sections-hook '(magit-insert-status-headers magit-insert-merge-log @@ -15,16 +25,22 @@ magit-insert-unpulled-from-upstream magit-insert-unpushed-to-pushremote magit-insert-unpushed-to-upstream)) + ;; Enable work-in-progress mode. (magit-wip-mode 1)) - +(require-package 'git-gutter) (use-package git-gutter + :defer t :hook (prog-mode . git-gutter-mode) :config + ;; Set the update interval for git-gutter. (setq git-gutter:update-interval 0.02)) +(require-package 'git-gutter-fringe) (use-package git-gutter-fringe + :defer t :config + ;; Define the fringe bitmaps for git-gutter. (define-fringe-bitmap 'git-gutter-fr:added [224] nil nil '(center repeated)) (define-fringe-bitmap 'git-gutter-fr:modified [224] nil nil '(center repeated)) (define-fringe-bitmap 'git-gutter-fr:deleted [128 192 224 240] nil nil 'bottom)) diff --git a/packages/pkg-ido.el b/packages/pkg-ido.el index 9138469..3400f89 100644 --- a/packages/pkg-ido.el +++ b/packages/pkg-ido.el @@ -1,98 +1,38 @@ -;; ;; Enable vertico -;; (use-package vertico -;; :init -;; (vertico-mode) +;;; pkg-ido.el --- Ido configuration -*- lexical-binding: t -*- -;; ;; Different scroll margin -;; ;; (setq vertico-scroll-margin 0) +;;; Commentary: +;; This package configures Ido, the Interactive Do mode, for completion. -;; ;; Show more candidates -;; ;; (setq vertico-count 20) +;;; Code: -;; ;; Grow and shrink the Vertico minibuffer -;; ;; (setq vertico-resize t) - -;; ;; Optionally enable cycling for `vertico-next' and `vertico-previous'. -;; ;; (setq vertico-cycle t) -;; ) - -;; ;; Persist history over Emacs restarts. Vertico sorts by history position. -;; (use-package savehist -;; :init -;; (savehist-mode)) - -;; ;; A few more useful configurations... -;; (use-package emacs -;; :init -;; ;; Add prompt indicator to `completing-read-multiple'. -;; ;; We display [CRM], e.g., [CRM,] if the separator is a comma. -;; (defun crm-indicator (args) -;; (cons (format "[CRM%s] %s" -;; (replace-regexp-in-string -;; "\\`\\[.*?]\\*\\|\\[.*?]\\*\\'" "" -;; crm-separator) -;; (car args)) -;; (cdr args))) -;; (advice-add #'completing-read-multiple :filter-args #'crm-indicator) - -;; ;; Do not allow the cursor in the minibuffer prompt -;; (setq minibuffer-prompt-properties -;; '(read-only t cursor-intangible t face minibuffer-prompt)) -;; (add-hook 'minibuffer-setup-hook #'cursor-intangible-mode) - -;; ;; Support opening new minibuffers from inside existing minibuffers. -;; (setq enable-recursive-minibuffers t) - -;; ;; Emacs 28 and newer: Hide commands in M-x which do not work in the current -;; ;; mode. Vertico commands are hidden in normal buffers. This setting is -;; ;; useful beyond Vertico. -;; (setq read-extended-command-predicate #'command-completion-default-include-p)) -;; Enable rich annotations using the Marginalia package -(use-package marginalia - ;; Bind `marginalia-cycle' locally in the minibuffer. To make the binding - ;; available in the *Completions* buffer, add it to the - ;; `completion-list-mode-map'. - :bind (:map minibuffer-local-map - ("M-A" . marginalia-cycle)) - - ;; The :init section is always executed. +(require-package 'ido) +(use-package ido :init - - ;; Marginalia must be activated in the :init section of use-package such that - ;; the mode gets enabled right away. Note that this forces loading the - ;; package. - (marginalia-mode)) -;; Require necessary packages -(require-package 'browse-kill-ring) -;; (use-package flx-ido) -;; (use-package flx) -;; (require 'flx-ido) -;; (flx-ido-mode) -;; Enable ido mode and flx-ido mode -(ido-mode 1) -(ido-everywhere 1) - -;; (flx-ido-mode t) - -;; enable flexible matching and use faces in ido -(setq ido-enable-flex-matching t) -(setq ido-use-faces t) - - - -;; Enable icomplete mode for better ido selection behavior -;; See https://www.gnu.org/software/emacs/manual/html_node/emacs/Icomplete.html for more info -(icomplete-mode t) - -;; Override M-x to use ido for command selection -(global-set-key - "\M-x" - (lambda () - (interactive) - (call-interactively - (intern - (ido-completing-read - "M-x " - (all-completions "" obarray 'commandp)))))) + ;; Enable Ido mode for all buffer and file operations. + (ido-mode 1) + (ido-everywhere 1) + ;; Enable flexible matching and use faces in Ido. + (setq ido-enable-flex-matching t) + (setq ido-use-faces t) + :config + ;; Use marginalia to show annotations in the minibuffer. + (require-package 'marginalia) + (use-package marginalia + :defer t + :bind (:map minibuffer-local-map + ("M-A" . marginalia-cycle)) + :init + (marginalia-mode)) + + ;; Override M-x to use Ido for command selection. + (global-set-key + "\M-x" + (lambda () + (interactive) + (call-interactively + (intern + (ido-completing-read + "M-x " + (all-completions "" obarray 'commandp))))))) (provide 'pkg-ido) diff --git a/packages/pkg-irc.el b/packages/pkg-irc.el index 4d024b1..41842f3 100644 --- a/packages/pkg-irc.el +++ b/packages/pkg-irc.el @@ -1,75 +1,84 @@ -;; Import necessary packages for ERC -(require 'auth-source) -(require 'erc) -(require 'erc-log) -(require 'erc-notify) -(require 'erc-spelling) -(require 'erc-autoaway) +;;; pkg-irc.el --- ERC configuration -*- lexical-binding: t -*- -;; ERC Configuration +;;; Commentary: +;; This package configures ERC, the Emacs IRC client. -;; General settings -(setq erc-modules '(autoaway autojoin button completion fill irccontrols keep-place - list log match menu move-to-prompt netsplit networks noncommands - notify notifications readonly ring stamp track) - erc-log-channels-directory "~/.erc/logs/" - erc-interpret-mirc-color t - erc-kill-buffer-on-part t - erc-kill-queries-on-quit t - erc-kill-server-buffer-on-quit t) +;;; Code: -;; Create logging directory if not exists -(unless (file-exists-p erc-log-channels-directory) - (mkdir erc-log-channels-directory t)) +(use-package erc + :defer t + :config + ;; Import necessary packages for ERC. + (require 'auth-source) + (require 'erc-log) + (require 'erc-notify) + (require 'erc-spelling) + (require 'erc-autoaway) -;; Autoaway settings -(setq erc-auto-discard-away t - erc-autoaway-idle-seconds 600 - erc-autoaway-use-emacs-idle t) + ;; ERC Configuration -;; Tracking settings -(require 'erc-track) -(setq erc-track-exclude-types '("JOIN" "NICK" "PART" "QUIT" "MODE" "324" "329" "332" "333" "353" "477") - erc-track-showcount t - erc-track-position-in-mode-line nil) + ;; General settings. + (setq erc-modules '(autoaway autojoin button completion fill irccontrols keep-place + list log match menu move-to-prompt netsplit networks noncommands + notify notifications readonly ring stamp track) + erc-log-channels-directory "~/.erc/logs/" + erc-interpret-mirc-color t + erc-kill-buffer-on-part t + erc-kill-queries-on-quit t + erc-kill-server-buffer-on-quit t) -;; Match mode settings -(require 'erc-match) -(setq erc-keywords '("RyanRix" "dongiverse" "\\brix\\b" "\\bPSA\\b" "\\b@here\\b" "\\b@all\\b") - erc-pals '("aviau") - erc-fools '("Froward")) -(erc-match-mode 1) -(remove-hook 'erc-text-matched-hook 'erc-hide-fools) + ;; Create logging directory if not exists. + (unless (file-exists-p erc-log-channels-directory) + (mkdir erc-log-channels-directory t)) -;; Function to reset tracking -(defun reset-erc-track-mode () - "Clear the ERC tracking list." - (interactive) - (setq erc-modified-channels-alist nil) - (erc-modified-channels-update)) -(global-set-key (kbd "C-c r") 'reset-erc-track-mode) + ;; Autoaway settings. + (setq erc-auto-discard-away t + erc-autoaway-idle-seconds 600 + erc-autoaway-use-emacs-idle t) -;; Function to connect to Freenode -(defun chat/freenode () - "Connect to the Freenode network." - (interactive) - (erc-tls :server "faille.io" - :port 6969 - :nick "darkmike" - :password (get-auth-password "social.faille.io" "michael.faille@gmail.com" "6969"))) + ;; Tracking settings. + (require 'erc-track) + (setq erc-track-exclude-types '("JOIN" "NICK" "PART" "QUIT" "MODE" "324" "329" "332" "333" "353" "477") + erc-track-showcount t + erc-track-position-in-mode-line nil) -;; Function to connect to Pirate -(defun chat/pirate () - "Connect to the Pirate network." - (interactive) - (erc-tls :server "faille.io" - :port 6969 - :nick "darkmike" - :password (get-auth-password "social.faille.io" "michael.faille@gmail.com" "6969"))) + ;; Match mode settings. + (require 'erc-match) + (setq erc-keywords '("RyanRix" "dongiverse" "\\brix\\b" "\\bPSA\\b" "\\b@here\\b" "\\b@all\\b") + erc-pals '("aviau") + erc-fools '("Froward")) + (erc-match-mode 1) + (remove-hook 'erc-text-matched-hook 'erc-hide-fools) -;; Function to retrieve password from auth-source -(defun get-auth-password (machine login port) - "Retrieve password from auth-source." - (funcall (plist-get (car (auth-source-search :machine machine :login login :port port)) :secret))) + ;; Function to reset tracking. + (defun reset-erc-track-mode () + "Clear the ERC tracking list." + (interactive) + (setq erc-modified-channels-alist nil) + (erc-modified-channels-update)) + (global-set-key (kbd "C-c r") 'reset-erc-track-mode) + + ;; Function to connect to Freenode. + (defun chat/freenode () + "Connect to the Freenode network." + (interactive) + (erc-tls :server "faille.io" + :port 6969 + :nick "darkmike" + :password (get-auth-password "social.faille.io" "michael.faille@gmail.com" "6969"))) + + ;; Function to connect to Pirate. + (defun chat/pirate () + "Connect to the Pirate network." + (interactive) + (erc-tls :server "faille.io" + :port 6969 + :nick "darkmike" + :password (get-auth-password "social.faille.io" "michael.faille@gmail.com" "6969"))) + + ;; Function to retrieve password from auth-source. + (defun get-auth-password (machine login port) + "Retrieve password from auth-source." + (funcall (plist-get (car (auth-source-search :machine machine :login login :port port)) :secret)))) (provide 'pkg-irc) diff --git a/packages/pkg-latex.el b/packages/pkg-latex.el index 41ffeda..3f2face 100644 --- a/packages/pkg-latex.el +++ b/packages/pkg-latex.el @@ -1,77 +1,78 @@ -;; Required packages -(require-package 'auctex) -(require-package 'cdlatex) -(require-package 'auctex-latexmk) -(require 'smartparens-latex) -;; (require 'tex-mik) -;; (require-package 'company-auctex) +;;; pkg-latex.el --- LaTeX configuration -*- lexical-binding: t -*- -;; (company-auctex-init) +;;; Commentary: +;; This package configures LaTeX support with AUCTeX, cdlatex, and +;; auctex-latexmk. -;; Configure TeX-view-program based on system type -(setq TeX-view-program-selection - (cond ((eq system-type 'darwin) - '((output-dvi "DVI Viewer") - (output-pdf "PDF Viewer") - (output-html "HTML Viewer"))) - (t '(output-dvi "open %o" - output-pdf "open %o" - output-html "open %o")))) -(setq TeX-view-program-list - '(("DVI Viewer" "open %o") - ("PDF Viewer" "open %o") - ("HTML Viewer" "open %o"))) +;;; Code: +(require-package 'auctex) +(use-package auctex + :defer t + :config + (require-package 'cdlatex) + (use-package cdlatex + :defer t) + (require-package 'auctex-latexmk) + (use-package auctex-latexmk + :defer t) + (require 'smartparens-latex) -;; Adding specific backends and LaTeXmk for LaTeX -(add-hook 'LaTeX-mode-hook (lambda () - ;; Prioritize Orderless completion with Carpe and Prescient in LaTeX-mode - (setq-local completion-at-point-functions '(orderless-completion-at-point prescient-completion-at-point cape-tex cape-keyword cape-dabbrev cape-file)) + ;; Configure TeX-view-program based on system type. + (setq TeX-view-program-selection + (cond ((eq system-type 'darwin) + '((output-dvi "DVI Viewer") + (output-pdf "PDF Viewer") + (output-html "HTML Viewer"))) + (t '(output-dvi "open %o" + output-pdf "open %o" + output-html "open %o")))) + (setq TeX-view-program-list + '(("DVI Viewer" "open %o") + ("PDF Viewer" "open %o") + ("HTML Viewer" "open %o"))) - ;; Latexmk command for easy compilation - (push '("Latexmk" "latexmk -pdf %s" TeX-run-command nil t :help "Run Latexmk on file") - TeX-command-list))) -;; (with-eval-after-load 'eglot -;; (add-to-list 'eglot-server-programs -;; `(latex-mode . ("digestif" :build -;; (:executable: -;; (tectonic) -;; )) -;; ))) + ;; Adding specific backends and LaTeXmk for LaTeX. + (add-hook 'LaTeX-mode-hook (lambda () + ;; Prioritize Orderless completion with Carpe and Prescient in LaTeX-mode. + (setq-local completion-at-point-functions '(orderless-completion-at-point prescient-completion-at-point cape-tex cape-keyword cape-dabbrev cape-file)) + ;; Latexmk command for easy compilation. + (push '("Latexmk" "latexmk -pdf %s" TeX-run-command nil t :help "Run Latexmk on file") + TeX-command-list))) -;; LaTeX mode defaults -(defun prelude-latex-mode-defaults () - "Default Prelude hook for `LaTeX-mode'." - (turn-on-auto-fill) - (abbrev-mode +1) - (smartparens-mode +1) - (pcase latex-fast-math-entry - (`LaTeX-math-mode (LaTeX-math-mode 1)) - (`cdlatex (turn-on-cdlatex)))) + ;; LaTeX mode defaults. + (defun prelude-latex-mode-defaults () + "Default Prelude hook for `LaTeX-mode'." + (turn-on-auto-fill) + (abbrev-mode +1) + (smartparens-mode +1) + (pcase latex-fast-math-entry + (`LaTeX-math-mode (LaTeX-math-mode 1)) + (`cdlatex (turn-on-cdlatex)))) -(add-hook 'LaTeX-mode-hook 'prelude-latex-mode-defaults) + (add-hook 'LaTeX-mode-hook 'prelude-latex-mode-defaults) -;; Set lualatex as the default compiler -(setq pdf-latex-command "lualatex") + ;; Set lualatex as the default compiler. + (setq pdf-latex-command "lualatex") -;; AUCTeX configuration -(setq TeX-auto-save t) -(setq TeX-parse-self t) -(setq-default TeX-engine 'luatex) -(setq-default TeX-PDF-mode t) + ;; AUCTeX configuration. + (setq TeX-auto-save t) + (setq TeX-parse-self t) + (setq-default TeX-engine 'luatex) + (setq-default TeX-PDF-mode t) -;; Hooks for LaTeX mode -(add-hook 'LaTeX-mode-hook 'visual-line-mode) -(add-hook 'LaTeX-mode-hook 'flyspell-mode) -(add-hook 'LaTeX-mode-hook 'LaTeX-math-mode) -(add-hook 'LaTeX-mode-hook 'turn-on-reftex) + ;; Hooks for LaTeX mode. + (add-hook 'LaTeX-mode-hook 'visual-line-mode) + (add-hook 'LaTeX-mode-hook 'flyspell-mode) + (add-hook 'LaTeX-mode-hook 'LaTeX-math-mode) + (add-hook 'LaTeX-mode-hook 'turn-on-reftex) -(setq reftex-plug-into-AUCTeX t) + (setq reftex-plug-into-AUCTeX t) -;; Flymake configuration for LaTeX -(defun flymake-get-tex-args (file-name) - (list "pdflatex" (list "-file-line-error" "-draftmode" "-interaction=nonstopmode" file-name))) + ;; Flymake configuration for LaTeX. + (defun flymake-get-tex-args (file-name) + (list "pdflatex" (list "-file-line-error" "-draftmode" "-interaction=nonstopmode" file-name)))) (provide 'pkg-latex) diff --git a/packages/pkg-loader.el b/packages/pkg-loader.el new file mode 100644 index 0000000..ff9efc6 --- /dev/null +++ b/packages/pkg-loader.el @@ -0,0 +1,26 @@ +(use-package pkg-ido) +(use-package pkg-corfu2) +(use-package pkg-org) +(use-package pkg-discover) +(use-package pkg-git) +(use-package pkg-flycheck) +(use-package pkg-ssh) +(use-package pkg-docker) +(use-package pkg-feel) +(use-package pkg-lsp) +(use-package pkg-latex) +(use-package pkg-yaml) +(use-package pkg-php) +(use-package pkg-projectile) +(use-package pkg-bash) +(use-package pkg-search) +(use-package pkg-eshell) +(use-package pkg-rust) +(use-package pkg-emms) +(use-package pkg-web) +(use-package pkg-systemd) +(use-package pkg-multipleCursor) +(use-package pkg-mouvement) +(use-package pkg-irc) +(use-package pkg-flutter) +(use-package pkg-terraform) diff --git a/packages/pkg-lsp.el b/packages/pkg-lsp.el index 5a12d60..3db2ac8 100644 --- a/packages/pkg-lsp.el +++ b/packages/pkg-lsp.el @@ -6,154 +6,63 @@ ;; providing syntax coloring and icons in completions. ;;; Code: - -(require 'use-package) -(require 'orderless) - - -(add-hook 'prog-mode-hook 'my-prog-mode-function) - -(defun my-prog-mode-function () - "This function will run in all prog-mode derived modes." - (message "Programming mode activated!") - ;; Add your customizations here, for example: - (display-line-numbers-mode 1) - (electric-indent-mode 1) - ;; (dart-indent-level 2) -) - -;; **1. Disable Automatic Package Initialization** -;; Prevent Emacs from initializing packages automatically to avoid conflicts. -(setq package-enable-at-startup nil) - -;; ;; **2. Configure Package Archives and Initialize Package System** -;; (require 'package) -;; (setq package-archives -;; '(("melpa" . "https://melpa.org/packages/") -;; ("org" . "https://orgmode.org/elpa/") -;; ("gnu" . "https://elpa.gnu.org/packages/"))) -;; (package-initialize) - -;; **4. Install and Configure `all-the-icons`** -(use-package all-the-icons - :ensure t - :if (display-graphic-p)) ;; Only load in GUI Emacs - -;; Run this command after installation to install fonts: -;; M-x all-the-icons-install-fonts RET -;; Follow the prompts to install the necessary fonts. - -;; **5. Configure Corfu for Completion** -(use-package corfu - :ensure t - :init - (global-corfu-mode) ;; Enable Corfu globally - ;; Enable Corfu in the minibuffer as well - (add-hook 'minibuffer-setup-hook #'corfu-mode) - :config - (setq corfu-cycle t) ;; Enable cycling for `corfu-next/previous' - (setq corfu-auto t) ;; Enable auto completion - (setq corfu-auto-delay 0.0) ;; No delay for auto completion - (setq corfu-min-width 40) ;; Minimum width of Corfu popup - (setq corfu-max-width 100)) ;; Maximum width of Corfu popup - -;; **6. Install and Configure `cape` for Enhanced Completion** -(use-package cape - :ensure t - :after corfu) - - - -;; **9. Define Custom Functions for Completion Behavior** - -(defun pkg-lsp/orderless-flex-first (_pattern index _total) - "Prioritize flex matching for the first word in completion. -_PATTERN: The search pattern. -_INDEX: The index of the current candidate. -_TOTAL: The total number of candidates." - (and (eq index 0) 'orderless-flex)) - - -(defun pkg-lsp/lsp-mode-setup-completion () - "Set up completion with orderless and Cape." - (when (fboundp 'lsp-completion-at-point) - (setf (alist-get 'styles (alist-get 'lsp-capf completion-category-defaults)) - '(orderless)) - (add-hook 'orderless-style-dispatchers - #'pkg-lsp/orderless-flex-first nil 'local) - (setq-local completion-at-point-functions - (list #'lsp-completion-at-point - (cape-capf-super - #'cape-file - #'cape-dabbrev))))) - -(defun pkg-lsp/setup-corfu () - "Setup Corfu for LSP." - ;; No additional setup needed since global-corfu-mode is active - ) - -(defun pkg-lsp/smart-tab-completion () - "Use TAB for indentation at beginning of line or after whitespace, completion elsewhere." - (interactive) - (if (or (bolp) ; At beginning of line - (looking-back "^[[:space:]]+") ; After whitespace at start - (looking-back "\\s-")) ; After any whitespace - (indent-for-tab-command) - (completion-at-point))) - - +(require-package 'lsp-mode) (use-package lsp-mode - :ensure t :defer t :commands (lsp lsp-deferred) :hook ((python-mode . lsp-deferred) (go-mode . lsp-deferred) (dart-mode . lsp-deferred) - - (lsp-completion-mode . pkg-lsp/lsp-mode-setup-completion) ; Remove quote + (lsp-completion-mode . pkg-lsp/lsp-mode-setup-completion) (lsp-mode . lsp-enable-which-key-integration) (lsp-mode . pkg-lsp/setup-corfu)) :custom + ;; Use Corfu for completion instead of the default LSP completion UI. (lsp-completion-provider :none) + ;; Set the keymap prefix for LSP commands. (lsp-keymap-prefix "C-c l") :config + ;; Use TAB for smart completion. (define-key lsp-mode-map (kbd "") #'pkg-lsp/smart-tab-completion) (define-key lsp-mode-map (kbd "TAB") #'pkg-lsp/smart-tab-completion)) - -;; **11. Configure `lsp-dart` for Dart Support** +(require-package 'lsp-dart) (use-package lsp-dart - :ensure t :after lsp-mode :hook (dart-mode . lsp)) -;; **12. Configure `lsp-ui` for Enhanced LSP UI** +(require-package 'lsp-ui) (use-package lsp-ui - :ensure t :after lsp-mode :commands lsp-ui-mode :custom + ;; Enable the documentation panel. (lsp-ui-doc-enable t) + ;; Set the position of the documentation panel. (lsp-ui-doc-position 'bottom) + ;; Show the documentation panel with the cursor. (lsp-ui-doc-show-with-cursor t) + ;; Show diagnostics in the sideline. (lsp-ui-sideline-show-diagnostics t) - (lsp-ui-sideline-show-hover nil) ;; Disable hover to prevent conflict with Corfu + ;; Don't show hover information in the sideline to prevent conflicts with Corfu. + (lsp-ui-sideline-show-hover nil) + ;; Show code actions in the sideline. (lsp-ui-sideline-show-code-actions t) + ;; Set the update mode for the sideline. (lsp-ui-sideline-update-mode 'line) :bind (:map lsp-ui-mode-map ([remap xref-find-definitions] . lsp-ui-peek-find-definitions) ([remap xref-find-references] . lsp-ui-peek-find-references))) -;; **13. Configure `lsp-treemacs` for Tree-based UI** +(require-package 'lsp-treemacs) (use-package lsp-treemacs - :ensure t :after lsp-mode :config + ;; Enable treemacs synchronization. (setq lsp-treemacs-sync-mode 1)) -;; **14. Configure `consult-lsp` for Enhanced LSP Integration with Consult** +(require-package 'consult-lsp) (use-package consult-lsp - :ensure t :after (lsp-mode consult) :bind (:map lsp-mode-map ([remap xref-find-apropos] . consult-lsp-symbols) @@ -161,147 +70,39 @@ _TOTAL: The total number of candidates." ("C-c l s" . consult-lsp-symbols) ("C-c l f" . consult-lsp-file-symbols))) -;; **15. Define Additional Setup Function** -(defun pkg-lsp-setup () - "Set up LSP for supported modes." - ;; Placeholder for additional custom configurations - ) - -;;;###autoload -(defun pkg-lsp-init () - "Initialize pkg-lsp configuration." - (pkg-lsp-setup)) - -;; **16. Bind TAB Key Within `lsp-mode`** -;; This ensures that the key bindings are set after `lsp-mode` is loaded -(add-hook 'lsp-mode-hook - (lambda () - (define-key lsp-mode-map (kbd "") #'pkg-lsp/smart-tab-completion) - (define-key lsp-mode-map (kbd "TAB") #'pkg-lsp/smart-tab-completion))) - -(provide 'pkg-lsp) - - -;;; pkg-lsp.el ends here -;; ;;; pkg-lsp.el --- LSP configuration compatible with general completion -*- lexical-binding: t -*- - -;; ;;; Commentary: -;; ;; This package provides LSP configuration that works alongside -;; ;; the general completion setup in pkg-corfu2.el - -;; ;;; Code: - -;; (require 'use-package) - - -;; (use-package lsp-mode -;; :ensure t -;; :defer t -;; :commands (lsp lsp-deferred) -;; :hook ((python-mode go-mode) . lsp-deferred) -;; :custom -;; ;; (lsp-completion-provider :none) ; we use Corfu! -;; (lsp-keymap-prefix "C-c l") -;; (lsp-auto-configure t) -;; (lsp-idle-delay 0.500) -;; (lsp-keep-workspace-alive nil) -;; (lsp-auto-guess-root t) -;; (lsp-prefer-flymake nil) -;; (lsp-enable-completion-at-point t) -;; (lsp-enable-indentation t) -;; (lsp-enable-on-type-formatting t) -;; (lsp-enable-snippet nil) - -;; :init -;; (defun my/orderless-dispatch-flex-first (_pattern index _total) -;; (and (eq index 0) 'orderless-flex)) - -;; (defun my/lsp-mode-setup-completion () -;; (setf (alist-get 'styles (alist-get 'lsp-capf completion-category-defaults)) -;; '(orderless)) - -;; ;; Configure the first word as flex filtered. -;; (add-hook 'orderless-style-dispatchers #'my/orderless-dispatch-flex-first nil 'local) - -;; ;; Use lsp-completion-at-point directly for LSP completion -;; (setq-local completion-at-point-functions '(lsp-completion-at-point))) - -;; :config -;; (add-hook 'lsp-mode-hook #'lsp-enable-which-key-integration) -;; (add-hook 'lsp-completion-mode-hook #'my/lsp-mode-setup-completion) -;; (add-hook 'lsp-mode-hook #'corfu-lsp-setup) -;; ) - -;; (defun corfu-lsp-setup () - -;; ;; Configure python-lsp-server (pylsp) -;; (with-eval-after-load 'lsp-pylsp -;; (setq lsp-pylsp-plugins-ruff-enabled t -;; lsp-pylsp-plugins-ruff-select ["I" "E" "F" "UP" "B" "SIM"] -;; lsp-pylsp-plugins-ruff-format ["E" "F"] -;; lsp-pylsp-plugins-ruff-unsafe-fixes "UP034" -;; lsp-pylsp-plugins-ruff-formatEnabled t - -;; ;; Disable other linters in favor of Ruff -;; lsp-pylsp-plugins-pycodestyle-enabled nil -;; lsp-pylsp-plugins-mccabe-enabled nil -;; lsp-pylsp-plugins-pyflakes-enabled nil -;; lsp-pylsp-plugins-autopep8-enabled nil -;; lsp-pylsp-plugins-yapf-enabled nil - -;; ;; Enhance Jedi settings -;; lsp-pylsp-plugins-jedi-completion-enabled t -;; lsp-pylsp-plugins-jedi-completion-include-params t -;; lsp-pylsp-plugins-jedi-completion-include-class-objects t -;; lsp-pylsp-plugins-jedi-completion-fuzzy t -;; lsp-pylsp-plugins-jedi-completion-auto-import-modules t -;; lsp-pylsp-plugins-jedi-hover-enabled t -;; lsp-pylsp-plugins-jedi-signature-help-enabled t -;; lsp-pylsp-plugins-jedi-symbols-enabled t -;; lsp-pylsp-plugins-jedi-use-pyenv-environment t -;; lsp-pylsp-plugins-jedi-completion-max-diagnostics 1000))) - -;; (use-package lsp-ui -;; :ensure t -;; :after lsp-mode -;; :commands lsp-ui-mode -;; :custom -;; (lsp-ui-doc-enable t) -;; (lsp-ui-doc-position 'bottom) -;; (lsp-ui-doc-show-with-cursor t) -;; (lsp-ui-sideline-show-diagnostics t) -;; (lsp-ui-sideline-show-hover t) -;; (lsp-ui-sideline-show-code-actions t) -;; (lsp-ui-sideline-update-mode 'line) -;; :bind (:map lsp-ui-mode-map -;; ([remap xref-find-definitions] . lsp-ui-peek-find-definitions) -;; ([remap xref-find-references] . lsp-ui-peek-find-references))) - -;; (use-package lsp-treemacs -;; :ensure t -;; :after lsp-mode -;; :config -;; (setq lsp-treemacs-sync-mode 1)) +(defun pkg-lsp/orderless-flex-first (_pattern index _total) + "Prioritize flex matching for the first word in completion. +_PATTERN: The search pattern. +_INDEX: The index of the current candidate. +_TOTAL: The total number of candidates." + (and (eq index 0) 'orderless-flex)) -;; (use-package consult-lsp -;; :ensure t -;; :after (lsp-mode consult) -;; :bind (:map lsp-mode-map -;; ([remap xref-find-apropos] . consult-lsp-symbols) -;; ("C-c l d" . consult-lsp-diagnostics) -;; ("C-c l s" . consult-lsp-symbols) -;; ("C-c l f" . consult-lsp-file-symbols))) -;; (defun pkg-lsp-setup () -;; "Set up LSP for supported modes." -;; ;; Additional setup if needed -;; ) +(defun pkg-lsp/lsp-mode-setup-completion () + "Set up completion with orderless and Cape." + (when (fboundp 'lsp-completion-at-point) + (setf (alist-get 'styles (alist-get 'lsp-capf completion-category-defaults)) + '(orderless)) + (add-hook 'orderless-style-dispatchers + #'pkg-lsp/orderless-flex-first nil 'local) + (setq-local completion-at-point-functions + (list #'lsp-completion-at-point + (cape-capf-super + #'cape-file + #'cape-dabbrev))))) -;; ;;;###autoload -;; (defun pkg-lsp-init () -;; "Initialize pkg-lsp configuration." -;; (pkg-lsp-setup)) +(defun pkg-lsp/setup-corfu () + "Setup Corfu for LSP." + ;; No additional setup needed since global-corfu-mode is active + ) -;; (provide 'pkg-lsp) +(defun pkg-lsp/smart-tab-completion () + "Use TAB for indentation at beginning of line or after whitespace, completion elsewhere." + (interactive) + (if (or (bolp) ; At beginning of line + (looking-back "^[[:space:]]+") ; After whitespace at start + (looking-back "\\s-")) ; After any whitespace + (indent-for-tab-command) + (completion-at-point))) -;; ;;; pkg-lsp.el ends here +(provide 'pkg-lsp) diff --git a/packages/pkg-mouvement.el b/packages/pkg-mouvement.el index b86f490..3f39a9b 100644 --- a/packages/pkg-mouvement.el +++ b/packages/pkg-mouvement.el @@ -1,7 +1,18 @@ -(require-package 'ace-window) -(require-package 'avy) -(require-package 'zop-to-char) -(require-package 'ace-jump-buffer) +;;; pkg-mouvement.el --- Mouvement configuration -*- lexical-binding: t -*- + +;;; Commentary: +;; This package configures various packages for efficient navigation. + +;;; Code: + +(use-package ace-window + :defer t) +(use-package avy + :defer t) +(use-package zop-to-char + :defer t) +(use-package ace-jump-buffer + :defer t) ;; Avy configuration for word or subword navigation (global-set-key (kbd "C-c j") 'avy-goto-word-or-subword-1) diff --git a/packages/pkg-multipleCursor.el b/packages/pkg-multipleCursor.el index a45f122..324f32f 100644 --- a/packages/pkg-multipleCursor.el +++ b/packages/pkg-multipleCursor.el @@ -1,16 +1,26 @@ -(use-package mc-extras - :ensure t - :bind (("C-S-c C-S-c" . mc/edit-lines) - ("C->" . mc/mark-next-like-this) - ("C-<" . mc/mark-previous-like-this) - ("C-c C-<" . mc/mark-all-like-this)) - :bind (:map mc/keymap - ("C-. =" . mc/compare-chars) - ("C-. C-a" . mc/edit-beginnings-of-lines) - ("C-. C-e" . mc/edit-ends-of-lines) - ("C-. |" . mc/vertical-align) - ("C-. n" . mc/insert-numbers) - ("C-. s" . mc/sort-regions) - ("C-. r" . mc/reverse-regions))) +;;; pkg-multiple-cursors.el --- Multiple cursors configuration -*- lexical-binding: t -*- + +;;; Commentary: +;; This package configures multiple-cursors for simultaneous editing. + +;;; Code: + +(use-package multiple-cursors + :defer t + :config + (use-package mc-extras + :defer t + :bind (("C-S-c C-S-c" . mc/edit-lines) + ("C->" . mc/mark-next-like-this) + ("C-<" . mc/mark-previous-like-this) + ("C-c C-<" . mc/mark-all-like-this)) + :bind (:map mc/keymap + ("C-. =" . mc/compare-chars) + ("C-. C-a" . mc/edit-beginnings-of-lines) + ("C-. C-e" . mc/edit-ends-of-lines) + ("C-. |" . mc/vertical-align) + ("C-. n" . mc/insert-numbers) + ("C-. s" . mc/sort-regions) + ("C-. r" . mc/reverse-regions))))) (provide 'pkg-multipleCursor) diff --git a/packages/pkg-org.el b/packages/pkg-org.el index 821283d..8f85450 100644 --- a/packages/pkg-org.el +++ b/packages/pkg-org.el @@ -1,115 +1,131 @@ -(require-package 'org) +;;; pkg-org.el --- Org mode configuration -*- lexical-binding: t -*- + +;;; Commentary: +;; This package configures Org mode, a powerful tool for keeping notes, +;; maintaining TODO lists, planning projects, and authoring documents. -;; Load necessary packages and libraries -(require 'org-protocol) -(require 'org-capture) -(require 'org-mobile) - -;; Install necessary packages if not already installed -(require-package 'ox-reveal) -(require-package 'org-bullets) -(require-package 'org-brain) -(require-package 'deft) - -;; Set the directory where org files are stored -(setq org-directory "~/org") -(setq org-default-notes-file (concat org-directory "/refile.org")) - -;; Function to get the path to an org file -(defun set-org-file (pkg-org/file) - (concat org-directory pkg-org/file)) - -;; Set the path for org-brain -(setq org-brain-path "~/org/brain") - -;; Set initial state for org-brain-visualize-mode -(with-eval-after-load 'evil - (evil-set-initial-state 'org-brain-visualize-mode 'emacs)) - -;; Set configuration for org ids -(setq org-id-track-globally t) -(setq org-id-locations-file "~/.emacs.d/.org-id-locations") - -;; Add a template for org-brain to org-capture-templates -(push '("b" "Brain" plain (function org-brain-goto-end) - "* %i%?" :empty-lines 1) - org-capture-templates) - -;; Set org-brain configuration -(setq org-brain-visualize-default-choices 'all) -(setq org-brain-title-max-length 12) - -;; Set up org-mobile -(setq org-mobile-files org-directory) -(setq org-mobile-inbox-for-pull (concat org-mobile-files "/flagged.org")) -(setq org-mobile-directory "~/ownCloud/org-mobile") - -;; Set up org-clock -(require 'org-clock) -(setq org-clock-persist 'history) -(org-clock-persistence-insinuate) - -;; Set org-capture templates -(setq org-capture-templates - (quote (("t" "todo" entry (file (set-org-file "/refile.org")) - "* TODO %?\n%U\n%a\n" :clock-in t :clock-resume t) - ("n" "note" entry (file (set-org-file "/refile.org")) - "* %? :NOTE:\n%U\n%a\n" :clock-in t :clock-resume t) - ("j" "Journal" entry (file+datetree (set-org-file "~/git/org/diary.org")) - "* %?\n%U\n" :clock-in t :clock-resume t)))) - -;; Configure deft -(setq deft-directory org-directory) -(setq deft-default-extension "org") -(setq deft-extensions (quote ("org" "txt" "text" "md" "markdown"))) -(global-set-key [f8] 'deft) -(setq deft-auto-save-interval 5) - -;; Bind org-capture to "C-c c" -(global-set-key (kbd "C-c c") 'org-capture) - -;; Add hook to org-mode -(add-hook 'org-mode-hook - (lambda () - (org-bullets-mode) - (visual-line-mode t) - (setq-default org-src-fontify-natively t))) - -;; Load languages for org-babel -(org-babel-do-load-languages - 'org-babel-load-languages - '((emacs-lisp . nil) - (ruby . t) - (shell . t) - (ditaa . t) - (plantuml . t) - (dot . t) - (python . t))) - -;; Set org-agenda files -(setq org-agenda-files (list (concat org-directory "/home/") - (concat org-directory "/clients/desjardins"))) - -;; Enable logging of TODOs -(setq org-log-done t) - -;; Set org-publish-project-alist -(setq org-publish-project-alist - '(("org-DevOps-VilleMTL" - :base-directory "~/src/DevOps-VilleMTL" - :base-extension "org" - :headline-levels 4 - :publishing-directory "~/Projects/randomgeekery.org/jekyll/" - :recursive t - :publishing-function org-publish-org-to-html - :html-extension "html" - :body-only t) - ("org-static-randomgeekery" - :base-directory "~/Projects/randomgeekery.org/org/" - :base-extension "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|ogg" - :publishing-directory "~/Projects/randomgeekery.org/" - :recursive t - :publishing-function org-publish-attachment) - ("rg" :components ("org-randomgeekery" "org-static-randomgeekery")))) +;;; Code: + +(require-package 'org) +(use-package org + :defer t + :config + ;; Load necessary packages for Org mode. + (require-package 'ox-reveal) + (use-package ox-reveal + :defer t) + (require-package 'org-bullets) + (use-package org-bullets + :defer t) + (require-package 'org-brain) + (use-package org-brain + :defer t) + (require-package 'deft) + (use-package deft + :defer t) + + ;; Set the directory where org files are stored. + (setq org-directory "~/org") + (setq org-default-notes-file (concat org-directory "/refile.org")) + + ;; Function to get the path to an org file. + (defun set-org-file (pkg-org/file) + (concat org-directory pkg-org/file)) + + ;; Set the path for org-brain. + (setq org-brain-path "~/org/brain") + + ;; Set initial state for org-brain-visualize-mode. + (with-eval-after-load 'evil + (evil-set-initial-state 'org-brain-visualize-mode 'emacs)) + + ;; Set configuration for org ids. + (setq org-id-track-globally t) + (setq org-id-locations-file "~/.emacs.d/.org-id-locations") + + ;; Add a template for org-brain to org-capture-templates. + (push '("b" "Brain" plain (function org-brain-goto-end) + "* %i%?" :empty-lines 1) + org-capture-templates) + + ;; Set org-brain configuration. + (setq org-brain-visualize-default-choices 'all) + (setq org-brain-title-max-length 12) + + ;; Set up org-mobile for syncing with mobile devices. + (setq org-mobile-files org-directory) + (setq org-mobile-inbox-for-pull (concat org-mobile-files "/flagged.org")) + (setq org-mobile-directory "~/ownCloud/org-mobile") + + ;; Set up org-clock for time tracking. + (require 'org-clock) + (setq org-clock-persist 'history) + (org-clock-persistence-insinuate) + + ;; Set org-capture templates for quickly capturing notes and TODOs. + (setq org-capture-templates + (quote (("t" "todo" entry (file (set-org-file "/refile.org")) + "* TODO %?\n%U\n%a\n" :clock-in t :clock-resume t) + ("n" "note" entry (file (set-org-file "/refile.org")) + "* %? :NOTE:\n%U\n%a\n" :clock-in t :clock-resume t) + ("j" "Journal" entry (file+datetree (set-org-file "~/git/org/diary.org")) + "* %?\n%U\n" :clock-in t :clock-resume t)))) + + ;; Configure deft for quickly searching notes. + (setq deft-directory org-directory) + (setq deft-default-extension "org") + (setq deft-extensions (quote ("org" "txt" "text" "md" "markdown"))) + (global-set-key [f8] 'deft) + (setq deft-auto-save-interval 5) + + ;; Bind org-capture to "C-c c". + (global-set-key (kbd "C-c c") 'org-capture) + + ;; Add hook to org-mode. + (add-hook 'org-mode-hook + (lambda () + ;; Use bullets for headlines. + (org-bullets-mode) + ;; Use visual line mode for better readability. + (visual-line-mode t) + ;; Fontify source blocks natively. + (setq-default org-src-fontify-natively t))) + + ;; Load languages for org-babel. + (org-babel-do-load-languages + 'org-babel-load-languages + '((emacs-lisp . nil) + (ruby . t) + (shell . t) + (ditaa . t) + (plantuml . t) + (dot . t) + (python . t))) + + ;; Set org-agenda files. + (setq org-agenda-files (list (concat org-directory "/home/") + (concat org-directory "/clients/desjardins"))) + + ;; Enable logging of TODOs. + (setq org-log-done t) + + ;; Set org-publish-project-alist for publishing org files to HTML. + (setq org-publish-project-alist + '(("org-DevOps-VilleMTL" + :base-directory "~/src/DevOps-VilleMTL" + :base-extension "org" + :headline-levels 4 + :publishing-directory "~/Projects/randomgeekery.org/jekyll/" + :recursive t + :publishing-function org-publish-org-to-html + :html-extension "html" + :body-only t) + ("org-static-randomgeekery" + :base-directory "~/Projects/randomgeekery.org/org/" + :base-extension "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|ogg" + :publishing-directory "~/Projects/randomgeekery.org/" + :recursive t + :publishing-function org-publish-attachment) + ("rg" :components ("org-randomgeekery" "org-static-randomgeekery"))))) (provide 'pkg-org) diff --git a/packages/pkg-php.el b/packages/pkg-php.el index 5ea98d8..61b70c6 100644 --- a/packages/pkg-php.el +++ b/packages/pkg-php.el @@ -1,4 +1,12 @@ -(require-package 'php-mode) +;;; pkg-php.el --- PHP configuration -*- lexical-binding: t -*- + +;;; Commentary: +;; This package configures PHP support with php-mode. +;;; Code: + +(require-package 'php-mode) +(use-package php-mode + :defer t) (provide 'pkg-php) diff --git a/packages/pkg-projectile.el b/packages/pkg-projectile.el index 8dbd3f7..d6f32fb 100644 --- a/packages/pkg-projectile.el +++ b/packages/pkg-projectile.el @@ -1,32 +1,43 @@ -;;; pkg-projectile.el --- +;;; pkg-projectile.el --- Projectile configuration -*- lexical-binding: t -*- -;; Ensure necessary packages are loaded -(require-package 'projectile) -(require-package 'go-projectile) -(require-package 'exec-path-from-shell) -(require-package 'perspective) - -;; Projectile Configuration -(setq projectile-completion-system 'ido - projectile-switch-project-action 'projectile-dired - projectile-cache-file (expand-file-name "projectile.cache" main-savefile-dir) - projectile-project-search-path '("~/src") - go-projectile-tools-path (concat (exec-path-from-shell-copy-env "HOME") "/go")) - -(projectile-mode t) - -(add-hook 'project-find-functions #'project-projectile) +;;; Commentary: +;; This package configures Projectile for project management. +;;; Code: -;; Key bindings for Projectile -(global-set-key (kbd "C-é") 'projectile-commander) -(define-key projectile-mode-map (kbd "C-") 'projectile-persp-switch-project) - -;; Perspective Configuration -(global-set-key (kbd "C-x C-b") 'persp-list-buffers) -(customize-set-variable 'persp-mode-prefix-key (kbd "C-c M-p")) -(persp-mode) +(require-package 'projectile) +(use-package projectile + :defer t + :config + (require-package 'go-projectile) + (use-package go-projectile + :defer t) + (require-package 'exec-path-from-shell) + (use-package exec-path-from-shell + :defer t) + (require-package 'perspective) + (use-package perspective + :defer t) + + ;; Projectile Configuration + (setq projectile-completion-system 'ido + projectile-switch-project-action 'projectile-dired + projectile-cache-file (expand-file-name "projectile.cache" main-savefile-dir) + projectile-project-search-path '("~/src") + go-projectile-tools-path (concat (exec-path-from-shell-copy-env "HOME") "/go")) + + (projectile-mode t) + + (add-hook 'project-find-functions #'project-projectile) + + + ;; Key bindings for Projectile + (global-set-key (kbd "C-é") 'projectile-commander) + (define-key projectile-mode-map (kbd "C-") 'projectile-persp-switch-project) + + ;; Perspective Configuration + (global-set-key (kbd "C-x C-b") 'persp-list-buffers) + (customize-set-variable 'persp-mode-prefix-key (kbd "C-c M-p")) + (persp-mode)) (provide 'pkg-projectile) - -;;; pkg-projectile.el ends here diff --git a/packages/pkg-rust.el b/packages/pkg-rust.el index fa8d4fb..b904f5e 100644 --- a/packages/pkg-rust.el +++ b/packages/pkg-rust.el @@ -1,67 +1,40 @@ -(require-package 'rust-mode) -(require-package 'flycheck-rust) +;;; pkg-rust.el --- Rust configuration -*- lexical-binding: t -*- +;;; Commentary: +;; This package configures Rust support with rust-mode and flycheck-rust. -(autoload 'rust-mode "rust-mode" nil t) -(add-to-list 'auto-mode-alist '("\\.rs\\'" . rust-mode)) +;;; Code: -;; (add-hook 'rust-mode-hook #'racer-mode) -;; (add-hook 'racer-mode-hook #'eldoc-mode) +(use-package rust-mode + :defer t + :config + (use-package flycheck-rust + :defer t) + (autoload 'rust-mode "rust-mode" nil t) + (add-to-list 'auto-mode-alist '("\\.rs\\'" . rust-mode)) -(add-hook 'rust-mode-hook #'(lambda() - ;; (setq racer-cmd "/target/release/racer") - ;; (setq racer-rust-src-path "/src/") - ;; (racer-mode) - (eldoc-mode) - (defun rust-save-compile-and-run () - (interactive) - (save-buffer) + (add-hook 'rust-mode-hook #'(lambda() + (eldoc-mode) + (defun rust-save-compile-and-run () + (interactive) + (save-buffer) - (if (locate-dominating-file (buffer-file-name) "Cargo.toml") + (if (locate-dominating-file (buffer-file-name) "Cargo.toml") - (compile "cargo run") + (compile "cargo run") - (compile + (compile - (format "rustc %s && .//%s" - (file-name-nondirectory (buffer-file-name)) - - (file-name-sans-extension (file-name-nondirectory (buffer-file-name))))))) - - - - - ;; (define-key rust-mode-map (kbd "") 'rust-save-compile-and-run) - - (define-key rust-mode-map (kbd "C-c C-c") 'rust-save-compile-and-run) - - - (eval-after-load 'flycheck - '(add-hook 'flycheck-mode-hook #'flycheck-rust-setup)) - - - - - - )) - - -;; (flycheck-define-checker servo-rust -;; "A Rust syntax checker using the Rust compiler in Servo." -;; :command ("/path/to/servo/rustc" -;; "--parse-only" -;; source) -;; :error-patterns -;; ((error line-start (file-name) ":" line ":" column ": " -;; (one-or-more digit) ":" (one-or-more digit) " error: " -;; (message) line-end)) -;; :modes rust-mode) - - ;(add-hook 'rust-mode-hook (lambda () (flycheck-select-checker 'servo-rust))) + (format "rustc %s && .//%s" + (file-name-nondirectory (buffer-file-name)) + (file-name-sans-extension (file-name-nondirectory (buffer-file-name))))))) + (define-key rust-mode-map (kbd "C-c C-c") 'rust-save-compile-and-run) + (eval-after-load 'flycheck + '(add-hook 'flycheck-mode-hook #'flycheck-rust-setup))))) (provide 'pkg-rust) diff --git a/packages/pkg-search.el b/packages/pkg-search.el index 43d78c3..92c9249 100644 --- a/packages/pkg-search.el +++ b/packages/pkg-search.el @@ -1,10 +1,12 @@ -;; go get -u github.com/monochromegane/the_platinum_searcher/... - -(require-package 'pt) +;;; pkg-search.el --- The Platinum Searcher configuration -*- lexical-binding: t -*- +;;; Commentary: +;; This package configures pt, The Platinum Searcher, for searching files. -;; usage +;;; Code: -;; M-x pt-regexp or M-x projectile-pt +(require-package 'pt) +(use-package pt + :defer t) (provide 'pkg-search) diff --git a/packages/pkg-ssh.el b/packages/pkg-ssh.el index 5a3db8f..30dad15 100644 --- a/packages/pkg-ssh.el +++ b/packages/pkg-ssh.el @@ -1,12 +1,24 @@ +;;; pkg-ssh.el --- SSH configuration -*- lexical-binding: t -*- + +;;; Commentary: +;; This package configures SSH mode for editing SSH config files. + +;;; Code: + (require-package 'ssh-config-mode) -(autoload 'ssh-config-mode "ssh-config-mode" t) +(use-package ssh-config-mode + :defer t + :config + ;; Autoload ssh-config-mode. + (autoload 'ssh-config-mode "ssh-config-mode" t) + ;; Associate ssh config files with ssh-config-mode. (add-to-list 'auto-mode-alist '(".ssh/config\\'" . ssh-config-mode)) (add-to-list 'auto-mode-alist '("sshd?_config\\'" . ssh-config-mode)) (add-to-list 'auto-mode-alist '("known_hosts\\'" . ssh-known-hosts-mode)) (add-to-list 'auto-mode-alist '("authorized_keys2?\\'" . ssh-authorized-keys-mode)) -(add-hook 'ssh-config-mode-hook 'turn-on-font-lock) - -(setq tramp-chunksize 1300) + ;; Enable font lock in ssh-config-mode. + (add-hook 'ssh-config-mode-hook 'turn-on-font-lock) + ;; Set the tramp chunksize to improve performance over slow connections. + (setq tramp-chunksize 1300)) (provide 'pkg-ssh) -;;; pkg-ssh.el ends here diff --git a/packages/pkg-systemd.el b/packages/pkg-systemd.el index 1b1cb72..a1f7d26 100644 --- a/packages/pkg-systemd.el +++ b/packages/pkg-systemd.el @@ -1,4 +1,11 @@ -(require-package 'systemd) +;;; pkg-systemd.el --- Systemd configuration -*- lexical-binding: t -*- +;;; Commentary: +;; This package configures systemd support. + +;;; Code: + +(use-package systemd + :defer t) (provide 'pkg-systemd) diff --git a/packages/pkg-web.el b/packages/pkg-web.el index 521f2de..2fbe37f 100644 --- a/packages/pkg-web.el +++ b/packages/pkg-web.el @@ -1,31 +1,46 @@ -(require-package 'web-mode) +;;; pkg-web.el --- Web mode configuration -*- lexical-binding: t -*- -(add-to-list 'auto-mode-alist '("\\.html?\\'" . web-mode)) -(add-to-list 'auto-mode-alist '("\\.phtml\\'" . web-mode)) -(add-to-list 'auto-mode-alist '("\\.tpl\\.php\\'" . web-mode)) -(add-to-list 'auto-mode-alist '("\\.[agj]sp\\'" . web-mode)) -(add-to-list 'auto-mode-alist '("\\.as[cp]x\\'" . web-mode)) -(add-to-list 'auto-mode-alist '("\\.erb\\'" . web-mode)) -(add-to-list 'auto-mode-alist '("\\.mustache\\'" . web-mode)) -(add-to-list 'auto-mode-alist '("\\.djhtml\\'" . web-mode)) -(add-to-list 'auto-mode-alist '("\\.css\\'" . css-mode)) +;;; Commentary: +;; This package configures web-mode for editing web templates. -(setq web-mode-engines-alist - '(("php" . "\\.phtml\\'") - ("blade" . "\\.blade\\.") - )) +;;; Code: -(add-hook 'web-mode-hook - (lambda () - (whitespace-mode -1) - (with-eval-after-load 'sgml-mode - (require-package 'emmet-mode) - (emmet-mode 1)) - (with-eval-after-load 'css-mode - (require-package 'emmet-mode) - (emmet-mode 1)) - (with-eval-after-load 'web-mode - (require-package 'css-eldoc)) - )) +(use-package web-mode + :defer t + :mode ("\\.html?\\'" . web-mode) + :mode ("\\.phtml\\'" . web-mode) + :mode ("\\.tpl\\.php\\'" . web-mode) + :mode ("\\.[agj]sp\\'" . web-mode) + :mode ("\\.as[cp]x\\'" . web-mode) + :mode ("\\.erb\\'" . web-mode) + :mode ("\\.mustache\\'" . web-mode) + :mode ("\\.djhtml\\'" . web-mode) + :mode ("\\.css\\'" . css-mode) + :config + ;; Define the web mode engines. + (setq web-mode-engines-alist + '(("php" . "\\.phtml\\'") + ("blade" . "\\.blade\\."))) + ;; Add a hook to web-mode. + (add-hook 'web-mode-hook + (lambda () + ;; Disable whitespace-mode in web-mode. + (whitespace-mode -1) + ;; Enable emmet-mode for sgml-mode. + (with-eval-after-load 'sgml-mode + (use-package emmet-mode + :defer t + :config + (emmet-mode 1))) + ;; Enable emmet-mode for css-mode. + (with-eval-after-load 'css-mode + (use-package emmet-mode + :defer t + :config + (emmet-mode 1))) + ;; Enable css-eldoc for web-mode. + (with-eval-after-load 'web-mode + (use-package css-eldoc + :defer t))))) (provide 'pkg-web) diff --git a/packages/pkg-yaml.el b/packages/pkg-yaml.el index 68ff56a..33bd3c6 100644 --- a/packages/pkg-yaml.el +++ b/packages/pkg-yaml.el @@ -1,14 +1,27 @@ +;;; pkg-yaml.el --- YAML configuration -*- lexical-binding: t -*- + +;;; Commentary: +;; This package configures YAML support with yaml-mode, indent-tools, +;; and flycheck-yamllint. + +;;; Code: + (require-package 'yaml-mode) -(add-to-list 'auto-mode-alist '("\\.yml$" . yaml-mode)) -(add-to-list 'auto-mode-alist '("\\.yaml$" . yaml-mode)) - -(add-hook 'yaml-mode-hook - (lambda () - (require-package 'indent-tools) - (require-package 'flycheck-yamllint) - (local-set-key (kbd "C-c >") 'indent-tools-hydra/body) - (eval-after-load 'flycheck - '(add-hook 'flycheck-mode-hook 'flycheck-yamllint-setup)) - )) +(use-package yaml-mode + :defer t + :mode ("\\.yml$" . yaml-mode) + :mode ("\\.yaml$" . yaml-mode) + :config + (require-package 'indent-tools) + (use-package indent-tools + :defer t) + (require-package 'flycheck-yamllint) + (use-package flycheck-yamllint + :defer t) + (add-hook 'yaml-mode-hook + (lambda () + (local-set-key (kbd "C-c >") 'indent-tools-hydra/body) + (eval-after-load 'flycheck + '(add-hook 'flycheck-mode-hook 'flycheck-yamllint-setup))))) (provide 'pkg-yaml)