From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: gnuist007@hotmail.com (gnuist) Newsgroups: gmane.emacs.help Subject: ** Q: HOW TO MANIPULATE STRINGS IN A FILE WITH A LISP FUNCTION ** Date: 15 Sep 2002 20:30:17 -0700 Organization: http://groups.google.com/ Sender: help-gnu-emacs-admin@gnu.org Message-ID: <9e8ebeb2.0209151930.79f76ae9@posting.google.com> NNTP-Posting-Host: localhost.gmane.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: main.gmane.org 1032147960 476 127.0.0.1 (16 Sep 2002 03:46:00 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 16 Sep 2002 03:46:00 +0000 (UTC) Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 17qmpj-00007X-00 for ; Mon, 16 Sep 2002 05:45:59 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10) id 17qmpx-0000VX-00; Sun, 15 Sep 2002 23:46:13 -0400 Original-Path: shelby.stanford.edu!nntp.stanford.edu!newsfeed.stanford.edu!postnews1.google.com!not-for-mail Original-Newsgroups: gnu.emacs.help,gnu.utils.help,comp.unix.shell,comp.unix.programmer Original-Lines: 35 Original-NNTP-Posting-Host: 209.178.177.177 Original-X-Trace: posting.google.com 1032147017 32317 127.0.0.1 (16 Sep 2002 03:30:17 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: 16 Sep 2002 03:30:17 GMT Original-Xref: nntp.stanford.edu gnu.emacs.help:104928 gnu.utils.help:4007 comp.unix.shell:132737 comp.unix.programmer:142753 Original-To: help-gnu-emacs@gnu.org Errors-To: help-gnu-emacs-admin@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.help:1483 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:1483 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