all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Andreas Röhler" <andreas.roehler@easy-emacs.de>
To: help-gnu-emacs@gnu.org
Subject: Re: Comment indentation problems in nxml
Date: Tue, 13 Nov 2018 11:55:45 +0100	[thread overview]
Message-ID: <9a3fa0ee-ab3c-dae6-ed9d-302f9df0d01c@easy-emacs.de> (raw)
In-Reply-To: <86r2frhdku.fsf@dod.no>

On 11.11.2018 15:51, Steinar Bang wrote:
> 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
> 



In ide-fix

replacing

  (replace-string "\t" " ")

bei a call like of untabify, for example

(untabify (point-min) (point-max))

would keep indent and might help.



      reply	other threads:[~2018-11-13 10:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-11 14:51 Comment indentation problems in nxml Steinar Bang
2018-11-13 10:55 ` Andreas Röhler [this message]

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9a3fa0ee-ab3c-dae6-ed9d-302f9df0d01c@easy-emacs.de \
    --to=andreas.roehler@easy-emacs.de \
    --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.
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.