├── davison-minimal-research-thumb.png ├── README.org └── minimal.el /davison-minimal-research-thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magnars/minimal/master/davison-minimal-research-thumb.png -------------------------------------------------------------------------------- /README.org: -------------------------------------------------------------------------------- 1 | #+title:Minimalist appearance for Emacs 2 | 3 | [[file:davison-minimal-research-thumb.png]] 4 | 5 | See the [[http://dandavison.github.com/minimal/][minimal.el webpage]] for screenshot and instructions. 6 | 7 | minimal.el adds a minor mode providing a minimalist appearance for 8 | Emacs. Toggle the minor mode with =M-x minimal-mode=. By default, this 9 | gets rid of 10 | 11 | - mode line 12 | - scroll bars 13 | - menu bar 14 | - tool bar 15 | 16 | The mode line is replaced by a thin separator line. 17 | -------------------------------------------------------------------------------- /minimal.el: -------------------------------------------------------------------------------- 1 | ;;; minimal.el --- Minimalist Emacs appearance 2 | 3 | ;; Copyright (C) 2010 Dan Davison 4 | 5 | ;; Author: Dan Davison 6 | ;; Keywords: appearance, minimalism 7 | 8 | ;;; License: 9 | 10 | ;; This program is free software; you can redistribute it and/or modify 11 | ;; it under the terms of the GNU General Public License as published by 12 | ;; the Free Software Foundation; either version 3, or (at your option) 13 | ;; any later version. 14 | ;; 15 | ;; This program is distributed in the hope that it will be useful, 16 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | ;; GNU General Public License for more details. 19 | ;; 20 | ;; You should have received a copy of the GNU General Public License 21 | ;; along with GNU Emacs; see the file COPYING. If not, write to the 22 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 23 | ;; Boston, MA 02110-1301, USA. 24 | 25 | ;;; Commentary: 26 | 27 | ;; minimalists may also like: 28 | ;; 29 | ;; (nconc default-frame-alist '((cursor-type . bar))) 30 | ;; (setq inhibit-startup-message t) 31 | ;; (blink-cursor-mode -1) 32 | 33 | ;;; Code: 34 | 35 | (defvar minimal-zap-mode-line t 36 | "Should the mode line be turned into a thin separator line?") 37 | 38 | (defvar minimal-zap-scroll-bar t 39 | "Should the scroll bars be removed?") 40 | 41 | (defvar minimal-zap-menu-bar t 42 | "Should the menu bar be removed?") 43 | 44 | (defvar minimal-zap-tool-bar t 45 | "Should the tool bar be removed?") 46 | 47 | (defvar minimal-mode-line-background "darkred" 48 | "Background colour for active mode line face when minimal minor 49 | mode is active") 50 | 51 | (defvar minimal-mode-line-inactive-background "dim grey" 52 | "Background colour for inactive mode line face when minimal 53 | minor mode is active") 54 | 55 | (defvar minimal-mode-line-height 0.1 56 | "Height of mode line when minimal minor mode is active") 57 | 58 | (defvar minimal-mode-hook nil 59 | "Hook run after switching to `minimal-mode'") 60 | 61 | (defvar minimal-mode-map (make-sparse-keymap)) 62 | (defvar minimal-zapped-scroll-bar nil) 63 | (defvar minimal-zapped-menu-bar nil) 64 | (defvar minimal-zapped-tool-bar nil) 65 | 66 | (define-minor-mode minimal-mode 67 | "Minimalist visual appearance. 68 | 69 | \\{minimal-mode-map}" 70 | nil " min" nil 71 | (cond 72 | (minimal-mode 73 | ;; turn on 74 | (when minimal-zap-mode-line 75 | (minimal-save-and-zap-mode-line) 76 | (unless (facep 'minimal-mode-line) 77 | (copy-face 'mode-line 'minimal-mode-line)) 78 | (set-face-attribute 'minimal-mode-line nil 79 | :background minimal-mode-line-background 80 | :height minimal-mode-line-height) 81 | (setq face-remapping-alist 82 | (cons '(mode-line minimal-mode-line) 83 | (assq-delete-all 'mode-line face-remapping-alist))) 84 | (unless (facep 'minimal-mode-line-inactive) 85 | (copy-face 'mode-line-inactive 'minimal-mode-line-inactive)) 86 | (set-face-attribute 'minimal-mode-line-inactive nil 87 | :background minimal-mode-line-inactive-background 88 | :height minimal-mode-line-height) 89 | (setq face-remapping-alist 90 | (cons '(mode-line-inactive minimal-mode-line-inactive) 91 | (assq-delete-all 'mode-line-inactive face-remapping-alist)))) 92 | (when (and scroll-bar-mode minimal-zap-scroll-bar) 93 | (setq minimal-zapped-scroll-bar t) 94 | (scroll-bar-mode -1)) 95 | (when (and menu-bar-mode minimal-zap-menu-bar) 96 | (setq minimal-zapped-menu-bar t) 97 | (menu-bar-mode -1)) 98 | (when (and tool-bar-mode minimal-zap-tool-bar) 99 | (setq minimal-zapped-tool-bar t) 100 | (tool-bar-mode -1)) 101 | (add-hook 'after-change-major-mode-hook 'minimal-mode)) 102 | (t 103 | ;; turn off 104 | ;; TODO: This turns off on a per-buffer basis. 105 | ;; how to turn off for all buffers? 106 | (when minimal-zap-mode-line 107 | (setq face-remapping-alist 108 | (assq-delete-all 'mode-line 109 | (assq-delete-all 'mode-line-inactive 110 | face-remapping-alist)))) 111 | (minimal-restore-mode-line) 112 | (when (and (not scroll-bar-mode) minimal-zapped-scroll-bar) 113 | (scroll-bar-mode +1)) 114 | (when (and (not menu-bar-mode) minimal-zapped-menu-bar) 115 | (menu-bar-mode +1)) 116 | (when (and (not tool-bar-mode) minimal-zapped-tool-bar) 117 | (tool-bar-mode +1))) 118 | (remove-hook 'after-change-major-mode-hook 'minimal-mode))) 119 | 120 | (defun minimal-save-and-zap-mode-line (&optional buffer) 121 | ;; Save buffer's `mode-line-format' and remove mode line 122 | (interactive) 123 | (when buffer (set-buffer buffer)) 124 | (unless (and (stringp mode-line-format) (string= mode-line-format "") 125 | (not (minibufferp))) 126 | (set (make-local-variable 'minimal-saved-mode-line-format) mode-line-format) 127 | (setq mode-line-format ""))) 128 | 129 | (defun minimal-restore-mode-line (&optional buffer) 130 | ;; Restore buffer's saved `mode-line-format' 131 | (interactive) 132 | (when buffer (set-buffer buffer)) 133 | (if (and (stringp mode-line-format) (string= mode-line-format "") 134 | (not (minibufferp))) 135 | (if (boundp 'minimal-saved-mode-line-format) 136 | (setq mode-line-format minimal-saved-mode-line-format) 137 | (message "Failed to restore `mode-line-format' in buffer %s" (buffer-name))))) 138 | 139 | (provide 'minimal) 140 | ;; minimal.el ends here 141 | --------------------------------------------------------------------------------