XEmacsNull Blog

Bi-Day XEmacs Tip Blog

Tuesday, December 06, 2005

Tip: Writing Lines from Bindings

Question: So, I can setup some bindings to write text. What if I want to write several lines? . . .

Problem: Using the
(global-set-key '[(control c)(n)] "str1" "str2" "str3")
doesn't work. Well, the global-set-key LISP function only expects one string as the last parameter. Or you could embed control characters in the string.

Solution 1: One way is to include a \n newline character.
"str1\nstr2\nstr3"


Solution 2: Or you can use the (kbd function and keep a cleaner look.
"str1 RET str2 RET str3 RET"


Platform: Linux
Level: Amateur
GlR

PS. Next time, I show how to do this by setting up abbreviations, instead.

0 Comments:

Post a Comment

<< Home