Hello,
I'm not sure if this is the correct newsgroup for this question if it is
not could you please refer me to the appropriate place.
I have an emacs lisp function that opens a shell then runs a shell script
to initialize some environment variables that I need set inorder to 'make'
my programs correctly, Here is the code
(defun ldw-gnustep-shell()
"Opens a shell and executes the GNUstep.sh file
in /usr/GNUstep/System/Makefiles/GNUstep.sh"
(interactive)
(shell)
(insert ". /usr/GNUstep/System/Makefiles/GNUstep.sh")
(comint-send-input))
My problem is I don't know if I am sending a carriage return properly
after I have inserted the line
". /usr/GNUstep/System/Makefiles/GNUstep.sh"
I have tried
". /usr/GNUstep/System/Makefiles/GNUstep.sh\n"
which simply puts a newline into the shell and does not execute the script
I have tried
". /usr/GNUstep/System/Makefiles/GNUstep.sh\n\r"
which puts a ^M at the start of a newline.
I ended up putting in a call to (comint-send-input)
I'm not really sure what this function does but one of it's side effects
is that it sends a terminal newline to the buffer.
Right now this code works it starts a shell and executes the shell script
". /usr/GNUstep/System/Makefiles/GNUstep.sh"
However I am wondering if there is a simple way to insert a carriage
return after I input the command to execute the shell script.
Liam
[note xpost, followups]
Liam Whalen <·······@cabletv.on.ca> writes:
> Hello,
>
> I'm not sure if this is the correct newsgroup for this question if it is
> not could you please refer me to the appropriate place.
comp.emacs (or comp.emacs.xemacs) is probably somewhat better. I've
xposted, and set followups.
> I have an emacs lisp function that opens a shell then runs a shell script
> to initialize some environment variables that I need set inorder to 'make'
> my programs correctly, Here is the code
> (defun ldw-gnustep-shell()
> "Opens a shell and executes the GNUstep.sh file
> in /usr/GNUstep/System/Makefiles/GNUstep.sh"
> (interactive)
> (shell)
> (insert ". /usr/GNUstep/System/Makefiles/GNUstep.sh")
> (comint-send-input))
That seems to work for me (well, I replace the command with 'echo hi',
and hi gets echoed).
>
> My problem is I don't know if I am sending a carriage return properly
> after I have inserted the line
> ". /usr/GNUstep/System/Makefiles/GNUstep.sh"
You're thinking about this wrong. Go into the shell buffer, and type
C-h k RET
you'll see that when you press return, you don't actually insert a
newline. You call the function #'comint-send-input, which inserts a
newline, and sends the current line to the process.
So calling the function explicitly is probably the best way.
--
If you want divine justice, die.
-- Nick Seldon