I was wondering how I can store certain text in a given register using elisp (so that I can set in a configuration files).
I know that I can do this manually with C-x r s r to store some text into the register r. Then, I can use it by C-x r i r.
I tried to set the register as follows:
(set-register 'r' "hI")
, and in the Help window I see that
register-alist’s value is ((r . "hI"))
But, when trying to use it with C-x r i r, I get:
user-error: Register does not contain text
I don't know much elisp.
Could someone explain how to set the content of the register in elisp correctly?
(set-register ?r "hI")– Tyler Sep 13 '22 at 00:19interactivethere. The answer there actually triggered this question. I saw mention ofset-registerthere, but couldn't figure out how to use it (due to my lack of knowledge on elisp). Hence this question. – tinlyx Sep 13 '22 at 00:48?ris how Emacs Lisp represents the literal characterrin lisp programs. The point that @Tyler is making is that the name of a register is a single character, not a string or a symbol or anything more complicated. So(set-register ?r "hI")sets the register namedrto have the stringhIas its contents. – NickD Sep 13 '22 at 01:15quotingin Emacs Lisp (i.e. to protect something from being evaluated)- they are never used as delimiters. – NickD Sep 13 '22 at 12:45