I have been using the following function to maximize and unmaximize a window for two years now.
(defun toggle-maximize-buffer () "Toggle maximize buffer"
(interactive)
(if (= 1 (length (window-list)))
(set-window-configuration my-saved-window-configuration)
(progn
(setq my-saved-window-configuration (current-window-configuration))
(delete-other-windows))))
I have it bound to:
(define-key my-keys-minor-mode-map (kbd "C-M-u") 'toggle-maximize-buffer)
It always worked great, but today, after upgrading to the latest version of Emacs in OS X:
brew install emacs --HEAD --use-git-head --cocoa --with-gnutls --with-rsvg --with-imagemagick
this function stopped working properly when invoking it from a buffer running M-x ansi-term
. More specifically, it works, but it moves cursor in my buffer whenever I do C-M-u RET
. It happens regardless weather I am in character
or line-mode
in the ansi-term
buffer.
The problem does not happen in any other type of buffer. Why am I having this problem, and what I can do about it?
In case it matters, here is the specific version I am using
GNU Emacs 25.0.50.1 (x86_64-apple-darwin14.1.0, NS appkit-1344.72 Version 10.10.2 (Build 14C1514))
Could this be a bug? Or is it perhaps a problem with my configuration?
current-window-configuration
does not save the point in the current buffer. For what ever reason it stopped working, maybe that's your solution (i.e. additionally save and restore it).