Emacs

From G1Joshi/Agent-Skills · View interactive version

Emacs is an AI agent skill from the GitHub repository G1Joshi/Agent-Skills. Expert GNU Emacs assistance covering init.el, Elisp, Org-mode, Magit, LSP Mode, and packages. Use when customizing Emacs, writing Elisp, and operating extensible keyboard-centric developer environments.

How to use this skill

Skill file

GNU Emacs

GNU Emacs is an extensible, customizable text editor and computing environment featuring built-in LSP integration (Eglot), Tree-sitter syntax parsing, and native compilation.

When to Use

Quick Start

;; ~/.emacs.d/init.el - Essential modern starter configuration
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(package-initialize)

(unless (package-installed-p 'use-package)
  (package-refresh-contents)
  (package-install 'use-package))

(setq inhibit-startup-message t)
(global-display-line-numbers-mode t)

Core Concepts

Modern Emacs Configuration with use-package & Eglot

Configuring modern package management and built-in LSP:

;; ~/.emacs.d/init.el
(require 'package)
(setq package-archives '(("melpa" . "https://melpa.org/packages/")
                         ("gnu" . "https://elpa.gnu.org/packages/")))
(package-initialize)

;; Install and configure use-package
(unless (package-installed-p 'use-package)
  (package-refresh-contents)
  (package-install 'use-package))
(require 'use-package)
(setq use-package-always-ensure t)

;; Built-in Eglot LSP configuration
(use-package eglot
  :ensure nil ; Built into Emacs 29+
  :hook ((rust-ts-mode . eglot-ensure)
         (python-ts-mode . eglot-ensure)
         (typescript-ts-mode . eglot-ensure))
  :config
  (setq eglot-autoshutdown t))

;; Fast completion with Corfu and Vertico
(use-package vertico
  :init
  (vertico-mode 1))

(use-package corfu
  :init
  (global-corfu-mode 1))

Org Mode Literate Programming

Executing embedded code blocks within documents:

* Technical Report
#+BEGIN_SRC python :results output
data = [12, 45, 67, 89, 34]
print(f"Average: {sum(data)/len(data):.2f}")
#+END_SRC

#+RESULTS:
: Average: 49.40

Magit: Git Porcelain for Emacs

Keyboard-driven Git operations (M-x magit-status):

Common Patterns

LSP Mode with Eglot (Built-in) for Fast Code Intelligence

Problem: Slow auto-completion and language server lag in heavy community frameworks.

Solution:

Use built-in lightweight eglot:

;; Enable Eglot for Rust, Python, and TypeScript modes
(use-package eglot
  :ensure t
  :hook ((rust-mode . eglot-ensure)
         (python-mode . eglot-ensure)
         (typescript-ts-mode . eglot-ensure)))

Best Practices

Do:

Don't:

Troubleshooting

| Error | Cause | Solution |

| :------------------------------------------------------ | :---------------------------------------------------------------------- | :---------------------------------------------------------------------- |

| Failed to download package: HTTPS connection error | Outdated TLS/GnuTLS libraries on system or expired certificate. | Set (setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3") if needed. |

| Spawning language server failed: executable not found | Target LSP server (e.g. pyright, rust-analyzer) not in system PATH. | Install language server and verify exec-path-from-shell package. |

| Emacs startup taking > 5 seconds | Synchronous package downloads and uncompiled Elisp during init. | Profile startup with emacs --profile and use use-package :defer t. |

References

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.