From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?ISO-8859-1?Q?Andreas_R=F6hler?= Newsgroups: gmane.emacs.help Subject: Re: Convert an existing keyboard macro to elisp code? Date: Sat, 04 Aug 2012 08:13:59 +0200 Message-ID: <501CBDA7.2020003@easy-emacs.de> References: <87mx2cxb7x.fsf@googlemail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1344060859 20998 80.91.229.3 (4 Aug 2012 06:14:19 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 4 Aug 2012 06:14:19 +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 04 08:14:16 2012 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 1SxXct-0002yB-N2 for geh-help-gnu-emacs@m.gmane.org; Sat, 04 Aug 2012 08:14:15 +0200 Original-Received: from localhost ([::1]:40069 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SxXcs-0001kl-SQ for geh-help-gnu-emacs@m.gmane.org; Sat, 04 Aug 2012 02:14:14 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:36345) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SxXcm-0001k0-QQ for help-gnu-emacs@gnu.org; Sat, 04 Aug 2012 02:14:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SxXcl-00010t-RX for help-gnu-emacs@gnu.org; Sat, 04 Aug 2012 02:14:08 -0400 Original-Received: from moutng.kundenserver.de ([212.227.126.171]:52689) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SxXcl-00010i-Hs for help-gnu-emacs@gnu.org; Sat, 04 Aug 2012 02:14:07 -0400 Original-Received: from [192.168.178.27] (brln-4db9f52a.pool.mediaWays.net [77.185.245.42]) by mrelayeu.kundenserver.de (node=mreu2) with ESMTP (Nemesis) id 0MSmwb-1TN8yh11gz-00Rba5; Sat, 04 Aug 2012 08:14:06 +0200 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:14.0) Gecko/20120713 Thunderbird/14.0 In-Reply-To: X-Provags-ID: V02:K0:I8FSRZIqy/EpobKs+OdkHkhY8y6cK6aGvVR5qy/SBZR yLogTwcANFRkTws5NOtkk9TT7aCGQOAE2geXACahsNvb5WfHu3 XzQoDCoUJ0Zq1BR2VM28RpgU1oJGswf83SmxdG9kyFZQvlLo54 +8m/89yJ8NDPYJb0j1DHGPpgNlQOMuG7YSDLQOxuqVGpvNsdIr 9yirpf3W/mTlHPWwfE+tK5Q4hgbShKqT39moSfw3E8KI5IbQ1m MsEzoLYYXR6CdTiiD1vSh7eceBRtDoCNSGm69ovlqdxgc0NNZT yB630KUiHPiccb7RF0MTSqbjGEsMqoKWBrKXEk9xmG8Y3rWLlW njnNWGtsVtjq869oLy8pfoIEQWGU3/il2DlDts7pk X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 212.227.126.171 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:86194 Archived-At: Am 03.08.2012 18:33, schrieb PJ Weisberg: > On Fri, Aug 3, 2012 at 8:10 AM, Thorsten Jolitz wrote: >> Unfortunately, the answer was more a less a 'NO'(or 'YOU HAVE TO WRITE >> IT YOURSELF'). >> >> Since Emacs is a pretty dynamic project, I thought I give it another try >> on the mailing list - maybe this feature request has been implemented in >> the meantime by somebody? > > If it were just a matter of reading the key sequence and mapping it to > functions it wouldn't be too bad, but the more I think about this, the > more it seems like a rat hole. How would you translate > > (fset 'my-macro > [?\M-x ?m ?a ?g tab ?i ?t tab ?s ?t tab ?t tab return ?m ?a tab return]) > > into > > (defun my-macro () > (interactive) > (magit-status "c:/Users/PJ/Documents/magit/")) > > ? > > You would need to know what auto-completion happened when the user > pressed tab, and then you would need to know how the function > translated its user input into interactive arguments. I don't think > there's a way to do it without running the macro and (somehow) > watching what happens. And that could have unpleasant side effects. > > And this particular example wouldn't even be portable, since when I > type "M-x magit-status RET magit RET", Magit actually does some magic > to translate that into a full path. So on my other machine, the > proper definition of that macro would be > > (defun my-macro () > (interactive) > (magit-status "/home/pj/source-code/magit")) > > > And that doesn't even take into account different keymaps. > > -PJ > Hi, so you might get different code when calling from different circumstances. Which wouldn't hinder to notate a would-be-executed code from a point of interest. Basically IMHO such a thing is feasible. Andreas > Gehm's Corollary to Clark's Law: Any technology distinguishable from > magic is insufficiently advanced. > >