aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2019-01-04 10:18:06 +1300
committerTom Ryder <tom@sanctum.geek.nz>2019-01-04 10:19:58 +1300
commit97a0d713317036d773df6476f8ae47a1e423276f (patch)
tree801397ab604b39e27156e078ed7474df5d2bd4a7
parentUse :lhelpgrep for help search shortcut (diff)
downloaddotfiles-97a0d713317036d773df6476f8ae47a1e423276f.tar.gz
dotfiles-97a0d713317036d773df6476f8ae47a1e423276f.zip
Further attempts at sane Emacs VISUAL setting
-rw-r--r--.gitignore1
-rw-r--r--Makefile5
-rw-r--r--emacs/bin/emacsm.sh3
-rw-r--r--emacs/profile.d/emacs.sh2
-rw-r--r--sh/profile.d/visual.sh26
5 files changed, 15 insertions, 22 deletions
diff --git a/.gitignore b/.gitignore
index 8b407166..309644a0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -152,6 +152,7 @@
/bin/xrq
/dillo/dillorc
/dillo/dillorc.m4
+/emacs/bin/emacsm
/games/aaf
/games/acq
/games/aesth
diff --git a/Makefile b/Makefile
index 31018936..6c7b9ee0 100644
--- a/Makefile
+++ b/Makefile
@@ -393,8 +393,11 @@ install-dunst: install-x
mkdir -p -- $(HOME)/.config/dunst
cp -p -- dunst/dunstrc $(HOME)/.config/dunst
-install-emacs:
+install-emacs: emacs/bin/emacsm install-sh
+ mkdir -p -- $(HOME)/.local/bin
cp -p -- emacs/emacs $(HOME)/.emacs
+ cp -p -- emacs/bin/emacsm $(HOME)/.local/bin
+ cp -p -- emacs/profile.d/emacs.sh $(HOME)/.profile.d
install-ex:
cp -p -- ex/exrc $(HOME)/.exrc
diff --git a/emacs/bin/emacsm.sh b/emacs/bin/emacsm.sh
new file mode 100644
index 00000000..58571c5c
--- /dev/null
+++ b/emacs/bin/emacsm.sh
@@ -0,0 +1,3 @@
+# Try to manage GNU emacs daemons on the terminal
+# Emphasis on "try". Man, I have no idea what I'm doing.
+emacsclient --create-frame --alternate-editor=''
diff --git a/emacs/profile.d/emacs.sh b/emacs/profile.d/emacs.sh
new file mode 100644
index 00000000..34f6d476
--- /dev/null
+++ b/emacs/profile.d/emacs.sh
@@ -0,0 +1,2 @@
+# Start an Emacs server if we can't detect one already running
+pgrep -fx -u "$USER" 'emacs --daemon' >/dev/null || emacs --daemon
diff --git a/sh/profile.d/visual.sh b/sh/profile.d/visual.sh
index f79158b8..d5280abd 100644
--- a/sh/profile.d/visual.sh
+++ b/sh/profile.d/visual.sh
@@ -1,24 +1,8 @@
-# If an Emacs is installed, and ~/.emacs exists, use emacs as the visual
-# editor; otherwise, use the system's vi
-if command -v emacs >/dev/null 2>&1 &&
- [ -f "$HOME"/.emacs ] ; then
-
- # Use or start a GNU Emacs client, if possible
- if command -v pgrep >/dev/null 2>&1 &&
- pgrep -fxu "$USER" 'emacs --daemon' >/dev/null ||
- emacs --daemon 2>/dev/null ; then
- VISUAL=emacsclient
-
- # If no GNU Emacs daemon is available, just create a new instance every
- # time
- else
- VISUAL=emacs
- fi
-
-# If an Emacs isn't installed, just use good old vi
+# If my Emacs wrapper is installed, use emacs as the visual editor; otherwise,
+# use the system's vi
+if command -v emacsm >/dev/null 2>&1 ; then
+ VISUAL='emacsm'
else
- VISUAL=vi
+ VISUAL='vi'
fi
-
-# Export final editor decision
export VISUAL