Max Nikulin <maniku...@gmail.com> writes:

> Regression is caused by
>
> commit 399481bad10845a77f210c9320ff1efee9a312c8
> Author: Ihor Radchenko <yanta...@gmail.com>
> Date:   Mon May 31 20:47:45 2021 +0800
>
>      Do not ignore user-defined display-buffer-alist in org-insert-link

See the attached fix.  The fix looks reasonable, though I fail to
understand why org-no-popup was even used in org-goto-location.  We kind
of want a popup there.  git blame did not reveal anything useful either.

Adam, can you test the fix in different scenarios first? I do not use
org-goto interface, so I only did a light testing.

Best,
Ihor

>From 72d62d9f54a356273b2fa8ccf4f71b9faccf280c Mon Sep 17 00:00:00 2001
Message-Id: <72d62d9f54a356273b2fa8ccf4f71b9faccf280c.1633437697.git.yanta...@gmail.com>
From: Ihor Radchenko <yanta...@gmail.com>
Date: Tue, 5 Oct 2021 20:37:02 +0800
Subject: [PATCH] org-goto: Fix window broken arrangement after 399481bad

* lisp/org-goto.el (org-goto-location): Do not wrap code into
`org-no-popups' macro.  The macro prevents popup windows and we do
want *Org Help* window as a popup herein.

Fixes https://list.orgmode.org/e169a2f9-72b1-02bb-96c1-6e7368f64...@gmail.com/T/#t
---
 lisp/org-goto.el | 67 ++++++++++++++++++++++++------------------------
 1 file changed, 33 insertions(+), 34 deletions(-)

diff --git a/lisp/org-goto.el b/lisp/org-goto.el
index 0a3470f54..352bf9f2e 100644
--- a/lisp/org-goto.el
+++ b/lisp/org-goto.el
@@ -203,40 +203,39 @@ (defun org-goto-location (&optional _buf help)
   "Let the user select a location in current buffer.
 This function uses a recursive edit.  It returns the selected
 position or nil."
-  (org-no-popups
-   (let ((isearch-mode-map org-goto-local-auto-isearch-map)
-	 (isearch-hide-immediately nil)
-	 (isearch-search-fun-function
-	  (lambda () #'org-goto--local-search-headings))
-	 (help (or help org-goto-help)))
-     (save-excursion
-       (save-window-excursion
-	 (delete-other-windows)
-	 (and (get-buffer "*org-goto*") (kill-buffer "*org-goto*"))
-	 (pop-to-buffer-same-window
-	  (condition-case nil
-	      (make-indirect-buffer (current-buffer) "*org-goto*" t)
-	    (error (make-indirect-buffer (current-buffer) "*org-goto*" t))))
-	 (let (temp-buffer-show-function temp-buffer-show-hook)
-	   (with-output-to-temp-buffer "*Org Help*"
-	     (princ (format help (if org-goto-auto-isearch
-				     "  Just type for auto-isearch."
-				   "  n/p/f/b/u to navigate, q to quit.")))))
-	 (org-fit-window-to-buffer (get-buffer-window "*Org Help*"))
-	 (org-overview)
-	 (setq buffer-read-only t)
-	 (if (and (boundp 'org-goto-start-pos)
-		  (integer-or-marker-p org-goto-start-pos))
-	     (progn (goto-char org-goto-start-pos)
-		    (when (org-invisible-p)
-		      (org-show-set-visibility 'lineage)))
-	   (goto-char (point-min)))
-	 (let (org-special-ctrl-a/e) (org-beginning-of-line))
-	 (message "Select location and press RET")
-	 (use-local-map org-goto-map)
-	 (recursive-edit)))
-     (kill-buffer "*org-goto*")
-     (cons org-goto-selected-point org-goto-exit-command))))
+  (let ((isearch-mode-map org-goto-local-auto-isearch-map)
+	(isearch-hide-immediately nil)
+	(isearch-search-fun-function
+	 (lambda () #'org-goto--local-search-headings))
+	(help (or help org-goto-help)))
+    (save-excursion
+      (save-window-excursion
+	(delete-other-windows)
+	(and (get-buffer "*org-goto*") (kill-buffer "*org-goto*"))
+	(pop-to-buffer-same-window
+	 (condition-case nil
+	     (make-indirect-buffer (current-buffer) "*org-goto*" t)
+	   (error (make-indirect-buffer (current-buffer) "*org-goto*" t))))
+	(let (temp-buffer-show-function temp-buffer-show-hook)
+	  (with-output-to-temp-buffer "*Org Help*"
+	    (princ (format help (if org-goto-auto-isearch
+				    "  Just type for auto-isearch."
+				  "  n/p/f/b/u to navigate, q to quit.")))))
+	(org-fit-window-to-buffer (get-buffer-window "*Org Help*"))
+	(org-overview)
+	(setq buffer-read-only t)
+	(if (and (boundp 'org-goto-start-pos)
+		 (integer-or-marker-p org-goto-start-pos))
+	    (progn (goto-char org-goto-start-pos)
+		   (when (org-invisible-p)
+		     (org-show-set-visibility 'lineage)))
+	  (goto-char (point-min)))
+	(let (org-special-ctrl-a/e) (org-beginning-of-line))
+	(message "Select location and press RET")
+	(use-local-map org-goto-map)
+	(recursive-edit)))
+    (kill-buffer "*org-goto*")
+    (cons org-goto-selected-point org-goto-exit-command)))
 
 ;;;###autoload
 (defun org-goto (&optional alternative-interface)
-- 
2.32.0

Reply via email to