Skip to content

Instantly share code, notes, and snippets.

@pft
Last active March 7, 2016 19:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pft/684603b6cc2856e41ac1 to your computer and use it in GitHub Desktop.
Save pft/684603b6cc2856e41ac1 to your computer and use it in GitHub Desktop.
Responsive lyout for mingus-mopidy branch
(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)))
@pft
Copy link
Author

pft commented Feb 6, 2016

Adjust column widths when resizing bufffers.

@pft
Copy link
Author

pft commented Mar 7, 2016

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