From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/33848 Path: main.gmane.org!not-for-mail From: Colin Walters Newsgroups: gmane.emacs.gnus.general Subject: Re: Mechaincal question Show filename of # marked Date: 22 Dec 2000 01:05:04 -0500 Organization: The Ohio State University Dept. of Computer and Info. Science Sender: owner-ding@hpc.uh.edu Message-ID: <87n1dprnxr.church.of.emacs@meta.verbum.org> References: <874rzxtadi.church.of.emacs@meta.verbum.org> Reply-To: ding@gnus.org NNTP-Posting-Host: coloc-standby.netfonds.no Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1035169878 27274 80.91.224.250 (21 Oct 2002 03:11:18 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 21 Oct 2002 03:11:18 +0000 (UTC) Return-Path: Original-Received: from spinoza.math.uh.edu (spinoza.math.uh.edu [129.7.128.18]) by mailhost.sclp.com (Postfix) with ESMTP id B3490D049D for ; Fri, 22 Dec 2000 01:09:36 -0500 (EST) Original-Received: from sina.hpc.uh.edu (lists@Sina.HPC.UH.EDU [129.7.3.5]) by spinoza.math.uh.edu (8.9.1/8.9.1) with ESMTP id AAB29418; Fri, 22 Dec 2000 00:06:08 -0600 (CST) Original-Received: by sina.hpc.uh.edu (TLB v0.09a (1.20 tibbs 1996/10/09 22:03:07)); Fri, 22 Dec 2000 00:05:34 -0600 (CST) Original-Received: from mailhost.sclp.com (postfix@66-209.196.61.interliant.com [209.196.61.66] (may be forged)) by sina.hpc.uh.edu (8.9.3/8.9.3) with ESMTP id AAA18450 for ; Fri, 22 Dec 2000 00:05:22 -0600 (CST) Original-Received: from cis.ohio-state.edu (mail.cis.ohio-state.edu [164.107.115.5]) by mailhost.sclp.com (Postfix) with ESMTP id D536DD049D for ; Fri, 22 Dec 2000 01:05:43 -0500 (EST) Original-Received: from meta.verbum.org (root@gold.cis.ohio-state.edu [164.107.112.16]) by cis.ohio-state.edu (8.9.1/8.9.1) with ESMTP id BAA21182 for ; Fri, 22 Dec 2000 01:05:43 -0500 (EST) Original-Received: by meta.verbum.org (Postfix (Debian/GNU), from userid 1000) id 1C09B1034A; Fri, 22 Dec 2000 01:05:05 -0500 (EST) Original-To: ding@gnus.org X-Attribution: Colin X-Face: %'w-_>8Mj2_'=;I$myE#]G"'D>x3CY_rk,K06:mXFUvWy>;3I"BW3_-MAiUby{O(mn"wV@m dd`)Vk[27^^Sa Original-Lines: 70 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.0.94 Precedence: list X-Majordomo: 1.94.jlt7 Xref: main.gmane.org gmane.emacs.gnus.general:33848 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:33848 Harry Putnam writes: > OK trying to get in to this, but I have no clue how that list might > be stored into a variable... In the shell, no problem but in > lisp.. I'm lost. Ok. By the way, I highly recommend Robert Chassell's "Programming in Emacs Lisp: An Introduction". It's how I started to learn Emacs Lisp. > Taking the first example, since I don't know how to generate a > variable containing a list I try using a single file name instead, > and insert something simple for a shell command `cat' (UUofC not > withstanding) Well, one way to (implicitly) create variables is with `setq', which you've probably seen before. Say you type (setq foo '("/home/reader/Mail/tmp/awk-work/13" "/home/reader/Mail/tmp/awk-work/14")) This is sort of like saying FOO="/home/reader/Mail/tmp/awk-work/13 /home/reader/Mail/tmp/awk-work/14" in a shell, because you separate elements in a shell list with whitespace. In the same way that you could then say (in bash) for x in $FOO; do cat $x; done you can say (dolist (x foo) (shell-command-to-string (concat "cat " x))) Of course, Lisp lists are tons better, because they don't get confused by whitespace, can store any kind of object, and get automatically freed when you're done with them :) > I'm guessing this is like a simple `for loop' and cat will be run on > each member in turn. So with just 1 member then maybe just on it. Right. > (mapcar (lambda (x) (shell-command-to-string (concat "cat " x))) > /home/reader/Mail/tmp/awk-work/13) > > So C-x C-e > Symbol's value as variable is void: \ > /home/reader/Mail/tmp/awk-work/13 Well, what you want to say here is: (mapcar (lambda (x) (shell-command-to-string (concat "cat " x))) '("/home/reader/Mail/tmp/awk-work/13")) So what you're doing here is creating a one-element list, with a string as its single element. > Well, I'm getting closer... May sound terribly lame, but I don't even > have a clue on how to begin looking this up in the Into or Lisp > manual. The Elisp intro is very good, and worth reading. > Good thing this isn't explosive... I'd have had a serious accident > by now. I still get that feeling pretty often :)