unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Kevin Rodgers <kevin.d.rodgers@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Need help with eshell hack
Date: Thu, 28 Feb 2008 00:45:53 -0700	[thread overview]
Message-ID: <fq5oqp$j73$1@ger.gmane.org> (raw)
In-Reply-To: <m2mys5vt6f.fsf@gmail.com>

Mathias Dahl wrote:
> Mathias Dahl <mathias.dahl@gmail.com> writes:
> 
>> It almost works. The problem is that when output from the command
>> reaches the bottom of the visible part of the eshell window, the
>> window isn't scrolled down to show the output.
> 
> I let go of the `save-excursion' + `set-buffer' approach, in other words
> being a bad boy, and got this that seems to work for me:
> 
> (defun my-eshell-execute-current-line ()
>   "Insert text of current line in eshell and execute."
>   (interactive)
>   (let ((command (buffer-substring
>                   (save-excursion
>                     (beginning-of-line)
>                     (point))
>                   (save-excursion
>                     (end-of-line)
>                     (point)))))

(buffer-substring (line-beginning-position) (line-end-position))

>     (let ((buf (current-buffer)))
>       (unless (get-buffer eshell-buffer-name)
>         (eshell))
>       (display-buffer eshell-buffer-name t)
>       (switch-to-buffer-other-window eshell-buffer-name)
>       (end-of-buffer)
>       (eshell-kill-input)
>       (insert command)
>       (eshell-send-input)
>       (end-of-buffer)
>       (switch-to-buffer-other-window buf))))
> 
> It annoys be however that I could not get it working without using
> switch-to-buffer... The docstring says to avoid use it.

(pop-to-buffer eshell-buffer-name)

-- 
Kevin Rodgers
Denver, Colorado, USA





      reply	other threads:[~2008-02-28  7:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-20 21:43 Need help with eshell hack Mathias Dahl
2007-12-20 23:32 ` Mathias Dahl
2008-02-28  7:45   ` Kevin Rodgers [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='fq5oqp$j73$1@ger.gmane.org' \
    --to=kevin.d.rodgers@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).