From 27b2fb424a8dd5d1dd593f94ae83252b06beb718 Mon Sep 17 00:00:00 2001 From: Ag Ibragimov Date: Thu, 18 Oct 2018 15:41:28 -0700 Subject: [PATCH] Keeps previous position on toggle-maximize-buffer --- layers/+spacemacs/spacemacs-defaults/funcs.el | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/layers/+spacemacs/spacemacs-defaults/funcs.el b/layers/+spacemacs/spacemacs-defaults/funcs.el index aa63a864e..f358bdee8 100644 --- a/layers/+spacemacs/spacemacs-defaults/funcs.el +++ b/layers/+spacemacs/spacemacs-defaults/funcs.el @@ -120,12 +120,13 @@ automatically applied to." (defun spacemacs/toggle-maximize-buffer () "Maximize buffer" (interactive) - (if (and (= 1 (length (window-list))) - (assoc ?_ register-alist)) - (jump-to-register ?_) - (progn - (window-configuration-to-register ?_) - (delete-other-windows)))) + (save-excursion + (if (and (= 1 (length (window-list))) + (assoc ?_ register-alist)) + (jump-to-register ?_) + (progn + (window-configuration-to-register ?_) + (delete-other-windows))))) ;; https://tsdh.wordpress.com/2007/03/28/deleting-windows-vertically-or-horizontally/ (defun spacemacs/maximize-horizontally ()