53 lines
1.7 KiB
EmacsLisp
53 lines
1.7 KiB
EmacsLisp
;;; window-utils.el --- Utility functions and config for window management -*- lexical-binding: t -*-
|
|
|
|
;; This file is not part of GNU Emacs
|
|
|
|
;; This program is free software: you can redistribute it and/or modify
|
|
;; it under the terms of the GNU General Public License as published by
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
;; (at your option) any later version.
|
|
|
|
;; This program is distributed in the hope that it will be useful,
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
;; GNU General Public License for more details.
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
|
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
;; commentary
|
|
|
|
;;; Code:
|
|
|
|
(setq switch-to-buffer-obey-display-actions t)
|
|
|
|
(defun delete-other-main-windows ()
|
|
"Kill all windows except for side windows."
|
|
(interactive)
|
|
(dolist (win (window-list))
|
|
(when (and (not (equal (selected-window) win))
|
|
(not (window-parameter win 'window-side)))
|
|
(delete-window win))))
|
|
|
|
(define-key global-map (kbd "C-x 1") #'delete-other-main-windows)
|
|
|
|
(define-key global-map (kbd "C-S-x 1") #'delete-other-windows)
|
|
|
|
;; left, top, right, bottom
|
|
(setq window-sides-slots (if (equal system-type 'android)
|
|
'(1 1 0 1)
|
|
'(5 1 5 1)))
|
|
|
|
(add-to-list 'display-buffer-alist
|
|
`("\\*Help\\*"
|
|
(display-buffer-in-side-window)
|
|
(side . ,(if (equal system-type 'android) 'bottom 'right))
|
|
(slot . ,(if (equal system-type 'android) 0 4))
|
|
(window-height . 0.2)))
|
|
|
|
(provide 'window-utils)
|
|
|
|
;;; window-utils.el ends here
|