all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: David Kastrup <dak@gnu.org>
Subject: Re: Execute as a command a yanked text
Date: Wed, 03 May 2006 11:56:19 +0200	[thread overview]
Message-ID: <85mzdzo2ik.fsf@lola.goethe.zz> (raw)
In-Reply-To: ubquftpr1.fsf@gmail.com

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

  reply	other threads:[~2006-05-03  9:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <E1FbCwb-0004RK-WD@host1.softexperience.ro>
2006-05-03  9:12 ` Execute as a command a yanked text 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 [this message]
     [not found] <E1FbJqy-0005FO-Rm@host1.softexperience.ro>
2006-05-03 17:01 ` 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=85mzdzo2ik.fsf@lola.goethe.zz \
    --to=dak@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.