From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Michael Heerdegen Newsgroups: gmane.emacs.help Subject: Re: Shell aliases as shell-commands Date: Thu, 22 Jan 2009 18:55:54 +0100 Organization: Universitaet Jena 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 1232649746 16691 80.91.229.12 (22 Jan 2009 18:42:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 22 Jan 2009 18:42:26 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Jan 22 19:43:39 2009 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 1LQ4We-0006Uy-0o for geh-help-gnu-emacs@m.gmane.org; Thu, 22 Jan 2009 19:43:36 +0100 Original-Received: from localhost ([127.0.0.1]:58198 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LQ4VM-0002C3-Gh for geh-help-gnu-emacs@m.gmane.org; Thu, 22 Jan 2009 13:42:16 -0500 Original-Path: news.stanford.edu!headwall.stanford.edu!news.glorb.com!newsfeed00.sul.t-online.de!t-online.de!news-1.dfn.de!news.uni-weimar.de!news.uni-jena.de!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 81 Original-NNTP-Posting-Host: pax07e3.mipool.uni-jena.de Original-X-Trace: lc03.rz.uni-jena.de 1232646954 12101 141.35.13.42 (22 Jan 2009 17:55:54 GMT) Original-X-Complaints-To: abuse@uni-jena.de Original-NNTP-Posting-Date: Thu, 22 Jan 2009 17:55:54 +0000 (UTC) User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (berkeley-unix) Cancel-Lock: sha1:U/qYOiYQPifBGSo8+asCFHhj7mA= Original-Xref: news.stanford.edu gnu.emacs.help:166243 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:61565 Archived-At: Thierry Volpiatto writes: > Michael Heerdegen writes: > > Just want to mention (again) that eshell-command work out of the box for > aliases. No config is needed. > The aliases are stored by default in .emacs.d/.eshell and are > different of those you have in .bashrc, that is a good thing: > You may have alias in your bashrc that are good for interactive shell > but no good for non-interactive shells. > And that avoid modifying bash with shopt (strange things can happen) > > And you have file-name completion also. > To add an alias: > M-x eshell-command > alias Mcle mount /dev/sdb1 > Yes, and eshell-command even completes these aliases! I have a question: Is it possible to run something asynchronously with M-x eshell-command? I wrote some code providing a menu from which you can start external programs (browsers, games and such stuff) like most window managers have, from Emacs. It is based on shell-command. It would be nice if it could use eshell-command instead. The menu itself uses a command I called `run-external-command' (defun run-external-command (command) "Prompt for an external command and run it asynchronously. It combines `read-shell-command' (which provides completion) and `asynchronous-shell-command'." (interactive (list (funcall (if (fboundp 'read-shell-command) 'read-shell-command 'read-string) "Run external application: "))) (let ((default-directory "~/")) (asynchronous-shell-command command command))) (global-set-key [?\C-c ?e] 'run-external-command) (defun asynchronous-shell-command (command buffer-name) "Execute COMMAND asynchronously in an inferior shell. The corresponding asynchronous Emacs process is associated with a \(unique\) buffer with a name based on the string BUFFER-NAME." (let* ((buffer-name (if (stringp buffer-name) (generate-new-buffer-name (concat "ASC: " buffer-name)) "Asynchronous shell command")) (b (get-buffer-create buffer-name)) (pop-up-frames nil)) (save-window-excursion (let ((call (concat "(" command ") &") ;; (command) & should be understood by all common ;; shells )) (shell-command call b) (with-current-buffer b (save-excursion (goto-char (point-max)) (insert "\n\n" (make-string fill-column ?-) "\n\nProcessed command: " call))) (message "%s" call) (when b (with-current-buffer b (make-local-variable 'asynchronous-shell-command-buffer) (setq asynchronous-shell-command-buffer t))))))) Is it possible to get this work with `eshell-command'?