This post covers "Highlights" from the appearance section of my init.

  • Appearance
    • Entering and Exiting Emacs
    • Default Appearance Customizations
    • Themes
    • Highlights
    • Hydras
    • Appearance Hydra


Emacs is old school. You're either new to it - which means you wouldn't be here unless it was your type of thing - or you know what you're looking for. In either case, go to the side bar of this page and click on the 'Emacs' tag. Then read the posts y date from oldest to newest.

In the last emacs post I covered lines 1031 - 1110. This post covers lines 1115 - 1195. I include the lines for anyone that wants to patch together my entire init from start to finish. The lines won't always match up because I take stuff out when I'm in my init.

The code for setting up the hydra packages needs to come before any hydra packages. The appearance hydra is wicked cool.

Highlight Numbers

Adds some syntax highlighting just for numbers. Use case: you have a doc with numbers everywhere and you want to see them contrasted against text.

(use-package hydra
;:pin melpa-stable
(use-package use-package-hydra
;:pin melpa-stable
(use-package hydra-posframe
:load-path hydra-posframe-p
(require 'hydra-posframe)
'((left-fringe . 4) (right-fringe . 4) (top-fringe . 4) (bottom-fringe . 4) (height . 18) (width . 105) (min-height . 17) (max-height . 30) (top . 25)))
(hydra-posframe-border-face ((t (:background "#ffffff"))))
(hydra-posframe-face ((t (:background-color "#6272a4"))))
(after-init . hydra-posframe-enable)
);end use-package-hydra-posframe
);end use-package hydra

;Pretty Hydra
(use-package pretty-hydra
(require 'pretty-hydra)
);end use package pretty hyrda
;title generator
(require 's)
(require 'all-the-icons)
(with-eval-after-load 'all-the-icons
(declare-function all-the-icons-faicon 'all-the-icons)
(declare-function all-the-icons-fileicon 'all-the-icons)
(declare-function all-the-icons-material 'all-the-icons)
(declare-function all-the-icons-octicon 'all-the-icons)

;with-faicon function allows an icon in hydra title. Requires following requires and aliases. To omit don't include 'with-faicon' in appearance-title

;define an icon function with all-the-icons-faicon
;to use filecon, etc, define same function with icon set
 (defun with-faicon (icon str &rest height v-adjust)
    (s-concat (all-the-icons-faicon icon :v-adjust (or v-adjust 0) :height (or height 1)) " " str))
 (defun with-fileicon (icon str &rest height v-adjust)
    (s-concat (all-the-icons-fileicon icon :v-adjust (or v-adjust 0) :height (or height 1)) " " str))

Appearance Hydra

This hydra is kick-ass. I bind it to 'C-m a' and use it all the time to cycle themes, hop into olivetti mode, throw the line numbers on, add transparency, maximize screen, and highlight stuff. Here's an image followed by the code.

emacs poseidon configuration code appearance hydra

;define a title function
(defvar appearance-title (with-faicon "desktop" "APPEARANCE"))
;generate hydra
(pretty-hydra-define Appearance_ (:foreign-keys warn :title appearance-title :quit-key "q" :color amaranth )
   (("o" olivetti-mode "Olivetti" :toggle t)
    ("t" toggle-window-transparency "Transparency" :toggle t )
    ("c" cycle-themes "Cycle Themes" )
    ("=" text-scale-increase "Zoom In")
    ("-" text-scale-decrease "Zoom Out")
    ("x" toggle-frame-maximized "Maximize Frame" :toggle t )
);end theme
     ("d" rainbow-delimiters-mode "Rainbow Delimiters" :toggle t )
     ("r" rainbow-mode "Show Hex Colours" :toggle t )
;    ("n" highlight-numbers-mode "Highlight Code Numbers" :toggle t )
     ("l" display-line-numbers-mode "Show Line Numbers" :toggle t )
     ("_" global-hl-line-mode "Highlight Current Line" :toggle t )
;    ("I" rainbow-identifiers-mode "Rainbow Identifiers" :toggle t )
     ("b" beacon-mode "Show Cursor Trailer" :toggle t )
;    ("e" emojify     "Enable Emojies" :toggle 0 )
);end highlighting
   (("j" visual-line-mode "Wrap Line Window"  :toggle t)
    ("m" visual-fill-column-mode "Wrap Line Column"  :toggle t)
    ("a" adaptive-wrap-prefix-mode "Indent Wrapped Lines" :toggle t )
;   ("i" highlight-indent-guides-mode  "Show Indent Guides" :toggle t )
    ("g" fci-mode "Show Fill Column" :toggle t )
    ("h" hydra-helm/body "Return To Helm" :color blue )
    ("<SPC>" nil "Quit" :color blue )
);end miscellaneous
);end hydra body
);end pretty-hydra-appearance
(bind-key "<C-m> a" 'Appearance_/body)

That’s all for now…