all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Mathias Dahl <mathias.dahl@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Need help with eshell hack
Date: Fri, 21 Dec 2007 00:32:24 +0100	[thread overview]
Message-ID: <m2mys5vt6f.fsf@gmail.com> (raw)
In-Reply-To: m2r6hhvy7q.fsf@gmail.com

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)))))
    (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.

Oh well,

/Mathias

  reply	other threads:[~2007-12-20 23:32 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 [this message]
2008-02-28  7:45   ` Kevin Rodgers

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

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

  git send-email \
    --in-reply-to=m2mys5vt6f.fsf@gmail.com \
    --to=mathias.dahl@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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.