help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: find a file and put it in a window


From: Jasen
Subject: Re: find a file and put it in a window
Date: Sun, 25 Jul 2004 22:34:40 -0700
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)



Eli Zaretskii wrote:

From: Jasen <address@hidden>
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.)



Ok, I'm almost there but Emacs gets me an empty new file rather than the existing file? Could this be the problem of space in the directory path because I'm using Windows XP and there are spaces in the path? c:/Documents and Settings/austin/Local Settings/Temp

Thanks,
Austin



reply via email to

[Prev in Thread] Current Thread [Next in Thread]