emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ingo Lohmar <i.lohmar@gmail.com>
To: emacs-orgmode@gnu.org
Subject: [PATCH] fix org-indent-mode for org-indent-indentation-per-level != 2
Date: Sat, 10 Dec 2011 13:33:50 +0200	[thread overview]
Message-ID: <8762hoacf5.fsf@acer.localhost.com> (raw)

Dear All,

After two years with explicit whitespace indentation, I am now a happy
user of org-indent-mode.  But I like org-indent-indentation-per-level
set to 1 (instead of 2), which rendered the indented parts not aligned
with their heading.

In the old thread http://thread.gmane.org/gmane.emacs.orgmode/26169 a
fix for org-indent-add-properties was described, but the thread died
with the implication that this is not a bug, but a matter of style.  I
disagree: the sole purpose of using org-indent-mode is to have the body
text align (no ambiguity here IMO) with its heading.

Below is an updated patch that works with the 7.7 release (sorry for not
using the development version right now).  I have been using this for
weeks without any issues.  As discussed in the above thread, the
calculated indentation is negative before the first heading, but the
function is never actually used there.

Best,
Ingo



--- org-indent.el	2011-12-10 13:18:16.920914213 +0200
+++ org-indent.el	2011-12-10 13:27:42.660937366 +0200
@@ -255,15 +255,15 @@
 		   (aref org-indent-stars nstars)
 		   'wrap-prefix
 		   (aref org-indent-strings
-			 (* (funcall get-real-level e level)
-			    org-indent-indentation-per-level)))))
+       (+ 2 (* (1- (funcall get-real-level e level))
+          org-indent-indentation-per-level))))))
 	  (when (> e b)
 	    (add-text-properties
 	     b  e (list 'line-prefix (aref org-indent-strings n)
 			'wrap-prefix (aref org-indent-strings n))))
 	  (setq b (1+ (point-at-eol))
-		n (* (funcall get-real-level b level)
-		     org-indent-indentation-per-level)))))))
+		n (+ 2 (* (1- (funcall get-real-level b level))
+              org-indent-indentation-per-level))))))))
 
 (defvar org-inlinetask-min-level)
 (defun org-indent-refresh-section ()

             reply	other threads:[~2011-12-10 11:34 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-10 11:33 Ingo Lohmar [this message]
2011-12-11  8:57 ` [PATCH] fix org-indent-mode for org-indent-indentation-per-level != 2 Nicolas Goaziou
2011-12-11 12:32   ` Bastien
2011-12-11 12:59   ` Ingo Lohmar
2011-12-11 13:04     ` Nicolas Goaziou
2011-12-11 13:18       ` Ingo Lohmar
2011-12-11 13:25         ` Nicolas Goaziou
2011-12-11 13:56           ` Ingo Lohmar
2011-12-11 14:01             ` Bastien

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.orgmode.org/

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

  git send-email \
    --in-reply-to=8762hoacf5.fsf@acer.localhost.com \
    --to=i.lohmar@gmail.com \
    --cc=emacs-orgmode@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 public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

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