diff --git a/home/emacs/early-init.el b/home/emacs/early-init.el new file mode 100644 index 00000000..14c3bd1b --- /dev/null +++ b/home/emacs/early-init.el @@ -0,0 +1,12 @@ +;;; early-init.el --- Emacs early initialization for Crafted Emacs (optional) -*- lexical-binding: t; -*- +;;; Commentary: +;; +;;; Code: + +;; Configures `package.el' +;; (load "~/crafted-emacs/modules/crafted-early-init-config") +(load (expand-file-name "crafted-emacs/modules/crafted-early-init-config" user-emacs-directory)) + +(provide 'early-init) + +;;; early-init.el ends here diff --git a/home/emacs/init.el b/home/emacs/init.el index 3617ba82..edfc7e6e 100644 --- a/home/emacs/init.el +++ b/home/emacs/init.el @@ -23,18 +23,16 @@ (require 'crafted-defaults-config) (require 'crafted-ide-config) (require 'crafted-org-config) -(require 'crafted-speedbar-config) -(require 'crafted-startup-config) -(require 'crafted-ui-config) (require 'crafted-workspaces-packages) (require 'crafted-writing-packages) (require 'custom-email-config) (require 'custom-feed-config) (require 'custom-ide-config) -(require 'custom-org-config) (require 'custom-ligatures-config) +(require 'custom-org-config) (require 'custom-project-config) +(require 'custom-ui-config) ;;; Optional configuration @@ -50,8 +48,8 @@ fill-column 80) ;; Theme settings -(setq use-dialog-box nil - crafted-startup-inhibit-splash t) +(customize-set-variable 'crafted-startup-inhibit-splash t) +(setq use-dialog-box nil) (tool-bar-mode -1) (scroll-bar-mode -1) (load-theme 'doom-tokyo-night t) diff --git a/home/emacs/modules/custom-ntfy-config.el b/home/emacs/modules/custom-ntfy-config.el new file mode 100644 index 00000000..1ebbebc6 --- /dev/null +++ b/home/emacs/modules/custom-ntfy-config.el @@ -0,0 +1,7 @@ +(setq ntfy-server "https://ntfy.xenia.me.uk" + ntfy-topic "UhrNGphnSKCpCnk8" + ntfy-header "Notification from emacs" + ntfy-tags "purple_circle,loudspeaker") +(require 'ntfy) + +(provide 'custom-ntfy-config) diff --git a/home/emacs/modules/custom-ui-config.el b/home/emacs/modules/custom-ui-config.el new file mode 100644 index 00000000..27ce69be --- /dev/null +++ b/home/emacs/modules/custom-ui-config.el @@ -0,0 +1,119 @@ +;;; custom-ui-config.el -*- lexical-binding: t; -*- + +;; Copyright (C) 2023 +;; SPDX-License-Identifier: MIT + +;; Author: System Crafters Community + +;;; Commentary: + +;; User interface customizations. Examples are icons, line numbers, +;; and how help buffers are displayed. + +;; This package provides a basic, customized appearance for +;; Emacs. Specifically, it uses: Helpful to customize the information +;; and visual display of help buffers, such as that created by M-x +;; `describe-function'; All-the-icons, to provide font-based icons +;; (rather than raster or vector images); and includes some Emacs Lisp +;; demonstrations. + +;;  Run `all-the-icons-install-fonts' to ensure the fonts necessary +;; for ALL THE ICONS are available on your system. You must run this +;; function if the "stop" icon at the beginning of this paragraph is +;; not displayed properly (it appears as a box with some numbers +;; and/or letters inside it). + +;; Read the documentation for `all-the-icons'; on Windows, +;; `all-the-icons-install-fonts' only downloads fonts, they must be +;; installed manually. This is necessary if icons are not displaying +;; properly. + +;;; Code: + +;;;; Help Buffers + +;; Make `describe-*' screens more helpful +(when (require 'helpful nil :noerror) + (keymap-set helpful-mode-map " " #'helpful-update) + (keymap-global-set " " #'helpful-command) + (keymap-global-set " " #'helpful-callable) + (keymap-global-set " " #'helpful-key) + (keymap-global-set " " #'helpful-symbol) + (keymap-global-set " " #'helpful-variable) + (keymap-global-set "C-h F" #'helpful-function)) + +;; Bind extra `describe-*' commands +(keymap-global-set "C-h K" #'describe-keymap) + +;;;; Line Numbers +(defcustom custom-ui-line-numbers-enabled-modes + '(conf-mode prog-mode) + "Modes which should display line numbers." + :type 'list + :group 'crafted-ui) + +(defcustom custom-ui-line-numbers-disabled-modes + '(org-mode) + "Modes which should not display line numbers. + +Modes derived from the modes defined in +`custom-ui-line-number-enabled-modes', but should not display line numbers." + :type 'list + :group 'crafted-ui) + +(defun custom-ui--enable-line-numbers-mode () + "Turn on line numbers mode. + +Used as hook for modes which should display line numbers." + (display-line-numbers-mode 1)) + +(defun custom-ui--disable-line-numbers-mode () + "Turn off line numbers mode. + +Used as hook for modes which should not display line numebrs." + (display-line-numbers-mode -1)) + +(defun custom-ui--update-line-numbers-display () + "Update configuration for line numbers display." + (if custom-ui-display-line-numbers + (progn + (dolist (mode custom-ui-line-numbers-enabled-modes) + (add-hook (intern (format "%s-hook" mode)) + #'custom-ui--enable-line-numbers-mode)) + (dolist (mode custom-ui-line-numbers-disabled-modes) + (add-hook (intern (format "%s-hook" mode)) + #'custom-ui--disable-line-numbers-mode)) + (setq-default + display-line-numbers-grow-only t + display-line-numbers-type t + display-line-numbers-width 2)) + (progn + (dolist (mode custom-ui-line-numbers-enabled-modes) + (remove-hook (intern (format "%s-hook" mode)) + #'custom-ui--enable-line-numbers-mode)) + (dolist (mode custom-ui-line-numbers-disabled-modes) + (remove-hook (intern (format "%s-hook" mode)) + #'custom-ui--disable-line-numbers-mode))))) + +(defcustom custom-ui-display-line-numbers nil + "Whether line numbers should be enabled." + :type 'boolean + :group 'crafted-ui + :set (lambda (sym val) + (set-default sym val) + (custom-ui--update-line-numbers-display))) + +;; add visual pulse when changing focus, like beacon but built-in +;; from from https://karthinks.com/software/batteries-included-with-emacs/ +(defun pulse-line (&rest _) + "Pulse the current line." + (pulse-momentary-highlight-one-line (point))) + +(dolist (command '(scroll-up-command + scroll-down-command + recenter-top-bottom + other-window)) + (advice-add command :after #'pulse-line)) + +(provide 'custom-ui-config) +;;; custom-ui-config.el ends here