From 6e277d08c986063197f0c3c076f1de2ffb5ab503 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Mon, 6 Sep 2021 23:49:55 -0500 Subject: [PATCH] Fix helpful-mode .. some more still not quite there --- init.el | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/init.el b/init.el index b438e73..fd3581a 100644 --- a/init.el +++ b/init.el @@ -1010,15 +1010,19 @@ successive invocations." (global-goto-address-mode) (add-hook 'after-change-major-mode-hook #'goto-address-mode))) -;; TODO: figure out a popper.el / shackle.el ... thing to fix this (setup (:straight helpful) + (:require-after 3) + + (defvar helpful-pre-windows nil + "Window configuration /before/ helpful was called.") + (:option helpful-switch-buffer-function (defun helpful-pop-to-buffer (&rest args) - (let ((foo - (if (eq major-mode 'helpful-mode) - #'pop-to-buffer-same-window - #'pop-to-buffer))) - (apply foo args)))) + (if (eq major-mode 'helpful-mode) + (apply #'pop-to-buffer-same-window args) + (require 'winner) + (setq helpful-pre-windows (winner-conf)) + (apply #'pop-to-buffer args)))) (:global " f" #'helpful-callable " v" #'helpful-variable @@ -1031,7 +1035,9 @@ successive invocations." (quit-window) (unless (or (= 1 (count-windows)) (eq major-mode 'helpful-mode)) - (delete-window)))))) + (delete-window) + (ignore-errors + (winner-set helpful-pre-windows))))))) (setup (:straight hungry-delete) (:option hungry-delete-chars-to-skip " \t"