From 30dafdab229971a1a8c519b2cc51d927b26d92cc Mon Sep 17 00:00:00 2001 From: Taylor Bockman Date: Sat, 21 Nov 2015 14:46:45 -0800 Subject: [PATCH] Fix Emacs + urxvt color weirdness on Linux --- dotfiles/Xresources | 2 +- dotfiles/zshrc | 12 +++++++++++- scripts/sysinstall/install_packages.sh | 23 ++++++++++++++--------- 3 files changed, 26 insertions(+), 11 deletions(-) diff --git a/dotfiles/Xresources b/dotfiles/Xresources index 0d1fe35..25156f1 100644 --- a/dotfiles/Xresources +++ b/dotfiles/Xresources @@ -141,7 +141,7 @@ URxvt*boldFont: xft:Inconsolata:bold URxvt.letterSpace: -1 URxvt*termName: rxvt - +URxvt*iso14755: False URxvt.urgentOnBell: true ! URxvt*foreground: color ! URxvt*color0: color diff --git a/dotfiles/zshrc b/dotfiles/zshrc index 0a08412..30b1c97 100644 --- a/dotfiles/zshrc +++ b/dotfiles/zshrc @@ -5,7 +5,17 @@ export LANG=en_US.UTF-8 export VISUAL="emacs -nw" export EDITOR="$VISUAL" export ITERM_24BIT=1 -export TERM=xterm-256color +export TERM=rxvt-256color + +# Colors get weird with Emacs in urxvt. I use urxvt on Linux +# so I need to export rxvt-256color and copy the rxvt-256color terminfo +# to the right location (see package installer for details). +# This will need to be changed if you use a different terminal emulator. +if [[ "$OSTYPE" == "linux-gnu" ]]; then + export TERM=rxvt-256color +else + export TERM=xterm-256color +fi alias emacs='emacs -nw' alias irssi='TERM=screen-256color irssi' diff --git a/scripts/sysinstall/install_packages.sh b/scripts/sysinstall/install_packages.sh index 13eb908..4a178ac 100755 --- a/scripts/sysinstall/install_packages.sh +++ b/scripts/sysinstall/install_packages.sh @@ -1,9 +1,9 @@ Y#!/bin/bash # # An almost completely untested automated package install script for new installs. -# +# # This file is relatively untested and stuff is generally added to it mostly -# for the sake of remembering what commands to run. This may not work +# for the sake of remembering what commands to run. This may not work # as expected (since I only ever use it when I have a fresh install) and you # should look over the code yourself before running. # @@ -11,7 +11,7 @@ Y#!/bin/bash function install_yaourt { sudo pacman -S base-devel yajl & mkdir -p ~/temp/AUR/ && cd ~/temp/AUR/ - + wget https://aur.archlinux.org/cgit/aur.git/snapshot/package-query.tar.gz tar xfz package-query.tar.gz cd package-query && makepkg @@ -38,7 +38,7 @@ echo "" >> /etc/pacman.conf # If these two commands fail with an error about dirmngr, you will probably need to # su into root and run dirmngr. This will error and create the .gnupg dotfile and the -# other files needed to make this work. +# other files needed to make this work. sudo pacman-key -r 962DDE58 sudo pacman-key --lsign-key 962DDE58 @@ -48,7 +48,7 @@ packages=("wget", "emacs", "gvim", "openssh", "steam", "zsh", "zsh-completions", "xf86-video-fbdev", "xf86-video-intel", "xf86-video-vesa", "alsa-utils", "xorg", "xorg-xinit", "dmenu", "ttf-inconsolata", "i3", "google-chrome", "clojure", "leiningen", "xclip", "playerctl", "infinality-bundle", "lieningen-completions", "npm", "conky", - "feh", "networkmanager", "htop", "physlock", "mit-scheme", "pulseaudio", "ponymix", "rlwrap") + "feh", "networkmanager", "htop", "physlock", "mit-scheme", "pulseaudio", "ponymix", "rlwrap") # Reload the font cache fc-cache -fv @@ -57,24 +57,24 @@ fc-cache -fv # Execute the array of commands for (( i=0; i<${#packages[@]}; i++ )); do printf "\n **** Installing: ${packages[$i]} ****\n\n" - + eval "yaourt -S ${packages[$i]}" done printf "\n **** Finished Installing Packages **** \n" # Add additional commands to be run here. They will be run one after the other in sequence. -commands=() +commands=() # Execute the array of commands for (( i=0; i<${#commands[@]}; i++ )); do printf "\n **** Running: ${commands[$i]} ****\n\n" - + eval "yaourt -S ${commands[$i]} | yes" done # Set locale correctly -sudo sed -i -e 's/#en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/g' /etc/locale.gen +sudo sed -i -e 's/#en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/g' /etc/locale.gen sudo locale-gen @@ -88,3 +88,8 @@ sudo locale-gen # copy services/10-physlock to /etc/pm/sleep.d/10-vlock # replacing USERNAME with their name via sed. # remember to use sudo + +# Copy terminfo so that text editors can find it +mkdir ~/.terminfo +nkdir ~/.terminfo/r/ +ln -s /usr/share/terminfo/r/rxvt-unicode ~/.terminfo/r/rxvt-unicode