* Hiding ^M
@ 2010-02-22 20:59 Óscar Fuentes
2010-02-22 21:35 ` Juanma Barranquero
0 siblings, 1 reply; 8+ messages in thread
From: Óscar Fuentes @ 2010-02-22 20:59 UTC (permalink / raw)
To: help-gnu-emacs
For buffers with certain major mode, I'll like to hide ^M characters. It
is not possible to remove them and adjusting the eol settings of the
buffer is not an option either (the lines that ends with ^M are mixed
with "normal" lines).
Setting the `escape-glyph' face to white foreground would do. Setting
the specific face of the ^M character would be okay too. But that should
only apply to buffers with an specific major mode.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Hiding ^M
2010-02-22 20:59 Hiding ^M Óscar Fuentes
@ 2010-02-22 21:35 ` Juanma Barranquero
0 siblings, 0 replies; 8+ messages in thread
From: Juanma Barranquero @ 2010-02-22 21:35 UTC (permalink / raw)
To: Óscar Fuentes; +Cc: help-gnu-emacs
> For buffers with certain major mode, I'll like to hide ^M characters. It
> is not possible to remove them and adjusting the eol settings of the
> buffer is not an option either (the lines that ends with ^M are mixed
> with "normal" lines).
>
> Setting the `escape-glyph' face to white foreground would do. Setting
> the specific face of the ^M character would be okay too. But that should
> only apply to buffers with an specific major mode.
You can try this
(define-minor-mode hide-^M-mode
"Minor mode to hide ^M."
:init-value nil
:lighter "hide^M"
(setq buffer-display-table
(and hide-^M-mode
(or (get 'hide-^M-mode :table)
(let ((table (or (copy-sequence standard-display-table)
(make-display-table))))
(aset table ?\^M [?\u00A0])
(aset table ?\^I (vector (make-glyph-code ?\^I 'underline)))
(put 'hide-^M-mode :table table))))
and then setting hide-^M-mode in the mode hooks.
Juanma
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Hiding ^M
[not found] <mailman.1672.1266873261.14305.help-gnu-emacs@gnu.org>
@ 2010-02-23 5:52 ` Torsten Mueller
2010-02-23 18:14 ` Óscar Fuentes
[not found] ` <mailman.1719.1266948904.14305.help-gnu-emacs@gnu.org>
2010-02-23 17:43 ` Mike Treseler
1 sibling, 2 replies; 8+ messages in thread
From: Torsten Mueller @ 2010-02-23 5:52 UTC (permalink / raw)
To: help-gnu-emacs
Óscar Fuentes <ofv@wanadoo.es> schrieb:
> For buffers with certain major mode, I'll like to hide ^M
> characters. It is not possible to remove them and adjusting the eol
> settings of the buffer is not an option either (the lines that ends
> with ^M are mixed with "normal" lines).
Yes, if there're ^M visible at the end of lines this is a notification
that there's a mix. I would not make them invisible. I would really
prefer to remove them because this mix is a relict from using
different editors who left the file in an inconsistent state.
I use a small file called eol-conversion.el for removing. It allows to
specify what kind of line ending should be used now for all lines.
T.M.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Hiding ^M
[not found] <mailman.1672.1266873261.14305.help-gnu-emacs@gnu.org>
2010-02-23 5:52 ` Torsten Mueller
@ 2010-02-23 17:43 ` Mike Treseler
1 sibling, 0 replies; 8+ messages in thread
From: Mike Treseler @ 2010-02-23 17:43 UTC (permalink / raw)
To: help-gnu-emacs
Óscar Fuentes wrote:
> For buffers with certain major mode, I'll like to hide ^M characters. It
> is not possible to remove them and adjusting the eol settings of the
> buffer is not an option either (the lines that ends with ^M are mixed
> with "normal" lines).
DOS files that have been edited by many people
often have mismatched carriage returns.
These files should be cleaned before being used for anything.
I just
M-x Query replace regexp: ^M
Query replace regexp ^M with:
<Enter>
and do a few manually,
then '!' for the rest.
Then
M-x buffer-to-dos
or
buffer-to-unix
And all is well.
-- Mike Treseler
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Hiding ^M
2010-02-23 5:52 ` Torsten Mueller
@ 2010-02-23 18:14 ` Óscar Fuentes
[not found] ` <mailman.1719.1266948904.14305.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 8+ messages in thread
From: Óscar Fuentes @ 2010-02-23 18:14 UTC (permalink / raw)
To: help-gnu-emacs
Torsten Mueller <dev-null@shared-files.de> writes:
> Óscar Fuentes <ofv@wanadoo.es> schrieb:
>
>> For buffers with certain major mode, I'll like to hide ^M
>> characters. It is not possible to remove them and adjusting the eol
>> settings of the buffer is not an option either (the lines that ends
>> with ^M are mixed with "normal" lines).
>
> Yes, if there're ^M visible at the end of lines this is a notification
> that there's a mix. I would not make them invisible. I would really
> prefer to remove them because this mix is a relict from using
> different editors who left the file in an inconsistent state.
I agree, but the advice does not apply here because that major mode
displays a series of diffs taken from all edited files on a git working
tree. Some have crlf line endings, and they are shown as ^M.
[snip]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Hiding ^M
[not found] ` <mailman.1719.1266948904.14305.help-gnu-emacs@gnu.org>
@ 2010-02-23 21:31 ` Tim X
2010-02-24 1:23 ` Óscar Fuentes
[not found] ` <mailman.1754.1266974624.14305.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 8+ messages in thread
From: Tim X @ 2010-02-23 21:31 UTC (permalink / raw)
To: help-gnu-emacs
Óscar Fuentes <ofv@wanadoo.es> writes:
> Torsten Mueller <dev-null@shared-files.de> writes:
>
>> Óscar Fuentes <ofv@wanadoo.es> schrieb:
>>
>>> For buffers with certain major mode, I'll like to hide ^M
>>> characters. It is not possible to remove them and adjusting the eol
>>> settings of the buffer is not an option either (the lines that ends
>>> with ^M are mixed with "normal" lines).
>>
>> Yes, if there're ^M visible at the end of lines this is a notification
>> that there's a mix. I would not make them invisible. I would really
>> prefer to remove them because this mix is a relict from using
>> different editors who left the file in an inconsistent state.
>
> I agree, but the advice does not apply here because that major mode
> displays a series of diffs taken from all edited files on a git working
> tree. Some have crlf line endings, and they are shown as ^M.
>
Doesn't GIT have some sort of setting to handle this?
In SVN you would set the eol-style property to something like 'native'.
Then, SVN would handle eol differences automatically and ensure such
differences were not considered in version diffs etc. This eliminates
spurious differences caused by editors on different platforms that use
different eol styles.
Tim
>
>
>
--
tcross (at) rapttech dot com dot au
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Hiding ^M
2010-02-23 21:31 ` Tim X
@ 2010-02-24 1:23 ` Óscar Fuentes
[not found] ` <mailman.1754.1266974624.14305.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 8+ messages in thread
From: Óscar Fuentes @ 2010-02-24 1:23 UTC (permalink / raw)
To: help-gnu-emacs
Tim X <timx@nospam.dev.null> writes:
>> I agree, but the advice does not apply here because that major mode
>> displays a series of diffs taken from all edited files on a git working
>> tree. Some have crlf line endings, and they are shown as ^M.
>
> Doesn't GIT have some sort of setting to handle this?
It has settings for eol conversion. In this case, I don't want those
conversions to take effect, because those files are supposed to have
crlf line endings.
[snip]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Hiding ^M
[not found] ` <mailman.1754.1266974624.14305.help-gnu-emacs@gnu.org>
@ 2010-02-24 6:57 ` Tim X
0 siblings, 0 replies; 8+ messages in thread
From: Tim X @ 2010-02-24 6:57 UTC (permalink / raw)
To: help-gnu-emacs
Óscar Fuentes <ofv@wanadoo.es> writes:
> Tim X <timx@nospam.dev.null> writes:
>
>>> I agree, but the advice does not apply here because that major mode
>>> displays a series of diffs taken from all edited files on a git working
>>> tree. Some have crlf line endings, and they are shown as ^M.
>>
>> Doesn't GIT have some sort of setting to handle this?
>
> It has settings for eol conversion. In this case, I don't want those
> conversions to take effect, because those files are supposed to have
> crlf line endings.
>
Under SVN, if you set eol-style to native, the SVN client takes care of
all this conversion stuff - it does not get into the repository - more
specifically, differences in client eol requirements are handled at the
client level and therefore don't affect what is in the repository and at
the same time eliminate issues of different eol styles because of users
with different clients. I would expect GIT to have something similar.
Tim
>
>
>
--
tcross (at) rapttech dot com dot au
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2010-02-24 6:57 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-22 20:59 Hiding ^M Óscar Fuentes
2010-02-22 21:35 ` Juanma Barranquero
[not found] <mailman.1672.1266873261.14305.help-gnu-emacs@gnu.org>
2010-02-23 5:52 ` Torsten Mueller
2010-02-23 18:14 ` Óscar Fuentes
[not found] ` <mailman.1719.1266948904.14305.help-gnu-emacs@gnu.org>
2010-02-23 21:31 ` Tim X
2010-02-24 1:23 ` Óscar Fuentes
[not found] ` <mailman.1754.1266974624.14305.help-gnu-emacs@gnu.org>
2010-02-24 6:57 ` Tim X
2010-02-23 17:43 ` Mike Treseler
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).