unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: gnuist007@hotmail.com (gnuist)
Subject: ** Q: HOW TO MANIPULATE STRINGS IN A FILE WITH A LISP FUNCTION **
Date: 15 Sep 2002 20:30:17 -0700	[thread overview]
Message-ID: <9e8ebeb2.0209151930.79f76ae9@posting.google.com> (raw)

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:

ABC98789
DDE90898889
FRE9090909

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.

Cheers

             reply	other threads:[~2002-09-16  3:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-16  3:30 gnuist [this message]
2002-09-16 13:07 ` ** Q: HOW TO MANIPULATE STRINGS IN A FILE WITH A LISP FUNCTION ** D. Goel
2002-09-17 17:49 ` Barry Margolin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9e8ebeb2.0209151930.79f76ae9@posting.google.com \
    --to=gnuist007@hotmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).