Skip to content

Latest commit

 

History

History
261 lines (222 loc) · 11.2 KB

File metadata and controls

261 lines (222 loc) · 11.2 KB

user-interface

Introduction

This is the code that defines all user interfaces except for those directly related to my memex or

Dependencies

DependencyDescription
doom-themesA package for creating and using themes.
doom-modelineModelines for doom emacs.
solaire-modeChanges colors on non-file buffers.
ivyImproves a lot of the UI features of Emacs.
counselAdds improved UI customizations.
swiperBetter search engine.
ivy-richAdds comments to ivy functions.
posframeDependency for posframe functions.
ivy-posframeAdds posframe popups to Ivy.
hydraAdds hydras, nice looking UI popups.
hydra-posframePOS-ifys hydras.
which-keyTell me what the keys do.
rainbow-delimitersMake delimeters pretty.
ace-windowBetter jumping between windows.
flyspell-correctA good, very effective spell checker.
(ec-load-deps deps)

General UI Improvements

Ivy Mode

I like to use ivy-mode to make my text editor feel better and be more useful, so I add it.

(setq ivy-height 20)
(ivy-mode)

Ivy Posframe

VariableValueDescription
ivy-posframe-min-heightnil
ivy-posframe-heightnil
ivy-posframe-min-width100Makes the width of the posframe reasonable.
ivy-posframe-border-width5

Now that we have the variables, we can actually set everything up with reckless abandon.

(ec-set-variables vars)

(setq ivy-posframe-display-functions-alist
      '((swiper-isearch          . ivy-posframe-display-at-window-bottom-left)
	(ec-searcan auditory bell, soh-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)))

(setf (alist-get 'ivy-completion-in-region ivy-posframe-display-functions-alist)
      'ivy-posframe-display-at-point)

(setq ivy-posframe-height ivy-height)

;; size it to the same thing as ivy posframe each time
(setq ivy-posframe-size-function
      (defun ivy-posframe-get-size+ ()
        (if (eq ivy--display-function
                'ivy-posframe-display-at-point)
            (list
             :min-height ivy-posframe-height
             :min-width 80)
          (list
           :min-height ivy-posframe-height
           :min-width (+ 2 (frame-width))))))

(ivy-posframe-mode +1)

Finally, we also include hydra-posframe related features, which makes our hydras look nicer.

(setq hydra-posframe-border-width 5)
(hydra-posframe-mode +1)

Ace Window

This first sets the primary key to M-o, which makes it easier to jump about.

(global-set-key (kbd "M-o") 'ace-window)

Then I also change the keys ot be alphanumeric.

(setq aw-keys '(?a ?b ?c ?d ?e ?f ?g ?h ?i ?j ?k ?l ?m ?n ?o ?p ?q ?r ?s ?t ?u ?v ?w ?x ?y ?z))

Flyspell

(define-key flyspell-mode-map (kbd "C-:") 'flyspell-correct-previous)
(add-hook 'org-mode-hook #'flyspell-mode)
(add-hook 'prog-mode-hook #'flyspell-mode)

there is no reazon

Coding UI Improvements

Rainbow Delimiters

Navagating lisp sucks with a simple sea of parens, so let’s break that up into a sea of subtly different colored parens.

(setq rainbow-delimiters-max-face-count 2)
(add-hook 'prog-mode-hook (lambda () (rainbow-delimiters-mode +1)))
(rainbow-delimiters-mode +1)

Default Configuration Improvements

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)

;; add visual lines for everything
(global-visual-line-mode t)

;; wrap words, but also kill the entire line
(setq-default word-wrap t)

;; y or n instead of yes or no
(fset 'yes-or-no-p 'y-or-n-p)

;; make the cursor a bar, which is more modern
(setq-default cursor-type '(bar . 2))
VariableValueDescription
max-mini-window-height1.0Make minibuffer height reasonable.
inhibit-startup-messagetClear away startup nonsense.
inhibit-startup-screent
inhibit-splash-screent
inhibit-compacting-font-cachestI have the RAM, I can take more memory usage.
mouse-yank-at-pointtMake mouse paste at point.
widget-image-enablenilNo more ugly buttons.
x-underline-at-descent-linetUnderline line at descent position.
left-fringe-width1Make fringes more manageable.
right-fringe-width1
window-divider-default-right-width10Make dividers drag-able but small.
line-spacingnilEliminate line spacing, I don’t like it.
use-dialog-boxnilKill the dialog boxes, I don’t like them.
find-file-visit-truenametRemove absurd file names.
mouse-wheel-scroll-amount‘(1 ((shift) . 1))Make scrolling consistent.
mouse-wheel-progressive-speedt
mouse-wheel-follow-mouset
scroll-step1
(ec-set-variables vars)

Startup Configuration

Scratch Buffer

This makes a nice scratch buffer with links to the documentation for saving it, has some code for elisp, and so on.

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

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

#+END_SRC

And then we set the scratch buffer so it starts up with it.

(setq initial-scratch-message scratch-buffer)
(setq initial-major-mode 'org-mode)

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 vars are defined.

VariableValue
doom-themes-enable-boldt
doom-themes-enable-italict
doom-themes-org-fontify-special-tagsnil
ring-bell-function#’ec-bell-function
custom-theme-directory(f-expand “./”)
(ec-set-variables vars)

Theme Loading

Finally, we actually tangle and load the theme file.

(doom-modeline-mode +1)
(solaire-mode +1)
 (let ((econf-out "econf-theme.el"))
   (doom-themes-org-config)
					;  (org-babel-tangle-file "econf-theme.org" econf-out "emacs-lisp\\|elisp")
   (load-theme 'econf t)
   ;; (delete-file econf-out)
   )

					;  (org-babel-tangle-file "~/Memex/emacs-config/econf-theme.org" "~/Memex/emacs-config/econf-theme.el" "emacs-lisp\\|elisp")