all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Changing file end-of-line style
@ 2012-11-05 11:57 Suvayu Ali
  2012-11-05 13:08 ` Jambunathan K
  0 siblings, 1 reply; 8+ messages in thread
From: Suvayu Ali @ 2012-11-05 11:57 UTC (permalink / raw)
  To: Emacs help

Hi,

I sometimes have to deal with files created on Windows or Mac OSX.  When
using emacs with X windows, I can click on the `(Mac)' or `(MS-DOS)'
marker on the bottom left corner of the frame to switch to whichever
style I want at the moment.

How do I do this when running emacs as `emacs -nw'?  I tried looking for
end-of-line with apropos, but could not find anything that seemed
relevant.  Any ideas?

Thanks,

-- 
Suvayu

Open source is the future. It sets us free.



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

* Re: Changing file end-of-line style
  2012-11-05 11:57 Changing file end-of-line style Suvayu Ali
@ 2012-11-05 13:08 ` Jambunathan K
  2012-11-05 13:24   ` Suvayu Ali
  0 siblings, 1 reply; 8+ messages in thread
From: Jambunathan K @ 2012-11-05 13:08 UTC (permalink / raw)
  To: Suvayu Ali; +Cc: Emacs help

Suvayu Ali <fatkasuvayu+linux@gmail.com> writes:

> Hi,
>
> I sometimes have to deal with files created on Windows or Mac OSX.  When
> using emacs with X windows, I can click on the `(Mac)' or `(MS-DOS)'
> marker on the bottom left corner of the frame to switch to whichever
> style I want at the moment.
>
> How do I do this when running emacs as `emacs -nw'?  I tried looking for
> end-of-line with apropos, but could not find anything that seemed
> relevant.  Any ideas?

From (info "(emacs) Text and Binary")

,---- 
|    To visit a file and specify whether it uses DOS-style or Unix-style
| end-of-line, specify a coding system (*note Text Coding::).  For
| example, `C-x <RET> c unix <RET> C-x C-f foobar.txt' visits the file
| `foobar.txt' without converting the EOLs; if some line ends with a
| carriage-return linefeed pair, Emacs will display `^M' at the end of
| that line.  Similarly, you can direct Emacs to save a buffer in a
| specified EOL format with the `C-x <RET> f' command.  For example, to
| save a buffer with Unix EOL format, type `C-x <RET> f unix <RET> C-x
| C-s'.  If you visit a file with DOS EOL conversion, then save it with
| Unix EOL format, that effectively converts the file to Unix EOL style,
| like `dos2unix'.
`----


>
> Thanks,

-- 



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

* Re: Changing file end-of-line style
  2012-11-05 13:08 ` Jambunathan K
@ 2012-11-05 13:24   ` Suvayu Ali
  2012-11-05 13:58     ` Jambunathan K
  2012-11-05 16:41     ` Eli Zaretskii
  0 siblings, 2 replies; 8+ messages in thread
From: Suvayu Ali @ 2012-11-05 13:24 UTC (permalink / raw)
  To: Jambunathan K; +Cc: Emacs help

Hi Jambunathan,

On Mon, Nov 05, 2012 at 06:38:31PM +0530, Jambunathan K wrote:
> Suvayu Ali <fatkasuvayu+linux@gmail.com> writes:
> 
> > Hi,
> >
> > I sometimes have to deal with files created on Windows or Mac OSX.  When
> > using emacs with X windows, I can click on the `(Mac)' or `(MS-DOS)'
> > marker on the bottom left corner of the frame to switch to whichever
> > style I want at the moment.
> >
> > How do I do this when running emacs as `emacs -nw'?  I tried looking for
> > end-of-line with apropos, but could not find anything that seemed
> > relevant.  Any ideas?
> 
> From (info "(emacs) Text and Binary")
> 
> ,---- 
> |    To visit a file and specify whether it uses DOS-style or Unix-style
> | end-of-line, specify a coding system (*note Text Coding::).  For
> | example, `C-x <RET> c unix <RET> C-x C-f foobar.txt' visits the file
> | `foobar.txt' without converting the EOLs; if some line ends with a
> | carriage-return linefeed pair, Emacs will display `^M' at the end of
> | that line.  Similarly, you can direct Emacs to save a buffer in a
> | specified EOL format with the `C-x <RET> f' command.  For example, to
> | save a buffer with Unix EOL format, type `C-x <RET> f unix <RET> C-x
> | C-s'.  If you visit a file with DOS EOL conversion, then save it with
> | Unix EOL format, that effectively converts the file to Unix EOL style,
> | like `dos2unix'.
> `----
> 

This works great!  I have a question though.  I was aware of the
set-buffer-file-coding-system command; when I tried it I was prompted
with utf-8[1] which did not seem to do anything.  What confuses me is
this prompt along with separate markers on the modeline for charset and
line ending style[2] led me to believe the coding system of the file is
the charset (as in the characters used in the text) it is using, whereas
line endings are set by something else.

From your answer it seems that is not the case.  Does that mean there
can be several coding system associated to a buffer?  Am I talking
gibberish or does my question make any sense?

Thanks,


Footnotes:

[1] I use utf-8 for all text files.

[2] There is a U for files with UTF-8 characters and DOS for files with
    DOS style line endings at separate places on the bottom left of the
    modeline.

-- 
Suvayu

Open source is the future. It sets us free.



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

* Re: Changing file end-of-line style
  2012-11-05 13:24   ` Suvayu Ali
@ 2012-11-05 13:58     ` Jambunathan K
  2012-11-05 14:05       ` Suvayu Ali
  2012-11-05 16:41     ` Eli Zaretskii
  1 sibling, 1 reply; 8+ messages in thread
From: Jambunathan K @ 2012-11-05 13:58 UTC (permalink / raw)
  To: Suvayu Ali; +Cc: Emacs help

Suvayu Ali <fatkasuvayu+linux@gmail.com> writes:

> Hi Jambunathan,
>
> On Mon, Nov 05, 2012 at 06:38:31PM +0530, Jambunathan K wrote:
>> Suvayu Ali <fatkasuvayu+linux@gmail.com> writes:
>> 
>> > Hi,
>> >
>> > I sometimes have to deal with files created on Windows or Mac OSX.  When
>> > using emacs with X windows, I can click on the `(Mac)' or `(MS-DOS)'
>> > marker on the bottom left corner of the frame to switch to whichever
>> > style I want at the moment.
>> >
>> > How do I do this when running emacs as `emacs -nw'?  I tried looking for
>> > end-of-line with apropos, but could not find anything that seemed
>> > relevant.  Any ideas?
>> 
>> From (info "(emacs) Text and Binary")
>> 
>> ,---- 
>> |    To visit a file and specify whether it uses DOS-style or Unix-style
>> | end-of-line, specify a coding system (*note Text Coding::).  For
>> | example, `C-x <RET> c unix <RET> C-x C-f foobar.txt' visits the file
>> | `foobar.txt' without converting the EOLs; if some line ends with a
>> | carriage-return linefeed pair, Emacs will display `^M' at the end of
>> | that line.  Similarly, you can direct Emacs to save a buffer in a
>> | specified EOL format with the `C-x <RET> f' command.  For example, to
>> | save a buffer with Unix EOL format, type `C-x <RET> f unix <RET> C-x
>> | C-s'.  If you visit a file with DOS EOL conversion, then save it with
>> | Unix EOL format, that effectively converts the file to Unix EOL style,
>> | like `dos2unix'.
>> `----
>> 
>
> This works great!  I have a question though.  I was aware of the
> set-buffer-file-coding-system command; when I tried it I was prompted
> with utf-8[1] which did not seem to do anything.  What confuses me is
> this prompt along with separate markers on the modeline for charset and
> line ending style[2] led me to believe the coding system of the file is
> the charset (as in the characters used in the text) it is using, whereas
> line endings are set by something else.
>
> From your answer it seems that is not the case.  Does that mean there
> can be several coding system associated to a buffer?  Am I talking
> gibberish or does my question make any sense?

> Footnotes:
>
> [1] I use utf-8 for all text files.
>
> [2] There is a U for files with UTF-8 characters and DOS for files with
>     DOS style line endings at separate places on the bottom left of the
>     modeline.

At C-x C-m f prompt, you can choose utf-8-unix, utf-8-dos, utf-8-mac
apart from other options that start with utf-8.  The two things -
encoding and what constitues a eol character - are orthogonal to each
other.

Frankly, I don't know any more that what the manual suggests.



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

* Re: Changing file end-of-line style
  2012-11-05 13:58     ` Jambunathan K
@ 2012-11-05 14:05       ` Suvayu Ali
  2012-11-06 18:08         ` Oleksandr Gavenko
  0 siblings, 1 reply; 8+ messages in thread
From: Suvayu Ali @ 2012-11-05 14:05 UTC (permalink / raw)
  To: Jambunathan K; +Cc: Emacs help

On Mon, Nov 05, 2012 at 07:28:13PM +0530, Jambunathan K wrote:
> Suvayu Ali <fatkasuvayu+linux@gmail.com> writes:
> 
> > Hi Jambunathan,
> >
> > This works great!  I have a question though.  I was aware of the
> > set-buffer-file-coding-system command; when I tried it I was prompted
> > with utf-8[1] which did not seem to do anything.  What confuses me is
> > this prompt along with separate markers on the modeline for charset and
> > line ending style[2] led me to believe the coding system of the file is
> > the charset (as in the characters used in the text) it is using, whereas
> > line endings are set by something else.
> >
> > From your answer it seems that is not the case.  Does that mean there
> > can be several coding system associated to a buffer?  Am I talking
> > gibberish or does my question make any sense?
> 
> > Footnotes:
> >
> > [1] I use utf-8 for all text files.
> >
> > [2] There is a U for files with UTF-8 characters and DOS for files with
> >     DOS style line endings at separate places on the bottom left of the
> >     modeline.
> 
> At C-x C-m f prompt, you can choose utf-8-unix, utf-8-dos, utf-8-mac
> apart from other options that start with utf-8.  The two things -
> encoding and what constitues a eol character - are orthogonal to each
> other.
> 

Yup that works!  I wonder why I did not see that earlier.  :-/

> Frankly, I don't know any more that what the manual suggests.

Fair enough.

Cheers,

-- 
Suvayu

Open source is the future. It sets us free.



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

* Re: Changing file end-of-line style
  2012-11-05 13:24   ` Suvayu Ali
  2012-11-05 13:58     ` Jambunathan K
@ 2012-11-05 16:41     ` Eli Zaretskii
  2012-11-06 16:48       ` Suvayu Ali
  1 sibling, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2012-11-05 16:41 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Mon, 5 Nov 2012 14:24:10 +0100
> From: Suvayu Ali <fatkasuvayu+linux@gmail.com>
> Cc: Emacs help <help-gnu-emacs@gnu.org>
> 
> This works great!  I have a question though.  I was aware of the
> set-buffer-file-coding-system command; when I tried it I was prompted
> with utf-8[1] which did not seem to do anything.  What confuses me is
> this prompt along with separate markers on the modeline for charset and
> line ending style[2] led me to believe the coding system of the file is
> the charset (as in the characters used in the text) it is using, whereas
> line endings are set by something else.

No, the coding-system includes both the character encoding and the EOL
encoding.  See the node "Coding Systems" in the Emacs User Manual.

> >From your answer it seems that is not the case.  Does that mean there
> can be several coding system associated to a buffer?

No, there's only one, but it specifies both character and EOL
conversions.



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

* Re: Changing file end-of-line style
  2012-11-05 16:41     ` Eli Zaretskii
@ 2012-11-06 16:48       ` Suvayu Ali
  0 siblings, 0 replies; 8+ messages in thread
From: Suvayu Ali @ 2012-11-06 16:48 UTC (permalink / raw)
  To: help-gnu-emacs

Hi Eli,

On Mon, Nov 05, 2012 at 06:41:52PM +0200, Eli Zaretskii wrote:
> > Date: Mon, 5 Nov 2012 14:24:10 +0100
> > From: Suvayu Ali <fatkasuvayu+linux@gmail.com>
> > Cc: Emacs help <help-gnu-emacs@gnu.org>
> > 
> > This works great!  I have a question though.  I was aware of the
> > set-buffer-file-coding-system command; when I tried it I was prompted
> > with utf-8[1] which did not seem to do anything.  What confuses me is
> > this prompt along with separate markers on the modeline for charset and
> > line ending style[2] led me to believe the coding system of the file is
> > the charset (as in the characters used in the text) it is using, whereas
> > line endings are set by something else.
> 
> No, the coding-system includes both the character encoding and the EOL
> encoding.  See the node "Coding Systems" in the Emacs User Manual.
> 
> > >From your answer it seems that is not the case.  Does that mean there
> > can be several coding system associated to a buffer?
> 
> No, there's only one, but it specifies both character and EOL
> conversions.
> 

Thanks a lot for clearing my confusion.  Obviously I need to read more.

:)

-- 
Suvayu

Open source is the future. It sets us free.



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

* Re: Changing file end-of-line style
  2012-11-05 14:05       ` Suvayu Ali
@ 2012-11-06 18:08         ` Oleksandr Gavenko
  0 siblings, 0 replies; 8+ messages in thread
From: Oleksandr Gavenko @ 2012-11-06 18:08 UTC (permalink / raw)
  To: help-gnu-emacs

On 2012-11-05, Suvayu Ali wrote:

>> At C-x C-m f prompt, you can choose utf-8-unix, utf-8-dos, utf-8-mac
>> apart from other options that start with utf-8.  The two things -
>> encoding and what constitues a eol character - are orthogonal to each
>> other.
>> 
>
> Yup that works!  I wonder why I did not see that earlier.  :-/

Because you don't press TAB!

With TAB Emacs show possible completions. Also I recommend such settings:

  (require 'icomplete) ; Interactive completion in minibuffer.
  (icomplete-mode 1)

So when you type utf-8 it show you:

  utf-8{-dos,-mac,auto,....}

-- 
Best regards!




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

end of thread, other threads:[~2012-11-06 18:08 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-05 11:57 Changing file end-of-line style Suvayu Ali
2012-11-05 13:08 ` Jambunathan K
2012-11-05 13:24   ` Suvayu Ali
2012-11-05 13:58     ` Jambunathan K
2012-11-05 14:05       ` Suvayu Ali
2012-11-06 18:08         ` Oleksandr Gavenko
2012-11-05 16:41     ` Eli Zaretskii
2012-11-06 16:48       ` Suvayu Ali

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.