From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Eli Zaretskii" Newsgroups: gmane.emacs.help Subject: Re: find a file and put it in a window Date: Mon, 26 Jul 2004 06:57:28 +0200 Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: <9003-Mon26Jul2004065727+0300-eliz@gnu.org> References: Reply-To: Eli Zaretskii NNTP-Posting-Host: deer.gmane.org X-Trace: sea.gmane.org 1090814407 11959 80.91.224.253 (26 Jul 2004 04:00:07 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 26 Jul 2004 04:00:07 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Jul 26 06:00:02 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1Boweg-00023W-00 for ; Mon, 26 Jul 2004 06:00:02 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1Bowhh-0003dm-6B for geh-help-gnu-emacs@m.gmane.org; Mon, 26 Jul 2004 00:03:09 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1BowhM-0003Ws-W5 for help-gnu-emacs@gnu.org; Mon, 26 Jul 2004 00:02:49 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1BowhJ-0003Vu-PE for help-gnu-emacs@gnu.org; Mon, 26 Jul 2004 00:02:48 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BowhJ-0003Vp-Fk for help-gnu-emacs@gnu.org; Mon, 26 Jul 2004 00:02:45 -0400 Original-Received: from [192.114.186.23] (helo=aragorn.inter.net.il) by monty-python.gnu.org with esmtp (Exim 4.34) id 1Bowdp-0002PK-7l for help-gnu-emacs@gnu.org; Sun, 25 Jul 2004 23:59:09 -0400 Original-Received: from zaretski (pns03-200-205.inter.net.il [80.230.200.205]) by aragorn.inter.net.il (MOS 3.4.6-GR) with ESMTP id DXO64635; Mon, 26 Jul 2004 06:59:03 +0300 (IDT) Original-To: help-gnu-emacs@gnu.org X-Mailer: emacs 21.3.50 (via feedmail 8 I) and Blat ver 1.8.9 In-reply-to: (message from Jasen on Sun, 25 Jul 2004 19:28:38 -0700) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:19789 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:19789 > From: Jasen > Newsgroups: gnu.emacs.help > Date: Sun, 25 Jul 2004 19:28:38 -0700 > > I would like to find a file in a directory through a shell command: > > ;; Get the newest version of file > (setq file (string (shell command "ls -tc > C:\\dir1\\dir2\\dir3/file*.txt | head -1"))) > > ;; Put the file is a windows > (find-file-other-window file) > > The problem is that either Emacs or Windows can't interpret the full > file name along with directory path correctly and I don't know how to > fix it? I think the problem is that the string you get includes a newline after the name of the file. You need to remove that before you use the string as a file name. (You can see what string Emacs gets by using shell-command-to-string.)