unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* nXML mode word separators
@ 2019-02-07 14:58 Skip Montanaro
  2019-02-07 15:23 ` Robert Pluim
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Skip Montanaro @ 2019-02-07 14:58 UTC (permalink / raw)
  To: Help GNU Emacs

I unfortunately have to work with handwritten XML which is used to
define complex application configs. In that context, apostrophes are
valid string delimiters, at least in whatever XML pseudo-dialect these
files are written in. So, both of these snippets mean the same thing:

<Env INST="2" />
<Env INST='2' />

I'm not in any sort of position to dictate any changes, so I need to
adapt. So, forward-word currently skips over apostrophes (considering
them word characters) and kill-word (even worse) deletes them. It has
probably been a decade since I fiddled with syntax tables. How do I
move apostrophes from word class to quotation(?) class in the relevant
syntax table? FWIW, when editing XML files I seem to be in nxml-mode
(nothing I enabled specifically, must just be the default mode).

Thanks,

Skip Montanaro



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

* Re: nXML mode word separators
  2019-02-07 14:58 nXML mode word separators Skip Montanaro
@ 2019-02-07 15:23 ` Robert Pluim
  2019-02-07 17:39   ` Skip Montanaro
  2019-02-07 15:34 ` Noam Postavsky
  2019-02-08 14:59 ` Stefan Monnier
  2 siblings, 1 reply; 6+ messages in thread
From: Robert Pluim @ 2019-02-07 15:23 UTC (permalink / raw)
  To: Skip Montanaro; +Cc: Help GNU Emacs

Skip Montanaro <skip.montanaro@gmail.com> writes:

> I unfortunately have to work with handwritten XML which is used to
> define complex application configs. In that context, apostrophes are
> valid string delimiters, at least in whatever XML pseudo-dialect these
> files are written in. So, both of these snippets mean the same thing:
>
> <Env INST="2" />
> <Env INST='2' />
>
> I'm not in any sort of position to dictate any changes, so I need to
> adapt. So, forward-word currently skips over apostrophes (considering
> them word characters) and kill-word (even worse) deletes them. It has
> probably been a decade since I fiddled with syntax tables. How do I
> move apostrophes from word class to quotation(?) class in the relevant
> syntax table? FWIW, when editing XML files I seem to be in nxml-mode
> (nothing I enabled specifically, must just be the default mode).
>

(add-hook 'nxml-mode-hook 
          (lambda ()
            (modify-syntax-entry ?' "\"")))

Robert



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

* Re: nXML mode word separators
  2019-02-07 14:58 nXML mode word separators Skip Montanaro
  2019-02-07 15:23 ` Robert Pluim
@ 2019-02-07 15:34 ` Noam Postavsky
  2019-02-07 15:53   ` Robert Pluim
  2019-02-08 14:59 ` Stefan Monnier
  2 siblings, 1 reply; 6+ messages in thread
From: Noam Postavsky @ 2019-02-07 15:34 UTC (permalink / raw)
  To: Skip Montanaro; +Cc: Help GNU Emacs

On Thu, 7 Feb 2019 at 10:02, Skip Montanaro <skip.montanaro@gmail.com> wrote:

> both of these snippets mean the same thing:
>
> <Env INST="2" />
> <Env INST='2' />

This is standard XML, so if there is some trouble with it perhaps a
change to nxml-mode is warranted.



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

* Re: nXML mode word separators
  2019-02-07 15:34 ` Noam Postavsky
@ 2019-02-07 15:53   ` Robert Pluim
  0 siblings, 0 replies; 6+ messages in thread
From: Robert Pluim @ 2019-02-07 15:53 UTC (permalink / raw)
  To: Noam Postavsky; +Cc: Skip Montanaro, Help GNU Emacs

Noam Postavsky <npostavs@gmail.com> writes:

> On Thu, 7 Feb 2019 at 10:02, Skip Montanaro <skip.montanaro@gmail.com> wrote:
>
>> both of these snippets mean the same thing:
>>
>> <Env INST="2" />
>> <Env INST='2' />
>
> This is standard XML, so if there is some trouble with it perhaps a
> change to nxml-mode is warranted.

I think 'sgml-specials' in sgml-mode is to blame here.

should fi



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

* Re: nXML mode word separators
  2019-02-07 15:23 ` Robert Pluim
@ 2019-02-07 17:39   ` Skip Montanaro
  0 siblings, 0 replies; 6+ messages in thread
From: Skip Montanaro @ 2019-02-07 17:39 UTC (permalink / raw)
  To: Robert Pluim; +Cc: Help GNU Emacs

> (add-hook 'nxml-mode-hook
>           (lambda ()
>             (modify-syntax-entry ?' "\"")))

Thanks, Robert. This worked perfectly. I will leave discussion of
broader issues related to nxml-mode and sqml-mode to the experts,
though it does seem that if apostrophes are valid quote string
delimiters everywhere, they should be treated syntactically like
quotation marks.


Skip



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

* Re: nXML mode word separators
  2019-02-07 14:58 nXML mode word separators Skip Montanaro
  2019-02-07 15:23 ` Robert Pluim
  2019-02-07 15:34 ` Noam Postavsky
@ 2019-02-08 14:59 ` Stefan Monnier
  2 siblings, 0 replies; 6+ messages in thread
From: Stefan Monnier @ 2019-02-08 14:59 UTC (permalink / raw)
  To: help-gnu-emacs

> I unfortunately have to work with handwritten XML which is used to
> define complex application configs. In that context, apostrophes are
> valid string delimiters, at least in whatever XML pseudo-dialect these
> files are written in. So, both of these snippets mean the same thing:
>
> <Env INST="2" />
> <Env INST='2' />
>
> I'm not in any sort of position to dictate any changes, so I need to
> adapt. So, forward-word currently skips over apostrophes (considering
> them word characters) and kill-word (even worse) deletes them.

Word operations are not meant to be sensitive to the major mode, so it's
not a bug for them to behave differently for ' and " here (and this is
a matter of personal preference and hence local customization).

OTOH, syntax-aware operations (such as highlighting, indentation, and
things like that) should not get confused by such a difference since
both are valid XML and equivalent.

So, if the problem you describe only affects word operations, go ahead
and customize them to your heart's content, but if it also affects
syntax-aware operations, please report it as a bug.


        Stefan




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

end of thread, other threads:[~2019-02-08 14:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-07 14:58 nXML mode word separators Skip Montanaro
2019-02-07 15:23 ` Robert Pluim
2019-02-07 17:39   ` Skip Montanaro
2019-02-07 15:34 ` Noam Postavsky
2019-02-07 15:53   ` Robert Pluim
2019-02-08 14:59 ` Stefan Monnier

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