all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: John Mastro <john.b.mastro@gmail.com>
To: "help-gnu-emacs@gnu.org" <help-gnu-emacs@gnu.org>
Cc: Matthew Pritchard <wintermute24x7@icloud.com>
Subject: Re: simply saving a text file to a directory OS X
Date: Wed, 30 Nov 2016 18:02:16 -0800	[thread overview]
Message-ID: <CAOj2CQQsqdwCiZdva0HW9BOuiJnmuU_5yyK=fPG7rEf8pLy3Lg@mail.gmail.com> (raw)
In-Reply-To: <63B5AC70-7DEF-4C3D-B856-8FEA12C65A71@icloud.com>

Matthew Pritchard <wintermute24x7@icloud.com> wrote:
> I want to work with a file and save it to a specific directory. what
> is a simple way to do this.

Do you mean when using Emacs interactively, or in Emacs Lisp code?

If the former, Emacs's equivalent to "save as" is the command
`write-file', which has the key binding `C-x C-w' by default. After
typing `C-x C-w' you'll be prompted for where to save the file. You can
either enter a complete file name, or just a directory name (in which
case the file will be saved in that directory with its existing base
name). I suggest working through the tutorial, which you can start by
typing `C-h t'.

If the latter, it will often look something like:

    (let ((file "/path/to/file.txt")
          (destination "/path/to/destination.txt"))
     (with-temp-buffer
       (insert-file-contents file)
       ;; work with the file's contents...
       (write-region nil nil destination)))

Hope that helps

        John



      reply	other threads:[~2016-12-01  2:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-01  1:44 simply saving a text file to a directory OS X Matthew Pritchard
2016-12-01  2:02 ` John Mastro [this message]

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='CAOj2CQQsqdwCiZdva0HW9BOuiJnmuU_5yyK=fPG7rEf8pLy3Lg@mail.gmail.com' \
    --to=john.b.mastro@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=wintermute24x7@icloud.com \
    /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.