[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Q: How to copy a string in a text into a variable?

From: gnuist
Subject: Q: How to copy a string in a text into a variable?
Date: 15 Sep 2002 20:54:22 -0700

Q: How to copy contents of kill ring into a string variable?

The purpose of these two questions above and the previous post is the 
same as below:

My problem is very simple for an emacs guru. More than one solution is
very welcome.

I have a list of numbers in a file as follows:


that is, first three letters and then a string of numbers and nothing else.

I want to write a lisp function (not a macro) that can read the first
three letter substring into a variable and the rest of the substring into
another variable. Then I want to use these substrings to generate my
final string. I know that can be done using the "insert" command. The problem
is how to put the text strings in a file into a variable? I know setq can
do this but then if I construct the string in sexp such as:

(setq letters-variable "ABC")

how do I eval it? I have tried eval-last-sexp IN THE LISP FUNCTION
and it gives some strange result in the minibuffer when the function is run.

Any and all help is appreciated.

With a macro using C-k and yank this is trivial but the kill buffer can only
hold (memorize) one piece at a time not the two pieces. Still it can be done
by moving to the two lines where they are separately held, but it is not a 
readible solution. It is at the turing machine level of copy and erase one
at a time, not store in named variables.

Once I have written this function for one string, I can run it on the 
whole list by C-u 3 M-x my-function.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]