From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Mathias Dahl Newsgroups: gmane.emacs.help Subject: Re: Need help with eshell hack Date: Fri, 21 Dec 2007 00:32:24 +0100 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1198194049 1115 80.91.229.12 (20 Dec 2007 23:40:49 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 20 Dec 2007 23:40:49 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Dec 21 00:41:00 2007 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1J5V0U-0007Fd-Fm for geh-help-gnu-emacs@m.gmane.org; Fri, 21 Dec 2007 00:40:50 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1J5V0A-0004GV-OS for geh-help-gnu-emacs@m.gmane.org; Thu, 20 Dec 2007 18:40:30 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 37 Original-X-Trace: individual.net 9pEbufnhuAFvp3fo9aGKeAKMDvJ+4fED0B2m7+tJ3KRyVlnzI5 Cancel-Lock: sha1:oemH6/IonQLypSTJT++f1iMGK20= sha1:otMUs+cno1eWzzy0KLUQl9tCwgg= User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.50 (gnu/linux) Original-Xref: shelby.stanford.edu gnu.emacs.help:154838 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:50263 Archived-At: Mathias Dahl 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