emacs

emacs is my favorite text editor due to it's transparency and customizing ability.

Configuration Overview

My Emacs configuration is split into two main files:

Performance Optimizations (early-init.el)

Core Features (init.el)

Packages I use

Built-in packages

dired

tramp

org-mode

eshell

flymake

eglot

treesit

xwidget

Third-party packages

Completion System

vertico - Vertical completion UI
marginalia - Rich annotations for minibuffer
orderless - Flexible completion style
consult - Consulting completing-read
consult-notes - Note-taking integration
embark - Contextual actions
embark-consult - Embark + consult integration
corfu - In-buffer completion
cape - Completion-at-point extensions
which-key - Key binding hints

Version Control

magit - Git interface
forge - GitHub/GitLab integration
diff-hl - Highlight uncommitted changes

Development

dap-mode - Debug Adapter Protocol
treesit-auto - Tree-sitter language support

Terminal

vterm - Full terminal emulator
eat - Terminal emulator for eshell

AI Integration

claude-code - Claude Code integration
claude-code-ide - IDE-like features with Claude
copilot - GitHub Copilot integration

Note-taking

deft - Plain text note browsing

Utilities

exec-path-from-shell - Environment variable setup

Configuration Details

Performance Settings

;; GC threshold manipulation for faster startup
(setq gc-cons-threshold most-positive-fixnum
      gc-cons-percentage 0.8)

;; Native compilation settings
(when (and (fboundp 'native-comp-available-p)
           (native-comp-available-p))
  (setq native-comp-async-report-warnings-errors nil
        native-comp-deferred-compilation t
        native-comp-speed 3
        native-comp-async-jobs (num-processors)
        native-comp-jit-compilation t))

UI Configuration

;; Remove UI elements for minimal appearance
(push '(tool-bar-lines . 0) default-frame-alist)
(push '(menu-bar-lines . 0) default-frame-alist)
(push '(vertical-scroll-bars) default-frame-alist)
(push '(horizontal-scroll-bars) default-frame-alist)

;; macOS-specific settings
(when (eq system-type 'darwin)
  (push '(ns-transparent-titlebar . t) default-frame-alist)
  (setq ns-use-native-fullscreen t
        ns-use-thin-smoothing t
        ns-pop-up-frames nil
        ns-use-proxy-icon nil))

Theme Management

;; Auto-switching themes based on system appearance
(defun my/handle-appearance-change (appearance)
  (when (eq system-type 'darwin)
    (pcase appearance
      ('light (load-theme 'modus-operandi-tinted)
              (when (executable-find "claude")
                (start-process "claude-theme" nil "claude" "config" "set" "-g" "theme" "light")))
      ('dark (load-theme 'modus-vivendi-tinted)
             (when (executable-find "claude")
               (start-process "claude-theme" nil "claude" "config" "set" "-g" "theme" "dark"))))))

Backup System

;; Organized backup system with automatic cleanup
(let ((backup-dir (expand-file-name "backups/backups/" user-emacs-directory))
      (auto-save-dir (expand-file-name "backups/auto-saves/" user-emacs-directory)))
  (setq backup-directory-alist `((".*" . ,backup-dir))
        auto-save-file-name-transforms `((".*" ,auto-save-dir t))
        auto-save-list-file-prefix (expand-file-name ".saves-" auto-save-dir))
  
  ;; Cleanup old backups (30 days)
  (run-with-timer 3600 3600 'my/cleanup-old-backups))

Completion System

;; Modern completion with vertico + consult
(use-package vertico
  :ensure t
  :init (vertico-mode)
  :custom
  (vertico-cycle t)
  (vertico-resize t))

(use-package consult
  :ensure t
  :bind (("C-s" . consult-line)
         ("C-x b" . consult-buffer)
         ("C-x C-r" . consult-recent-file)
         ("M-s r" . consult-ripgrep)))

(use-package orderless
  :ensure t
  :custom
  (completion-styles '(orderless basic))
  (orderless-matching-styles '(orderless-literal orderless-regexp)))

Note-taking Setup

;; Note-taking workflow
(use-package consult-notes
  :ensure t
  :custom
  (consult-notes-file-dir-sources
   '(("Notes" ?n "~/workspace/notes/")
     ("Journal" ?j "~/workspace/notes/journal/"))))

;; Org capture template for notes
(setq org-capture-templates
      '(("n" "Note" plain
         (file (lambda ()
                 (let* ((title (read-string "Title: "))
                        (slug (downcase
                               (replace-regexp-in-string
                                "[^a-z0-9]+" "-" title))))
                   (expand-file-name (concat slug ".org") "~/workspace/notes/"))))
         "#+title:      %(or org-capture-current-title \"\")\n#+filetags:   %(my/org-capture-process-tags)\n\n%?")))

AI Integration

;; Claude Code integration
(use-package claude-code
  :ensure t
  :vc (:url "https://github.com/stevemolitor/claude-code.el" :rev :newest)
  :config (claude-code-mode)
  :bind-keymap ("C-c c" . claude-code-command-map))

;; Claude Code IDE features
(use-package claude-code-ide
  :ensure t
  :vc (:url "https://github.com/manzaltu/claude-code-ide.el" :rev :newest)
  :bind (("C-c i i" . claude-code-ide)
         ("C-c i r" . claude-code-ide-resume)
         ("C-c i s" . claude-code-ide-stop)))

;; GitHub Copilot
(use-package copilot
  :vc (:url "https://github.com/copilot-emacs/copilot.el" :rev :newest)
  :hook (prog-mode . copilot-mode)
  :bind (:map copilot-completion-map
              ("<tab>" . copilot-accept-completion)
              ("TAB" . copilot-accept-completion)))

Key Bindings

;; Global key bindings
(global-set-key (kbd "C-s-f") 'toggle-frame-fullscreen)
(global-set-key (kbd "C-c e") 'eshell)
(global-set-key (kbd "C-x g") 'magit-status)

;; Notes keymap
(defvar my/notes-map (make-sparse-keymap))
(define-key my/notes-map (kbd "n") 'org-capture)
(define-key my/notes-map (kbd "c") 'consult-notes)
(define-key my/notes-map (kbd "s") 'consult-notes-search-in-all-notes)
(global-set-key (kbd "C-c n") my/notes-map)

Dired Configuration

;; Use GNU ls on macOS for better dired experience
(when (executable-find "gls")
  (setq insert-directory-program "gls"))

Development Tools

;; Language Server Protocol support
(use-package eglot
  :ensure t
  :hook ((python-mode js-mode typescript-mode go-mode rust-mode) . eglot-ensure))

;; Tree-sitter for better syntax highlighting
(use-package treesit-auto
  :ensure t
  :config
  (treesit-auto-add-to-auto-mode-alist 'all)
  (global-treesit-auto-mode))

;; Debugging support
(use-package dap-mode
  :ensure t
  :bind ("C-c d" . dap-debug))

;; Flymake for syntax checking
(use-package flymake
  :hook (prog-mode . flymake-mode)
  :bind (:map flymake-mode-map
              ("M-n" . flymake-goto-next-error)
              ("M-p" . flymake-goto-prev-error)))

Terminal Integration

;; Full terminal emulator
(use-package vterm
  :ensure t
  :commands vterm)

;; Enhanced eshell with terminal emulation
(use-package eat
  :ensure t
  :hook (eshell-load . eat-eshell-mode)
  :config
  (setq eat-enable-mouse t))

;; Eshell improvements
(use-package eshell
  :init
  (add-hook 'eshell-mode-hook
            (lambda ()
              (define-key eshell-mode-map (kbd "C-r") 'consult-history)
              (define-key eshell-mode-map (kbd "C-p") 'eshell-previous-input)
              (define-key eshell-mode-map (kbd "C-n") 'eshell-next-input))))

Web Browsing

;; Built-in webkit browser
(use-package xwidget
  :when (featurep 'xwidget-internal)
  :bind (("C-c x" . xwidget-webkit-browse-url)
         :map xwidget-webkit-mode-map
         ("h" . xwidget-webkit-back)
         ("l" . xwidget-webkit-forward)
         ("r" . xwidget-webkit-reload)
         ("q" . quit-window))
  :custom
  (xwidget-webkit-enable-plugins t))

Workflow and Productivity

Server Mode

;; Always start Emacs server for quick client connections
(require 'server)
(unless (server-running-p)
  (server-start))

Code Formatting

;; Consistent coding standards
(setq-default tab-width 2
              indent-tabs-mode nil)
(setq js-indent-level 2)

;; Auto-format JSON files
(add-hook 'json-mode-hook
  (lambda ()
    (when (< (buffer-size) 50000)
      (add-hook 'before-save-hook 'json-pretty-print-buffer nil t))))

;; Clean up trailing whitespace
(add-hook 'before-save-hook 'delete-trailing-whitespace)

Environment Integration

;; Import environment variables from shell
(use-package exec-path-from-shell
  :ensure t
  :custom
  (exec-path-from-shell-warn-duration-millis 2000)
  :init
  (when (memq window-system '(mac ns x))
    (exec-path-from-shell-initialize)))

Workflow Examples

Daily Development Workflow

  1. Morning Setup: C-c n j to create journal entry
  2. Project Work: C-x g for git status, C-c i i for AI assistance
  3. Note Taking: C-c n n for quick notes, C-c n s to search existing notes
  4. Code Search: M-s r for ripgrep, C-s for in-buffer search
  5. Terminal Work: C-c e for eshell, vterm for full terminal

Note-Taking Workflow

  1. Capture Ideas: C-c n n creates new note with automatic filename
  2. Quick Reference: C-c n c browses all notes with live preview
  3. Research: C-c n s searches content across all notes
  4. Organization: Tags and cross-references maintain knowledge graph
  5. Publishing: Notes automatically sync to mayphus.org website

AI-Assisted Coding

  1. Inline Help: Copilot provides completions as you type
  2. Architecture Discussion: C-c i i for design conversations
  3. Code Review: C-c c for analysis and improvements
  4. Problem Solving: Claude helps debug and optimize code
  5. Learning: AI explains unfamiliar code and concepts

Performance Metrics

Startup Time

Memory Usage

Key Efficiency Gains

Future Plans

TODO Cursor Editor Features

TODO Enhanced AI Integration

TODO Performance Optimizations

TODO Note-Taking Enhancements

TODO Development Environment

Troubleshooting

Common Issues

Performance Monitoring

Resources and References

Configuration Files

Package Documentation

Useful Commands

Community Resources