emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [BUG] org-lint: Spurious warning from 'misplaced-heading lint-checker [9.7.2 (release_N/A-N/A-88dd2c @ /home/user/.emacs.d/elpa/org-9.7.2/)]
@ 2024-06-04 18:42 Suhail Singh
  2024-06-05 13:14 ` Ihor Radchenko
  0 siblings, 1 reply; 9+ messages in thread
From: Suhail Singh @ 2024-06-04 18:42 UTC (permalink / raw)
  To: emacs-orgmode


Remember to cover the basics, that is, what you expected to happen and
what in fact did happen.  You don't know how to make a good report?  See

     https://orgmode.org/manual/Feedback.html#Feedback

Your bug report will be posted to the Org mailing list.
------------------------------------------------------------------------

When there is, say, an "example" result block that is indented (i.e.,
the entire block including the delimiters is indented) and it contains
some asterisks in the middle, org-lint considers it to be a possible
case of misplaced-heading.  Case in point:

#+begin_src org
  - Some words
    ,#+begin_example
      this is a line with asterisks** in the middle
    ,#+end_example
#+end_src

The lint check should guard against occurrences that happen within code
blocks.

Emacs  : GNU Emacs 29.3 (build 2, x86_64-suse-linux-gnu, GTK+ Version 3.24.41, cairo version 1.18.0)
Package: Org mode version 9.7.2 (release_N/A-N/A-88dd2c @ /home/user/.emacs.d/elpa/org-9.7.2/)
-- 
Suhail


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

* Re: [BUG] org-lint: Spurious warning from 'misplaced-heading lint-checker [9.7.2 (release_N/A-N/A-88dd2c @ /home/user/.emacs.d/elpa/org-9.7.2/)]
  2024-06-04 18:42 [BUG] org-lint: Spurious warning from 'misplaced-heading lint-checker [9.7.2 (release_N/A-N/A-88dd2c @ /home/user/.emacs.d/elpa/org-9.7.2/)] Suhail Singh
@ 2024-06-05 13:14 ` Ihor Radchenko
  2024-06-07  0:01   ` Suhail Singh
  0 siblings, 1 reply; 9+ messages in thread
From: Ihor Radchenko @ 2024-06-05 13:14 UTC (permalink / raw)
  To: Suhail Singh; +Cc: emacs-orgmode

"Suhail Singh" <suhailsingh247@gmail.com> writes:

> When there is, say, an "example" result block that is indented (i.e.,
> the entire block including the delimiters is indented) and it contains
> some asterisks in the middle, org-lint considers it to be a possible
> case of misplaced-heading.  Case in point:
>
> #+begin_src org
>   - Some words
>     ,#+begin_example
>       this is a line with asterisks** in the middle
>     ,#+end_example
> #+end_src
>
> The lint check should guard against occurrences that happen within code
> blocks.

Makes sense.
Fixed, on bugfix.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=b8497aa7f

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


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

* Re: [BUG] org-lint: Spurious warning from 'misplaced-heading lint-checker [9.7.2 (release_N/A-N/A-88dd2c @ /home/user/.emacs.d/elpa/org-9.7.2/)]
  2024-06-05 13:14 ` Ihor Radchenko
@ 2024-06-07  0:01   ` Suhail Singh
  2024-06-07 14:54     ` Ihor Radchenko
  0 siblings, 1 reply; 9+ messages in thread
From: Suhail Singh @ 2024-06-07  0:01 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Suhail Singh, emacs-orgmode

Ihor Radchenko <yantar92@posteo.net> writes:

> "Suhail Singh" <suhailsingh247@gmail.com> writes:
>
>> When there is, say, an "example" result block that is indented (i.e.,
>> the entire block including the delimiters is indented) and it contains
>> some asterisks in the middle, org-lint considers it to be a possible
>> case of misplaced-heading.  Case in point:
>>
>> #+begin_src org
>>   - Some words
>>     ,#+begin_example
>>       this is a line with asterisks** in the middle
>>     ,#+end_example
>> #+end_src
>>
>> The lint check should guard against occurrences that happen within code
>> blocks.
>
> Makes sense.
> Fixed, on bugfix.
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=b8497aa7f

This doesn't seem fixed as of 9.7.3 (the MRE above still shows spurious
warning).  It seems that org-at-block-p returns nil when point is within
the block.

-- 
Suhail


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

* Re: [BUG] org-lint: Spurious warning from 'misplaced-heading lint-checker [9.7.2 (release_N/A-N/A-88dd2c @ /home/user/.emacs.d/elpa/org-9.7.2/)]
  2024-06-07  0:01   ` Suhail Singh
@ 2024-06-07 14:54     ` Ihor Radchenko
  2024-06-07 16:03       ` Suhail Singh
  0 siblings, 1 reply; 9+ messages in thread
From: Ihor Radchenko @ 2024-06-07 14:54 UTC (permalink / raw)
  To: Suhail Singh; +Cc: emacs-orgmode

Suhail Singh <suhailsingh247@gmail.com> writes:

>> Fixed, on bugfix.
>> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=b8497aa7f
>
> This doesn't seem fixed as of 9.7.3 (the MRE above still shows spurious
> warning).  It seems that org-at-block-p returns nil when point is within
> the block.

Oops.
I amended the fix now.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=6c862699a

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


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

* Re: [BUG] org-lint: Spurious warning from 'misplaced-heading lint-checker [9.7.2 (release_N/A-N/A-88dd2c @ /home/user/.emacs.d/elpa/org-9.7.2/)]
  2024-06-07 14:54     ` Ihor Radchenko
@ 2024-06-07 16:03       ` Suhail Singh
  2024-06-08 14:41         ` Suhail Singh
  0 siblings, 1 reply; 9+ messages in thread
From: Suhail Singh @ 2024-06-07 16:03 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Suhail Singh, emacs-orgmode

Ihor Radchenko <yantar92@posteo.net> writes:

> Oops.
> I amended the fix now.
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=6c862699a

It's better, but not quite there.  For instance, tangle the block below
into an org file and observe the reported warning.

#+begin_src org :tangle /tmp/misplaced-heading-mre-2.org
  - Some words
    ,#+RESULTS:
    : this is a line with asterisks** in the middle

#+end_src

-- 
Suhail


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

* Re: [BUG] org-lint: Spurious warning from 'misplaced-heading lint-checker [9.7.2 (release_N/A-N/A-88dd2c @ /home/user/.emacs.d/elpa/org-9.7.2/)]
  2024-06-07 16:03       ` Suhail Singh
@ 2024-06-08 14:41         ` Suhail Singh
  2024-06-08 15:32           ` Ihor Radchenko
  0 siblings, 1 reply; 9+ messages in thread
From: Suhail Singh @ 2024-06-08 14:41 UTC (permalink / raw)
  To: Suhail Singh; +Cc: Ihor Radchenko, emacs-orgmode

Suhail Singh <suhailsingh247@gmail.com> writes:

> Ihor Radchenko <yantar92@posteo.net> writes:
>
>> Oops.
>> I amended the fix now.
>> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=6c862699a
>
> It's better, but not quite there.  For instance, tangle the block below
> into an org file and observe the reported warning.
>
> #+begin_src org :tangle /tmp/misplaced-heading-mre-2.org
>   - Some words
>     ,#+RESULTS:
>     : this is a line with asterisks** in the middle
>
> #+end_src

Thinking some more about it, I am of the opinion that instead of
allowing some select elements (as is currently done for comment-block,
example-block, export-block, src-block), it might be better to *only*
trigger the warning for select elements from org-element-all-elements.
E.g., paragraph.  For instance, it seems silly to trigger the warning in
a table-row, or a babel-call etc.

#+begin_src org :tangle /tmp/misplaced-heading-mre-3.org
  | Blah | Hello** world |
  |      |               |

  #+call: blah :var foo="hello** world"
#+end_src

On a related note, what specific situation(s) was this checker intended
to help the user in?  I.e., what are the situations that could result in
misplaced headings?

While the checker seems to be similar to the 'misplaced-planning-info
checker in spirit, the difference (in reality) is that the regular
expression to detect possibly misplaced headings is much easier to get
false positives for.

-- 
Suhail


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

* Re: [BUG] org-lint: Spurious warning from 'misplaced-heading lint-checker [9.7.2 (release_N/A-N/A-88dd2c @ /home/user/.emacs.d/elpa/org-9.7.2/)]
  2024-06-08 14:41         ` Suhail Singh
@ 2024-06-08 15:32           ` Ihor Radchenko
  2024-06-08 15:51             ` Suhail Singh
  0 siblings, 1 reply; 9+ messages in thread
From: Ihor Radchenko @ 2024-06-08 15:32 UTC (permalink / raw)
  To: Suhail Singh; +Cc: emacs-orgmode

Suhail Singh <suhailsingh247@gmail.com> writes:

> On a related note, what specific situation(s) was this checker intended
> to help the user in?  I.e., what are the situations that could result in
> misplaced headings?

For example,

* Heading 1
* Heading 2* Heading 3
* Heading 4

or

* Heading

Some text inside.
Accidentally deleted newline here* Heading 2

More text

* Heading 3

> While the checker seems to be similar to the 'misplaced-planning-info
> checker in spirit, the difference (in reality) is that the regular
> expression to detect possibly misplaced headings is much easier to get
> false positives for.

Sure. It is difficult to find the right balance between being useful and
generating too many false positives.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


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

* Re: [BUG] org-lint: Spurious warning from 'misplaced-heading lint-checker [9.7.2 (release_N/A-N/A-88dd2c @ /home/user/.emacs.d/elpa/org-9.7.2/)]
  2024-06-08 15:32           ` Ihor Radchenko
@ 2024-06-08 15:51             ` Suhail Singh
  2024-06-08 19:09               ` Ihor Radchenko
  0 siblings, 1 reply; 9+ messages in thread
From: Suhail Singh @ 2024-06-08 15:51 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Suhail Singh, emacs-orgmode

Ihor Radchenko <yantar92@posteo.net> writes:

> Accidentally deleted newline here* Heading 2

Are there situations which result in such accidental newline deletions
that are likely to not be immediately caught if not prompted by the
checker?  Or was the checker added preemptively?

Perhaps the checker should simply be limited to headline, paragraph and
select other node types where an asterisk could not occur.

-- 
Suhail


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

* Re: [BUG] org-lint: Spurious warning from 'misplaced-heading lint-checker [9.7.2 (release_N/A-N/A-88dd2c @ /home/user/.emacs.d/elpa/org-9.7.2/)]
  2024-06-08 15:51             ` Suhail Singh
@ 2024-06-08 19:09               ` Ihor Radchenko
  0 siblings, 0 replies; 9+ messages in thread
From: Ihor Radchenko @ 2024-06-08 19:09 UTC (permalink / raw)
  To: Suhail Singh; +Cc: emacs-orgmode

Suhail Singh <suhailsingh247@gmail.com> writes:

> Ihor Radchenko <yantar92@posteo.net> writes:
>
>> Accidentally deleted newline here* Heading 2
>
> Are there situations which result in such accidental newline deletions
> that are likely to not be immediately caught if not prompted by the
> checker?  Or was the checker added preemptively?

I have seen such situations many times. Sometimes, as accidental edits;
sometimes, because of subtle bugs in Org.

> Perhaps the checker should simply be limited to headline, paragraph and
> select other node types where an asterisk could not occur.

Ok. (I did not really expect false-positives with the existing checker;
but since there are clearly there, I just made the check more selective)
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=915e88364

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


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

end of thread, other threads:[~2024-06-08 19:08 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-04 18:42 [BUG] org-lint: Spurious warning from 'misplaced-heading lint-checker [9.7.2 (release_N/A-N/A-88dd2c @ /home/user/.emacs.d/elpa/org-9.7.2/)] Suhail Singh
2024-06-05 13:14 ` Ihor Radchenko
2024-06-07  0:01   ` Suhail Singh
2024-06-07 14:54     ` Ihor Radchenko
2024-06-07 16:03       ` Suhail Singh
2024-06-08 14:41         ` Suhail Singh
2024-06-08 15:32           ` Ihor Radchenko
2024-06-08 15:51             ` Suhail Singh
2024-06-08 19:09               ` Ihor Radchenko

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