Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed emacs startup

Emacsclient won't call an alternate editor with command line
arguments, so using the -a switch didn't work.  However, it is easy to
tell if it exits with an error, so we do a quick calculation with it
to test if it's running and if it's not, start the daemon properly.
  • Loading branch information...
commit d0e49cee438e0fa57a66def588d21fafed7afb1b 1 parent 4cdf6d5
@chrismgray authored
Showing with 24 additions and 4 deletions.
  1. +9 −1 TODO.org
  2. +15 −3 sh/new-org
View
10 TODO.org
@@ -15,7 +15,15 @@
- State "DONE" from "TODO" [2011-12-03 Sat 08:52]
:END:
**** Possibly sleep for a short amount of time.
-*** TODO Figure out why it doesn't work from a daemonized emacs
+*** DONE Figure out why it doesn't work from a daemonized emacs
+ CLOSED: [2011-12-14 Wed 21:44]
+ :LOGBOOK:
+ - State "DONE" from "STARTED" [2011-12-14 Wed 21:44]
+ CLOCK: [2011-12-14 Wed 19:02]--[2011-12-14 Wed 19:15] => 0:13
+ CLOCK: [2011-12-14 Wed 18:34]--[2011-12-14 Wed 18:35] => 0:01
+ - State "STARTED" from "TODO" [2011-12-14 Wed 18:17]
+ CLOCK: [2011-12-14 Wed 18:17]--[2011-12-14 Wed 18:34] => 0:17
+ :END:
*** DONE Write scan and linkify procedures
CLOSED: [2011-12-06 Tue 14:38]
:LOGBOOK:
View
18 sh/new-org
@@ -4,7 +4,8 @@ inputfile=$(tempfile)
outputfile=$(tempfile)
watch() {
- tail --follow=name $outputfile
+# tail --follow=name $outputfile > /dev/stderr &
+ tail --follow=name $outputfile 2> /dev/null
}
cleanup() {
@@ -14,9 +15,20 @@ cleanup() {
trap cleanup SIGHUP SIGINT EXIT
-watch &
+check-emacs() {
+ # check if the daemon is running with a simple math problem
+ emacsclient -s "org-ikiwiki-compiler" --eval "(+ 1 1)"
+ # if it isn't then start a new one
+ if [ $? -ne 0 ]; then
+ emacs --daemon --eval "(progn (require 'ikiwiki-org-plugin) (setq server-name \"org-ikiwiki-compiler\") (server-start))"
+ fi
+}
+
IFS=
-emacsclient -s "org-ikiwiki-compiler" --eval "(org-ikiwiki-compile \"$inputfile\" \"$outputfile\")" -a "emacs --daemon --eval \"(progn (setq server-name \\"org-ikiwiki-compiler\\") (server-start) (org-ikiwiki-compile \\"$inputfile\\" \\"$outputfile\\"))\"" &
+watch &
+check-emacs
+emacsclient -s "org-ikiwiki-compiler" --eval "(org-ikiwiki-compile \"$inputfile\" \"$outputfile\")" &
while read -r line; do
echo -E "$line" >> $inputfile
+# echo -E "$line" > /dev/stderr
done
Please sign in to comment.
Something went wrong with that request. Please try again.