unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Can I change the way emacs saves text files?
@ 2004-02-20 20:37 William Payne
  2004-02-20 20:43 ` David Kastrup
  0 siblings, 1 reply; 7+ messages in thread
From: William Payne @ 2004-02-20 20:37 UTC (permalink / raw)


Hello, can I control the way Emacs saves text files, and by way I mean
windows style and *nix style line breaks?

Preferrably, I'm looking for a setting I can put in my .emacs file.

/ WP

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

* Re: Can I change the way emacs saves text files?
  2004-02-20 20:37 Can I change the way emacs saves text files? William Payne
@ 2004-02-20 20:43 ` David Kastrup
  2004-02-20 20:55   ` William Payne
  2004-02-20 21:13   ` Roodwriter
  0 siblings, 2 replies; 7+ messages in thread
From: David Kastrup @ 2004-02-20 20:43 UTC (permalink / raw)


"William Payne" <mikas493_no_s_p_a_m_@student.liu.se> writes:

> Hello, can I control the way Emacs saves text files, and by way I mean
> windows style and *nix style line breaks?
> 
> Preferrably, I'm looking for a setting I can put in my .emacs file.

What problem are you having with it?  It saves usually in the style
in which it has read them.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

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

* Re: Can I change the way emacs saves text files?
  2004-02-20 20:43 ` David Kastrup
@ 2004-02-20 20:55   ` William Payne
  2004-02-21  0:26     ` David Kastrup
  2004-02-21  9:38     ` Eli Zaretskii
  2004-02-20 21:13   ` Roodwriter
  1 sibling, 2 replies; 7+ messages in thread
From: William Payne @ 2004-02-20 20:55 UTC (permalink / raw)



"David Kastrup" <dak@gnu.org> wrote in message
news:x5r7wpmqhw.fsf@lola.goethe.zz...
> "William Payne" <mikas493_no_s_p_a_m_@student.liu.se> writes:
>
> > Hello, can I control the way Emacs saves text files, and by way I mean
> > windows style and *nix style line breaks?
> >
> > Preferrably, I'm looking for a setting I can put in my .emacs file.
>
> What problem are you having with it?  It saves usually in the style
> in which it has read them.
>
> -- 
> David Kastrup, Kriemhildstr. 15, 44793 Bochum

Well, if I do C-x C-f and "open" a file that doesn't exist I would like to
be able to specify how it should be saved (windows or *nix style line
breaks). I am using Emacs for Windows (I compiled Emacs from source myself)
under Cygwin, and I want to save all files I create from within Emacs as
unix files instead of Windows files as it is doing now.

/ WP

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

* Re: Can I change the way emacs saves text files?
  2004-02-20 20:43 ` David Kastrup
  2004-02-20 20:55   ` William Payne
@ 2004-02-20 21:13   ` Roodwriter
  1 sibling, 0 replies; 7+ messages in thread
From: Roodwriter @ 2004-02-20 21:13 UTC (permalink / raw)


David Kastrup wrote:

> "William Payne" <mikas493_no_s_p_a_m_@student.liu.se> writes:
> 
>> Hello, can I control the way Emacs saves text files, and by way I mean
>> windows style and *nix style line breaks?
>> 
>> Preferrably, I'm looking for a setting I can put in my .emacs file.
> 
> What problem are you having with it?  It saves usually in the style
> in which it has read them.
> 

I've had the same problem with 21.1.1, though it worked fine with an earlier 
version. It always saved with Linux/unix line ends.

I just created macros using replace-regexp to change the line ends, easily 
converting from either system.

These days, though, I figure I'm on Linux for good so I no longer save with 
Windows line ends unless I'm sending the file to a Windows machine.



--Rod

__________

Author of "Linux for Non-Geeks--Clear-eyed Answered for Practical Consumers" 
and "Boring Stories from Uncle Rod." Both are available at 
http://www.rodwriterpublishing.com/index.html

To reply by e-mail, take the extra "o" out of the name.

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

* Re: Can I change the way emacs saves text files?
  2004-02-20 20:55   ` William Payne
@ 2004-02-21  0:26     ` David Kastrup
  2004-02-21  9:41       ` Eli Zaretskii
  2004-02-21  9:38     ` Eli Zaretskii
  1 sibling, 1 reply; 7+ messages in thread
From: David Kastrup @ 2004-02-21  0:26 UTC (permalink / raw)


"William Payne" <mikas493_no_s_p_a_m_@student.liu.se> writes:

> "David Kastrup" <dak@gnu.org> wrote in message
> news:x5r7wpmqhw.fsf@lola.goethe.zz...
> > "William Payne" <mikas493_no_s_p_a_m_@student.liu.se> writes:
> >
> > > Hello, can I control the way Emacs saves text files, and by way I mean
> > > windows style and *nix style line breaks?
> > >
> > > Preferrably, I'm looking for a setting I can put in my .emacs file.
> >
> > What problem are you having with it?  It saves usually in the style
> > in which it has read them.
> 
> Well, if I do C-x C-f and "open" a file that doesn't exist I would like to
> be able to specify how it should be saved (windows or *nix style line
> breaks). I am using Emacs for Windows (I compiled Emacs from source myself)
> under Cygwin, and I want to save all files I create from within Emacs as
> unix files instead of Windows files as it is doing now.

C-x RET f latin-1-unix RET

and the file will be saved as Unix.

(set-default-coding-system 'latin-1-unix)

or something like that should do the trick for setting the default.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

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

* Re: Can I change the way emacs saves text files?
  2004-02-20 20:55   ` William Payne
  2004-02-21  0:26     ` David Kastrup
@ 2004-02-21  9:38     ` Eli Zaretskii
  1 sibling, 0 replies; 7+ messages in thread
From: Eli Zaretskii @ 2004-02-21  9:38 UTC (permalink / raw)


> From: "William Payne" <mikas493_no_s_p_a_m_@student.liu.se>
> Newsgroups: gnu.emacs.help
> Date: Fri, 20 Feb 2004 21:55:58 +0100
> 
> Well, if I do C-x C-f and "open" a file that doesn't exist I would like to
> be able to specify how it should be saved (windows or *nix style line
> breaks). I am using Emacs for Windows (I compiled Emacs from source myself)
> under Cygwin, and I want to save all files I create from within Emacs as
> unix files instead of Windows files as it is doing now.

Read the section in the on-line manual about text and binary files
(the node name is "Text and Binary").  It describes the
untranslated-file-system feature that does exactly what you want, and
allows to control this on a filesystem or directory basis.  That is,
you can tell Emacs that files created on a certain Windows drive or in
a certain directory and all its subdirectories should have Unix
end-of-line (EOL) format.

For an individual file, typing "C-x RET f unix RET" will cause it to
be saved in the Unix EOL format.  Likewise, "C-x RET f dos RET" will
cause it to be saved in the DOS/Windows EOL format.

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

* Re: Can I change the way emacs saves text files?
  2004-02-21  0:26     ` David Kastrup
@ 2004-02-21  9:41       ` Eli Zaretskii
  0 siblings, 0 replies; 7+ messages in thread
From: Eli Zaretskii @ 2004-02-21  9:41 UTC (permalink / raw)


> From: David Kastrup <dak@gnu.org>
> Newsgroups: gnu.emacs.help
> Date: 21 Feb 2004 01:26:52 +0100
> 
> (set-default-coding-system 'latin-1-unix)
> 
> or something like that should do the trick for setting the default.

Not a good idea, IMHO: the OP only wants to control the end-of-line
translation, not the entire encoding.  Forcing Emacs to always use
latin-1-unix will do much more, and is most probably not what you want
in the OP's situation.

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

end of thread, other threads:[~2004-02-21  9:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-02-20 20:37 Can I change the way emacs saves text files? William Payne
2004-02-20 20:43 ` David Kastrup
2004-02-20 20:55   ` William Payne
2004-02-21  0:26     ` David Kastrup
2004-02-21  9:41       ` Eli Zaretskii
2004-02-21  9:38     ` Eli Zaretskii
2004-02-20 21:13   ` Roodwriter

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).