help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Execute as a command a yanked text


From: David Kastrup
Subject: Re: Execute as a command a yanked text
Date: Wed, 03 May 2006 11:56:19 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

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 via email to

[Prev in Thread] Current Thread [Next in Thread]