Re: [BUG] org-up-heading-safe behaves different in v9.7 [9.7 (9.7-??-d6f3aed @ /home/zhaoyiyu/.config/emacs/.local/straight/build-28.1/org/)]

2023-08-27 Thread Ihor Radchenko
zhaoyiyu  writes:

> When I track down a issue about org-journal, with org v9.7
> I noticed that when execute
> (org-up-heading-safe)
> it's different with org v9.6, which would caused the org-journal issue.
> In detail as follows org file. After execution the cursor position will
> change to
>
>
> File Header                 <-- v9.7, return nil and cursor here
> * heading lv 1 <-- v9.6, return nil and cursor here
> some contents and your prev cursor is here I
>
>...
> Package: Org mode version 9.7 (9.7-??-d6f3aed @ 
> /home/zhaoyiyu/.config/emacs/.local/straight/build-28.1/org/)

Duplicate of 
https://orgmode.org/list/CAG=u__pAT9k_AsRG6cpyPPUt0__5S7o=3a8wwkaijuppugc...@mail.gmail.com
Already fixed.
Handled.

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



[BUG] org-up-heading-safe behaves different in v9.7 [9.7 (9.7-??-d6f3aed @ /home/zhaoyiyu/.config/emacs/.local/straight/build-28.1/org/)]

2023-08-26 Thread zhaoyiyu




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 track down a issue about org-journal, with org v9.7
I noticed that when execute
(org-up-heading-safe)
it's different with org v9.6, which would caused the org-journal issue.
In detail as follows org file. After execution the cursor position will
change to


File Header                 <-- v9.7, return nil and cursor here
* heading lv 1 <-- v9.6, return nil and cursor here
some contents and your prev cursor is here I


Personaly, I write a advice to fix the issue


(defun myfunc/org-up-heading-safe ()
(let* ((heading (org-element-lineage
(org-element-at-point)
'(headline inlinetask) 'with-self))
(parent (org-element-parent heading))
(ret (and parent
(org-element-property :level parent)
(<= (point-min) (org-element-begin parent)
(if ret
(goto-char (org-element-begin parent))
(when heading
(goto-char (org-element-begin heading
ret))
(advice-add 'org-up-heading-safe :override #'myfunc/org-up-heading-safe)

However, Since I didn't get the purpose for the org v9.7 changes, I
submit this issue here.


Emacs : GNU Emacs 28.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 
3.24.33, cairo version 1.16.0)

of 2022-05-31
Package: Org mode version 9.7 (9.7-??-d6f3aed @ 
/home/zhaoyiyu/.config/emacs/.local/straight/build-28.1/org/)