When the lid to your MacBook is closed, to make it hibernate (save state on disk and power down completely) rather than sleep (which still consumes power), open a Terminal window and enter:
sudo pmset -a hibernatemode 1
It is difficult to keep track of which login files are read when a shell is invoked from a terminal window, from within emacs, or by another process. I find it simpliest to put all login information in my .bashrc file and have all the other login files read it. The .bashrc files determines itself whether PATH and other environmental variables need to be set, and whether the shell is interactive. I also use a utility program named unique_path.
Here is a zip archive of my OS X environment: LoginOSX.tgz
Here are the files:
.profile
. ~/.bashrc
.emacs_bash
tty -echo alias man=m . ~/.bashrc
~/bin/unique_path
#!/bin/bash
echo "$1" | tr ':' "\n" | awk '{if ($0 in store) x=1; else print; store[$0]=1;}' | tr "\n" ':'
.bashrc
if [[ "$PATH" != */sw/* ]]; then if [ -r /sw/bin/init.sh ]; then . /sw/bin/init.sh; fi fi if [[ "$PATH" != *$HOME/bin* ]]; then PATH="$HOME/bin:$PATH" PATH=$(unique_path "$PATH") fiif [[ "$-" == *i* ]]; then alias barb='ssh -Y barb.cs.washington.edu' alias rm='rm -i' alias clean='/bin/rm -f ?*~ .?*~ *junk* "#"*"#" core.*' alias mv='mv -i' alias cp='cp -i' alias ls='ls -F' alias v='ghostview' alias new='ls -lt | head' alias wget='wget -nd' alias wgetr='"wget" -r -l 2 -np' export PS1='\w % ' fi
~/bin/backup
#!/bin/bashshopt -s nullglob shopt -s extglobf="${1}" f="${f%/}" b=1 for g in v+([0-9])__"${f}" do g="${g#v}" g="${g%%__*}" (( b = (g > b) ? g : b )) done (( b = b + 1 )) echo Creating v${b}__"${f}" cp -r "${f}" v${b}__"${f}"
~/bin/m
#!/bin/bash man $* | cat