I'd like to prompt the user for a register name. Is there an easy way to do this? Apparently, this functionality isn't built into interactive (https://www.gnu.org/software/emacs/manual/html_node/elisp/Interactive-Codes.html)...


1 Answer 1


Just by looking at source code of the first function I found via apropos that has anything to do with registers, I found register-read-with-preview. It might be what you're looking for.

You can prompt for registers only when calling a function interactively by passing code that returns a list of arguments to interactive as it's argument.

Here's the docstring:

register-read-with-preview is a compiled Lisp function in ‘register.el’.

(register-read-with-preview PROMPT)

Read and return a register name, possibly showing existing registers. Prompt with the string PROMPT. If ‘register-alist’ and ‘register-preview-delay’ are both non-nil, display a window listing existing registers after ‘register-preview-delay’ seconds. If ‘help-char’ (or a member of ‘help-event-list’) is pressed, display such a window regardless.

  • That works, thanks! I didn't think to check the source code. Apr 4, 2017 at 16:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.