From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Emanuel Berg Newsgroups: gmane.emacs.help Subject: Re: shell-CLI for Emacs Date: Sat, 24 Aug 2013 05:30:47 +0200 Organization: Aioe.org NNTP Server Message-ID: <87zjs7bw8v.fsf@nl106-137-194.student.uu.se> References: <87zjs8kozg.fsf@nl106-137-194.student.uu.se> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1377315314 9246 80.91.229.3 (24 Aug 2013 03:35:14 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 24 Aug 2013 03:35:14 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Aug 24 05:35:18 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VD4dB-0007rM-8g for geh-help-gnu-emacs@m.gmane.org; Sat, 24 Aug 2013 05:35:17 +0200 Original-Received: from localhost ([::1]:39718 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VD4dA-0004CL-TX for geh-help-gnu-emacs@m.gmane.org; Fri, 23 Aug 2013 23:35:16 -0400 Original-Path: usenet.stanford.edu!goblin2!goblin.stu.neva.ru!aioe.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 32 Original-NNTP-Posting-Host: FplVx5MqBzlFp1u9bZOXWQ.user.speranza.aioe.org Original-X-Complaints-To: abuse@aioe.org User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux) X-Notice: Filtered by postfilter v. 0.8.2 Cancel-Lock: sha1:a5iR5ZJoK4l7QAjbrPd+PupgG7M= Original-Xref: usenet.stanford.edu gnu.emacs.help:200808 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:93075 Archived-At: Thien-Thi Nguyen writes: > Maybe you can play w/ ‘call-interactively’ and > ‘unread-command-events’. Split the line as before but instead > of ‘apply’ing the command to the args, push the args (character > by character, in reverse order) onto ‘unread-command-events’, > preceding each arg (set) with ‘C-j’ (newline). Yes... that was a good idea. Impressive to say the least. (require 'cl) (defvar *ps* " $> ") (defun string-to-cmd (str) (interactive (list (read-string *ps*))) (let*((cmd-and-args (split-string str " ")) (cmd (read (car cmd-and-args))) (args (cdr cmd-and-args))) (dolist (arg (nreverse args)) (push 10 unread-command-events) (dolist (n (reverse (string-to-list arg))) (push n unread-command-events) )) (call-interactively cmd) )) (define-key (current-global-map) (kbd "M-i") 'string-to-cmd) Works for your zow test function, 'man emacs', and you don't have to rewrite replace-string. -- Emanuel Berg - programmer (hire me! CV below) computer projects: http://user.it.uu.se/~embe8573 internet activity: http://home.student.uu.se/embe8573