Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/Alexander-Miller/cfrs

Child Frame Read String
https://github.com/Alexander-Miller/cfrs

emacs input utils

Last synced: about 2 months ago
JSON representation

Child Frame Read String

Awesome Lists containing this project

README

        

# -*- fill-column: 120 org-list-indent-offset: 1 -*-
#+STARTUP: noinlineimages

* cfrs.el -- Child Frame Read String

[[file:cfrs.png]]

cfrs.el is a simple alternative to ~read-string~ that allows reading input via a small child-frame spawned at the
position of the cursor. Its goal is to make the string input interface closer to those used in modern GUI programs and
to help the user with having to switch focus from whatever they are doing currently to look at the minibuffer.

There is just one single entry point, ~cfrs-read~, and its interface simple enough to not require further explanation:

#+BEGIN_SRC emacs-lisp
(defun cfrs-read (prompt &optional initial-input) ... )
#+END_SRC

The text in the resulting child-frame can be edited freely, with the caveat that it is meant to fit on a single line -
cfrs.el is meant for /simple/ inputs. The input can be confirmed via either ~C-c C-c~ or ~RET~.

A runnable example:

#+BEGIN_SRC emacs-lisp
(let ((input (cfrs-read "Text: " "Initial Input")))
(message "Hello %s!" input))
#+END_SRC

In a terminal environment cfrs will fall back to the default ~read-string~.