From 34f8b75b35f6cf4d886385d3d0f8f965bef3db22 Mon Sep 17 00:00:00 2001 From: Adam Porter Date: Sat, 13 Jan 2024 00:02:16 -0600 Subject: [PATCH] Fix: (org-ql-find) Go to base buffer if possible Use the base buffer if it has one, because if we run the search from an indirect buffer, it's likely already narrowed to a different entry, and making an indirect buffer from that one would end up with a restriction that would likely hide the selected entry. --- README.org | 4 ++- org-ql-find.el | 3 +- org-ql.info | 84 +++++++++++++++++++++++++++----------------------- 3 files changed, 50 insertions(+), 41 deletions(-) diff --git a/README.org b/README.org index b8f2475..d1c606e 100644 --- a/README.org +++ b/README.org @@ -555,7 +555,9 @@ Simple links may also be written manually in either sexp or non-sexp form, like: ** 0.8.4-pre -Nothing new yet. +*Fixes* + ++ Command ~org-ql-find~ goes to the selected entry in the base buffer (rather than potentially an indirect buffer, whose narrowing could leave the selected entry hidden. The nuances around going to entries in buffers that may be indirect and/or narrowed are surprisingly complicated. Hopefully this is the last fix). ** 0.8.3 diff --git a/org-ql-find.el b/org-ql-find.el index 591e958..f6f2b9c 100644 --- a/org-ql-find.el +++ b/org-ql-find.el @@ -75,7 +75,8 @@ single predicate)." :query-prefix query-prefix :query-filter query-filter :prompt prompt))) - (set-buffer (marker-buffer marker)) + (set-buffer (or (buffer-base-buffer (marker-buffer marker)) + (marker-buffer marker))) (pop-to-buffer (current-buffer) org-ql-find-display-buffer-action) (without-restriction (goto-char marker) diff --git a/org-ql.info b/org-ql.info index 10249a2..e501628 100644 --- a/org-ql.info +++ b/org-ql.info @@ -1074,7 +1074,13 @@ File: README.info, Node: 084-pre, Next: 083, Up: Changelog 5.1 0.8.4-pre ============= -Nothing new yet. +*Fixes* + + • Command ‘org-ql-find’ goes to the selected entry in the base buffer + (rather than potentially an indirect buffer, whose narrowing could + leave the selected entry hidden. The nuances around going to + entries in buffers that may be indirect and/or narrowed are + surprisingly complicated. Hopefully this is the last fix).  File: README.info, Node: 083, Next: 082, Prev: 084-pre, Up: Changelog @@ -1963,44 +1969,44 @@ Node: Links38869 Node: Tips39556 Node: Changelog39880 Node: 084-pre40760 -Node: 08340872 -Node: 08241217 -Node: 08141610 -Node: 0842031 -Node: 07444755 -Node: 07344978 -Node: 07245710 -Node: 07146629 -Node: 0747438 -Node: 06350304 -Node: 06250837 -Node: 06151144 -Node: 0651714 -Node: 05254770 -Node: 05155072 -Node: 0555497 -Node: 04957028 -Node: 04857310 -Node: 04757659 -Node: 04658068 -Node: 04558476 -Node: 04458837 -Node: 04359196 -Node: 04259399 -Node: 04159560 -Node: 0459807 -Node: 03263908 -Node: 03164311 -Node: 0364508 -Node: 02367808 -Node: 02268042 -Node: 02168322 -Node: 0268527 -Node: 0172605 -Node: Notes72706 -Node: Comparison with Org Agenda searches72868 -Node: org-sidebar73757 -Node: License74036 +Node: 08341212 +Node: 08241557 +Node: 08141950 +Node: 0842371 +Node: 07445095 +Node: 07345318 +Node: 07246050 +Node: 07146969 +Node: 0747778 +Node: 06350644 +Node: 06251177 +Node: 06151484 +Node: 0652054 +Node: 05255110 +Node: 05155412 +Node: 0555837 +Node: 04957368 +Node: 04857650 +Node: 04757999 +Node: 04658408 +Node: 04558816 +Node: 04459177 +Node: 04359536 +Node: 04259739 +Node: 04159900 +Node: 0460147 +Node: 03264248 +Node: 03164651 +Node: 0364848 +Node: 02368148 +Node: 02268382 +Node: 02168662 +Node: 0268867 +Node: 0172945 +Node: Notes73046 +Node: Comparison with Org Agenda searches73208 +Node: org-sidebar74097 +Node: License74376  End Tag Table