* Bug: org-map-entries narrowing smaller than entry [9.1.14 (9.1.14-1049-g04641c-elpaplus @ /home/ionasal/.emacs.d/elpa/org-plus-contrib-20181203/)]
@ 2018-12-11 7:43 Allen Li
2018-12-11 16:27 ` Nicolas Goaziou
0 siblings, 1 reply; 4+ messages in thread
From: Allen Li @ 2018-12-11 7:43 UTC (permalink / raw)
To: Org Mode List
org-map-entries narrows the buffer to narrower than the given entry.
1. Run: cat > /tmp/tmp.org <<EOF
* some headline
** stuff
some text
** asdf asdf
EOF
2. emacs -Q
3. M-g M-g 2 RET
4. M-: (org-map-entries (lambda () (list (org-element-at-point)
(point-min) (point-max))) nil 'tree) RET
Actual:
(((headline (:raw-value "stuff" :begin 17 :end 36 :pre-blank 0
:contents-begin 26 :contents-end 36 ...)) 17 35))
Note that point-max is 35 whereas :end is 36
Emacs : GNU Emacs 26.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.30)
of 2018-07-05
Package: Org mode version 9.1.14 (9.1.14-1049-g04641c-elpaplus @
/home/ionasal/.emacs.d/elpa/org-plus-contrib-20181203/)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Bug: org-map-entries narrowing smaller than entry [9.1.14 (9.1.14-1049-g04641c-elpaplus @ /home/ionasal/.emacs.d/elpa/org-plus-contrib-20181203/)]
2018-12-11 7:43 Bug: org-map-entries narrowing smaller than entry [9.1.14 (9.1.14-1049-g04641c-elpaplus @ /home/ionasal/.emacs.d/elpa/org-plus-contrib-20181203/)] Allen Li
@ 2018-12-11 16:27 ` Nicolas Goaziou
2018-12-11 21:47 ` Allen Li
0 siblings, 1 reply; 4+ messages in thread
From: Nicolas Goaziou @ 2018-12-11 16:27 UTC (permalink / raw)
To: Allen Li; +Cc: Org Mode List
Hello,
Allen Li <darkfeline@felesatra.moe> writes:
> org-map-entries narrows the buffer to narrower than the given entry.
>
> 1. Run: cat > /tmp/tmp.org <<EOF
> * some headline
> ** stuff
> some text
> ** asdf asdf
> EOF
>
> 2. emacs -Q
> 3. M-g M-g 2 RET
> 4. M-: (org-map-entries (lambda () (list (org-element-at-point)
> (point-min) (point-max))) nil 'tree) RET
>
> Actual:
>
> (((headline (:raw-value "stuff" :begin 17 :end 36 :pre-blank 0
> :contents-begin 26 :contents-end 36 ...)) 17 35))
`org-element-at-point' ignores narrowing.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Bug: org-map-entries narrowing smaller than entry [9.1.14 (9.1.14-1049-g04641c-elpaplus @ /home/ionasal/.emacs.d/elpa/org-plus-contrib-20181203/)]
2018-12-11 16:27 ` Nicolas Goaziou
@ 2018-12-11 21:47 ` Allen Li
2018-12-12 12:21 ` Nicolas Goaziou
0 siblings, 1 reply; 4+ messages in thread
From: Allen Li @ 2018-12-11 21:47 UTC (permalink / raw)
To: Org Mode List
On Tue, Dec 11, 2018 at 8:27 AM Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:
> > (((headline (:raw-value "stuff" :begin 17 :end 36 :pre-blank 0
> > :contents-begin 26 :contents-end 36 ...)) 17 35))
>
> `org-element-at-point' ignores narrowing.
Yes, but my issue is with the fact that the entry bounds reported by
org-element-at-point disagrees with the bounds used by org-map-entries
narrowing, in specific edge cases.
For example, when running org-map-entries on a tree, the bounds
reported by org-element-at-point can be used *except* for the last
entry, which will extend one character past the narrowing.
It seems to me that whatever Org mode considers the bounds for an
entry should be used consistently.
I looked into this and it seems this behavior is deliberate in
org-narrow-to-subtree. I can see why this behavior exists, because if
point is at the end of an entry (after the newline), it is considered
to be pointing at the next entry. Thus the narrowing is artificially
tightened to make it impossible to position point at the end of an
entry. Example, the bounds of an entry/subtree delimited by $:
* A
$* B
** foo
** bar
$* C
The bounds used by narrowing:
* A
$* B
** foo
** bar$
* C
If one were to narrow to a subtree and delete the entire visible
region, it would leave an extra newline that should be considered part
of the deleted subtree. If such an operation were repeated, it would
leave behind many extra newlines.
I think this issue is medium/low priority and difficult to resolve. I
have worked around it for my use case. However, I still think it is
an issue since it's an edge case that users of org-map-entries will
need to take into account.
>
> Regards,
>
> --
> Nicolas Goaziou
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Bug: org-map-entries narrowing smaller than entry [9.1.14 (9.1.14-1049-g04641c-elpaplus @ /home/ionasal/.emacs.d/elpa/org-plus-contrib-20181203/)]
2018-12-11 21:47 ` Allen Li
@ 2018-12-12 12:21 ` Nicolas Goaziou
0 siblings, 0 replies; 4+ messages in thread
From: Nicolas Goaziou @ 2018-12-12 12:21 UTC (permalink / raw)
To: Allen Li; +Cc: Org Mode List
Hello,
Allen Li <darkfeline@felesatra.moe> writes:
> I think this issue is medium/low priority and difficult to resolve. I
> have worked around it for my use case. However, I still think it is
> an issue since it's an edge case that users of org-map-entries will
> need to take into account.
This is not specific to `org-map-entries' and many parts of the code
already deal with it. I don't think there is anything to fix in
a general fashion, though.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-12-12 12:21 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-11 7:43 Bug: org-map-entries narrowing smaller than entry [9.1.14 (9.1.14-1049-g04641c-elpaplus @ /home/ionasal/.emacs.d/elpa/org-plus-contrib-20181203/)] Allen Li
2018-12-11 16:27 ` Nicolas Goaziou
2018-12-11 21:47 ` Allen Li
2018-12-12 12:21 ` Nicolas Goaziou
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).