all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Tassilo Horn <tassilo@member.fsf.org>
To: help-gnu-emacs@gnu.org
Subject: Re: delete-file using wildcard
Date: Sat, 29 Oct 2011 10:50:12 +0200	[thread overview]
Message-ID: <8762j8p4fv.fsf@thinkpad.tsdh.de> (raw)
In-Reply-To: 87aa8kp4ie.fsf@thinkpad.tsdh.de

Tassilo Horn <tassilo@member.fsf.org> writes:

> ishi soichi <soichi777@gmail.com> writes:
>
> Hi!
>
>> the wildcard command does not seem work similarly in Emacs Lisp.
>>
>> (delete-file (subseq (file-expand-wildcards "~/Desktop/*") -1))
>
> `delete-file' wants exactly one file given as string, but the `subseq'
> form returns a *list* with exactly one file name, i.e., the last file
> matching the given wildcard.
>
> This should do the trick:
>
>   (delete-file (nth 0 (subseq (file-expand-wildcards "~/Desktop/*") -1)))

Argh, of course one would use `car' instead of `nth' here.

Bye,
Tassilo
-- 
(What the world needs (I think) is not
      (a Lisp (with fewer parentheses))
      but (an English (with more.)))
Brian Hayes, http://tinyurl.com/3y9l2kf




  reply	other threads:[~2011-10-29  8:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-29  7:54 delete-file using wildcard ishi soichi
2011-10-29  8:12 ` Jambunathan K
2011-10-29  8:48 ` Tassilo Horn
2011-10-29  8:50   ` Tassilo Horn [this message]
2011-10-29  8:57   ` ishi soichi
2011-10-29  9:03 ` Peter Dyballa
2011-10-29 14:16 ` Drew Adams
2011-10-29 20:30   ` ishi soichi

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

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

  git send-email \
    --in-reply-to=8762j8p4fv.fsf@thinkpad.tsdh.de \
    --to=tassilo@member.fsf.org \
    --cc=help-gnu-emacs@gnu.org \
    /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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.