emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ruijie Yu via "General discussions about Org-mode." <emacs-orgmode@gnu.org>
To: emacs-orgmode@gnu.org
Subject: [BUG] org-num-mode does not clear previous numbers [9.5.5 (9.5.5-g9ce472 @ /home/user/.config/emacs/straight/build/org/)]
Date: Tue, 18 Oct 2022 21:08:02 -0500	[thread overview]
Message-ID: <sdvbkq8a7lp.fsf@fw.net.yu> (raw)


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 I call `(org-num-mode)' from lisp multiple times on a single
orgmode buffer, I get multiple numberings on each heading.
Subsequently, when I call `(org-num-mode -1)' or `(org-num--clear)',
only one layer of numberings are removed.

This behavior is observed at the build below, but should still be
reproducible in current HEAD (4179d1205ed791254aa21fadf262623bc805595d).

I have also successfully replicated this issue from a `emacs -Q -nw'
environment, using the same orgmode version.  Because of this, I have
removed the "current state" section since they are proven irrelevant.

The offending code is the `cond' construct in `org-num-mode' minor mode
definition, where we are directly resetting `org-num--overlays'.  I
think we should run something like `(org-num--clear)' before the two
`setq''s, so that the previous numbers are cleared.

Alternatively (and probably a bad advice), maybe we could simply not
execute the "enable" branch in `cond' when `org-num--overlays' is
non-nil?

I don't have a full understanding of the role of `org-num--numbering',
so I don't have anything to say about this variable.


Emacs  : GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.34, cairo version 1.17.6)
 of 2022-10-14
Package: Org mode version 9.5.5 (9.5.5-g9ce472 @ /home/user/.config/emacs/straight/build/org/)

current state:
==============
;; omitted


             reply	other threads:[~2022-10-19 11:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-19  2:08 Ruijie Yu via General discussions about Org-mode. [this message]
2022-10-20  4:53 ` [BUG] org-num-mode does not clear previous numbers [9.5.5 (9.5.5-g9ce472 @ /home/user/.config/emacs/straight/build/org/)] Ihor Radchenko

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=sdvbkq8a7lp.fsf@fw.net.yu \
    --to=emacs-orgmode@gnu.org \
    --cc=ruijie@netyu.xyz \
    /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).