|
From: | Stefan Horomnea |
Subject: | Re: Execute as a command a yanked text |
Date: | Wed, 03 May 2006 20:01:45 +0300 |
User-agent: | Thunderbird 1.5.0.2 (X11/20060420) |
Hello, Thank you both for your answers. Indeed, the code (command-execute (intern (car kill-ring-yank-pointer))) works ! One more thing.... I am new relatively new to emacs (a few months), and I wanted to tell you guys I think this editor and the community around it is beautiful. I am very enthuziast about it. It's so great and can be so customized that it creates dependence of customization and making it better for your needs. This is maybe the only thing I'm worried about. For the beginning I tried to set up a maximum limit of learning and customization emacs per day - 2 hours, because in the last 4-5 days I think it's the main thing I did and I am late with my projects :) Anyway, back to my question. I thought I'd share with you,maybe someone finds it useful. I asked for that code which works now thanks to you, because I think every programmer of emacs have a set of maybe 40-50 or more templates that are used often and can be learned their 2-3 letters shortcuts. And that code, make the whole road for inserting the template code, a key less. For example (I am a html/php developer) I have a template which I name "htb". Which inserts the code for a html table: <table... ><tr><td>... bla bla with tabs and all. Before, I had to do that: - M-x htb enter Now I do - htb Ctrl-enter (that's one key shorter) Maybe some of you say that I can assign shortcuts like C-M-t or C-x t, but some of these are already taken for editing commands, and templates can be easily remembered by 2-3 or 4 letters. I used Eclipse, and I had there 120 templates, but maybe just 50-60 were used often. The complete code (which is very short) is: ______________________ (defun your-fun () "helps execute a template" (interactive) (backward-kill-word 1) (command-execute (intern (car kill-ring-yank-pointer))) ) (global-set-key [(control return)] 'stefan-fun) ______________________ now, if I have to enter a template, I do: htb C-RET or div C-RET etc. Thanks for your help and patience. Stefan ps: a newbie in lists question: how can I reply to a message if I receive the list in the digest mode ? Message: 3 Date: Wed, 03 May 2006 11:35:30 +0200 From: Mathias Dahl <brakjoller@gmail.com> Subject: Re: Execute as a command a yanked text To: help-gnu-emacs@gnu.org Message-ID: ubquftpr1.fsf@gmail.com"><ubquftpr1.fsf@gmail.com> Content-Type: text/plain; charset=us-ascii Stefan Horomnea <stefan@softexperience.ro> writes:Hello, Do you have any idea how to execute a text that was previously killed ? I mean, I have a function named insert-html-table. This code works: (command-execute 'insert-html-table) This code doesn't work: (command-execute (car kill-ring-yank-pointer)) *and I have previously killed "insert-html-table" and, this also works (insert (car kill-ring-yank-pointer)) - and inserts the text: "insert-html-table".The problem seems to be that (car kill-ring-yank-pointer) returns a *string*, not a symbol which `command-execute' needs. Maybe this works (untested): (command-execute (make-symbol (car kill-ring-yank-pointer))) Try it. ------------------------------ Message: 4 Date: Wed, 03 May 2006 11:56:19 +0200 From: David Kastrup <dak@gnu.org> Subject: Re: Execute as a command a yanked text To: help-gnu-emacs@gnu.org Message-ID: 85mzdzo2ik.fsf@lola.goethe.zz"><85mzdzo2ik.fsf@lola.goethe.zz> Content-Type: text/plain; charset=us-ascii Mathias Dahl <brakjoller@gmail.com> writes: |
[Prev in Thread] | Current Thread | [Next in Thread] |