2017-06-08 11:47:56 +02:00
|
|
|
;;; core/autoload/ui.el -*- lexical-binding: t; -*-
|
2017-02-01 00:31:58 -05:00
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun doom/toggle-fullscreen ()
|
2017-05-19 17:21:52 +02:00
|
|
|
"Toggle fullscreen Emacs (non-native on MacOS)."
|
2017-02-01 00:31:58 -05:00
|
|
|
(interactive)
|
|
|
|
(set-frame-parameter
|
|
|
|
nil 'fullscreen
|
|
|
|
(unless (frame-parameter nil 'fullscreen)
|
|
|
|
'fullboth)))
|
|
|
|
|
|
|
|
;;;###autoload
|
2017-05-13 22:39:50 +02:00
|
|
|
(defun doom/toggle-line-numbers (&optional arg)
|
|
|
|
"Toggle `linum-mode'."
|
|
|
|
(interactive "P")
|
2017-05-28 15:31:53 +02:00
|
|
|
(cond ((featurep 'nlinum)
|
|
|
|
(nlinum-mode (or arg (if nlinum-mode -1 +1))))
|
2017-06-08 11:47:56 +02:00
|
|
|
((featurep 'linum)
|
2017-05-28 15:31:53 +02:00
|
|
|
(linum-mode (or arg (if linum-mode -1 +1))))
|
|
|
|
(t
|
|
|
|
(error "No line number plugin detected"))))
|
2017-02-01 00:31:58 -05:00
|
|
|
|
2017-05-19 03:00:27 +02:00
|
|
|
;;;###autoload
|
|
|
|
(defun doom-resize-window (new-size &optional horizontal)
|
|
|
|
"Resize a window to NEW-SIZE. If HORIZONTAL, do it width-wise."
|
|
|
|
(enlarge-window (- new-size (if horizontal (window-width) (window-height)))
|
|
|
|
horizontal))
|
|
|
|
|
2017-02-19 18:11:44 -05:00
|
|
|
;;;###autoload
|
|
|
|
(defun doom/window-zoom ()
|
|
|
|
"Maximize and isolate the current buffer. Activate again to undo this. If the
|
|
|
|
window changes before then, the undo expires."
|
|
|
|
(interactive)
|
2017-05-11 09:48:12 +02:00
|
|
|
(if (and (one-window-p)
|
|
|
|
(assoc ?_ register-alist))
|
|
|
|
(jump-to-register ?_)
|
|
|
|
(window-configuration-to-register ?_)
|
|
|
|
(delete-other-windows)))
|
2017-05-19 03:00:27 +02:00
|
|
|
|
2017-05-19 15:56:35 +02:00
|
|
|
(defvar doom--window-enlargened nil)
|
2017-05-19 03:00:27 +02:00
|
|
|
;;;###autoload
|
|
|
|
(defun doom/window-enlargen ()
|
|
|
|
"Enlargen the current window. Activate again to undo."
|
|
|
|
(interactive)
|
|
|
|
(setq doom--window-enlargened
|
|
|
|
(if (and doom--window-enlargened
|
|
|
|
(assoc ?_ register-alist))
|
|
|
|
(ignore (jump-to-register ?_))
|
|
|
|
(window-configuration-to-register ?_)
|
|
|
|
(doom-resize-window (truncate (/ (frame-width) 1.2)) t)
|
|
|
|
(doom-resize-window (truncate (/ (frame-height) 1.2)))
|
|
|
|
t)))
|