Fix: (org-ql-find) Moving point and widening buffer as needed

See #380.

Reported-by: Omar Antolín Camarena <omar.antolin@gmail.com>
This commit is contained in:
Adam Porter 2024-01-10 01:55:16 -06:00
parent 694739b31d
commit 0b1e4b43ec
3 changed files with 60 additions and 40 deletions

View file

@ -555,7 +555,9 @@ Simple links may also be written manually in either sexp or non-sexp form, like:
** 0.8.3-pre ** 0.8.3-pre
Nothing new yet. *Fixes*
+ Command ~org-ql-find~ incorrectly moved point. (See [[https://github.com/alphapapa/org-ql/issues/380#issuecomment-1881913025][#380]]. Thanks to [[https://github.com/oantolin][Omar Antolín Camarena]] for reporting.)
** 0.8.2 ** 0.8.2

View file

@ -78,7 +78,20 @@ single predicate)."
(set-buffer (marker-buffer marker)) (set-buffer (marker-buffer marker))
(pop-to-buffer (current-buffer) org-ql-find-display-buffer-action) (pop-to-buffer (current-buffer) org-ql-find-display-buffer-action)
(without-restriction (without-restriction
(run-hook-with-args 'org-ql-find-goto-hook)))) (goto-char marker)
(run-hook-with-args 'org-ql-find-goto-hook))
(when (equal (current-buffer) (marker-buffer marker))
;; Ensure point is still within visible portion of buffer. (If
;; `org-tree-to-indirect-buffer' is used in `org-ql-find-goto-hook',
;; the buffer will have been changed and it won't matter; otherwise,
;; the buffer could have been narrowed to a region excluding the
;; selected entry.)
(let ((end-of-subtree (org-with-point-at marker
(org-end-of-subtree 'invisible-ok))))
(unless (and (<= (point-min) marker)
(>= (point-max) end-of-subtree))
(widen)
(goto-char marker))))))
;;;###autoload ;;;###autoload
(defun org-ql-refile (marker) (defun org-ql-refile (marker)

View file

@ -1072,7 +1072,12 @@ File: README.info, Node: 083-pre, Next: 082, Up: Changelog
5.1 0.8.3-pre 5.1 0.8.3-pre
============= =============
Nothing new yet. *Fixes*
• Command org-ql-find incorrectly moved point. (See #380
(https://github.com/alphapapa/org-ql/issues/380#issuecomment-1881913025).
Thanks to Omar Antolín Camarena (https://github.com/oantolin) for
reporting.)
 
File: README.info, Node: 082, Next: 081, Prev: 083-pre, Up: Changelog File: README.info, Node: 082, Next: 081, Prev: 083-pre, Up: Changelog
@ -1948,43 +1953,43 @@ Node: Links38855
Node: Tips39542 Node: Tips39542
Node: Changelog39866 Node: Changelog39866
Node: 083-pre40732 Node: 083-pre40732
Node: 08240844 Node: 08241073
Node: 08141241 Node: 08141470
Node: 0841662 Node: 0841891
Node: 07444386 Node: 07444615
Node: 07344609 Node: 07344838
Node: 07245341 Node: 07245570
Node: 07146260 Node: 07146489
Node: 0747069 Node: 0747298
Node: 06349933 Node: 06350162
Node: 06250466 Node: 06250695
Node: 06150773 Node: 06151002
Node: 0651343 Node: 0651572
Node: 05254399 Node: 05254628
Node: 05154701 Node: 05154930
Node: 0555126 Node: 0555355
Node: 04956657 Node: 04956886
Node: 04856939 Node: 04857168
Node: 04757288 Node: 04757517
Node: 04657697 Node: 04657926
Node: 04558105 Node: 04558334
Node: 04458466 Node: 04458695
Node: 04358825 Node: 04359054
Node: 04259028 Node: 04259257
Node: 04159189 Node: 04159418
Node: 0459436 Node: 0459665
Node: 03263537 Node: 03263766
Node: 03163940 Node: 03164169
Node: 0364137 Node: 0364366
Node: 02367437 Node: 02367666
Node: 02267671 Node: 02267900
Node: 02167951 Node: 02168180
Node: 0268156 Node: 0268385
Node: 0172234 Node: 0172463
Node: Notes72335 Node: Notes72564
Node: Comparison with Org Agenda searches72497 Node: Comparison with Org Agenda searches72726
Node: org-sidebar73386 Node: org-sidebar73615
Node: License73665 Node: License73894
 
End Tag Table End Tag Table