From 1582fae86127b508fc1d6e0b9172cf55a4eede6e Mon Sep 17 00:00:00 2001 From: Geir Okkenhaug Jerstad Date: Wed, 28 May 2025 10:03:19 +0200 Subject: [PATCH] some more work on emacs init.el --- Emacs/.instructions.md | 46 ++++++++++++++++++++++++++++++++++++++ Emacs/emacs.org | 50 ++++++++++++++++++++++++++++-------------- 2 files changed, 80 insertions(+), 16 deletions(-) create mode 100644 Emacs/.instructions.md diff --git a/Emacs/.instructions.md b/Emacs/.instructions.md new file mode 100644 index 0000000..2639b3f --- /dev/null +++ b/Emacs/.instructions.md @@ -0,0 +1,46 @@ +--- +applyTo: '**' +--- +Coding standards, domain knowledge, and preferences that AI should follow. + +# Instructions + +## Context +- User maintains a literate Emacs configuration using Org-mode +- Configuration is tangled from `emacs.org` to `~/.emacs.d/init.el` +- User prefers minimal, clean code with good documentation +- Running NixOS system with declarative package management + +## Emacs/Org-mode Preferences +- Always use `use-package` for package configuration +- Include `:ensure t` for external packages +- Add descriptive comments explaining configuration choices +- Use org-babel for literate programming approach +- Prefer built-in Emacs features when possible + +## Code Style +- Use semicolon comments for Emacs Lisp: `;;` +- Namespace custom functions with `geokkjer/` prefix +- Keep code blocks focused and single-purpose +- Include installation checks: `(unless (package-installed-p 'pkg)...)` + +## File Organization +- Group related configurations under logical headings +- Use `** Subsection` for major feature areas +- Include explanatory text before each code block +- Maintain consistent indentation and formatting + +## When Suggesting Changes +- Always show complete org-mode code blocks with proper syntax +- Include the `#+BEGIN_SRC emacs-lisp` and `#+END_SRC` markers +- Explain what the configuration does and why it's useful +- Mention tangling requirement after changes + +# domain knowledge +- Familiar with Emacs Lisp and Org-mode syntax +- Understands NixOS package management +- Knows how to use `use-package` for package management +- Comfortable with literate programming concepts +- Values clean, maintainable code with good documentation +- Prefers a functional programming style +- Appreciates modular and reusable code structures \ No newline at end of file diff --git a/Emacs/emacs.org b/Emacs/emacs.org index 34889ac..7f9041a 100644 --- a/Emacs/emacs.org +++ b/Emacs/emacs.org @@ -16,14 +16,7 @@ This will generate the `~/.emacs.d/init.el` file with the configuration. * Prep -** Copilot Authentication -To use GitHub Copilot, you need to authenticate with your GitHub account. This is done by running the following command in Emacs: -after installing the copilot package: -Try to trigger the GitHub OAuth flow from within Emacs: -#+BEGIN_SRC emacs-lisp :eval yes -(call-interactively 'copilot-auth) -#+END_SRC * Configuration @@ -65,16 +58,32 @@ Here we set up the UI to our liking. We disable the menu bar, tool bar, and scro (set-face-attribute 'default nil :height 140) #+END_SRC Set up doom modeline, which is a nice status line for Emacs. We set it up to show the current buffer name and the current line number. + #+BEGIN_SRC emacs-lisp -;; install doom-modeline if not already installed -(unless (package-installed-p 'doom-modeline) - (package-refresh-contents) - (package-install 'doom-modeline)) -(require 'doom-modeline) -;; enable doom-modeline -(doom-modeline-mode 1) -;; set up doom-modeline to show the current buffer name and line number -(setq doom-modeline-buffer-file-name-style 'truncate-with-project) +;; Doom modline, all-the-icons and doom-theme +(use-package doom-modeline + :ensure t + :init (doom-modeline-mode 1) + :custom ((doom-modeline-height 15))) + +(setq doom-modeline-icon t) +(use-package all-the-icons) + +(use-package doom-themes + :init (load-theme 'doom-monokai-pro t)) +#+END_SRC +Set up all-the-icons, which provides icons for various file types and modes in Emacs. This enhances the visual appearance of the UI. +install all-the-icons if not already installed with 'M-x package-install all-the-icons' +#+BEGIN_SRC emacs-lisp +(use-package all-the-icons + :if (display-graphic-p) ;; only load in GUI Emacs + :ensure t + :init + (unless (package-installed-p 'all-the-icons) + (package-refresh-contents) + (package-install 'all-the-icons)) + :config + (all-the-icons-setup)) #+END_SRC ** Set up package management @@ -157,6 +166,15 @@ Here we install from MELPA, enable it in all prog-modes and bind keys for comple (define-key copilot-completion-map (kbd "") #'copilot-accept-completion) #+END_SRC +** Copilot Authentication +To use GitHub Copilot, you need to authenticate with your GitHub account. This is done by running the following command in Emacs: +after installing the copilot package: +Try to trigger the GitHub OAuth flow from within Emacs: + +#+BEGIN_SRC emacs-lisp :eval yes +(call-interactively 'copilot-auth) +#+END_SRC + ** Language support Here we install and configure support for various programming languages. We use the `use-package` macro to ensure that the packages are installed and configured correctly.