* Re: Execute as a command a yanked text [not found] <E1FbJqy-0005FO-Rm@host1.softexperience.ro> @ 2006-05-03 17:01 ` Stefan Horomnea 2006-05-03 18:38 ` Peter Dyballa [not found] ` <mailman.1290.1146675647.9609.help-gnu-emacs@gnu.org> 1 sibling, 1 reply; 7+ messages in thread From: Stefan Horomnea @ 2006-05-03 17:01 UTC (permalink / raw) [-- Attachment #1: Type: text/html, Size: 5752 bytes --] [-- Attachment #2: Type: text/plain, Size: 152 bytes --] _______________________________________________ help-gnu-emacs mailing list help-gnu-emacs@gnu.org http://lists.gnu.org/mailman/listinfo/help-gnu-emacs ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Execute as a command a yanked text 2006-05-03 17:01 ` Execute as a command a yanked text Stefan Horomnea @ 2006-05-03 18:38 ` Peter Dyballa 2006-05-03 19:52 ` Reiner Steib 0 siblings, 1 reply; 7+ messages in thread From: Peter Dyballa @ 2006-05-03 18:38 UTC (permalink / raw) Cc: help-gnu-emacs Am 03.05.2006 um 19:01 schrieb Stefan Horomnea: > ps: a newbie in lists question: how can I reply to a message if I > receive the list in the digest mode ? Copy the original subject of the eMail you want to reply to and paste it after "Re: " over the digest's subject. -- Greetings Pete How many Microsoft engineers does it take to screw in a lightbulb? None. They just redefine "dark" as the new standard. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Execute as a command a yanked text 2006-05-03 18:38 ` Peter Dyballa @ 2006-05-03 19:52 ` Reiner Steib 0 siblings, 0 replies; 7+ messages in thread From: Reiner Steib @ 2006-05-03 19:52 UTC (permalink / raw) On Wed, May 03 2006, Peter Dyballa wrote: > Am 03.05.2006 um 19:01 schrieb Stefan Horomnea: > >> ps: a newbie in lists question: how can I reply to a message if I receive >> the list in the digest mode ? > > Copy the original subject of the eMail you want to reply to and > paste it after "Re: " over the digest's subject. Better get a mail reader that is capable of dissecting digest articles properly and reply to the article. Gnus can do this. Bye, Reiner. -- ,,, (o o) ---ooO-(_)-Ooo--- | PGP key available | http://rsteib.home.pages.de/ ^ permalink raw reply [flat|nested] 7+ messages in thread
[parent not found: <mailman.1290.1146675647.9609.help-gnu-emacs@gnu.org>]
* Re: Execute as a command a yanked text [not found] ` <mailman.1290.1146675647.9609.help-gnu-emacs@gnu.org> @ 2006-05-04 8:03 ` Mathias Dahl 0 siblings, 0 replies; 7+ messages in thread From: Mathias Dahl @ 2006-05-04 8:03 UTC (permalink / raw) Stefan Horomnea <stefan@softexperience.ro> writes: > Indeed, the code > (command-execute (intern (car kill-ring-yank-pointer))) > works ! And thanks to your post I learned about `intern' :) > 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. I like this "trick" of yours very much! These are things which I am very interested in, how to make your computer environment easier and faster to use. For your information I experimented with abbrevs in a way that you might find interesting: Most people know how abbrevs work in Emacs. You define the abbrev (the "short" word) and you define what is should expand to, and when you are in abbrev-mode, each abbrev will be expanded to the expansion as you type. Simple. Useful. One thing that I don't think all users know about is that you can also make an abbrev execute code. Example: ;; Simple function to demonstrate (defun xtst-func () (message "xtst-func was called") ;; Need to return non-`nil' in order to inhibit inserting ;; the character that triggered the expansion. See the elisp ;; manual for more information. t) ;; Needed in combination with the `t' above. Again, read the manual. (put 'xtst-func 'no-self-insert t) ;; Let the expansion be an empty string, set the HOOK argument to our ;; new function. Did I say you should read the manual? ... :) (define-abbrev lisp-mode-abbrev-table "xtst" "" 'xtst-func) ;; Enable abbrev mode (abbrev-mode 1) To test it: 1. Go to the *scratch* buffer (should be in lisp-mode) and paste the above 2. Evaluate all of the above 3. Type xtst and then space (or return, both works) The result should be that the message "xtst-func was called" is printed in the echo area and the abbrev you wrote should be gone. I actually don't *use* this for anything (yet) but I think it is interesting functionality. It is also much more complex than you clever hack. When naming the abbrevs, makes sure you pick names that you will not type by mistake, so to speak. Maybe use a prefix that is easy/quick to type, before all your "commands". Anyway, about your example: maybe you should use normal abbrevs (create one called htb, for example) that expands into the text you want to insert in your code. Or use skeletons or some other expansion/template functionality that exists in Emacs and Emacs add-ons. /Mathias ^ permalink raw reply [flat|nested] 7+ messages in thread
[parent not found: <E1FbCwb-0004RK-WD@host1.softexperience.ro>]
* Execute as a command a yanked text [not found] <E1FbCwb-0004RK-WD@host1.softexperience.ro> @ 2006-05-03 9:12 ` Stefan Horomnea [not found] ` <mailman.1260.1146647515.9609.help-gnu-emacs@gnu.org> 1 sibling, 0 replies; 7+ messages in thread From: Stefan Horomnea @ 2006-05-03 9:12 UTC (permalink / raw) 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". Thanks a lot for any help. ^ permalink raw reply [flat|nested] 7+ messages in thread
[parent not found: <mailman.1260.1146647515.9609.help-gnu-emacs@gnu.org>]
* Re: Execute as a command a yanked text [not found] ` <mailman.1260.1146647515.9609.help-gnu-emacs@gnu.org> @ 2006-05-03 9:35 ` Mathias Dahl 2006-05-03 9:56 ` David Kastrup 0 siblings, 1 reply; 7+ messages in thread From: Mathias Dahl @ 2006-05-03 9:35 UTC (permalink / raw) 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. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Execute as a command a yanked text 2006-05-03 9:35 ` Mathias Dahl @ 2006-05-03 9:56 ` David Kastrup 0 siblings, 0 replies; 7+ messages in thread From: David Kastrup @ 2006-05-03 9:56 UTC (permalink / raw) Mathias Dahl <brakjoller@gmail.com> writes: > Stefan Horomnea <stefan@softexperience.ro> writes: > >> 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))) Won't work because make-symbol returns an uninterned symbol (which has the print name "insert-html-table", but not the meaning of the previously interned symbol with the same name): make-symbol is a built-in function in `C source code'. (make-symbol NAME) Return a newly allocated uninterned symbol whose name is NAME. Its value and function definition are void, and its property list is nil. Instead you need to use intern: intern is a built-in function in `C source code'. (intern STRING &optional OBARRAY) Return the canonical symbol whose name is STRING. If there is none, one is created by this function and returned. A second optional argument specifies the obarray to use; it defaults to the value of `obarray'. -- David Kastrup, Kriemhildstr. 15, 44793 Bochum ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2006-05-04 8:03 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <E1FbJqy-0005FO-Rm@host1.softexperience.ro> 2006-05-03 17:01 ` Execute as a command a yanked text Stefan Horomnea 2006-05-03 18:38 ` Peter Dyballa 2006-05-03 19:52 ` Reiner Steib [not found] ` <mailman.1290.1146675647.9609.help-gnu-emacs@gnu.org> 2006-05-04 8:03 ` Mathias Dahl [not found] <E1FbCwb-0004RK-WD@host1.softexperience.ro> 2006-05-03 9:12 ` Stefan Horomnea [not found] ` <mailman.1260.1146647515.9609.help-gnu-emacs@gnu.org> 2006-05-03 9:35 ` Mathias Dahl 2006-05-03 9:56 ` David Kastrup
Code repositories for project(s) associated with this external index https://git.savannah.gnu.org/cgit/emacs.git https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.