diff --git a/emacs/init.org b/emacs/init.org index 527e09c..e210d84 100755 --- a/emacs/init.org +++ b/emacs/init.org @@ -1011,9 +1011,45 @@ Display the column number in programming modes: (add-hook 'prog-mode-hook #'column-number-mode) #+END_SRC -Load up some tasty themes: +Render stuff differently based on whether or not we are graphical: #+BEGIN_SRC emacs-lisp - (use-package solarized-theme) + (defun graphical-setup () + (when (display-graphic-p (selected-frame)) + (message "Running graphically") + (use-package solarized-theme))) + + (defun non-graphical-setup () + (when (not (display-graphic-p (selected-frame))) + (message "Running in terminal") + (menu-bar-mode -1))) + + (defun do-graphical-non-graphical-setup () + (graphical-setup) + (non-graphical-setup)) + + (add-hook 'window-setup-hook #'do-graphical-non-graphical-setup) +#+END_SRC + +Try to make the background normal colored in the terminal: +#+BEGIN_SRC emacs-lisp + (defvar no-background-in-tty-faces '(default line-number)) + + (defun on-frame-open (frame) + (unless (display-graphic-p frame) + (menu-bar-mode -1) + (dolist (face no-background-in-tty-faces) + (set-face-background face "unspecified" frame)))) + + (mapc #'on-frame-open (frame-list)) + + (add-hook 'after-make-frame-functions #'on-frame-open) + + (defun on-after-init () + (unless (display-graphic-p (selected-frame)) + (dolist (face no-background-in-tty-faces) + (set-face-background face "unspecified" (selected-frame))))) + + (add-hook 'window-setup-hook #'on-after-init) #+END_SRC UI-related keybindings: