unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#60467: 30.0.50; primitive-undo: Changes to be undone by function different from announced
@ 2023-01-01 13:40 Ihor Radchenko
  2023-01-01 14:38 ` Eli Zaretskii
                   ` (2 more replies)
  0 siblings, 3 replies; 52+ messages in thread
From: Ihor Radchenko @ 2023-01-01 13:40 UTC (permalink / raw)
  To: 60467

Hi,

Original report:
https://orgmode.org/list/25520.20685.583180.776610@gargle.gargle.HOWL

I am not sure if it is Emacs bug, but I have difficulty understanding
the origin of the following error:

1. Create /tmp/bug.org with the following contents

* h1
** h2

2. emacs -Q /tmp/bug.org
3. Move point to h2
4. M-x org-promote-subtree
5. M-x undo
6. Observe "Changes to be undone by function different from announced" error

The functions in question are below and I fail to see anything that may
be wrong there.

(defun org-promote-subtree ()
  "Promote the entire subtree.
See also `org-promote'."
  (interactive)
  (save-excursion
    (org-back-to-heading t)
    (combine-change-calls (point) (save-excursion (org-end-of-subtree t))
      (org-with-limited-levels (org-map-tree 'org-promote))))
  (org-fix-position-after-promote))

(defun org-promote ()
  "Promote the current heading higher up the tree."
  (org-with-wide-buffer
   (org-back-to-heading t)
   (let* ((after-change-functions (remq 'flyspell-after-change-function
					after-change-functions))
	  (level (save-match-data (funcall outline-level)))
	  (up-head (concat (make-string (org-get-valid-level level -1) ?*) " "))
	  (diff (abs (- level (length up-head) -1))))
     (cond
      ((and (= level 1) org-allow-promoting-top-level-subtree)
       (replace-match "# " nil t))
      ((= level 1)
       (user-error "Cannot promote to level 0.  UNDO to recover if necessary"))
      (t (replace-match (apply #'propertize up-head (text-properties-at (match-beginning 0))) t)))
     (unless (= level 1)
       (when org-auto-align-tags (org-align-tags))
       (when org-adapt-indentation (org-fixup-indentation (- diff))))
     (run-hooks 'org-after-promote-entry-hook))))  

In GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
 3.24.35, cairo version 1.17.6) of 2022-12-26 built on localhost
Repository revision: cc29fab3a66c59e77d0ff67c0f3e2e34ec80a03c
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101004
System Description: Gentoo Linux

-- 
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] 52+ messages in thread
[parent not found: <3eea0a7dff2915453876fc3a2b628886c78a4d4b.camel@laposte.net>]

end of thread, other threads:[~2023-08-16 16:09 UTC | newest]

Thread overview: 52+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-01 13:40 bug#60467: 30.0.50; primitive-undo: Changes to be undone by function different from announced Ihor Radchenko
2023-01-01 14:38 ` Eli Zaretskii
2023-01-02  0:46 ` Gregory Heytings
2023-01-02  1:50   ` Gregory Heytings
2023-01-02  9:31     ` Ihor Radchenko
2023-01-03  9:41       ` Gregory Heytings
2023-01-03 12:46         ` Eli Zaretskii
2023-01-03 13:44           ` Gregory Heytings
2023-01-03 14:48             ` Eli Zaretskii
2023-01-03 15:05               ` Gregory Heytings
2023-01-03 16:10                 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-01-03 16:33                   ` Gregory Heytings
2023-01-03 16:51                     ` Gregory Heytings
2023-01-04  0:16                     ` Gregory Heytings
2023-01-04  2:49                       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-01-04  9:24                         ` Gregory Heytings
2023-01-04 10:50                           ` Gregory Heytings
2023-01-04 14:39                             ` Eli Zaretskii
2023-01-04 14:43                               ` Gregory Heytings
2023-01-04 14:36                           ` Eli Zaretskii
2023-01-04 14:39                             ` Gregory Heytings
2023-01-04 18:02                               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-01-04 18:16                                 ` Gregory Heytings
2023-01-04 18:42                                   ` Eli Zaretskii
2023-01-04 21:04                                     ` Gregory Heytings
2023-01-03 14:56             ` Gregory Heytings
2023-01-03 15:16         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-01-03 15:29           ` Gregory Heytings
2023-01-03 16:32             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-01-08 15:43           ` Alan Mackenzie
2023-01-09  6:03             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-01-09 12:16               ` Eli Zaretskii
2023-01-13 22:45                 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-01-14  7:06                   ` Eli Zaretskii
2023-01-02  9:27   ` Ihor Radchenko
2023-06-22 19:28 ` bug#60467: New problem introduced Frédéric Giquel via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-23 11:01   ` bug#60467: 30.0.50; primitive-undo: Changes to be undone by function different from announced Eli Zaretskii
2023-06-23 13:06     ` Gregory Heytings
2023-06-26 14:51       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-26 14:53       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-26 15:18         ` Gregory Heytings
2023-06-26 15:30           ` Eli Zaretskii
2023-07-01 14:14             ` Gregory Heytings
2023-07-01 14:27               ` Eli Zaretskii
2023-07-15  7:46                 ` Eli Zaretskii
2023-08-03  7:38                   ` Eli Zaretskii
2023-08-10 11:28                     ` Gregory Heytings
2023-08-10 13:41                       ` Eli Zaretskii
2023-08-10 13:55                         ` Gregory Heytings
2023-08-12  7:09                           ` Eli Zaretskii
2023-08-16 16:09                             ` Gregory Heytings
     [not found] <3eea0a7dff2915453876fc3a2b628886c78a4d4b.camel@laposte.net>
2023-07-04  0:03 ` sbaugh

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.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).