Last active
March 7, 2016 19:41
-
-
Save pft/684603b6cc2856e41ac1 to your computer and use it in GitHub Desktop.
Responsive lyout for mingus-mopidy branch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun pft/mingus-resize (&optional frame) | |
(let ((windows (remove nil | |
(list | |
(get-buffer-window | |
(get-buffer "*Mingus Browser*")) | |
(get-buffer-window | |
(get-buffer "*Mingus*")))))) | |
(mapc (lambda (w) | |
(with-selected-window | |
w | |
(when (pft/mingus-needs-redraw w) | |
(mingus-redraw-buffer)))) | |
windows))) | |
(defun pft/mingus-needs-redraw (w) | |
(let* ((pw (window-parameter nil 'pft/mingus-pw)) | |
(need (and pw (not (= pw (window-width w)))))) | |
(when (or (not pw) need) | |
(set-window-parameter w 'pft/mingus-pw (window-width w))) | |
need)) | |
(eval-after-load "mingus" | |
'(when (fboundp 'mingus-redraw-buffer) | |
(add-hook 'window-size-change-functions | |
'pft/mingus-resize))) |
I updated the gist to memorize previous width to prevent too many redraws and subsequent cursor jumping
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Adjust column widths when resizing bufffers.