Updated March 18, 2021
Most of my code has changed a lot recently. Check updated posts.
For each post can update code listed in that post. Keep in mind code for linux and wsl configs will have their own posts, except in the case of .early-init and init.el, which have system switches (to load system specific dot-files).
Also note: abandoned convention of listing init lines. Now if you want to find the code, and there is now plenty of decent emacs code, use the search function. The site is not large.
Popup
(use-package popup
:config
(set-face-attribute 'popup-scroll-bar-foreground-face nil :background "#464f60" :inherit nil)
(set-face-attribute 'popup-scroll-bar-background-face nil :background "#263146" :inherit nil )
(set-face-attribute 'popup-menu-selection-face nil :inherit nil :background "#464f60" :foreground "#ffffff" )
(set-face-attribute 'popup-face nil :inherit nil :background "#263146" :foreground "#ffffff" )
; add some shotcuts in popup menu mode
(define-key popup-menu-keymap (kbd "C-i") 'popup-select)
(define-key popup-menu-keymap (kbd "C-n") 'popup-next)
(define-key popup-menu-keymap (kbd "C-p") 'popup-previous)
);end popup
Added some keys to popup as I'm now using it when company-yasnippet offers multiple selections (see yasnippet when updated for that code)
Tooltip
(set-face-attribute 'tooltip nil :inherit nil :background "gray96")
(tooltip-mode 1)
Pos-tip
(use-package pos-tip
:config
(setq pos-tip-background-color "#2471A3")
(setq pos-tip-foreground-color "#FFC300")
;(pos-tip-w32-max-width-height)
;(pos-tip-w32-max-width-height t)
)
The colors don't really come into play for pos-tip and tool-tip, as company is the main force for that.
Whichkey
Dropped which-key entirely as Poseidon has plenty of hydras, and fewer custom keys. This frees up memory, by which I mean your memory. Also, added counsel, ivy, and ivy-rich for exploring various functions and libraries.
Original Post Below
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 from oldest to newest.
In this earlier emacs post I covered lines 534 - 656 of my configuration file. This post covers lines 664 - 769
Some Key Bindings
Emacs is all about key bindings and shortcuts. The 'macs' part is short for 'macro.' Here are a few I use.
; Rebind C-m as prefix [before any C-m bound]
;unest C-m from RET
(define-key input-decode-map [?\C-m] [C-m])
; translate it as synonymous with <apps> key
(define-key key-translation-map (kbd "<apps>") (kbd "<C-m>"))
;create a prefix command
(define-prefix-command 'super-keymap)
;set C-m as the prefix-command (note s- is also enabled now
;so all C-m can be run with s-
(global-set-key (kbd "<C-m>") super-keymap)
;(bind-key "<C-m>" super-keymap)
;Undo Undo Default Binding
(global-unset-key (kbd "C-_"))
(bind-key "C-c C-u" 'undo)
;Bind append-lines
(global-set-key (kbd "M-j") 'append-lines)
;(bind-key "M-j" append-lines)
;Bind Kill This Buffer
(bind-key "\C-x\C-k" 'kill-this-buffer)
;New Scratch Buffer
(bind-key "C-c b" 'new-frame-scratch-buffer)
; remap go-to-line
(bind-key "M-g" 'goto-line)
(global-set-key [remap goto-line] 'goto-line-with-feedback)
;Bind New Line Dwim (gets next line bullet, creates new line with it)
(bind-key "<C-return>" 'new-line-dwim)
;(setq there-is-no-variable-here )
;describe personal key bindings
(bind-key "<f11>" 'describe-personal-keybindings)
Posframe and Popup
Popup and Posframe are standard packages you need to use other packages with popup frames, like hydra. Here's the code:
(use-package popup
:config
(set-face-attribute 'popup-scroll-bar-foreground-face nil :inherit nil :background "#FFC300")
(set-face-attribute 'popup-scroll-bar-background-face nil :inherit nil :background "#2471A3")
(set-face-attribute 'popup-face
'((t (:background "#FFC300" :foreground "#2471A3"))))
(define-key popup-menu-keymap (kbd "SPC") 'popup-select)
);end popup
;tooltip popups on mouse over
(tooltip-mode 1)
;customize tooltip background
(set-face-attribute 'tooltip nil :inherit nil :background "gray96")
;pos-tip, scroll over popups with info
(use-package pos-tip
:config
(defvar pos-tip-foreground-color "#FFC300"
"Default foreground color of pos-tip's tooltip.")
(defvar pos-tip-background-color "#2471A3"
"Default background color of pos-tip's tooltip.")
(setq pos-tip-background-color "#2471A3")
(setq pos-tip-foreground-color "#FFC300")
;(pos-tip-w32-max-width-height)
;(pos-tip-w32-max-width-height t)
)
;posframe
(use-package posframe
:config
(require 'posframe)
)
Which Key
Which Key opens a frame with next letter options and explanations after you type a letter. It's great until you have a system of hydras, at which point you won't need it. I leave up as it doesn't get in the way.
;Which Key
(use-package which-key
:after popup pos-tip
:diminish
:init
(require 'which-key)
(which-key-mode 1)
:config
;(which-key-setup-side-window-right)
;(which-key-setup-minibuffer)
;(setq which-key-use-C-h-commands t)
(setq which-key-popup-type 'frame)
; max width of which-key frame: number of columns (an integer)
;(setq which-key-frame-max-width 140)
; max height of which-key frame: number of lines (an integer)
;(setq which-key-frame-max-height 120)
;this is supposed to improve speed with custom fonts
(setq which-key-allow-imprecise-window-fit t)
(setq which-key-sort-order 'which-key-local-then-key-order)
;just so you can read your hyrda function titles in C-m m
(setq-default which-key-show-docstrings nil)
(setq-default which-key-max-description-length 11)
);end which-key
;Which Key Posframe
(use-package which-key-posframe
:load-path which-key-posframe-p
:after posframe
:config
(require 'which-key-posframe)
(which-key-posframe-mode)
;(setq which-key-posframe-poshandlee 'posframe-poshandler-frame-center)
(setq which-key-posframe-poshandler 'posframe-poshandler-frame-top-center)
(set-face-attribute 'which-key-posframe nil :inherit nil :background "#061229")
(set-face-attribute 'which-key-command-description-face nil :inherit nil :foreground "ghost white")
(set-face-attribute 'which-key-posframe-border nil :inherit nil :background "ghost white")
);end which-key-posframe