[Emacs] Organize appearance heading

This commit is contained in:
Ivan Malison 2016-10-03 17:44:56 -07:00
parent 0b903e0841
commit 212c5c2a43
No known key found for this signature in database
GPG Key ID: 62530EFBE99DC2F8

View File

@ -4036,12 +4036,9 @@ Set the character used to represent spaces to ·, and the character used for tab
(add-hook 'compilation-filter-hook 'colorize-compilation-buffer) (add-hook 'compilation-filter-hook 'colorize-compilation-buffer)
#+END_SRC #+END_SRC
** TODO Finish making the following litarate ** Automatic Theme Changer
Disabled for now
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
;; These can be overriden in custom-before.el
(defvar imalison:light-theme 'solarized-light)
(defvar imalison:dark-theme 'material)
(use-package theme-changer (use-package theme-changer
:disabled t :disabled t
:config :config
@ -4050,50 +4047,14 @@ Set the character used to represent spaces to ·, and the character used for tab
(imalison:get-lat-long) (imalison:get-lat-long)
(setq calendar-latitude latitude) (setq calendar-latitude latitude)
(setq calendar-longitude longitude)))) (setq calendar-longitude longitude))))
#+END_SRC
(defun imalison:set-font-height () ** Fix ~ansi-term~ Colors
(interactive) For some reason, loading certain themes can cause colors in
(let ((new-height (read-face-attribute 'default :height (selected-frame)))) ~ansi-term-color-vector~ to be undefined. The following code handles restoring
(set-face-attribute 'default nil :height new-height))) the original ~ansi-term-color-vector~ state. The code is exectued in a
load-theme hook (See the heading below).
(defvar imalison:linum-format) #+BEGIN_SRC emacs-lisp
(require 'term)
(make-variable-buffer-local 'imalison:linum-format)
(defun imalison:linum-before-numbering-hook ()
(setq imalison:linum-format
(concat "%" (number-to-string
(max (length
(number-to-string
(count-lines (point-min) (point-max)))) 3)) "d")))
(defun imalison:format-linum (line-text)
(propertize (format imalison:linum-format line-text) 'face 'linum))
(defun imalison:remove-fringe-and-hl-line-mode (&rest _stuff)
(interactive)
(if (fboundp 'scroll-bar-mode) (scroll-bar-mode -1))
(if (fboundp 'tool-bar-mode) (tool-bar-mode -1))
(if (fboundp 'menu-bar-mode) (menu-bar-mode -1))
;; (set-fringe-mode 0) ;; Lets reenable fringes. They seem useful
(defvar-setq linum-format 'imalison:format-linum)
(add-hook 'linum-before-numbering-hook 'imalison:linum-before-numbering-hook)
(setq left-margin-width 0)
(defvar-setq hl-line-mode nil))
(defun imalison:after-load-theme (&rest _args)
(when (fboundp 'powerline-reset)
(powerline-reset))
(set-face-background 'fringe (face-background 'default))
(imalison:restore-ansi-term-color-vector))
(when t
(if
(advice-add 'load-theme :after #'imalison:after-load-theme)
(defadvice load-theme (after name activate)
(imalison:after-load-theme))))
(when (file-exists-p custom-after-file) (load custom-after-file))
(defvar imalison:ansi-term-color-vector ansi-term-color-vector) (defvar imalison:ansi-term-color-vector ansi-term-color-vector)
(defun imalison:ansi-term-color-vector-broken? () (defun imalison:ansi-term-color-vector-broken? ()
@ -4104,8 +4065,44 @@ Set the character used to represent spaces to ·, and the character used for tab
(when (or force (imalison:ansi-term-color-vector-broken?)) (when (or force (imalison:ansi-term-color-vector-broken?))
(setq ansi-term-color-vector imalison:ansi-term-color-vector))) (setq ansi-term-color-vector imalison:ansi-term-color-vector)))
#+END_SRC #+END_SRC
* Frame Initialization ** After ~load-theme~ hook
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(defvar imalison:light-theme 'solarized-light)
(defvar imalison:dark-theme 'material)
(defun imalison:after-load-theme (&rest _args)
(when (fboundp 'powerline-reset)
(powerline-reset))
(set-face-background 'fringe (face-background 'default))
(imalison:restore-ansi-term-color-vector))
(advice-add 'load-theme :after #'imalison:after-load-theme)
#+END_SRC
** Frame Initialization
#+BEGIN_SRC emacs-lisp
(defvar imalison:linum-format)
(defun imalison:format-linum (line-text)
(propertize (format imalison:linum-format line-text) 'face 'linum))
(make-variable-buffer-local 'imalison:linum-format)
(defun imalison:linum-before-numbering-hook ()
(setq imalison:linum-format
(concat "%" (number-to-string
(max (length
(number-to-string
(count-lines (point-min) (point-max)))) 3)) "d")))
(defun imalison:remove-fringe-and-hl-line-mode (&rest _stuff)
(interactive)
(if (fboundp 'scroll-bar-mode) (scroll-bar-mode -1))
(if (fboundp 'tool-bar-mode) (tool-bar-mode -1))
(if (fboundp 'menu-bar-mode) (menu-bar-mode -1))
(defvar-setq linum-format 'imalison:format-linum)
(add-hook 'linum-before-numbering-hook 'imalison:linum-before-numbering-hook)
(setq left-margin-width 0)
(defvar-setq hl-line-mode nil))
(defun imalison:appearance (&optional frame) (defun imalison:appearance (&optional frame)
(interactive (list nil)) (interactive (list nil))
(if (display-graphic-p) (if (display-graphic-p)
@ -4129,3 +4126,7 @@ Set the character used to represent spaces to ·, and the character used for tab
;; TODO/XXX: why do we immediately remove this hook? ;; TODO/XXX: why do we immediately remove this hook?
(remove-hook 'after-make-frame-functions 'imalison:appearance) (remove-hook 'after-make-frame-functions 'imalison:appearance)
#+END_SRC #+END_SRC
* Post Init Custom
#+BEGIN_SRC emacs-lisp
(when (file-exists-p custom-after-file) (load custom-after-file))
#+END_SRC