]> git.mdlowis.com Git - projs/tide.git/commitdiff
Added logic to load an RC file in the edit wrapper script and each subshell for comma...
authorMichael D. Lowis <mike.lowis@gentex.com>
Tue, 31 Jan 2017 13:31:27 +0000 (08:31 -0500)
committerMichael D. Lowis <mike.lowis@gentex.com>
Tue, 31 Jan 2017 13:31:27 +0000 (08:31 -0500)
Makefile
TODO.md
edit
xedit.c

index 27359b4fb28c06c9c575f314d3c4608764b78c6c..4fd995f707c51c7c5d12e566e5c040b7f49f98c8 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -21,6 +21,7 @@ all: xedit xpick
 
 clean:
        $(RM) *.o lib*/*.o tests/*.o *.a xpick xedit unittests
+       $(RM) *.d lib*/*.d tests/*.d
        $(RM) *.gcno lib*/*.gcno tests/*.gcno
        $(RM) *.gcda lib*/*.gcda tests/*.gcda
        $(RM) *.gcov lib*/*.gcov tests/*.gcov
diff --git a/TODO.md b/TODO.md
index a42e607c0f2f1398163562d31ba10716f2355635..448a7c80280a9096a6470acf7becabbc4d1bd2cd 100644 (file)
--- a/TODO.md
+++ b/TODO.md
@@ -10,8 +10,6 @@ Up Next:
 * invalid memory accesses while viewing docs/waf
 * check for file changes on save
 * check for file changes when window regains focus
-* Use $SHELL if defined, fallback on /bin/sh
-* Set ENV to ~/.config/edit/rc if undefined
 
 The Rest:
 
@@ -19,12 +17,13 @@ The Rest:
 * add a distinct state for pointer move versus drag
 * Add a SaveAs tag that takes an argument for the filename to save as
 * Add a GoTo tag for ctags lookup and line number jump
-* implement command diffing logic to optimize the undo/redo log
 * add command line flags to toggle options (Tabs, Indent, etc..)
 * Add a ctrl+space shortcut to autocomplete ctag
 * off by one error on scrolling up with wrapped lines
 * 100% coverage with unit and unit-integration tests
 * shortcut to repeat previous operation
+* implement command diffing logic to optimize the undo/redo log
+
 
 The Future:
 
@@ -35,3 +34,4 @@ The Future:
 * Acme-like window manager
 * Win-like terminal emulator
 * File browser
+
diff --git a/edit b/edit
index f08e35e216c44f88e75ef1f0cd506e83f75e6ba7..6da509401adf3487a14bef9964c609beaef2572d 100755 (executable)
--- a/edit
+++ b/edit
@@ -4,6 +4,11 @@
 # while editing.
 export PATH="$HOME/.config/edit/tools:$PATH"
 
+# If $SHELL is bash, this will allow us to define functions in an RC file and
+# use them in the editor
+export EDITRCFILE="$HOME/.config/edit/editrc"
+export BASH_ENV="$EDITRCFILE"
+
 # Now figure out the correct editor to execute
 if [ -z "$DISPLAY" ]; then
     if [ -z "$EDITOR" ]; then
@@ -15,6 +20,7 @@ elif [ 0 -eq $# ]; then
     (nohup xedit > /dev/null 2>&1) &
 else
     for f in "$@"; do
+        [ -f "$EDITRCFILE" ] && . "$EDITRCFILE"
         (nohup xedit "$f" > /dev/null 2>&1) &
     done
 fi
diff --git a/xedit.c b/xedit.c
index ba59599205f68b37b5cf8d958f6c9b0696944c73..5349ee855a5d60216c320359ec7bb602d12b1a8f 100644 (file)
--- a/xedit.c
+++ b/xedit.c
@@ -179,6 +179,9 @@ static KeyBinding Bindings[] = {
 
 /* External Commands
  *****************************************************************************/
+/* The shell: Filled in with $SHELL. Used to execute commands */
+static char* ShellCmd[] = { NULL, "-c", NULL, NULL };
+
 #ifdef __MACH__
 static char* CopyCmd[]  = { "pbcopy", NULL };
 static char* PasteCmd[] = { "pbpaste", NULL };
@@ -186,7 +189,6 @@ static char* PasteCmd[] = { "pbpaste", NULL };
 static char* CopyCmd[]  = { "xsel", "-bi", NULL };
 static char* PasteCmd[] = { "xsel", "-bo", NULL };
 #endif
-static char* ShellCmd[] = { "/bin/sh", "-c", NULL, NULL };
 static char* PickFileCmd[] = { "xfilepick", ".", NULL };
 static char* PickTagCmd[] = { "xtagpick", "tags", NULL, NULL };
 static char* OpenCmd[] = { "xedit", NULL, NULL };
@@ -196,6 +198,9 @@ static char* SedCmd[] = { "sed", "-e", NULL, NULL };
  *****************************************************************************/
 #ifndef TEST
 int main(int argc, char** argv) {
+    /* setup the shell */
+    ShellCmd[0] = getenv("SHELL");
+    if (!ShellCmd[0]) ShellCmd[0] = "/bin/sh";
     /* load the buffer views */
     char* tags = getenv("EDITTAGS");
     view_init(getview(TAGS), NULL);