akhayyat/dotfiles
Conditional emacs support
Commit 23497347cda0 · Ahmad Khayyat · 2026-06-21 07:44 +0300
Comments
No comments yet.
Diff
diff --git a/zsh/programs.zsh b/zsh/programs.zsh
--- a/zsh/programs.zsh
+++ b/zsh/programs.zsh
@@ -9,20 +9,21 @@
fi
# Emacs
-alias e="emacsclient -a '' -t"
-alias ew="emacsclient -a '' -c --no-wait"
-
-ediff() {
- if (($+2)); then
- emacs --eval "(ediff-files \"$1\" \"$2\")"
- else
- echo "Usage: ediff <file-1> <file-2>"
- fi
-}
-
-# EDITOR
-export EDITOR="emacsclient -a '' -t"
-export VISUAL="emacsclient -a '' -t"
+if [ -x "$(which emacsclient)" ]; then
+ alias e="emacsclient -a '' -t"
+ alias ew="emacsclient -a '' -c --no-wait"
+ export EDITOR="emacsclient -a '' -t"
+ export VISUAL="emacsclient -a '' -t"
+fi
+if [ -x "$(which emacs)" ]; then
+ ediff() {
+ if (($+2)); then
+ emacs --eval "(ediff-files \"$1\" \"$2\")"
+ else
+ echo "Usage: ediff <file-1> <file-2>"
+ fi
+ }
+fi
# Apt
upd() {