From c598f0208738f16b6d00c05a7338c226d15f5d12 Mon Sep 17 00:00:00 2001 Message-Id: From: Ihor Radchenko Date: Mon, 31 May 2021 20:47:45 +0800 Subject: [PATCH] Do not ignore user-defined display-buffer-alist in org-insert-link * lisp/ol.el (org-insert-link): Handle case when *Org Links* window is not created. * lisp/org-macs.el (org-no-popups): Do not override `display-buffer-alist'. Use `pop-up-windows' instead. --- lisp/ol.el | 13 +++++++------ lisp/org-macs.el | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/lisp/ol.el b/lisp/ol.el index a2cf872b8..ae0177695 100644 --- a/lisp/ol.el +++ b/lisp/ol.el @@ -1856,12 +1856,13 @@ (defun org-insert-link (&optional complete-file link-location description) (reverse org-stored-links) "\n"))) (goto-char (point-min))) - (let ((cw (selected-window))) - (select-window (get-buffer-window "*Org Links*" 'visible)) - (with-current-buffer "*Org Links*" (setq truncate-lines t)) - (unless (pos-visible-in-window-p (point-max)) - (org-fit-window-to-buffer)) - (and (window-live-p cw) (select-window cw))) + (when (get-buffer-window "*Org Links*" 'visible) + (let ((cw (selected-window))) + (select-window (get-buffer-window "*Org Links*" 'visible)) + (with-current-buffer "*Org Links*" (setq truncate-lines t)) + (unless (pos-visible-in-window-p (point-max)) + (org-fit-window-to-buffer)) + (and (window-live-p cw) (select-window cw)))) (setq all-prefixes (append (mapcar #'car abbrevs) (mapcar #'car org-link-abbrev-alist) (org-link-types))) diff --git a/lisp/org-macs.el b/lisp/org-macs.el index d56fc3bce..133960fea 100644 --- a/lisp/org-macs.el +++ b/lisp/org-macs.el @@ -170,7 +170,7 @@ (defmacro org-preserve-local-variables (&rest body) (defmacro org-no-popups (&rest body) "Suppress popup windows and evaluate BODY." - `(let (pop-up-frames display-buffer-alist) + `(let (pop-up-frames pop-up-windows) ,@body)) -- 2.26.3