emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [BUG] org-num-skip-unnumbered is not respected if a org-mode file enables org-num-mode on startup [9.6.18 ( @ /home/drcxd/.emacs.d/elpa/org-9.6.18/)]
@ 2024-02-08  3:54 Chang Xiaoduan
  2024-02-08 15:21 ` Ihor Radchenko
  0 siblings, 1 reply; 4+ messages in thread
From: Chang Xiaoduan @ 2024-02-08  3:54 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.
------------------------------------------------------------------------

Hello,

I have been experimenting with org-num-mode recently. I find that if an
org-mode file enables org-num-mode on startup by adding:

```emacs-lisp
#+STARTUP: num
```

and if there is a file local prop line:

```emacs-lisp
# -*- org-num-skip-unnumbered: t; -*-
```

then org-num-mode does not respect the file local variable, i.e., some
headings with the `UNNUMBERED` property set to `t` still get their
numbering. This also happens for `org-num-max-level` if it is set on the
file local prop line. If I toggle org-num-mode after visiting the
file, then org-num-mode respect those file local variables.

What's more, I have tried to remove the `STARTUP` keyword, so I can
enable org-num-mode after visiting the file. However, without enabling
org-num-mode on visiting the file, Emacs reports those file local
variables as unsafe, though their values are safe, according to the
documentation. I guess it is determined as unsafe because org-num-mode
is not loaded.

This can be reproduced by launching Emacs using `emacs -Q` and visiting
the following org-mode file:

```
# -*- org-num-skip-unnumbered: t; -*-

#+STARTUP: num

* Unnumbered Heading
:PROPERTIES:
:UNNUMBERED: t
:END:

* Numbered Heading
```

I expect that if I enable org-num-mode using the `STARTUP` keyword, it
will respect file local properties specified on the file local prop
line. Alternatively, Emacs should not report those file local variables
as unsafe if the org-num-mode is not enabled on startup.

Thank you

Xiaoduan

Emacs  : GNU Emacs 29.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.38, cairo version 1.16.0)
 of 2023-08-30, modified by Debian
Package: Org mode version 9.6.18 ( @ /home/drcxd/.emacs.d/elpa/org-9.6.18/)


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

* Re: [BUG] org-num-skip-unnumbered is not respected if a org-mode file enables org-num-mode on startup [9.6.18 ( @ /home/drcxd/.emacs.d/elpa/org-9.6.18/)]
  2024-02-08  3:54 [BUG] org-num-skip-unnumbered is not respected if a org-mode file enables org-num-mode on startup [9.6.18 ( @ /home/drcxd/.emacs.d/elpa/org-9.6.18/)] Chang Xiaoduan
@ 2024-02-08 15:21 ` Ihor Radchenko
  2024-02-09  4:29   ` Chang Xiaoduan
  0 siblings, 1 reply; 4+ messages in thread
From: Ihor Radchenko @ 2024-02-08 15:21 UTC (permalink / raw)
  To: Chang Xiaoduan; +Cc: emacs-orgmode

Chang Xiaoduan <drcxd@sina.com> writes:

> I have been experimenting with org-num-mode recently. I find that if an
> org-mode file enables org-num-mode on startup by adding:
>
> ```emacs-lisp
> #+STARTUP: num
> ```
>
> and if there is a file local prop line:
>
> ```emacs-lisp
> # -*- org-num-skip-unnumbered: t; -*-
> ```

> then org-num-mode does not respect the file local variable, i.e., some
> headings with the `UNNUMBERED` property set to `t` still get their
> numbering. This also happens for `org-num-max-level` if it is set on the
> file local prop line. If I toggle org-num-mode after visiting the
> file, then org-num-mode respect those file local variables.

This is known.
#+STARTUP options are handled before buffer-local variables take effect.
See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=57003
Handled.

> What's more, I have tried to remove the `STARTUP` keyword, so I can
> enable org-num-mode after visiting the file. However, without enabling
> org-num-mode on visiting the file, Emacs reports those file local
> variables as unsafe, though their values are safe, according to the
> documentation. I guess it is determined as unsafe because org-num-mode
> is not loaded.

Yup.
Fixed on main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=bfc0cb372

-- 
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] 4+ messages in thread

* Re: [BUG] org-num-skip-unnumbered is not respected if a org-mode file enables org-num-mode on startup [9.6.18 ( @ /home/drcxd/.emacs.d/elpa/org-9.6.18/)]
  2024-02-08 15:21 ` Ihor Radchenko
@ 2024-02-09  4:29   ` Chang Xiaoduan
  2024-02-09 22:55     ` Ihor Radchenko
  0 siblings, 1 reply; 4+ messages in thread
From: Chang Xiaoduan @ 2024-02-09  4:29 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode

Ihor Radchenko <yantar92@posteo.net> writes:

>
> This is known.
> #+STARTUP options are handled before buffer-local variables take effect.
> See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=57003
> Handled.
>

I have read the thread but I can not figure a solution. I tried to
search "early local" you proposed in the org-mode manual or Emacs manual
but find nothing related. So currently if I use STARTUP options to
enable org-num-mode on visiting the file, there is no way to make
org-num-mode apply file local variables such as `org-num-max-level'? Is
that right?

>
> Yup.
> Fixed on main.
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=bfc0cb372

Thanks a lot.


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

* Re: [BUG] org-num-skip-unnumbered is not respected if a org-mode file enables org-num-mode on startup [9.6.18 ( @ /home/drcxd/.emacs.d/elpa/org-9.6.18/)]
  2024-02-09  4:29   ` Chang Xiaoduan
@ 2024-02-09 22:55     ` Ihor Radchenko
  0 siblings, 0 replies; 4+ messages in thread
From: Ihor Radchenko @ 2024-02-09 22:55 UTC (permalink / raw)
  To: Chang Xiaoduan; +Cc: emacs-orgmode

Chang Xiaoduan <drcxd@sina.com> writes:

>> This is known.
>> #+STARTUP options are handled before buffer-local variables take effect.
>> See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=57003
>> Handled.
>>
>
> I have read the thread but I can not figure a solution. I tried to
> search "early local" you proposed in the org-mode manual or Emacs manual
> but find nothing related. So currently if I use STARTUP options to
> enable org-num-mode on visiting the file, there is no way to make
> org-num-mode apply file local variables such as `org-num-max-level'? Is
> that right?

Yes, you are right. The Emacs bug I linked to is not resolved.
In other words, your issue is not new, known, but not solved yet.

-- 
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] 4+ messages in thread

end of thread, other threads:[~2024-02-09 22:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-08  3:54 [BUG] org-num-skip-unnumbered is not respected if a org-mode file enables org-num-mode on startup [9.6.18 ( @ /home/drcxd/.emacs.d/elpa/org-9.6.18/)] Chang Xiaoduan
2024-02-08 15:21 ` Ihor Radchenko
2024-02-09  4:29   ` Chang Xiaoduan
2024-02-09 22:55     ` 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).