# emacs-with-simulated-input

> non-interactive testing Emacs library

**Wikidata**: [Q131431684](https://www.wikidata.org/wiki/Q131431684)  
**Source**: https://4ort.xyz/entity/emacs-with-simulated-input

## Summary
`emacs-with-simulated-input` is a free software Emacs Lisp library designed for non-interactive testing of interactive Emacs commands. It allows developers to simulate user input during automated tests, making it easier to verify behavior without manual intervention. Created by Ryan C. Thompson, it has been widely adopted in the Emacs ecosystem since its initial release in 2017.

## Key Facts
- Creator: Ryan C. Thompson
- Inception: July 20, 2017
- Latest stable version: 3.0 (released May 28, 2021)
- Programming language: Emacs Lisp
- Platform: GNU Emacs
- License: GNU General Public License v3 or later (SPDX identifier Q27016754)
- Distributed via: NonGNU ELPA and MELPA
- Instance of: Macro, test suite, NonGNU ELPA package, free software
- Source repository: https://github.com/DarwinAwardWinner/with-simulated-input

## FAQs
### Q: What is emacs-with-simulated-input used for?
A: It is used to simulate user input non-interactively for testing purposes within GNU Emacs. This enables automated testing of otherwise interactive Emacs commands.

### Q: Is emacs-with-simulated-input free software?
A: Yes, it is free software licensed under the GNU General Public License version 3 or later, allowing redistribution and modification.

### Q: Where can I install emacs-with-simulated-input from?
A: It is available through package managers such as NonGNU ELPA, MELPA, Debian (as `elpa-with-simulated-input`), Gentoo (`app-emacs/with-simulated-input`), and Nix (as `emacsPackages.with-simulated-input`).

## Why It Matters
`emacs-with-simulated-input` plays a crucial role in enhancing the reliability and maintainability of Emacs packages by enabling robust automated testing of interactive features. Prior to its development, testing interactive Emacs functions required manual execution or complex workarounds. By simulating keyboard input programmatically, it lowers the barrier for writing comprehensive regression tests, improving code quality across the Emacs ecosystem. Its adoption in major distributions like Debian and integration into platforms like NonGNU ELPA underscores its importance to the community.

## Notable For
- First dedicated library for simulating interactive input in Emacs unit tests
- Integration into multiple package archives including NonGNU ELPA and MELPA
- Long-term maintenance since 2017 by a single author, ensuring consistency and reliability
- Support for both legacy and modern Emacs versions due to backward-compatible design
- Packaged in major Linux distributions such as Debian, Ubuntu, and Gentoo

## Body

### Overview
`emacs-with-simulated-input`, also known by its alias `with-simulated-input`, is an Emacs Lisp macro that facilitates non-interactive simulation of user input during testing. This capability is particularly useful when validating interactive Emacs commands which typically require direct user involvement.

The project was initiated on July 20, 2017, with the first commit made publicly available on GitHub. Since then, it has evolved through several iterations, reaching version 3.0 on May 28, 2021, marking its maturity and stability.

### Development & Licensing
Developed solely by Ryan C. Thompson, the project maintains consistent authorship and direction. The software is released under the GNU General Public License version 3 or later, qualifying it as free software per FSF guidelines. As noted in the initial commit's license header:
> "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License..."

This licensing ensures wide accessibility and encourages community contributions while preserving freedoms associated with open-source software.

### Distribution & Packaging
The library is distributed primarily through two official Emacs package repositories:
- **MELPA**: Provides access to cutting-edge releases
- **NonGNU ELPA**: Hosts officially recognized non-GNU packages; inclusion began January 11, 2022

Additionally, it is packaged in various Linux distributions:
- **Debian**: Available as `elpa-with-simulated-input` in stable releases since February 13, 2018
- **Gentoo**: Packaged as `app-emacs/with-simulated-input`
- **NixOS/Guix**: Accessible via variable names `emacs-with-simulated-input` and `emacsPackages.with-simulated-input`

These integrations reflect broad acceptance and utility within the broader free software ecosystem.

### Technical Details
Written entirely in **Emacs Lisp**, the tool targets **GNU Emacs** environments exclusively. It supports all recent Emacs versions compatible with standard ELisp APIs for event handling and command execution.

Key functionality includes:
- Simulating keystrokes and command sequences
- Supporting nested simulations for compound interactions
- Enabling precise control over timing-sensitive behaviors in tests

Its implementation relies heavily on low-level primitives exposed by Emacs for synthetic event generation, abstracting away complexity for end-users.

### Version History Highlights
Below are selected milestones in the evolution of the package:
- **Version 1.0** – Released July 21, 2017
- **Version 2.0** – Released July 23, 2017
- **Version 2.4** – Released September 13, 2019
- **Version 3.0** – Finalized May 28, 2021 (current stable)

Each iteration brought refinements to core simulation logic, expanded compatibility, and improved error reporting—ensuring dependable performance in diverse testing scenarios.

## References

1. [Initial version](https://github.com/DarwinAwardWinner/with-simulated-input/commit/5a67067ae073d71cb1b39afd5edf54c07a5e3108)
2. [Source](https://github.com/DarwinAwardWinner/with-simulated-input/releases/tag/v3.0)
3. [Release 1.0. 2017](https://github.com/DarwinAwardWinner/with-simulated-input/releases/tag/v1.0)
4. [Release 2.0. 2017](https://github.com/DarwinAwardWinner/with-simulated-input/releases/tag/v2.0)
5. [Release 2.1. 2017](https://github.com/DarwinAwardWinner/with-simulated-input/releases/tag/v2.1)
6. [Release 2.2. 2017](https://github.com/DarwinAwardWinner/with-simulated-input/releases/tag/v2.2)
7. [Release 2.3. 2017](https://github.com/DarwinAwardWinner/with-simulated-input/releases/tag/v2.3)
8. [Release 2.4. 2019](https://github.com/DarwinAwardWinner/with-simulated-input/releases/tag/v2.4)
9. [Source](https://www.reddit.com/r/emacs/comments/6p1ovj/test_interactive_emacs_commands_easily_with/)
10. [Source](https://elpa.nongnu.org/nongnu/with-simulated-input.html)
11. [Source](https://packages.debian.org/source/bookworm/with-simulated-input-el)