Fix helm persistent action with *Org Links* window

Fixes #829. Helm's persistent action would try to operate on the *Org
Links* window, which is dedicated, causing a "Cannot split side window
or parent of side window" error.

This fix gets rid of this unhelpful popup altogether when helm is
enabled.
This commit is contained in:
Henrik Lissner 2018-08-24 01:09:53 +02:00
parent 619ac43017
commit 6b91039283
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -168,7 +168,7 @@ the command buffer."
;; `helm' ;; `helm'
(after! helm (when (featurep! :completion helm)
(setq helm-default-display-buffer-functions '(+popup-display-buffer-stacked-side-window)) (setq helm-default-display-buffer-functions '(+popup-display-buffer-stacked-side-window))
;; Fix left-over popup window when closing persistent help for `helm-M-x' ;; Fix left-over popup window when closing persistent help for `helm-M-x'
@ -178,11 +178,21 @@ the command buffer."
(string= candidate (helm-attr 'help-current-symbol)) (string= candidate (helm-attr 'help-current-symbol))
(setq win (get-buffer-window (get-buffer (help-buffer))))) (setq win (get-buffer-window (get-buffer (help-buffer)))))
(delete-window win)))) (delete-window win))))
(advice-add #'helm-elisp--persistent-help :before #'+popup*helm-elisp--persistent-help)) (advice-add #'helm-elisp--persistent-help :before #'+popup*helm-elisp--persistent-help)
;; Get rid of useless Org Links popup, which causes window selection errors
;; with helm's persistent action.
(defun +popup*delete-org-links-popup (orig-fn &rest args)
(cl-letf* ((old-org-completing-read (symbol-function #'org-completing-read))
((symbol-function #'org-completing-read)
(lambda (&rest args)
(when-let* ((win (get-buffer-window "*Org Links*")))
(delete-window win))
(apply old-org-completing-read args))))
(apply orig-fn args)))
(advice-add #'org-insert-link :around #'+popup*delete-org-links-popup)
;; `helm-ag' ;; `helm-ag'
(progn
(defun +helm*pop-to-buffer (orig-fn &rest args) (defun +helm*pop-to-buffer (orig-fn &rest args)
(pop-to-buffer (pop-to-buffer
(save-window-excursion (apply orig-fn args) (save-window-excursion (apply orig-fn args)