* elisp to change line endings for new remote file
@ 2008-10-06 17:07 yary
2008-10-06 23:50 ` Giorgos Keramidas
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: yary @ 2008-10-06 17:07 UTC (permalink / raw
To: help-gnu-emacs
Hello,
Hoping someone can write a line or two of elisp for my .emacs file
that will set the line endings to Unix for any new file opened via
tramp. I'm using GNU Emacs 23.0.60.1 on Windows, often creating Unix
files via plink, and usually forgetting to change the line endings
from DOS when I do. If you've already solved this in your setup,
please share.
Thanks much!
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: elisp to change line endings for new remote file
2008-10-06 17:07 elisp to change line endings for new remote file yary
@ 2008-10-06 23:50 ` Giorgos Keramidas
2008-10-07 6:42 ` Kevin Rodgers
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: Giorgos Keramidas @ 2008-10-06 23:50 UTC (permalink / raw
To: help-gnu-emacs
On Mon, 6 Oct 2008 10:07:50 -0700 (PDT), yary <not.com@gmail.com> wrote:
> Hello,
> Hoping someone can write a line or two of elisp for my .emacs file
> that will set the line endings to Unix for any new file opened via
> tramp. I'm using GNU Emacs 23.0.60.1 on Windows, often creating Unix
> files via plink, and usually forgetting to change the line endings
> from DOS when I do. If you've already solved this in your setup,
> please share.
You can change teh line endings later. Type `C-x RET f' and then, at
the prompt for a coding system, type the name of a coding system with
the "-dos" or "-unix" suffix.
For example, to convert a remote file to UTF-8 with Unix-style line
endings, you can visit the file in a buffer and type:
C-x RET f utf-8-unix RET
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: elisp to change line endings for new remote file
2008-10-06 17:07 elisp to change line endings for new remote file yary
2008-10-06 23:50 ` Giorgos Keramidas
@ 2008-10-07 6:42 ` Kevin Rodgers
2008-10-07 9:43 ` Peter Dyballa
[not found] ` <mailman.434.1223372672.25473.help-gnu-emacs@gnu.org>
3 siblings, 0 replies; 7+ messages in thread
From: Kevin Rodgers @ 2008-10-07 6:42 UTC (permalink / raw
To: help-gnu-emacs
yary wrote:
> Hoping someone can write a line or two of elisp for my .emacs file
> that will set the line endings to Unix for any new file opened via
> tramp. I'm using GNU Emacs 23.0.60.1 on Windows, often creating Unix
> files via plink, and usually forgetting to change the line endings
> from DOS when I do. If you've already solved this in your setup,
> please share.
From the "Text and Binary" node of the Emacs manual:
When you use NFS, Samba, or some other similar method to access file
systems that reside on computers using GNU or Unix systems, Emacs
should not perform end-of-line translation on any files in these file
systems--not even when you create a new file. To request this,
designate these file systems as "untranslated" file systems by calling
the function `add-untranslated-filesystem'. It takes one argument: the
file system name, including a drive letter and optionally a directory.
For example,
(add-untranslated-filesystem "Z:")
designates drive Z as an untranslated file system, and
(add-untranslated-filesystem "Z:\\foo")
designates directory `\foo' on drive Z as an untranslated file system.
Most often you would use `add-untranslated-filesystem' in your
`.emacs' file, or in `site-start.el' so that all the users at your site
get the benefit of it.
--
Kevin Rodgers
Denver, Colorado, USA
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: elisp to change line endings for new remote file
2008-10-06 17:07 elisp to change line endings for new remote file yary
2008-10-06 23:50 ` Giorgos Keramidas
2008-10-07 6:42 ` Kevin Rodgers
@ 2008-10-07 9:43 ` Peter Dyballa
[not found] ` <mailman.434.1223372672.25473.help-gnu-emacs@gnu.org>
3 siblings, 0 replies; 7+ messages in thread
From: Peter Dyballa @ 2008-10-07 9:43 UTC (permalink / raw
To: yary; +Cc: help-gnu-emacs
Am 06.10.2008 um 19:07 schrieb yary:
> I'm using GNU Emacs 23.0.60.1 on Windows, often creating Unix
> files via plink, and usually forgetting to change the line endings
> from DOS when I do.
There is before-save-hook. It could be (time-stamp). You could add
(via the customisation interface) another function that changes from
DOS to UNIX file endings, (set-buffer-file-coding-system coding-
system &optional force nomodify).
Another option is to put into your init file:
(prefer-coding-system 'utf-8-unix)
although I doubt that this would change *existing* line endings.
Can't plink be taught to prefer UNIX style line endings? If it's so
dumb than you should learn to prefer GNU Emacs and TRAMP ...
--
Greetings
Pete
Upgraded, adj.:
Didn't work the first time.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: elisp to change line endings for new remote file
[not found] ` <mailman.434.1223372672.25473.help-gnu-emacs@gnu.org>
@ 2008-10-07 15:41 ` yary
2008-10-08 1:29 ` Kevin Rodgers
[not found] ` <mailman.516.1223429355.25473.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 7+ messages in thread
From: yary @ 2008-10-07 15:41 UTC (permalink / raw
To: help-gnu-emacs
Thanks all. I already knew about add-untranslated-filesystem. tramp/
plink is smart enough to not translate its files, so that's not the
solution for creating new files with unix line endings.
On Oct 7, 2:43 am, Peter Dyballa <Peter_Dyba...@Web.DE> wrote:
> Am 06.10.2008 um 19:07 schrieb yary:
...
> There is before-save-hook. It could be (time-stamp). You could add
> (via the customisation interface) another function that changes from
> DOS to UNIX file endings, (set-buffer-file-coding-system coding-
> system &optional force nomodify).
...
That seems close to the right thing, but I'd want to call after
opening a new "tramp" file, not before saving- if it has MS-DOS line
endings already, I want to change it manually.
> Another option is to put into your init file:
>
> (prefer-coding-system 'utf-8-unix)
>
> although I doubt that this would change *existing* line endings.
That's also a good answer, as I don't want to change existing endings-
just want to make my new files correct for the platform. Though I'd
have a problem when I opened up a new file on the Windows side.
(Curse that CR, how many thousands of hours have been wasted due to
you...)
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: elisp to change line endings for new remote file
2008-10-07 15:41 ` yary
@ 2008-10-08 1:29 ` Kevin Rodgers
[not found] ` <mailman.516.1223429355.25473.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 7+ messages in thread
From: Kevin Rodgers @ 2008-10-08 1:29 UTC (permalink / raw
To: help-gnu-emacs
yary wrote:
> Thanks all. I already knew about add-untranslated-filesystem. tramp/
> plink is smart enough to not translate its files, so that's not the
> solution for creating new files with unix line endings.
Then where do the DOS line endings come from?
When you visit a new file via tramp, what does `C-h v
buffer-file-coding-system'
report? Did you actually add the file's directory (or an ancestor
directory) to
untranslated-filesystem-list?
--
Kevin Rodgers
Denver, Colorado, USA
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: elisp to change line endings for new remote file
[not found] ` <mailman.516.1223429355.25473.help-gnu-emacs@gnu.org>
@ 2008-10-17 0:08 ` yary
0 siblings, 0 replies; 7+ messages in thread
From: yary @ 2008-10-17 0:08 UTC (permalink / raw
To: help-gnu-emacs
On Oct 7, 6:29 pm, Kevin Rodgers <kevin.d.rodg...@gmail.com> wrote:
> When you visit a new file via tramp, what does `C-h v
> buffer-file-coding-system'
> report? Did you actually add the file's directory (or an ancestor
> directory) to
> untranslated-filesystem-list?
>
> --
> Kevin Rodgers
> Denver, Colorado, USA
Sorry took so long to follow up.
(add-untranslated-filesystem "/plink:")
as suggested, in ~/.emacs did the trick
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2008-10-17 0:08 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-06 17:07 elisp to change line endings for new remote file yary
2008-10-06 23:50 ` Giorgos Keramidas
2008-10-07 6:42 ` Kevin Rodgers
2008-10-07 9:43 ` Peter Dyballa
[not found] ` <mailman.434.1223372672.25473.help-gnu-emacs@gnu.org>
2008-10-07 15:41 ` yary
2008-10-08 1:29 ` Kevin Rodgers
[not found] ` <mailman.516.1223429355.25473.help-gnu-emacs@gnu.org>
2008-10-17 0:08 ` yary
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.