~hristoast/dot-emacs

478bc83c5720253ab04e82777e18d46972dc1a98 — Hristos N. Triantafillou 1 year, 10 months ago 38867c4
Customizable SML theme, reorganize some things

* A lot of stuff in internals.el really belonged in ui.el.  Most of
that has been moved.
* One dangling org-mode thing has been moved as well.
* The SML theme can now be set with an env var.
4 files changed, 75 insertions(+), 52 deletions(-)

M lib/internals.el
M lib/keybindings.el
M lib/orgmode.el
M lib/ui.el
M lib/internals.el => lib/internals.el +4 -40
@@ 12,20 12,9 @@
(flyspell-prog-mode)
;; http://www.gnu.org/software/emacs/manual/html_node/emacs/Autorevert.html
(global-auto-revert-mode t)
;; https://www.emacswiki.org/emacs/HighlightCurrentLine
(global-hl-line-mode t)
;; No toolbar, please.
(tool-bar-mode -1)
;; Or menu bar...
(menu-bar-mode -1)
;; Or scroll bar.
(scroll-bar-mode -1)
;; Delete highlighted text when you type
(delete-selection-mode t)

;; As advised by https://www.emacswiki.org/emacs/TrampMode
(setq-default tramp-default-method "ssh")

(setq
 ;; Backup files ...
 backup-directory-alist `(("." . "~/.emacs.d/backups"))


@@ 37,7 26,7 @@
 ;; initial-buffer-choice 'org-agenda-list
 ;; Auto-open symlinks that point to vcs-controlled files
 vc-follow-symlinks t
 ;; No splash screen.
 ;; No splash screen.  TODO: Is this better suited for ui.el?
 inhibit-splash-screen t
 ;; No default scratch
 initial-scratch-message nil


@@ 75,9 64,9 @@
 ;; No tabs
 indent-tabs-mode nil
 ;; "Tabs" are 4 spaces
 tab-width 4)

(display-time-mode)
 tab-width 4
 ;; As advised by https://www.emacswiki.org/emacs/TrampMode
 tramp-default-method "ssh")

;; Enable the disabled things
(put 'downcase-region 'disabled nil)


@@ 86,29 75,4 @@
(put 'upcase-region 'disabled nil)
(put 'upcase-word 'disabled nil)

(if (getenv "EMACS_LINUM")
    ;; http://is.gd/Mw5KiS
    (global-linum-mode t))

(defvar h-font-height)
(if (getenv "RETINA_DISPLAY")
    (setq h-font-height 170)
  (setq h-font-height 100))

;; Hack - http://sourcefoundry.org/hack/
(if (or (file-exists-p (concat (getenv "HOME") "/.fonts/Hack-Regular.ttf"))
        (file-exists-p "/usr/share/fonts/TTF/Hack-Regular.ttf"))
    (set-face-attribute 'default nil
                        :family "Hack"
                        :height h-font-height
                        :weight 'normal))

;; Emoji font
(set-fontset-font t 'symbol (font-spec :family "Noto Emoji") (selected-frame) 'prepend)
;; I don't work on macOS much anymore.. but if i do:
;; (set-fontset-font t 'symbol (font-spec :family "Apple Color Emoji") (selected-frame) 'prepend))

;; Maximize Emacs when it's opened
(add-to-list 'default-frame-alist '(fullscreen . maximized))

;;; internals.el ends here

M lib/keybindings.el => lib/keybindings.el +2 -3
@@ 15,10 15,12 @@
;; Make text bigger
(global-set-key (kbd "M-+") 'text-scale-increase)
(global-set-key (kbd "<f9>") 'text-scale-increase)
;; Ctrl-mouse scroll up to make text bigger
(global-set-key (kbd "<C-mouse-4>") 'text-scale-increase)
;; Or make it smaller
(global-set-key (kbd "M--") 'text-scale-decrease)
(global-set-key (kbd "<f8>") 'text-scale-decrease)
;; Ctrl-mouse scroll down to make text smaller
(global-set-key (kbd "<C-mouse-5>") 'text-scale-decrease)
;; Toggle whitespace-mode
(global-set-key (kbd "C-c w") 'whitespace-mode)


@@ 38,7 40,4 @@
;; Kill this buffer!
(substitute-key-definition 'kill-buffer 'kill-buffer-and-window global-map)

;; TODO: put this in with the orgmode stuff
(setq-default org-support-shift-select t)

;;; keybindings.el ends here

M lib/orgmode.el => lib/orgmode.el +3 -1
@@ 10,6 10,8 @@
  ("C-c l" . org-store-link)
  ("C-c a" . org-agenda)
  :defer t
  :init (setq-default org-startup-truncated nil))
  :init (setq-default
         org-startup-truncated nil
         org-support-shift-select t))

;;; orgmode.el ends here

M lib/ui.el => lib/ui.el +66 -8
@@ 29,24 29,82 @@
    :config
    (flycheck-status-emoji-mode)))

;; TODO: customizable sml theme
(unless (getenv "EMACS_NO_SMART_MODE_LINE") ;; Don't use smart-mode-line.
  ;; A powerful and beautiful mode-line for Emacs.
  ;; https://github.com/Malabarba/smart-mode-line
  (use-package smart-mode-line
    :ensure t
    :config
    (setq
     sml/shorten-directory t
     sml/theme 'dark)
    (sml/setup)))
  ;; TODO: Possibly add support for extra themes (e.g. powerline and solarized)
  (let ((h/sml/themes
         #s(hash-table
            size 3
            test equal
            data
            ("dark" dark
             "light" light
             "respectful" respectful)))
        (h/sml/default-theme "dark"))

    (use-package smart-mode-line
      :ensure t
      :config
      (setq
       sml/shorten-directory t
       sml/theme
       (gethash (or (getenv "EMACS_USE_SML_THEME") h/sml/default-theme)
                          h/sml/themes nil))
      (sml/setup))))

(unless (getenv "EMACS_NO_THEME") ;; Don't load a theme.
  ;; Color Theme for emacs based on material design colors
  ;; https://github.com/cpaulik/emacs-material-theme
  ;; TODO: How to use darker grey vs blue colors?
  ;; Also, allow for using different themes;
  ;; from a list or perhaps an arbitrary one.
  (use-package material-theme
    :ensure t
    :config (load-theme 'material t)))

(if (getenv "EMACS_LINUM")
    ;; http://is.gd/Mw5KiS
    (global-linum-mode t))

(defvar h-font-height)
(if (getenv "RETINA_DISPLAY")
    (setq h-font-height 170)
  (setq h-font-height 100))

;; TODO: Support different fonts
(unless (getenv "EMACS_NO_HACK_FONT")
  ;; Hack - http://sourcefoundry.org/hack/
  (if (or (file-exists-p (concat (getenv "HOME") "/.fonts/Hack-Regular.ttf"))
          (file-exists-p "/usr/share/fonts/TTF/Hack-Regular.ttf"))
      (set-face-attribute 'default nil
                          :family "Hack"
                          :height h-font-height
                          :weight 'normal)))

(unless (getenv "EMACS_NO_NOTO_EMOJI")
  ;; I don't work on macOS much anymore.. but if i do:
  ;; (set-fontset-font t 'symbol (font-spec :family "Apple Color Emoji") (selected-frame) 'prepend)
  ;; Emoji font
  (set-fontset-font t 'symbol (font-spec :family "Noto Emoji") (selected-frame) 'prepend))

;; TODO: Make the below things toggle-able

(display-time-mode)

;; https://www.emacswiki.org/emacs/HighlightCurrentLine
(global-hl-line-mode t)

;; No toolbar, please.
(tool-bar-mode -1)

;; Or menu bar...
(menu-bar-mode -1)

;; Or scroll bar.
(scroll-bar-mode -1)

;; Maximize Emacs when it's opened
(add-to-list 'default-frame-alist '(fullscreen . maximized))

;;; ui.el ends here