From aeb2067def22366219b6c3fd9ac365eeb5e0a784 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Mon, 1 Oct 2018 09:04:00 -0700 Subject: [emacs] Remove code to manage display. I don't need so many custom code to manage the display. We just want to specify the font size, and how to switch to full screen. --- configs/rcs/emacs.d/init.el | 70 +++++++-------------------------------------- 1 file changed, 10 insertions(+), 60 deletions(-) (limited to 'configs/rcs') diff --git a/configs/rcs/emacs.d/init.el b/configs/rcs/emacs.d/init.el index a9249e6..b6749a8 100644 --- a/configs/rcs/emacs.d/init.el +++ b/configs/rcs/emacs.d/init.el @@ -101,11 +101,19 @@ '(inhibit-startup-message t) '(inhibit-startup-echo-area-message t)) +(use-package frame + :ensure nil + :bind (("C-c C-m" . toggle-frame-fullscreen)) + :config + ;; when using darwin I don't want to use the native full screen mode, as it opens a new work space + (when (eq system-type 'darwin) + (setq ns-use-native-fullscreen nil)) + (set-face-attribute 'default nil :height 150 :weight 'normal :width 'normal)) + (use-package general :config (general-define-key - "M-j" 'join-line - "C-c m m" 'emacs-toggle-size)) + "M-j" 'join-line)) ;;; emacs hygiene @@ -370,61 +378,3 @@ (use-package protobuf-mode :after (flyspell) :hook ((protobuf-mode . flyspell-prog-mode))) - -;;; layout -;; when using darwin, I don't want to use the native fullscreen mode (it opens a new workspace) -(when (eq system-type 'darwin) - (setq ns-use-native-fullscreen nil)) - -(defconst display-name - (pcase (display-pixel-width) - (`1440 'macbook-pro) - (_ 'default))) - -(defconst emacs-min-top 23) - -(defconst emacs-min-left - (pcase display-name - (`macbook-pro 140) - (`default 200))) - -(defconst emacs-min-height - (pcase display-name - (`macbook-pro 60) - (`default 47))) - -(defconst emacs-min-width - (pcase display-name - (`macbook-pro 130) - (`default 110))) - -(defconst emacs-min-font - (pcase display-name - (_ "-*-DejaVu Sans Mono-normal-normal-normal-*-15-*-*-*-m-0-iso10646-1"))) - -(defun emacs-min () - (interactive) - (cl-flet ((set-param (p v) (set-frame-parameter (selected-frame) p v))) - (set-param 'fullscreen nil) - (set-param 'vertical-scroll-bars nil) - (set-param 'horizontal-scroll-bars nil)) - (set-frame-position (selected-frame) emacs-min-left emacs-min-top) - (set-frame-height (selected-frame) emacs-min-height) - (set-frame-width (selected-frame) emacs-min-width) - (set-frame-font emacs-min-font)) - -(defun emacs-max () - (interactive) - (cl-flet ((set-param (p v) (set-frame-parameter (selected-frame) p v))) - (set-param 'fullscreen 'fullboth) - (set-param 'vertical-scroll-bars nil) - (set-param 'horizontal-scroll-bars nil)) - (set-frame-font emacs-min-font)) - -(defun emacs-toggle-size () - (interactive) - (if (alist-get 'fullscreen (frame-parameters)) - (emacs-min) - (emacs-max))) - -(add-hook 'emacs-startup-hook #'emacs-min t) -- cgit 1.4.1