From: Steinar Bang <sb@dod.no>
To: help-gnu-emacs@gnu.org
Subject: Comment indentation problems in nxml
Date: Sun, 11 Nov 2018 15:51:45 +0100 [thread overview]
Message-ID: <86r2frhdku.fsf@dod.no> (raw)
Emacs version: GNU Emacs 25.1.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.11) of 2017-09-15, modified by Debian
(I'm using the version of nxml delivered with emacs)
I recently changed the copyright headers in XML files in one of my
projects from the massive
<!-- Copyright 2018 Steinar Bang -->
<!-- -->
<!-- Licensed under the Apache License, Version 2.0 (the "License"); -->
<!-- you may not use this file except in compliance with the License. -->
<!-- You may obtain a copy of the License at -->
<!-- http://www.apache.org/licenses/LICENSE-2.0 -->
<!-- Unless required by applicable law or agreed to in writing, -->
<!-- software distributed under the License is distributed on an "AS IS" BASIS, -->
<!-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -->
<!-- See the License for the specific language governing permissions and limitations -->
<!-- under the License. -->
to the more "airy" an (I think) estetic
<!--
Copyright 2018 Steinar Bang
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and limitations
under the License.
-->
However, this doesn't play well with my formatting fixup function:
(defun ide-fix ()
"Remove trailing spaces and fix indentation"
(interactive)
(save-excursion
(goto-char (point-min))
(replace-regexp "[ \t]+$" "")
(goto-char (point-min))
(replace-string "\t" " ")
(indent-region (point-min) (point-max))))
After running "ide-fix", the indentation of the first line is kept, but
all of the other lines are moved to the left margin:
<!--
Copyright 2018 Steinar Bang
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and limitations
under the License.
-->
Is it possible to make nxml preserve the original indentation in these
comments?
(Or should I just bite the bullet and go back to the old copyright
headers?)
Thanks!
- Steinar
next reply other threads:[~2018-11-11 14:51 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-11 14:51 Steinar Bang [this message]
2018-11-13 10:55 ` Comment indentation problems in nxml Andreas Röhler
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86r2frhdku.fsf@dod.no \
--to=sb@dod.no \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).