unpackaged.el icon indicating copy to clipboard operation
unpackaged.el copied to clipboard

improve unpackaged/org-forward-to-entry-content

Open whudwl opened this issue 2 years ago • 2 comments

whudwl avatar Apr 21 '22 03:04 whudwl

Thanks, but this feels like a bogus fix. Narrowing to the subtree doesn't seem like it should be necessary. Are you sure you've followed the code and figured out what it's doing wrong, e.g. with Edebug?

alphapapa avatar Apr 21 '22 18:04 alphapapa

I wouldn't be surprised if this is a bogus fix either as I am not very good at programming or elisp :)

The problem as I understand it is, when a node has a drawer but no content, goto the end of the drawer would reach the start of the next node.

I first tried just narrowing to subtree, but that caused the function to be stuck in infinite loop, since once it reaches the end of last drawer it'll process that drawer again and again((org-element-at-point) keeps getting the same drawer). So then I added the condition (> (- pos (point)) 1)) since from what I understand, when narrowed, the maximum position is 1 less than the :end of the last drawer, when the loop reaches there it should stop.

whudwl avatar Apr 21 '22 22:04 whudwl