Last active
December 10, 2015 23:08
-
-
Save Sliim/4506823 to your computer and use it in GitHub Desktop.
An emacs plugin for oh-my-zsh.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## | |
# This program is free software: you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation, either version 3 of the License, or | |
# (at your option) any later version. | |
# | |
# This program is distributed in the hope that it will be useful, | |
# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
# GNU General Public License for more details. | |
# | |
# You should have received a copy of the GNU General Public License | |
# along with this program. If not, see <http://www.gnu.org/licenses/>. | |
## | |
# Author: Sliim <sliim@mailoo.org> | |
## | |
# This script is an oh-my-zsh plugin for emacs. | |
# You can overwrite variables EMACS_DAEMON_LOG_FILE, EMACS_BIN and EMACS_CLIENT_BIN depending on your preferences. | |
# | |
# To install it: | |
# * Copy this script in ~/.oh-my-zsh/custom/plugins/emacs/emacs.plugin.zsh | |
# * Enable it in your ~/.zshrc (variable `plugins`) | |
# * Enjoy! | |
## | |
export EMACS_DAEMON_LOG_FILE="~/.emacs.d/daemon.log" | |
export EMACS_BIN="emacs-snapshot" | |
export EMACS_CLIENT_BIN="emacsclient" | |
alias emacs="$EMACS_BIN --no-site-file --no-splash --no-site-lisp" | |
alias ed="emacs --daemon >&$EMACS_DAEMON_LOG_FILE" | |
alias e="emacs" | |
alias emacsc="$EMACS_CLIENT_BIN -c" | |
alias emacst="$EMACS_CLIENT_BIN -t" | |
function emacs-daemon-started() { | |
return $(test -e "/tmp/emacs$UID/server") | |
} | |
function emacs-start-daemon() { | |
ed | |
} | |
function emacs-stop-daemon() { | |
emacst -e "(kill-emacs)" | |
} | |
function emacs-check-daemon() { | |
if ! emacs-daemon-started; then | |
echo -n "Starting Emacs daemon.." | |
emacs-start-daemon | |
echo ".done." | |
fi | |
} | |
function em() { | |
emacs-check-daemon | |
emacst $@ | |
} | |
function ec() { | |
emacs-check-daemon | |
emacsc $@ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment