From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ingo Lohmar Subject: [PATCH] fix org-indent-mode for org-indent-indentation-per-level != 2 Date: Sat, 10 Dec 2011 13:33:50 +0200 Message-ID: <8762hoacf5.fsf@acer.localhost.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([140.186.70.92]:52420) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RZLBq-0004Q5-Mz for emacs-orgmode@gnu.org; Sat, 10 Dec 2011 06:34:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RZLBp-0002Qs-HZ for emacs-orgmode@gnu.org; Sat, 10 Dec 2011 06:34:02 -0500 Received: from mail-ey0-f169.google.com ([209.85.215.169]:33758) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RZLBp-0002Qc-6v for emacs-orgmode@gnu.org; Sat, 10 Dec 2011 06:34:01 -0500 Received: by eaai13 with SMTP id i13so89820eaa.0 for ; Sat, 10 Dec 2011 03:33:59 -0800 (PST) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org 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 ()