HOME

Customizations That Serve No Other Purpose Than to Make Me Happy

Senseless Eye-Candy

Frame Opacity

I'm not entirely sure why, but I like to be able to see through my editor window. Sometimes I can read documentation through there, but I have no real excuse other than I think it looks cool.

First, a function that adjusts the frame opacity:

(defun opacity-modify (&optional dec)
  "Modify the transparency of the emacs frame; if DEC is t,
 decrease the transparency, otherwise increase it in 5%-steps"
  (let* ((alpha-or-nil (frame-parameter nil 'alpha)) ; nil before setting
         (oldalpha (if alpha-or-nil alpha-or-nil 100))
         (newalpha (if dec (- oldalpha 5) (+ oldalpha 5))))
    (when (and (>= newalpha frame-alpha-lower-limit) (<= newalpha 100))
      (modify-frame-parameters nil (list (cons 'alpha newalpha))))))

Then, some interactive functions to call it:

(defun toby/increase-frame-opacity ()
  (interactive)
  (opacity-modify))
(defun toby/decrease-frame-opacity ()
  (interactive)
  (opacity-modify t))

(defun toby/reset-frame-opacity ()
  (interactive)
  (modify-frame-parameters nil `((alpha . 100))))

Finally, some keybindings to invoke it all:

  • C-c C-8 will increase opacity (== decrease transparency)
  • C-c C-9 will decrease opacity (== increase transparency
  • C-c C-0 will returns the state to normal
(global-set-key (kbd "C-c C-8") 'toby/increase-frame-opacity)
(global-set-key (kbd "C-c C-9") 'toby/decrease-frame-opacity)
(global-set-key (kbd "C-c C-0") 'toby/reset-frame-opacity)

WHITESPACE!

Show me those pesky white-space errors so I might crush them!

(setq whitespace-display-mappings
      '((space-mark 32   [183]  [46])   ; normal space, ·
        (space-mark 160  [164]  [95])
        (space-mark 2208 [2212] [95])
        (space-mark 2336 [2340] [95])
        (space-mark 3616 [3620] [95])
        (space-mark 3872 [3876] [95])
        (newline-mark 10 [182 10])      ; newlne, ¶
        (tab-mark 9 [9655 9] [92 9])    ; tab, ▷
        ))
(setq whitespace-line-column 78)

;; Set in customize
; (setq whitespace-style  '(face lines-tail))

Word-Wrapping

Via: http://ergoemacs.org/emacs/emacs23_features.html

Visual line mode causes lines to be wrapped at word boundaries instead of in the midst of things.

(global-visual-line-mode 1)

Theme

I have one.

(load-theme 'toby)
;; Make sure terminals pick up the theme settings:
(setq term-default-fg-color (face-foreground 'default))
(setq term-default-bg-color (face-background 'default))

Twitter

Talk about senseless…

(require-package 'twittering-mode)
(autoload 'twittering-mode "twittering-mode" "Twitter stream in Emacs" t)

(setq twittering-username "tobytripp")
(setq twittering-icon-mode t)

(global-set-key (kbd "C-c t") 'twittering-update-status-interactive)

Make its window sticky:

(toby/defhook twittering-mode-hook
  (set-window-dedicated-p (selected-window) 1))

Author: Toby Tripp

Created: 2018-03-04 Sun 00:38

Validate