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

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

How to make a non-interactive function into a command?


From: mbork
Subject: How to make a non-interactive function into a command?
Date: Wed, 14 May 2025 08:26:37 +0200

Hi all,

I know about the `interactive-form' symbol property, but for some reason
I can't make it work.  I tried this in `emacs -Q':

--8<---------------cut here---------------start------------->8---
(defun my-function ()
  "1-2-3-testing"
  (message "Hello!"))

(put 'my-function 'interactive-form '(interactive))
--8<---------------cut here---------------end--------------->8---

but I keep getting the error "Found an 'interactive-form' property!"
when trying to call `my-function' via `M-x'.

It looks like this error message was introduced ~3 years ago in commit
bffc4cb39dc7b83fc4a1bffd23eeed2774b79444:

--8<---------------cut here---------------start------------->8---
New generic function `oclosure-interactive-form`

[...]

* src/eval.c (Fcommandp): Delegate to `interactive-form` if the arg is
an OClosure.

[...]
--8<---------------cut here---------------end--------------->8---

Sadly, I don't understand that commit.

Any ideas how to make `interactive-form' property work?

-- 
Marcin Borkowski
https://mbork.pl
https://crimsonelevendelightpetrichor.net/



reply via email to

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