all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* simply saving a text file to a directory OS X
@ 2016-12-01  1:44 Matthew Pritchard
  2016-12-01  2:02 ` John Mastro
  0 siblings, 1 reply; 2+ messages in thread
From: Matthew Pritchard @ 2016-12-01  1:44 UTC (permalink / raw)
  To: help-gnu-emacs

I want to work with a file and save it to a specific directory. what is a simple way to do this.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: simply saving a text file to a directory OS X
  2016-12-01  1:44 simply saving a text file to a directory OS X Matthew Pritchard
@ 2016-12-01  2:02 ` John Mastro
  0 siblings, 0 replies; 2+ messages in thread
From: John Mastro @ 2016-12-01  2:02 UTC (permalink / raw)
  To: help-gnu-emacs@gnu.org; +Cc: Matthew Pritchard

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



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-12-01  2:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-01  1:44 simply saving a text file to a directory OS X Matthew Pritchard
2016-12-01  2:02 ` John Mastro

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.