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

* Re: [PATCH] fix org-indent-mode for org-indent-indentation-per-level != 2
  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
  0 siblings, 2 replies; 9+ messages in thread
From: Nicolas Goaziou @ 2011-12-11  8:57 UTC (permalink / raw)
  To: Ingo Lohmar; +Cc: emacs-orgmode

Hello,

Ingo Lohmar <i.lohmar@gmail.com> writes:

> Below is an updated patch that works with the 7.7 release (sorry for not
> using the development version right now).

org-indent.el has been heavily modified since 7.7 release. You may want
to test development version first, as your patch might not be necessary
anymore.


Regards,

-- 
Nicolas Goaziou

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

* Re: [PATCH] fix org-indent-mode for org-indent-indentation-per-level != 2
  2011-12-11  8:57 ` Nicolas Goaziou
@ 2011-12-11 12:32   ` Bastien
  2011-12-11 12:59   ` Ingo Lohmar
  1 sibling, 0 replies; 9+ messages in thread
From: Bastien @ 2011-12-11 12:32 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Ingo Lohmar, emacs-orgmode

Hi,

Nicolas Goaziou <n.goaziou@gmail.com> writes:

> Ingo Lohmar <i.lohmar@gmail.com> writes:
>
>> Below is an updated patch that works with the 7.7 release (sorry for not
>> using the development version right now).
>
> org-indent.el has been heavily modified since 7.7 release. You may want
> to test development version first, as your patch might not be necessary
> anymore.

I did try to apply the patch and it failed.  

Ingo, please try the latest org-indent.el version.  

Best,

-- 
 Bastien

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

* Re: [PATCH] fix org-indent-mode for org-indent-indentation-per-level != 2
  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
  1 sibling, 1 reply; 9+ messages in thread
From: Ingo Lohmar @ 2011-12-11 12:59 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode

On Sun, 11 Dec 2011 09:57:50 +0100, Nicolas Goaziou <n.goaziou@gmail.com> wrote:
> Hello,
> 
> Ingo Lohmar <i.lohmar@gmail.com> writes:
> 
> > Below is an updated patch that works with the 7.7 release (sorry for not
> > using the development version right now).
> 
> org-indent.el has been heavily modified since 7.7 release. You may want
> to test development version first, as your patch might not be necessary
> anymore.

Hi Nicolas,

My bad, and bad timing: Should have checked the development status.
Turns out, it is very different now, but unfortunately still wrong.  I
will check how to fix it and come back (hopefully) with a new patch.

Regards,
Ingo

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

* Re: [PATCH] fix org-indent-mode for org-indent-indentation-per-level != 2
  2011-12-11 12:59   ` Ingo Lohmar
@ 2011-12-11 13:04     ` Nicolas Goaziou
  2011-12-11 13:18       ` Ingo Lohmar
  0 siblings, 1 reply; 9+ messages in thread
From: Nicolas Goaziou @ 2011-12-11 13:04 UTC (permalink / raw)
  To: Ingo Lohmar; +Cc: emacs-orgmode

Ingo Lohmar <i.lohmar@gmail.com> writes:

> My bad, and bad timing: Should have checked the development status.
> Turns out, it is very different now, but unfortunately still wrong.

Unless I'm missing your point, I don't see anything wrong in the current
behaviour. Whatever may be the value of
`org-indent-indentation-per-level', the text is always aligned with the
headline.


Regards,

-- 
Nicolas Goaziou

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

* Re: [PATCH] fix org-indent-mode for org-indent-indentation-per-level != 2
  2011-12-11 13:04     ` Nicolas Goaziou
@ 2011-12-11 13:18       ` Ingo Lohmar
  2011-12-11 13:25         ` Nicolas Goaziou
  0 siblings, 1 reply; 9+ messages in thread
From: Ingo Lohmar @ 2011-12-11 13:18 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode

On Sun, 11 Dec 2011 14:04:38 +0100, Nicolas Goaziou <n.goaziou@gmail.com> wrote:
> Ingo Lohmar <i.lohmar@gmail.com> writes:
> 
> > My bad, and bad timing: Should have checked the development status.
> > Turns out, it is very different now, but unfortunately still wrong.
> 
> Unless I'm missing your point, I don't see anything wrong in the current
> behaviour. Whatever may be the value of
> `org-indent-indentation-per-level', the text is always aligned with the
> headline.

Hmmm, just did a clean test:  emacs -Q, require org-install and org-indent.

If I use the std setting of 2 and turn on org-indent-mode, all is fine:

* 1st-level heading
  Here goes the text.
*** 2nd-level heading
    More text.

Setting the indentation to 1:
   
* 1st-level heading
 Here goes the text.
** 2nd-level heading
  More text.

That is, missing one space.  Will check again.
  

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

* Re: [PATCH] fix org-indent-mode for org-indent-indentation-per-level != 2
  2011-12-11 13:18       ` Ingo Lohmar
@ 2011-12-11 13:25         ` Nicolas Goaziou
  2011-12-11 13:56           ` Ingo Lohmar
  0 siblings, 1 reply; 9+ messages in thread
From: Nicolas Goaziou @ 2011-12-11 13:25 UTC (permalink / raw)
  To: Ingo Lohmar; +Cc: emacs-orgmode

Ingo Lohmar <i.lohmar@gmail.com> writes:

> Hmmm, just did a clean test:  emacs -Q, require org-install and org-indent.
>
> If I use the std setting of 2 and turn on org-indent-mode, all is fine:
>
> * 1st-level heading
>   Here goes the text.
> *** 2nd-level heading
>     More text.
>
> Setting the indentation to 1:
>    
> * 1st-level heading
>  Here goes the text.
> ** 2nd-level heading
>   More text.

I cannot reproduce this. Could you try to byte-compile again all Org
files, or call org-reload with an argument?


Regards,

-- 
Nicolas Goaziou

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

* Re: [PATCH] fix org-indent-mode for org-indent-indentation-per-level != 2
  2011-12-11 13:25         ` Nicolas Goaziou
@ 2011-12-11 13:56           ` Ingo Lohmar
  2011-12-11 14:01             ` Bastien
  0 siblings, 1 reply; 9+ messages in thread
From: Ingo Lohmar @ 2011-12-11 13:56 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode

On Sun, 11 Dec 2011 14:25:11 +0100, Nicolas Goaziou <n.goaziou@gmail.com> wrote:
> Ingo Lohmar <i.lohmar@gmail.com> writes:
> 
> > Hmmm, just did a clean test:  emacs -Q, require org-install and org-indent.
> >
> > If I use the std setting of 2 and turn on org-indent-mode, all is fine:
> >
> > * 1st-level heading
> >   Here goes the text.
> > *** 2nd-level heading
> >     More text.
> >
> > Setting the indentation to 1:
> >    
> > * 1st-level heading
> >  Here goes the text.
> > ** 2nd-level heading
> >   More text.
> 
> I cannot reproduce this. Could you try to byte-compile again all Org
> files, or call org-reload with an argument?

Guys,

I am terribly sorry --- my apologies for the noise.  I had an issue with
shadowed load paths.  From what I can see, org-indent works just fine in
the development version.

Learned one or two things :)

Regards,
Ingo

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

* Re: [PATCH] fix org-indent-mode for org-indent-indentation-per-level != 2
  2011-12-11 13:56           ` Ingo Lohmar
@ 2011-12-11 14:01             ` Bastien
  0 siblings, 0 replies; 9+ messages in thread
From: Bastien @ 2011-12-11 14:01 UTC (permalink / raw)
  To: Ingo Lohmar; +Cc: emacs-orgmode, Nicolas Goaziou

Ingo Lohmar <i.lohmar@gmail.com> writes:

> I am terribly sorry --- my apologies for the noise.  I had an issue with
> shadowed load paths.  From what I can see, org-indent works just fine in
> the development version.

That's good news :)  Thanks for confirming,

-- 
 Bastien

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