[Top][All Lists]

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

Re: simply saving a text file to a directory OS X

From: John Mastro
Subject: Re: simply saving a text file to a directory OS X
Date: Wed, 30 Nov 2016 18:02:16 -0800

Matthew Pritchard <> 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"))
       (insert-file-contents file)
       ;; work with the file's contents...
       (write-region nil nil destination)))

Hope that helps


reply via email to

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