all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Use nxml mode, but without the auto formatting
@ 2014-03-07 17:40 Harry Putnam
  2014-03-07 20:41 ` Stefan Monnier
  0 siblings, 1 reply; 9+ messages in thread
From: Harry Putnam @ 2014-03-07 17:40 UTC (permalink / raw)
  To: help-gnu-emacs

How can I use emacs to edit nxml documents but not let it format
regions when I press bckspc at the end of a line.

Or I guess, I want to use the mode for syntax highlight and commenting
but again with no auto formatting.




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

* Re: Use nxml mode, but without the auto formatting
  2014-03-07 17:40 Use nxml mode, but without the auto formatting Harry Putnam
@ 2014-03-07 20:41 ` Stefan Monnier
  2014-03-23  2:40   ` Harry Putnam
  0 siblings, 1 reply; 9+ messages in thread
From: Stefan Monnier @ 2014-03-07 20:41 UTC (permalink / raw)
  To: help-gnu-emacs

> How can I use emacs to edit nxml documents but not let it format
> regions when I press bckspc at the end of a line.

Can you show an example of reformatting (I don't use nxml mode myself)?
Maybe this functionality should only be enabled depending on something
like electric-indent-mode.


        Stefan




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

* Re: Use nxml mode, but without the auto formatting
  2014-03-07 20:41 ` Stefan Monnier
@ 2014-03-23  2:40   ` Harry Putnam
  2014-03-23  4:14     ` Yuri Khan
  2014-03-23 22:19     ` Stefan
  0 siblings, 2 replies; 9+ messages in thread
From: Harry Putnam @ 2014-03-23  2:40 UTC (permalink / raw)
  To: help-gnu-emacs

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> How can I use emacs to edit nxml documents but not let it format
>> regions when I press bckspc at the end of a line.
>
> Can you show an example of reformatting (I don't use nxml mode myself)?
> Maybe this functionality should only be enabled depending on something
> like electric-indent-mode.

Sorry Stefan, you tried to help and I dropped the ball.

Here is the situation

This happens in  Xming  '*.launch' files on windows, for me.

These files are created if you use the xming gui to setup a launcher
for a remote program.

If I let emacs format the code then the code doesn't work to launch anything.  If I leave it in a
single line, it does.

Emacs goes into nXML-mode whenever I open an Xming.launch file.

If you use the Xming gui to create a launch file, the code appears as below.

A launcher for a remote xterm
,----
| <?xml version="1.0" encoding="utf-8"?>
| <XLaunch xmlns="http://www.straightrunning.com/XmingNotes" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.straightrunning.com/XmingNotes XLaunch.xsd" WindowMode="MultiWindow" ClientMode="StartProgram" Program="xterm -g 84x36 -fg linen -bg DarkSlateGrey -cr Skyblue -fn dec-terminal-medium-r-normal--14-140-75-75-c-80-iso8859-1" ClientStart="PuTTY" RemoteHost="192.168.1.42" RemoteUser="reader" Clipboard="true"/>
`----

However, if you decide to hand edit that code... then hitting <enter>
at about any point will try to format whatever is behind or above the
cursor.

Here is what happens if I hit <enter> after the last '>'.
,----
|    <?xml version="1.0" encoding="utf-8"?>
|    <XLaunch xmlns="http://www.straightrunning.com/XmingNotes"
|             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|             xsi:schemaLocation="http://www.straightrunning.com/XmingNotes
|                                 XLaunch.xsd" WindowMode="MultiWindow"
|             ClientMode="StartProgram" Program="xterm -g 84x36 -fg linen -bg
|                                                DarkSlateGrey -cr Skyblue
|                                                -fn
|                                                dec-terminal-medium-r-normal--14-140-75-75-c-80-iso8859-1"
|             ClientStart="PuTTY" RemoteHost="192.168.1.42"
|             RemoteUser="reader" Clipboard="true"/>
`----
   
To avoid this, I revert to fundamental-mode.. but, of course, then I
don't have the nifty and helpful syntax highlighting.




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

* Re: Use nxml mode, but without the auto formatting
  2014-03-23  2:40   ` Harry Putnam
@ 2014-03-23  4:14     ` Yuri Khan
  2014-03-23 13:35       ` Harry Putnam
  2014-03-23 22:19     ` Stefan
  1 sibling, 1 reply; 9+ messages in thread
From: Yuri Khan @ 2014-03-23  4:14 UTC (permalink / raw)
  To: Harry Putnam; +Cc: help-gnu-emacs@gnu.org

On Sun, Mar 23, 2014 at 9:40 AM, Harry Putnam <reader@newsguy.com> wrote:

> This happens in  Xming  '*.launch' files on windows, for me.
>
> These files are created if you use the xming gui to setup a launcher
> for a remote program.
>
> If I let emacs format the code then the code doesn't work to launch anything.  If I leave it in a
> single line, it does.
[…]
>
> Here is what happens if I hit <enter> after the last '>'.
> ,----
> |    <?xml version="1.0" encoding="utf-8"?>
> |    <XLaunch xmlns="http://www.straightrunning.com/XmingNotes"
> |             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> |             xsi:schemaLocation="http://www.straightrunning.com/XmingNotes
> |                                 XLaunch.xsd" WindowMode="MultiWindow"
> |             ClientMode="StartProgram" Program="xterm -g 84x36 -fg linen -bg
> |                                                DarkSlateGrey -cr Skyblue
> |                                                -fn
> |                                                dec-terminal-medium-r-normal--14-140-75-75-c-80-iso8859-1"
> |             ClientStart="PuTTY" RemoteHost="192.168.1.42"
> |             RemoteUser="reader" Clipboard="true"/>
> `----

You might want to also file a bug report with Xming. As an XML file,
the reformatted version is equivalent to the original, so the software
must treat them identically.

Also, see what happens if you remove all line breaks in attribute
values. (Not that it makes any difference with regard to XML
well-formedness, validity or semantics — any XML processor that treats
the original version, your reformatted version or my reformatted
version below differently is broken.)

,----
|    <?xml version="1.0" encoding="utf-8"?>
|    <XLaunch xmlns="http://www.straightrunning.com/XmingNotes"
|             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|             xsi:schemaLocation="http://www.straightrunning.com/XmingNotes
XLaunch.xsd"
|             WindowMode="MultiWindow"
|             ClientMode="StartProgram"
|             Program="xterm -g 84x36 -fg linen -bg DarkSlateGrey -cr
Skyblue -fn dec-terminal-medium-r-normal--14-140-75-75-c-80-iso8859-1"
|             ClientStart="PuTTY" RemoteHost="192.168.1.42"
|             RemoteUser="reader" Clipboard="true"/>
`----

(OK, I’m not entirely confident that my email client won’t re-wrap it
but you get the idea.)

Also, the xsi:schemaLocation attribute value seems to be wrong — it
specifies two schema URIs, the first of which does not resolve to an
XML schema definition document (but to a redirect to an ordinary HTML
page), and the other is just a filename with no indication of how to
locate it. On the other hand, the URI
http://www.straightrunning.com/XmingNotes/XLaunch.xsd (after replacing
space with a slash) is valid and resolves to a schema definition. I
don’t see how this could affect the processing of the document,
however.



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

* Re: Use nxml mode, but without the auto formatting
  2014-03-23  4:14     ` Yuri Khan
@ 2014-03-23 13:35       ` Harry Putnam
  2014-03-23 14:24         ` Yuri Khan
  0 siblings, 1 reply; 9+ messages in thread
From: Harry Putnam @ 2014-03-23 13:35 UTC (permalink / raw)
  To: help-gnu-emacs

Yuri Khan <yuri.v.khan@gmail.com> writes:

> On Sun, Mar 23, 2014 at 9:40 AM, Harry Putnam <reader@newsguy.com> wrote:
>
>> This happens in  Xming  '*.launch' files on windows, for me.
>>
>> These files are created if you use the xming gui to setup a launcher
>> for a remote program.
>>
>> If I let emacs format the code then the code doesn't work to launch
>> anything.  If I leave it in a
>> single line, it does.
> […]
>>
>> Here is what happens if I hit <enter> after the last '>'.
>> ,----
>> |    <?xml version="1.0" encoding="utf-8"?>
>> |    <XLaunch xmlns="http://www.straightrunning.com/XmingNotes"
>> |             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> |             xsi:schemaLocation="http://www.straightrunning.com/XmingNotes
>> |                                 XLaunch.xsd" WindowMode="MultiWindow"
>> |             ClientMode="StartProgram" Program="xterm -g 84x36 -fg linen -bg
>> |                                                DarkSlateGrey -cr Skyblue
>> |                                                -fn
>> |                                                dec-terminal-medium-r-normal--14-140-75-75-c-80-iso8859-1"
>> |             ClientStart="PuTTY" RemoteHost="192.168.1.42"
>> |             RemoteUser="reader" Clipboard="true"/>
>> `----
>
> You might want to also file a bug report with Xming. As an XML file,
> the reformatted version is equivalent to the original, so the software
> must treat them identically.
>
> Also, see what happens if you remove all line breaks in attribute
> values. (Not that it makes any difference with regard to XML
> well-formedness, validity or semantics — any XML processor that treats
> the original version, your reformatted version or my reformatted
> version below differently is broken.)
>
> ,----
> |    <?xml version="1.0" encoding="utf-8"?>
> |    <XLaunch xmlns="http://www.straightrunning.com/XmingNotes"
> |             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> |             xsi:schemaLocation="http://www.straightrunning.com/XmingNotes
> XLaunch.xsd"
> |             WindowMode="MultiWindow"
> |             ClientMode="StartProgram"
> |             Program="xterm -g 84x36 -fg linen -bg DarkSlateGrey -cr
> Skyblue -fn dec-terminal-medium-r-normal--14-140-75-75-c-80-iso8859-1"
> |             ClientStart="PuTTY" RemoteHost="192.168.1.42"
> |             RemoteUser="reader" Clipboard="true"/>
> `----
>
> (OK, I’m not entirely confident that my email client won’t re-wrap it
> but you get the idea.)
>
> Also, the xsi:schemaLocation attribute value seems to be wrong — it
> specifies two schema URIs, the first of which does not resolve to an
> XML schema definition document (but to a redirect to an ordinary HTML
> page), and the other is just a filename with no indication of how to
> locate it. On the other hand, the URI
> http://www.straightrunning.com/XmingNotes/XLaunch.xsd (after replacing
> space with a slash) is valid and resolves to a schema definition. I
> don’t see how this could affect the processing of the document,
> however.

I haven't experimented further yet, but it was not clear from your
helpful response if you have actually tried the unformatted and
formatted versions and found they both work, or not.





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

* Re: Use nxml mode, but without the auto formatting
  2014-03-23 13:35       ` Harry Putnam
@ 2014-03-23 14:24         ` Yuri Khan
  2014-03-23 20:09           ` Harry Putnam
  0 siblings, 1 reply; 9+ messages in thread
From: Yuri Khan @ 2014-03-23 14:24 UTC (permalink / raw)
  To: Harry Putnam; +Cc: help-gnu-emacs@gnu.org

On Sun, Mar 23, 2014 at 8:35 PM, Harry Putnam <reader@newsguy.com> wrote:

> I haven't experimented further yet, but it was not clear from your
> helpful response if you have actually tried the unformatted and
> formatted versions and found they both work, or not.

I haven’t and I can’t, as I don’t have Xming or Windows. But if Xming
treats equivalent forms of XML differently, it’s a bug in Xming, not
Emacs. Similarly, if Xming writes out the wrong value for
xsi:schemaLocation, it’s a bug in Xming.



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

* Re: Use nxml mode, but without the auto formatting
  2014-03-23 14:24         ` Yuri Khan
@ 2014-03-23 20:09           ` Harry Putnam
  0 siblings, 0 replies; 9+ messages in thread
From: Harry Putnam @ 2014-03-23 20:09 UTC (permalink / raw)
  To: help-gnu-emacs

Yuri Khan <yuri.v.khan@gmail.com> writes:

> On Sun, Mar 23, 2014 at 8:35 PM, Harry Putnam <reader@newsguy.com> wrote:
>
>> I haven't experimented further yet, but it was not clear from your
>> helpful response if you have actually tried the unformatted and
>> formatted versions and found they both work, or not.
>
> I haven’t and I can’t, as I don’t have Xming or Windows. But if Xming
> treats equivalent forms of XML differently, it’s a bug in Xming, not
> Emacs. Similarly, if Xming writes out the wrong value for
> xsi:schemaLocation, it’s a bug in Xming.

OK, I get that.  What my post was asking wasn't anything about any
bugs anywhere... only how to open nXML files without emacs trying to
format them... but still have syntax highlighting.

I'm aware I can go to fundamental-mode to stop any formatting, but of
course, that also kills any syntax highlighting.

So, is there some kind of mode that kills all attempts at formatting, yet
provides syntax highlighting.  Or maybe just how to turn on syntax
highlight for nXML but stay in fundamental-mode?




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

* Re: Use nxml mode, but without the auto formatting
  2014-03-23  2:40   ` Harry Putnam
  2014-03-23  4:14     ` Yuri Khan
@ 2014-03-23 22:19     ` Stefan
  2014-03-24  2:35       ` Harry Putnam
  1 sibling, 1 reply; 9+ messages in thread
From: Stefan @ 2014-03-23 22:19 UTC (permalink / raw)
  To: help-gnu-emacs

> Here is what happens if I hit <enter> after the last '>'.
> ,----
> |    <?xml version="1.0" encoding="utf-8"?>
> |    <XLaunch xmlns="http://www.straightrunning.com/XmingNotes"
> |             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> |             xsi:schemaLocation="http://www.straightrunning.com/XmingNotes
> |                                 XLaunch.xsd" WindowMode="MultiWindow"
> |             ClientMode="StartProgram" Program="xterm -g 84x36 -fg linen -bg
> |                                                DarkSlateGrey -cr Skyblue
> |                                                -fn
> |                                                dec-terminal-medium-r-normal--14-140-75-75-c-80-iso8859-1"
> |             ClientStart="PuTTY" RemoteHost="192.168.1.42"
> |             RemoteUser="reader" Clipboard="true"/>
> `----

Looks like it's simply the result of auto-fill-mode.
AFAICT, nxml does not itself enable auto-fill, so it's probably due to your
enabling auto-fill in nxml-mode, maybe indirectly (by enabling it in
text-mode, which is a parent of nxml-mode).  Try

   (add-hook 'nxml-mode-hook
             (lambda () (auto-fill-mode -1)))


-- Stefan




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

* Re: Use nxml mode, but without the auto formatting
  2014-03-23 22:19     ` Stefan
@ 2014-03-24  2:35       ` Harry Putnam
  0 siblings, 0 replies; 9+ messages in thread
From: Harry Putnam @ 2014-03-24  2:35 UTC (permalink / raw)
  To: help-gnu-emacs

Stefan <monnier@iro.umontreal.ca> writes:

>> Here is what happens if I hit <enter> after the last '>'.
>> ,----
>> |    <?xml version="1.0" encoding="utf-8"?>
>> |    <XLaunch xmlns="http://www.straightrunning.com/XmingNotes"
>> |             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> |             xsi:schemaLocation="http://www.straightrunning.com/XmingNotes
>> |                                 XLaunch.xsd" WindowMode="MultiWindow"
>> |             ClientMode="StartProgram" Program="xterm -g 84x36 -fg linen -bg
>> |                                                DarkSlateGrey -cr Skyblue
>> |                                                -fn
>> |                                                dec-terminal-medium-r-normal--14-140-75-75-c-80-iso8859-1"
>> |             ClientStart="PuTTY" RemoteHost="192.168.1.42"
>> |             RemoteUser="reader" Clipboard="true"/>
>> `----
>
> Looks like it's simply the result of auto-fill-mode.
> AFAICT, nxml does not itself enable auto-fill, so it's probably due to your
> enabling auto-fill in nxml-mode, maybe indirectly (by enabling it in
> text-mode, which is a parent of nxml-mode).  Try
>
>    (add-hook 'nxml-mode-hook
>              (lambda () (auto-fill-mode -1)))

Haa... I was stumbling around the wrong approach.
Nice, thank you sir.




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

end of thread, other threads:[~2014-03-24  2:35 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-07 17:40 Use nxml mode, but without the auto formatting Harry Putnam
2014-03-07 20:41 ` Stefan Monnier
2014-03-23  2:40   ` Harry Putnam
2014-03-23  4:14     ` Yuri Khan
2014-03-23 13:35       ` Harry Putnam
2014-03-23 14:24         ` Yuri Khan
2014-03-23 20:09           ` Harry Putnam
2014-03-23 22:19     ` Stefan
2014-03-24  2:35       ` Harry Putnam

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.