From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: "N. Raghavendra" Newsgroups: gmane.emacs.help Subject: Re: nXML mode indentation Date: Tue, 08 May 2018 13:39:08 +0530 Message-ID: <878t8uwouz.fsf@gmail.com> References: <87a7tedxyb.fsf@gmail.com> <8736z2ydeq.fsf@gmail.com> Reply-To: "N. Raghavendra" NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1525766857 21022 195.159.176.226 (8 May 2018 08:07:37 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 8 May 2018 08:07:37 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue May 08 10:07:33 2018 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fFxen-0005OX-0i for geh-help-gnu-emacs@m.gmane.org; Tue, 08 May 2018 10:07:33 +0200 Original-Received: from localhost ([::1]:49852 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fFxgu-0005QR-7t for geh-help-gnu-emacs@m.gmane.org; Tue, 08 May 2018 04:09:44 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41103) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fFxgT-0005QJ-Et for help-gnu-emacs@gnu.org; Tue, 08 May 2018 04:09:18 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fFxgQ-0008P2-Am for help-gnu-emacs@gnu.org; Tue, 08 May 2018 04:09:17 -0400 Original-Received: from mail-pl0-x22f.google.com ([2607:f8b0:400e:c01::22f]:32847) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fFxgQ-0008Oo-54 for help-gnu-emacs@gnu.org; Tue, 08 May 2018 04:09:14 -0400 Original-Received: by mail-pl0-x22f.google.com with SMTP id w12-v6so1761515plp.0 for ; Tue, 08 May 2018 01:09:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:in-reply-to:references:user-agent:reply-to :mail-followup-to:date:message-id:mime-version; bh=rJfEU4+hMWCs0wA4TGFw0jZUQZTb1JCSe9S7mQfp3Tc=; b=lt5ZfgHd2UTUt+HIxf6YajNncxT710MwQi6KgwgEtbSMlnicFrScQV2qWxrKwwvynA i4s2KSCrYgPhF+J5xOgkRF2eUHcL3+WLHl+0PFW9HnPDNVvH6KJPaa4zsAqgguPFU09R z/pSxETvaC7syVnJoJRsIzTAniEQ2ROHhFBnM9FR9EZ+xJ5FsETv6qeYhJvqZRRLLJSW ZJ5cK5CaV6z+b5QKy5hHEmqigVg9zogTI+sgEMsHfBu6E0K+r1P3flEjhpQojE68USRX Sf6ih9mbBm5XGjN1HvBlserkWyz/xYv8VG4uv22FVgItjp3WTUznfKZgUCUEA6axLKvO jiOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:in-reply-to:references :user-agent:reply-to:mail-followup-to:date:message-id:mime-version; bh=rJfEU4+hMWCs0wA4TGFw0jZUQZTb1JCSe9S7mQfp3Tc=; b=LABa8nfAz937iEEKbb4RgZUGpRTlnQkkVWYPNFh259Oogsvnhgz2eBAGiq8RP58Bri BUeD/sNfiljMVUW3nfNIMjGJ0i+WqLZCwCKTEXvdc6mis0xLhg8cfamOCXnP96W13Ujd QYWECrtfSw+4WRwfMf9DznsZmWuR3+8NT0iL3o+TtkND/3AKdpuxe2bWFq6wOxNQ5QlK EDgLUjsN9X9M2QwilqOsWZT4BRnJMIHk/shbM1kq2fw13Y+BPD8f/L6JeUJUuEkyhxhE jRKOBhnnF8bsDLlG+fEkXW6AI1eRqLiDPG+Z8suiMloY2Iy3DixlkZm2nedsGTo//7RI 0IXg== X-Gm-Message-State: ALQs6tCtPFyCzwQAQdpMPD1SKZ2ux/0KEXQGN109d0vaBBCXU5EgP2qG u0zKbi6uwqBuno7oEvzJlzzFvQ== X-Google-Smtp-Source: AB8JxZo4Z3cYtOyuU3h77dbmOg1txou5DdEvhVUgqUW1qQXUSUHjOfF42KrvdALh6VuXg4pI0vmoCQ== X-Received: by 2002:a17:902:8685:: with SMTP id g5-v6mr13836640plo.302.1525766953074; Tue, 08 May 2018 01:09:13 -0700 (PDT) Original-Received: from ailuros ([14.139.59.140]) by smtp.gmail.com with ESMTPSA id s4-v6sm37165537pgp.35.2018.05.08.01.09.11 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 May 2018 01:09:12 -0700 (PDT) In-Reply-To: <8736z2ydeq.fsf@gmail.com> (N. Raghavendra's message of "Tue, 08 May 2018 10:03:33 +0530") Mail-Followup-To: help-gnu-emacs@gnu.org X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c01::22f X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:116688 Archived-At: At 2018-05-08T10:03:33+05:30, N. Raghavendra wrote: > It looks like `nxml-compute-indent-from-previous-line' in nxml-mode.el > is relevant, but I can't see how to modify or advise it. I have made some progress, with this function. I tried changing the definition of `nxml-compute-indent-from-previous-line' as follows: ---------- diff --git a/lisp/nxml/nxml-mode.el b/lisp/nxml/nxml-mode.el index e2b51bc..f2e185e 100644 --- a/lisp/nxml/nxml-mode.el +++ b/lisp/nxml/nxml-mode.el @@ -1377,10 +1377,17 @@ nxml-compute-indent-from-previous-line (nxml-compute-indent-in-token bol)))) (skip-chars-forward " \t\r\n")) (goto-char ref) - (+ (current-column) - (* nxml-child-indent - (+ (if (eq before-context 'start-tag) 1 0) - (if (eq after-context 'end-tag) -1 0)))))))) + (message "bc=%s ac=%s" before-context after-context) + (cond ((and (eq before-context 'mixed) + (eq after-context 'markup)) + (+ (current-column) nxml-child-indent)) + ((and (eq before-context 'markup) + (eq after-context 'markup)) + (current-column)) + (t (+ (current-column) + (* nxml-child-indent + (+ (if (eq before-context 'start-tag) 1 0) + (if (eq after-context 'end-tag) -1 0)))))))))) (defun nxml-merge-indent-context-type (context) "Merge the indent context type CONTEXT with the token in `xmltok-type'. ---------- This almost gives me the indentation that I want, as in, ----------
Kant lipsum Let us suppose that the noumena have nothing to do with necessity, since knowledge of the Categories is a posteriori. Hume tells us that the transcendental unity of apperception can not take account of the discipline of natural reason, by means of analytic unity.
---------- The only thing is that the last line in the para, the one starting with "analytic", is not indented as I want it. It should be indented to the same column as the previous line, the one starting with "not". I have put (message "bc=%s ac=%s" before-context after-context) to give me some idea of what is happening. However, it does not produce any message when I go to the troublesome last line of the para, and press tab. I'd appreciate if someone can help with this problem. If it is better off on emacs-devel, I'll move it there. Thanks, Raghu. -- N. Raghavendra , http://www.retrotexts.net/ Harish-Chandra Research Institute, http://www.hri.res.in/