6

Github GitHub - Alexander-Miller/cfrs: Child Frame Read String

 3 years ago
source link: https://github.com/Alexander-Miller/cfrs
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

cfrs.el – Child Frame Read String

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:

(defun cfrs-read (prompt &optional initial-input) ... )

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:

(let ((input (cfrs-read "Text: " "Initial Input")))
  (message "Hello %s!" input))

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


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK