unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* need for a shell-mode-post-hook ?
@ 2003-03-05  9:07 Matthew Kennedy
  2003-03-05  9:23 ` Kai Großjohann
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Matthew Kennedy @ 2003-03-05  9:07 UTC (permalink / raw)



My ~/.emacs_bash contains the following:

,----[ .emacs_bash ]
|
| PS1='\u@\h \W \$ '
`----

When I start shell with M-x shell RET, I get several prompts across
the top of the buffer.  It looks pretty tacky to me.  So I thought of
adding "clear" to the end of ~/.emacs_bash, however since its not
terminal-connected, clear has no effect (I think?).

So I'm wondering if there is a good case for a kind of
shell-mode-post-hook that would allow a hook *after* the start file
(~/.emacs_bash) is sent to the bash process via. comint.  What I am
getting at is something like this:

        (add-hook 'shell-mode-post-hook '(erase-buffer))

(followed possibly by sending a single, initial RET to the bash
process to force the prompt to show).

Perhaps there's an alternate way to achieve this? (as opposed to
editing my shell.el in the site-wide emacs lisp/ dir).

Matt

-- 
Matthew Kennedy

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: need for a shell-mode-post-hook ?
  2003-03-05  9:07 need for a shell-mode-post-hook ? Matthew Kennedy
@ 2003-03-05  9:23 ` Kai Großjohann
  2003-03-05 19:38 ` Kevin Rodgers
  2003-03-10 20:21 ` Stefan Monnier
  2 siblings, 0 replies; 6+ messages in thread
From: Kai Großjohann @ 2003-03-05  9:23 UTC (permalink / raw)


You could put PS1='' at the beginning and PS1=$REAL_VALUE at the end
of that file.

But that would be cheating :-)
-- 
A preposition is not a good thing to end a sentence with.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: need for a shell-mode-post-hook ?
  2003-03-05  9:07 need for a shell-mode-post-hook ? Matthew Kennedy
  2003-03-05  9:23 ` Kai Großjohann
@ 2003-03-05 19:38 ` Kevin Rodgers
  2003-03-10 20:21 ` Stefan Monnier
  2 siblings, 0 replies; 6+ messages in thread
From: Kevin Rodgers @ 2003-03-05 19:38 UTC (permalink / raw)


Matthew Kennedy wrote:

> My ~/.emacs_bash contains the following:
> 
> ,----[ .emacs_bash ]
> |
> | PS1='\u@\h \W \$ '
> `----
> 
> When I start shell with M-x shell RET, I get several prompts across
> the top of the buffer.  It looks pretty tacky to me.  So I thought of
> adding "clear" to the end of ~/.emacs_bash, however since its not
> terminal-connected, clear has no effect (I think?).

Here's my ~/.emacs_ksh file:

print "# Reading ~/.emacs_${SHELL##*/}...\c"; . ~/emacs/.kshrc

-- 
<a href="mailto:&lt;kevin.rodgers&#64;ihs.com&gt;">Kevin Rodgers</a>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: need for a shell-mode-post-hook ?
  2003-03-05  9:07 need for a shell-mode-post-hook ? Matthew Kennedy
  2003-03-05  9:23 ` Kai Großjohann
  2003-03-05 19:38 ` Kevin Rodgers
@ 2003-03-10 20:21 ` Stefan Monnier
  2003-03-11 15:31   ` Kai Großjohann
  2 siblings, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2003-03-10 20:21 UTC (permalink / raw)


>>>>> "Matthew" == Matthew Kennedy <mbkennedy@austin.rr.com> writes:
>         (add-hook 'shell-mode-post-hook '(erase-buffer))

That's difficult because the shell buffer is asynchronous, so
Emacs doesn't know when the shell's initialization is done.

Tramp has to deal with the problem and it's pretty ugly, but maybe
you can convince Kai to tell you how to reuse that ugly code for
this other case ?


        Stefan

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: need for a shell-mode-post-hook ?
  2003-03-10 20:21 ` Stefan Monnier
@ 2003-03-11 15:31   ` Kai Großjohann
  2003-03-12  7:53     ` Matthew Kennedy
  0 siblings, 1 reply; 6+ messages in thread
From: Kai Großjohann @ 2003-03-11 15:31 UTC (permalink / raw)


"Stefan Monnier" <monnier+gnu.emacs.help/news/@flint.cs.yale.edu> writes:

>>>>>> "Matthew" == Matthew Kennedy <mbkennedy@austin.rr.com> writes:
>>         (add-hook 'shell-mode-post-hook '(erase-buffer))
>
> That's difficult because the shell buffer is asynchronous, so
> Emacs doesn't know when the shell's initialization is done.
>
> Tramp has to deal with the problem and it's pretty ugly, but maybe
> you can convince Kai to tell you how to reuse that ugly code for
> this other case ?

Tramp just looks for a shell prompt...

But maybe Matthew could change his ~/.emacs_bash to produce less
output?  For example, maybe it works to put all commands on one
(virtual) line by doing things like

    command1; \
    command2; \
    ...

in ~/.emacs_bash.
-- 
A preposition is not a good thing to end a sentence with.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: need for a shell-mode-post-hook ?
  2003-03-11 15:31   ` Kai Großjohann
@ 2003-03-12  7:53     ` Matthew Kennedy
  0 siblings, 0 replies; 6+ messages in thread
From: Matthew Kennedy @ 2003-03-12  7:53 UTC (permalink / raw)


kai.grossjohann@uni-duisburg.de (Kai Großjohann) writes:

> But maybe Matthew could change his ~/.emacs_bash to produce less
> output?  For example, maybe it works to put all commands on one
> (virtual) line by doing things like
> 
>     command1; \
>     command2; \
>     ...
> 
> in ~/.emacs_bash.

That works ;) I ended up with this:

,----[ .emacs_bash ]
| export PS1='\u@\h \W \$ ' ; echo -ne "\r              \n"
`----

The echo writes spaces over the initial mess after moving to the
beginning of the line.

-- 
Matthew Kennedy

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2003-03-12  7:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-03-05  9:07 need for a shell-mode-post-hook ? Matthew Kennedy
2003-03-05  9:23 ` Kai Großjohann
2003-03-05 19:38 ` Kevin Rodgers
2003-03-10 20:21 ` Stefan Monnier
2003-03-11 15:31   ` Kai Großjohann
2003-03-12  7:53     ` Matthew Kennedy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).