emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: William Henney <whenney@gmail.com>
To: David Maus <dmaus@ictsoc.de>
Cc: emacs-org <emacs-orgmode@gnu.org>
Subject: Re: Two bugs in org-indent (plus a fix to correct one of them)
Date: Tue, 15 Jun 2010 18:10:50 -0500	[thread overview]
Message-ID: <AANLkTil0wFm2TRQpVpX5EhUZ4-dN6GHUPME23wDF5NTn@mail.gmail.com> (raw)
In-Reply-To: <871vc8ftjl.wl%dmaus@ictsoc.de>

Hi David

Thanks for looking at this.

On Tue, Jun 15, 2010 at 6:02 AM, David Maus <dmaus@ictsoc.de> wrote:
> William Henney wrote:
>>Hi all
>
>>1. If one sets org-indent-indentation-per-level to any value other
>>than the default of 2, then the indentation of lines following a
>>heading is not correct. I seem to have managed to fix this by changing
>>line 231 of org-indent.el from
>
>>                n (* (or level 0) org-indent-indentation-per-level))))))))
>
>>to
>
>>                n (+ 2 (* (1- (or level 0)) org-indent-indentation-per-level)))))))))
>
>>Tested with org-indent-indentation-per-level = 0, 1, 2, and 3.
>
> I don't understand this: The original formula sets the indentation
> level of n times org-indent-indentation-per-level with n being the
> outline level.  Why do you consider this not being correct?[1]
>

Consider what one would want to happen when
org-indent-indentation-per-level = 1 (which is what I prefer):

Indentation of 0
* Level one heading
  Indentation of 2
** Level two heading
   Indentation of 3
*** Level three heading
    Indentation of 4

So, the desired sequence of indentation is [0, 2, 3, 4, ...] whereas
the original formula gives the sequence [0, 1, 2, 3, ...]

> [1] Besides, the suggested function does not consider no outline
> level.  I.e. returns negative indentation.

Yes, you are quite right -- my function does indeed return garbage if
you are before the first headline.  However, in practice this is not a
problem since the line-prefix and wrap-prefix text properties only
seem to get applied to text after headlines. But I am sure that the
lisp experts on the list can come up with a more elegant function than
mine.

Cheers

Will


-- 

  Dr William Henney, Centro de Radioastronomía y Astrofísica,
  Universidad Nacional Autónoma de México, Campus Morelia

  reply	other threads:[~2010-06-15 23:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-13  2:44 Two bugs in org-indent (plus a fix to correct one of them) William Henney
2010-06-15 11:02 ` David Maus
2010-06-15 23:10   ` William Henney [this message]
2010-06-15 23:17     ` William Henney
2010-06-18 15:42     ` David Maus
2010-09-23 19:09 ` David Maus

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=AANLkTil0wFm2TRQpVpX5EhUZ4-dN6GHUPME23wDF5NTn@mail.gmail.com \
    --to=whenney@gmail.com \
    --cc=dmaus@ictsoc.de \
    --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).