unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: "Eli Zaretskii" <eliz@gnu.org>
Subject: Re: find a file and put it in a window
Date: Mon, 26 Jul 2004 06:57:28 +0200	[thread overview]
Message-ID: <9003-Mon26Jul2004065727+0300-eliz@gnu.org> (raw)
In-Reply-To: <S%ZMc.15276$%p4.7483@okepread04> (message from Jasen on Sun, 25 Jul 2004 19:28:38 -0700)

> From: Jasen <xx@yy.zz>
> 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.)

  reply	other threads:[~2004-07-26  4:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-26  2:28 find a file and put it in a window Jasen
2004-07-26  4:57 ` Eli Zaretskii [this message]
     [not found] ` <mailman.1472.1090814571.1960.help-gnu-emacs@gnu.org>
2004-07-26  5:34   ` Jasen
2004-07-26 18:26     ` Eli Zaretskii
  -- strict thread matches above, loose matches on Subject: below --
2004-07-26  2:28 Jasen

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=9003-Mon26Jul2004065727+0300-eliz@gnu.org \
    --to=eliz@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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).