emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] fix org-indent-mode for org-indent-indentation-per-level != 2
@ 2011-12-10 11:33 Ingo Lohmar
  2011-12-11  8:57 ` Nicolas Goaziou
  0 siblings, 1 reply; 9+ messages in thread
From: Ingo Lohmar @ 2011-12-10 11:33 UTC (permalink / raw)
  To: emacs-orgmode

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2011-12-11 14:00 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-10 11:33 [PATCH] fix org-indent-mode for org-indent-indentation-per-level != 2 Ingo Lohmar
2011-12-11  8:57 ` 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

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