From df65c93572d4f6fa6e594ab6811f0251d64d8174 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Tue, 18 Apr 2017 05:00:39 -0400 Subject: [PATCH] core-popups: fix xref-goto-xref not closing popup after following links --- core/core-popups.el | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/core/core-popups.el b/core/core-popups.el index 721587c35..ffba07189 100644 --- a/core/core-popups.el +++ b/core/core-popups.el @@ -384,6 +384,18 @@ the command buffer." (setq twittering-pop-to-buffer-function #'pop-to-buffer)) +(after! xref + (advice-add 'xref-goto-xref :around '+jump*xref-goto-xref) + (defun +jump*xref-goto-xref (orig-fn &rest args) + "Jump to the xref on the current line, select its window and close the popup +you came from." + (interactive) + (let ((popup-p (doom-popup-p)) + (window (selected-window))) + (apply orig-fn args) + (when popup-p (doom/popup-close window))))) + + ;; Ensure these settings are attached to org-load-hook as late as possible, ;; giving other modules to add their own hooks. (add-hook! 'after-init-hook