Testing out a new Emacs Configuation

When I want to test and learn a single package in Emacs it suits my best to create a simple empty emacs configuration directory in my src folder.

mkdir test-emacs-config

Then put in a very minimal .emacs file testing the package in question. The following sample tests the Vertico package.

;; -*- lexical-binding: t; -*-

(require 'package)

;;; Start package configuration
(add-to-list 'package-archives '("elpa" . "https://elpa.org/packages/") t)

(package-initialize)

(eval-when-compile
  (require 'use-package))

(use-package vertico
   :ensure t
   :custom
     (vertico-cycle t)
   :init
     (vertico-mode)
   )

Now to test this config you have to start emacs with this file AND ignore the existing configuration that you have in your home dir.

emacs -q --init-directory=~/src/test-emacs-config -l ~/src/test-emacs-config/.emacs

The q parameter tells Emacs to ignore the standard config load. The --init-directory tells where to load finds from and the -l parameter tells which file to use as init.

You can put this into your aliases and make a simple command such as testemacs.

When starting emacs with this command it will execute the use-package command and download the vertico package into an elpa directory under the directory test-emacs-config.

By using this approach you can test out simple package configurations befor merging them into your main Emacs configuration.

Happy Emacs'ing :)

Tags

Add new comment

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.
Please share this article on your favorite website or platform.