Econf Styling

Table of Contents

Introduction

This is how I define my theme in Emacs. It's probably not the best way to go about it, but it's how I have it set up.

Dependencies

Dependency Description
doom-themes A package for creating and using themes.
(ec-load-deps deps)

UI Features

This is a temporary thing, but basically this places everything in posframes. These will be moved to other files and I will probably include a fork of hydra-posframe.

(use-package ivy-posframe
  :custom
  (ivy-posframe-min-height nil)
  (ivy-posframe-height nil)
  (ivy-posframe-min-width 200)
  (ivy-posframe-width 200)
  (ivy-posframe-border-width 5)
  (ivy-posframe-display-functions-alist
   '((swiper-isearch          . ivy-posframe-display-at-window-bottom-left)
     (ec-search-interactively . ivy-posframe-display-at-window-bottom-left)
     (w3m-browse-url          . ivy-posframe-display-at-window-bottom-left)
     (flyspell-correct-ivy    . ivy-posframe-display-at-point)
     (t                       . ivy-posframe-display)))
  (ivy-posframe-height-alist
   '((flyspell-correct-ivy . 20)
     (t                    . 10)))
  :config (ivy-posframe-mode))


(use-package hydra-posframe
  :straight (hydra-posframe :type git :host github :repo "Ladicle/hydra-posframe")
  :custom (hydra-posframe-border-width 5)
  :config (hydra-posframe-mode))

Basic Customizations

To make the Emacs configuration a little more modern (and minimal) I remove the scrollbar, splash screens, and set the mini-window height.

;; Remove Scrollbar
(scroll-bar-mode -1)
;; Remove Tool Bar
(tool-bar-mode -1)
;; Remove Menubar
(menu-bar-mode -1)
;; Remove Tooltips
(tooltip-mode -1)

;; y or n instead of yes or no
(fset 'yes-or-no-p 'y-or-n-p)
Variable Value Description
max-mini-window-height 1.0 Make minibuffer height reasonable.
inhibit-startup-message t Clear away startup nonsense.
inhibit-startup-screen t ''
inhibit-splash-screen t ''
inhibit-compacting-font-caches t I have the RAM, I can take more memory usage.
mouse-yank-at-point t Make mouse paste at point.
widget-image-enable nil No more ugly buttons.
x-underline-at-descent-line t Underline line at descent position, not baseline position.
left-fringe-width 1 Make fringes more manageable.
right-fringe-width 1 ''
window-divider-default-right-width 5 Make dividers drag-able but small.
line-spacing nil Eliminate line spacing, I don't like it.
use-dialog-box nil Kill the dialog boxes, I don't like them.
find-file-visit-truename t Remove absurd file names.
mouse-wheel-scroll-amount '(1 ((shift) . 1)) Make scrolling consistent.
mouse-wheel-progressive-speed t ''
mouse-wheel-follow-mouse t ''
scroll-step 1 ''

Now I just set some more vars and other things

(ec-set-variables vars)

;; have cursor look nicer
(setq-default cursor-type  '(bar . 2))

;; indent without tabs
(setq-default line-spacing 0)

;; Indent without tabs
(setq-default indent-tabs-mode nil)

;; Make words wrap and remove ugly arrows
(global-visual-line-mode 1)

;; display window dividers
(window-divider-mode t)

Display line numbers in various modes where I want to have line numbers, but don't display them in all modes since that kind of sucks.

(add-hook 'prog-mode-hook 'display-line-numbers-mode)
(add-hook 'conf-mode-hook 'display-line-numbers-mode)

Startup Configuration

Now I also like to have my

Scratch Buffer

This makes a nice scratch buffer with links to the documentation for saving it, has some code for elisp, and so on. 1 This is what the org-bable-execute:org function I defined earlier is for, making it easier to template things and display them nicely.

#+TITLE: Scratch Buffer
This is the scratch buffer, write whatever you want here. It won't be saved unless you enter the save-buffer command using \[save-buffer].

#+BEGIN_SRC emacs-lisp
;; You can also write code here.

#+END_SRC
(setq initial-scratch-message scratch-buffer)

(setq initial-major-mode 'org-mode)

Initial Buffer

Here I just set the initial buffer to the main index I have set up for my configuration.

(setq initial-buffer-choice ec-main-index)

Theme Config

Bell

I like both having a visual bell and an auditory bell, so I have this function which makes a nice beep and blinks the modeline.

(defun ec-bell-function ()
  (exec-shell-command "play -n synth 0.1 sin 500 chorus 1 0.9 55 0.4 0.1 2 -t") 
  (doom-themes-visual-bell-fn))

Vars

Here some variables are set.

Variable Value
doom-themes-enable-bold t
doom-themes-enable-italic t
doom-themes-org-fontify-special-tags nil
ring-bell-function #'ec-bell-function
custom-theme-directory (f-expand "./")

Now finally I load my theme which is located here. This function tangles it and then loads it.

(ec-set-variables var-themes)
(doom-themes-org-config)

Theme Loading

This is just a bit of code to create the theme file, load it, and then remove it so it doesn't clutter up my directory. 2 Yes, all of this is probably somewhat slow, so I probably should consider optimizing it someday, maybe pre-tangling and pre-compiling it.

(let ((econf-out "econf-theme.el"))
  (org-babel-tangle-file "econf-theme.org" econf-out "emacs-lisp\\|elisp")
  (load-theme 'econf t)
  (delete-file econf-out))

Last Modified: 2022-W05-1 22:09

Generated Using: Emacs 27.2 (Org mode 9.4.6)

Except where otherwise noted content on cons.dev is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.