[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] [PATCH] fix org-indent-mode for org-indent-indentation-per-level !=

From: Ingo Lohmar
Subject: [O] [PATCH] fix org-indent-mode for org-indent-indentation-per-level != 2
Date: Sat, 10 Dec 2011 13:33:50 +0200
User-agent: Notmuch/0.10+57~g3434d19 (http://notmuchmail.org) Emacs/ (x86_64-pc-linux-gnu)

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.


--- 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)
                   (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)
             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 via email to

[Prev in Thread] Current Thread [Next in Thread]