some more work on emacs init.el

This commit is contained in:
Geir Okkenhaug Jerstad 2025-05-28 10:03:19 +02:00
parent a5d571fc75
commit 1582fae861
2 changed files with 80 additions and 16 deletions

46
Emacs/.instructions.md Normal file
View file

@ -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

View file

@ -16,14 +16,7 @@ This will generate the `~/.emacs.d/init.el` file with the configuration.
* Prep * 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 * 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) (set-face-attribute 'default nil :height 140)
#+END_SRC #+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. 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 #+BEGIN_SRC emacs-lisp
;; install doom-modeline if not already installed ;; Doom modline, all-the-icons and doom-theme
(unless (package-installed-p 'doom-modeline) (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-refresh-contents)
(package-install 'doom-modeline)) (package-install 'all-the-icons))
(require 'doom-modeline) :config
;; enable doom-modeline (all-the-icons-setup))
(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)
#+END_SRC #+END_SRC
** Set up package management ** 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 "<tab>") #'copilot-accept-completion) (define-key copilot-completion-map (kbd "<tab>") #'copilot-accept-completion)
#+END_SRC #+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 ** 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. 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.