Re: Where does headline data end for the purpose of `org-adapt-indentation´ == ´headline-data

2023-06-14 Thread Jens Schmidt

On 2023-06-09  09:34, Ihor Radchenko wrote:


Emacs master tracks the latest stable Org release.


OK, so I cobbled up Org main with branch emacs-29.

./src/emacs -Q

M-x org-version

Org mode version 9.7-pre (release_9.6.6-408-g9082fa @ ...)

(setq org-adapt-indentation 'headline-data)

Paste the following into a new org file, headline A being the on the
first line:

 snip 
** Headline A



** Headline B



** Headline C
   :properties:
 snip 

Then try TAB on lines (my humble opinion in parentheses)

2: no indent (NOK)
3: no indent (OK)
6: indent (OK)
7: indent (NOK)
11: no indent (NOK)

I could try "fixing" that, but I'm not sure what is intended an what not.

WDYT?




Re: Where does headline data end for the purpose of `org-adapt-indentation´ == ´headline-data

2023-06-11 Thread Farblos

On 2023-06-11  12:21, Ihor Radchenko wrote:


This is a bug. Fixed now, on main.


Thanks!





Re: Where does headline data end for the purpose of `org-adapt-indentation´ == ´headline-data

2023-06-11 Thread Ihor Radchenko
Jens Schmidt  writes:

> (setq org-adapt-indentation 'headline-data)
>
> Paste the following into a new org file, headline A being the on the
> first line:
>
>  snip 
> ** Headline A
>
>
>
> ** Headline B
>
>
>
> ** Headline C
> :properties:
>  snip 
>
> Then try TAB on lines (my humble opinion in parentheses)
>
> 2: no indent (NOK)

This is right:

`org-adapt-indentation' docstring states

When this variable is set to headline-data, Org only adapts the
indentation of the data lines right below the headline, such as
planning/clock lines and property/logbook drawers.

Blank line is not a planning/clock/line/property drawer/logbook.
So, we do not indent.

> 6: indent (OK)
> 7: indent (NOK)

This is a bug. Fixed now, on main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=34082ff18

The logic in `org-indent-line' did not account for blank lines after heading.

> 11: no indent (NOK)

This is also OK. ":properties:", from Org's point of view is not a
property drawer, but a paragraph (there is no closing :end: and property
values inside). So, it is not a headline data.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: Where does headline data end for the purpose of `org-adapt-indentation´ == ´headline-data

2023-06-10 Thread Farblos

On 2023-06-10  22:47, Farblos wrote:

Hang on, that test case is not really clean yet ... -Q disabled my 
load-path additions, of course ... will give it another try ...


No, the test case is good and exactly as described in the mail before 
the previous one, even with "emacs -Q".


Thanks




Re: Where does headline data end for the purpose of `org-adapt-indentation´ == ´headline-data

2023-06-10 Thread Farblos




On 2023-06-10  22:39, Jens Schmidt wrote:


OK, so I cobbled up Org main with branch emacs-29.


Hang on, that test case is not really clean yet ... -Q disabled my 
load-path additions, of course ... will give it another try ...


Sorry.



Re: Where does headline data end for the purpose of `org-adapt-indentation´ == ´headline-data

2023-06-09 Thread Ihor Radchenko
Farblos  writes:

>> Note that we had some bugs in this area in older Org versions.
>
> I happen to have master from git://git.savannah.gnu.org/emacs.git
> checked out here.  How recent is that w.r.t. "bleeding edge Org" from
> git://git.savannah.gnu.org/emacs/org-mode.git?  I haven't found anything
> on that in the Org FAQ https://orgmode.org/worg/org-faq.html.

Emacs master tracks the latest stable Org release.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: Where does headline data end for the purpose of `org-adapt-indentation´ == ´headline-data

2023-06-08 Thread Farblos

Thanks for the clarification.

On 2023-06-08  13:17, Ihor Radchenko wrote:


Note that we had some bugs in this area in older Org versions.


I happen to have master from git://git.savannah.gnu.org/emacs.git
checked out here.  How recent is that w.r.t. "bleeding edge Org" from
git://git.savannah.gnu.org/emacs/org-mode.git?  I haven't found anything
on that in the Org FAQ https://orgmode.org/worg/org-faq.html.



Re: Where does headline data end for the purpose of `org-adapt-indentation´ == ´headline-data

2023-06-08 Thread Ihor Radchenko
Farblos  writes:

> I like the idea of org-adapt-indentation being ´headline-data:
>
>When this variable is set to ‘headline-data’, Org only adapts the
>indentation of the data lines right below the headline, such as
>planning/clock lines and property/logbook drawers.
>
> However, I find the resulting indentation behavior confusing.  Before
> reporting bugs, I'd like to know where the headline data ends.  I'd
> expect that the first blank (or whitespace-only?) line after a headline
> would end the headline data.

(defun org--at-headline-data-p ( beg element)
  "Return non-nil when `point' or BEG is inside headline metadata.

Metadata is planning line, properties drawer, logbook drawer right
after property drawer, or clock log line immediately following
properties drawer/planning line/ heading.

Hope it clarifies things.

Note that we had some bugs in this area in older Org versions.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Where does headline data end for the purpose of `org-adapt-indentation´ == ´headline-data

2023-06-08 Thread Farblos

I like the idea of org-adapt-indentation being ´headline-data:

  When this variable is set to ‘headline-data’, Org only adapts the
  indentation of the data lines right below the headline, such as
  planning/clock lines and property/logbook drawers.

However, I find the resulting indentation behavior confusing.  Before
reporting bugs, I'd like to know where the headline data ends.  I'd
expect that the first blank (or whitespace-only?) line after a headline
would end the headline data.

Below are some examples where to I think headline data expands ("<==" 
pointing to point, underscore indicating trailing blanks).  Probably 
somebody could correct or confirm.


Thanks!

** Headline 1
<== in headline data ==

** Headline 2
   :properties:
   <== in headline data ==

** Headline 3
   :properties:
   :custom_id: foo
   :end:
   :logbook:
   clock: [2023-06-08 Thu 12:34]--[2023-06-08 Thu 12:36] =>  0:02
   :end:
   <== in headline data ==

** Headline 4
   :properties:

<== out of headline data

** Headline 5
   :properties:
___
<== out of headline data (previous line containing three blanks)