Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6928327

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:10:21+00:00 2026-05-27T11:10:21+00:00

As some of you who use GNU/Emacs to develop for Android, you are surely

  • 0

As some of you who use GNU/Emacs to develop for Android, you are surely aware that the latest Android Tools introduces a new xml formatter. I use the excellent nxml-mode to edit xml since… I edit xml files 😉 and I’m pretty happy with it BUT… as I can customize the Nxml Attribute Indent variable, the documentation says:

Indentation for the attributes of an element relative to the start-tag. Hide   
This only applies when the first attribute of a tag starts a line.
In other cases, the first attribute on one line is indented the same
as the first attribute on the previous line.

What matters there is the fallback for which a standalone attribute is aligned on the first attribute when this one is on the same line that the element.

Is this possible to change that behavior, in order to obtain a Android Tools compatible indentation? I just found nothing in the documentation and googling failed…

Update:

The comment helps me to realize that I’m not clear. Thus, here is an example of what nxml-mode does by default:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="org.foo.bar"
          android:versionCode="1"
          android:versionName="1.0">

  <uses-sdk android:minSdkVersion="8" />
  <application
      android:label="@string/app_name"
      android:icon="@drawable/ic_launcher">

    <activity
        android:name="Foo"
        android:label="@string/foo" />

    <activity android:name="Bar"
              android:label="@string/bar" />

  </application>

</manifest>

What I would like to get:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="org.foo.bar"
    android:versionCode="1"
    android:versionName="1.0">

  <uses-sdk android:minSdkVersion="8" />
  <application
      android:label="@string/app_name"
      android:icon="@drawable/ic_launcher">

    <activity
        android:name="Foo"
        android:label="@string/foo" />

    <activity android:name="Bar"
        android:label="@string/bar" />

  </application>

</manifest>

First case (default nxml-mode indentation behavior):

  • the package attribute of the manifest element is aligned with the xmlns:android decl
  • the android:label attribute of the Bar activity element is aligned with the android:name element.

Second case (intended result):

  • the package attribute of the manifest element is aligned with the parent manifest element plus a configurable number of spaces
  • the android:label attribute of the Bar activity element is aligned with the parent element plus a configurable number of spaces

I have browsed the nxml-mode source code and the indentation behavior begins with nxml-indent-line but I failed to follow the many subcalls to see what defun should be customized… due to my lack of lisp knowledge.

You could see that the manifest second attribute is not aligned with the first

Cheers,

Renaud (hardly managing the massive headache to conform with the Android coding and formatting rules)

  • 0 0 Answers
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T11:10:22+00:00Added an answer on May 27, 2026 at 11:10 am

    doesn’t look like that behavior is easily modifiable, as it appears to be hard coded into the nxml-compute-indent-in-start-tag function. the relevant chunk of code appears to be this:

                  (let* ((att (car atts))
                         (start (xmltok-attribute-name-start att)))
                    (when (< start pos)
                      (goto-char start)
                      (setq off 0))))
    

    you could always copy that method into your own init file, comment those lines out, and load your function definition after nxml mode loads (which will override the original implementation).

    Note, you might also want to submit an enhancement request to the gnu emacs maintainers to make this behavior easily customizable in the future.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have seen some Apps and Websites who use Data from the Android Play
We have some devs on Android part of our application who actively use prefixing
I know of some people who use git pull --rebase by default and others
For some reason everyone who upgrades their Flash Player to the latest version (10,0,32,18)
I've created some new fields for users who register in admin/config/people/profile since we are
I've people who use [variable release] and some other times variable = nil to
I support users who use MS Access as a front-end for viewing some Oracle
This question is, as indicated, for those who use Emacs. When you do, do
I'd like to create a new InstantRails-type app for Rails developers who use Windows.
is there anyone who makes use of the Microsoft Open XML SDK 2.0 for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.